--- url: /guide/getting-started.md description: >- Install claudelint and run your first validation of Claude Code project files including CLAUDE.md, skills, hooks, and MCP servers. --- # Getting Started claudelint is a linter for Claude Code projects. It validates CLAUDE.md files, skills, settings, hooks, MCP servers, plugins, agents, and more — surfacing misconfigurations and standardizing your setup before issues cause silent failures. ## Set Up with Claude Let Claude walk you through setup. Copy this prompt into a Claude Code session: ```text Set up claudelint for this project to validate my Claude Code files. Follow the setup guide at https://claudelint.com/setup-guide.md ``` Claude will read the guide, create a task list, and walk you through each step — install location, rule preset, hooks, validation, and plugin installation. ## Manual Setup If you prefer to install and configure claudelint yourself, follow these steps. ### 1. Install Or install globally: ### 2. Configure ```bash claudelint init ``` This creates `.claudelintrc.json` with the recommended preset and `.claudelintignore` for excluding files. Add `.claudelint-cache/` to your `.gitignore` if it isn't there already -- claudelint uses this directory for caching and it should not be committed. See [Configuration](/guide/configuration) for presets, per-rule overrides, and advanced options. ### 3. Validate ```bash claudelint ``` That's it. claudelint scans your project and reports any issues. See the [CLI Reference](/guide/cli-reference) for all available commands and flags. ### 4. Optional: Claude Code Plugin Install the claudelint plugin for slash commands like `/validate-all` and `/optimize-cc-md` directly inside Claude Code sessions. See the [Plugin Guide](/integrations/claude-code-plugin) for installation. ### 5. Optional: SessionStart Hook Automatically validate your project every time a Claude Code session begins: ```bash claudelint init --hooks ``` See [Hooks](/integrations/hooks) for details and alternative hook types. ## What Gets Validated claudelint checks different aspects of your Claude Code project: * **[CLAUDE.md](/validators/claude-md)** - File size, imports, paths, content structure * **[Skills](/validators/skills)** - Names, descriptions, security, versioning * **[Settings](/validators/settings)** - Permissions, environment variables * **[Hooks](/validators/hooks)** - Event types, script references * **[MCP Servers](/validators/mcp)** - Transport types, URLs, environment variables * **[Plugins](/validators/plugin)** - Manifest structure, component references * **[Agents](/validators/agents)** - Names, descriptions, tools, models * **[LSP](/validators/lsp)** - Transport config, language IDs, extensions * **[Output Styles](/validators/output-styles)** - Name validation * **[Commands](/validators/commands)** - Migration checks ## Next Steps * **[Configuration](/guide/configuration)** - Presets, per-rule overrides, ignore patterns * **[Rules Overview](/rules/overview)** - Browse all rules * **[CI/CD Integration](/integrations/ci)** - GitHub Actions, GitLab CI, SARIF output * **[Auto-fix](/guide/auto-fix)** - Automatically fix common issues * **[Custom Rules](/development/custom-rules)** - Write your own validation rules * **[Why claudelint?](/guide/why-claudelint)** - What problems it solves and how --- --- url: /guide/why-claudelint.md description: >- Learn why claudelint exists, what problems it solves in Claude Code projects, and how it catches silent misconfigurations before they cause failures. --- # Why claudelint? claudelint validates your Claude Code project configuration to catch issues early, enforce best practices, and improve developer experience. ## The Problem ### Configuration sprawl A serious Claude Code setup quickly becomes a project inside your project. What starts as a single CLAUDE.md grows into a tree of interconnected files: ```text .claude/ settings.json settings.local.json hooks/hooks.json rules/*.md skills/ deploy/SKILL.md, deploy.sh test-runner/SKILL.md, run-tests.sh code-review/SKILL.md agents/ reviewer/AGENT.md planner/AGENT.md .mcp.json .lsp.json CLAUDE.md ``` These files reference each other — skills declare tool permissions, agents reference skills by name, hooks trigger on specific tool events, and plugins bundle all of it together. Rename a skill, and the agent that references it breaks. Change a hook event name, and automation stops firing. None of these failures produce an error message — hooks with unmatched matchers are silently ignored, and misconfigured skills or settings fall back to defaults without warning. ### No built-in guardrails Claude Code's `/doctor` command checks runtime health, but it doesn't validate cross-file references, naming conventions, or security issues. Mistakes stay hidden until something fails silently: * A hook event misspelled as `preToolUse` instead of `PreToolUse` — silently ignored, never fires * A skill script containing `eval` or `rm -rf` — no security warning * A CLAUDE.md that exceeds the context window size limit — degrades performance with no error * A missing agent `description` — Claude can't determine when to use it, just degraded behavior ## How claudelint Helps claudelint treats your Claude Code configuration as a first-class codebase. It validates every file against rules, checks cross-file references, enforces naming conventions, and flags security issues — the same way ESLint checks your JavaScript or SwiftLint checks your Swift. ```bash npx claude-code-lint check-all ``` Because it's a standard CLI tool, you can [run it in CI](/integrations/ci) alongside your existing linters and tests. Configuration problems become build failures — caught on the pull request that introduced them, not days later when someone triggers a broken hook. ## What It Catches ```text CLAUDE.md (1 error) 0 error File exceeds 40KB limit (42000 bytes) claude-md-size skills/deploy/SKILL.md (1 error) 3 error Description must be at least 10 characters skill-description .claude/hooks/hooks.json (1 warning) 0 warning Unknown hook event: preToolUse hooks-invalid-event skills/cleanup/cleanup.sh (1 error) 8 error Dangerous command in "cleanup.sh": rm -rf / (deletes entire filesystem) skill-dangerous-command 4 problems (3 errors, 1 warning) ``` ## Next Steps * [Getting Started](/guide/getting-started) - Install and run your first check * [Rules Reference](/rules/overview) - Browse all rules across 10 categories * [Auto-fix](/guide/auto-fix) - Automatically fix common issues with `--fix` * [Configuration](/guide/configuration) - Per-rule severity, [inline disables](/guide/inline-disables), and `.claudelintrc.json` config * [CI/CD Integration](/integrations/ci) - GitHub Actions annotations, [SARIF](/integrations/sarif) upload, and git hooks * [Monorepo Support](/integrations/monorepos) - Config inheritance, workspace detection, parallel validation * [CLI Reference](/guide/cli-reference) - All commands, output formats, and options --- --- url: /guide/configuration.md description: >- Configure claudelint with rules, presets, ignore patterns, overrides, and output options using .claudelintrc.json or package.json. --- # Configuration claudelint supports configuration through multiple methods, allowing you to customize linting rules and behavior for your project. ## Configuration Files claudelint will automatically search for configuration files in the following order: 1. `.claudelintrc.json` - JSON configuration file (recommended) 2. `package.json` - Configuration in the `claudelint` field The search starts in the current directory and walks up the directory tree until a configuration file is found or the root is reached. ## Configuration Format ### Basic Structure ```json { "extends": "string or array", "rules": { "rule-name": "severity" }, "overrides": [], "ignorePatterns": [], "output": {}, "reportUnusedDisableDirectives": false } ``` ### Extends The `extends` field allows you to inherit configuration from other config files or npm packages. **Relative paths:** ```json { "extends": "../.claudelintrc.json", "rules": { "claude-md-size": "warn" } } ``` **Node modules:** ```json { "extends": "@company/claudelint-config" } ``` **Multiple extends:** ```json { "extends": ["./base.json", "./strict.json"] } ``` **Built-in presets:** claudelint ships with three built-in presets you can use directly: ```json { "extends": "claudelint:recommended" } ``` * `claudelint:recommended` - A curated subset of rules focused on correctness, security, and broad applicability. Best for most projects. This is the default when no config file is present. * `claudelint:strict` - Everything in recommended, plus additional quality and best-practice rules. Good for teams that want stricter guardrails. * `claudelint:all` - Every rule at its source-defined severity. Maximum coverage for comprehensive audits. You can extend a preset and override individual rules: ```json { "extends": "claudelint:recommended", "rules": { "skill-missing-changelog": "off", "skill-body-too-long": "error" } } ``` ::: tip claudelint defaults to the **recommended** preset. Run `claudelint init` to choose a different preset, or use `--preset all` for maximum coverage. ::: **Merge behavior:** When extending configs, claudelint merges configurations in this order: 1. Base config (first in extends array) 2. Additional extended configs (in order) 3. Current config (overrides everything) Rules are deep merged (child can override specific rules). Overrides and ignore patterns are concatenated. Circular dependencies are detected and prevented. See [Monorepo documentation](/integrations/monorepos) for detailed examples. ### Rules Rules can be configured with a severity level or a full configuration object: ```json { "rules": { "claude-md-size": "warn", "claude-md-import-missing": "off" } } ``` Severity levels: * `"off"` - Disable the rule * `"warn"` - Treat violations as warnings * `"error"` - Treat violations as errors For rules that support options: ```json { "rules": { "claude-md-size": { "severity": "warn", "options": { "maxSize": 50000 } } } } ``` ### Available Rules See the [Rules Reference](/rules/overview) for the complete list of available rules, or run `claudelint list-rules`. ### Overrides Override rules for specific file patterns: ```json { "overrides": [ { "files": ["*.test.ts", "*.spec.ts"], "rules": { "claude-md-size": "off" } }, { "files": [".claude/skills/**/SKILL.md"], "rules": { "claude-md-size": "off" } } ] } ``` ### Ignoring Files Patterns to exclude from linting (in addition to `.claudelintignore`): ```json { "ignorePatterns": ["**/*.generated.ts", ".cache/", "coverage/"] } ``` ### Output Options Configure output formatting: ```json { "output": { "format": "stylish", "verbose": false, "color": true } } ``` Options: * `format` - Output format: `"stylish"`, `"json"`, `"compact"`, or `"sarif"` * `verbose` - Enable verbose output * `color` - Enable/disable color output (auto-detected by default) ### Inline Disables You can disable rules for specific files, lines, or blocks using HTML comments, and optionally report unused disable directives. See [Inline Disable Directives](./inline-disables.md) for syntax, examples, and the `reportUnusedDisableDirectives` option. ### Max Warnings Exit with error if warning count exceeds this threshold: ```json { "maxWarnings": 10 } ``` Set to `0` to fail on any warning. Omit the field to allow unlimited warnings. The CLI `--max-warnings` option overrides this config value: ```bash # Override config maxWarnings with CLI option claudelint check-all --max-warnings 5 # Allow unlimited warnings (ignores config) claudelint check-all --max-warnings 0 ``` ## package.json Configuration You can also configure claudelint in your `package.json`: ```json { "name": "my-project", "version": "1.0.0", "claudelint": { "rules": { "claude-md-size": "off" } } } ``` ## .claudelintignore See [File Discovery — Ignoring Files](./file-discovery.md#ignoring-files) for `.claudelintignore` syntax, `.gitignore` integration, and default ignores. ## CLI Overrides Config file settings can be overridden with CLI flags (`--config`, `--format`, `--strict`, `--max-warnings`, `--rule`). See the [CLI Reference](./cli-reference.md) for all commands and options. ## Example Configuration Complete example `.claudelintrc.json`: ```json { "rules": { "claude-md-size": "warn", "claude-md-import-missing": "error", "claude-md-import-circular": "error", "skill-missing-shebang": "warn", "skill-dangerous-command": "error" }, "overrides": [ { "files": ["*.test.ts"], "rules": { "claude-md-size": "off" } } ], "ignorePatterns": ["**/*.generated.ts", ".cache/"], "output": { "format": "stylish", "verbose": false, "color": true }, "reportUnusedDisableDirectives": true, "maxWarnings": 10 } ``` ## Hierarchical Configuration claudelint searches for configuration files starting from the current directory and walking up the directory tree. This allows for: * Project-level configuration in the project root * Repository-level configuration in monorepo roots * Global configuration in home directory The first configuration file found is used. Files lower in the tree take precedence over files higher up. ## Programmatic API claudelint exposes a programmatic API for use in custom tooling and scripts: ```typescript import { ClaudeLint } from 'claude-code-lint'; ``` See the [API Overview](/api/overview) for full documentation, including the [ClaudeLint class](/api/claudelint-class), [functional API](/api/functional-api), and [recipes](/api/recipes). --- --- url: /guide/cli-reference.md description: >- Complete reference for all claudelint CLI commands, flags, options, exit codes, and usage examples including check-all, init, explain, and more. --- # CLI Reference Complete reference for all claudelint commands, options, and usage patterns. ## Table of Contents * [Primary Commands](#primary-commands) * [check-all](#check-all) - Run all validators (main command) * [init](#init) - Initialize configuration * [Config Management](#config-management) * [print-config](#print-config) - View resolved configuration * [resolve-config](#resolve-config) - Config for specific file * [validate-config](#validate-config) - Validate config file * [Rule Management](#rule-management) * [list-rules](#list-rules) - Browse available rules * [explain](#explain) - Full documentation for a rule * [Deprecation Management](#deprecation-management) * [check-deprecated](#check-deprecated) - Check for deprecated rules * [migrate](#migrate) - Migrate deprecated rules * [Cache Management](#cache-management) * [cache-clear](#cache-clear) - Clear validation cache * [Individual Validators](#individual-validators) - Run specific validators * [Formatting](#formatting) * [format](#format) - Format files * [Development](#development) * [watch](#watch) - Watch for changes and re-validate * [install-plugin](#install-plugin) - Plugin installation guide * [Exit Codes](#exit-codes) ## Primary Commands ### check-all Run all validators on your Claude Code project. This is the **default command** -- running `claudelint` with no arguments is equivalent to `claudelint check-all`. **Usage:** ```bash # These are equivalent: claudelint claudelint check-all [options] ``` **Options:** | Option | Description | Default | |--------|-------------|---------| | `--cwd ` | Run as if claudelint was started in this directory | Current directory | | `-v, --verbose` | Show detailed output including skipped validators and timing | `false` | | `-q, --quiet` | Suppress warnings, show only errors | `false` | | `--format ` | Output format: `stylish`, `json`, `compact`, `sarif`, or `github` | `stylish` | | `--config ` | Path to custom config file | Auto-detect | | `--no-config` | Disable configuration file loading | - | | `--preset ` | Built-in preset when no config file: `recommended`, `strict`, or `all` | `recommended` | | `--strict` | Exit with error on any issues (errors, warnings, or info) | `false` | | `--max-warnings ` | Fail if warning count exceeds this limit | Unlimited | | `--no-collapse` | Show all issues without collapsing repeated rules | `false` | | `--warnings-as-errors` | Treat all warnings as errors | `false` | | `--explain` | Show Why: and Fix: lines under each issue (Tier 2 progressive disclosure) | `false` | | `--fix` | Automatically fix problems | `false` | | `--fix-dry-run` | Preview fixes without applying them | `false` | | `--fix-type ` | Fix `errors`, `warnings`, or `all` | `all` | | `--cache` | Enable validation caching | `true` | | `--no-cache` | Disable validation caching | - | | `--cache-location ` | Cache directory location | `.claudelint-cache` | | `--color` | Force color output | Auto-detect | | `--no-color` | Disable color output | - | | `--debug-config` | Show configuration loading debug info | `false` | | `--show-docs-url` | Show documentation URLs for rules | `false` | | `--fast` | Fast mode: skip expensive checks | `false` | | `--no-deprecated-warnings` | Suppress warnings about deprecated rules | `false` | | `--error-on-deprecated` | Treat usage of deprecated rules as errors | `false` | | `--timing` | Show per-validator timing breakdown | `false` | | `--allow-empty-input` | Exit 0 when no files are found to check | `false` | | `-o, --output-file ` | Write results to file (in addition to stdout) | - | | `--ignore-pattern ` | Additional pattern to ignore (repeatable) | - | | `--no-ignore` | Disable ignore file and pattern processing | `false` | | `--rule ` | Override rule severity from CLI (repeatable) | - | | `--cache-strategy ` | Cache invalidation strategy: `metadata` or `content` | `metadata` | | `--changed` | Only check files with uncommitted git changes | `false` | | `--since ` | Only check files changed since a git ref (branch, tag, or SHA) | - | | `--stats` | Include per-rule statistics in output | `false` | | `--stdin` | Read input from stdin instead of files | `false` | | `--stdin-filename ` | Provide filename context for stdin input (e.g., `CLAUDE.md`) | - | | `--workspace ` | Validate specific workspace package by name | - | | `--workspaces` | Validate all workspace packages | `false` | **Scoping to changed files:** `--changed` and `--since ` narrow validation to the files git reports as changed, which is what makes claudelint usable as a PR check: a pull request is not failed for pre-existing findings in files it never touched. Two details are worth knowing: * **Deleted files are excluded.** A deletion is a change, so git lists it, but validating a path that no longer exists would report on a file you intentionally removed. * **Cross-file findings can be missed.** Some rules report on file A because of file B — `claude-md-import-missing` fires on the importer when the imported file is gone. If a change deletes B without touching A, a scoped run does not see it. Run an unscoped `claudelint check-all` (in CI, on the merged result) to catch that class. A skill is in scope when **any** file inside its directory changed, not only its `SKILL.md`, since rules also read the scripts and reference files beside it. **Examples:** ```bash # Basic validation claudelint check-all # Verbose with explanations and timing claudelint check-all --verbose --explain --timing # CI mode: JSON output, strict, fail on any warnings claudelint check-all --format json --strict --max-warnings 0 # GitHub Actions annotations claudelint check-all --format github # Preview auto-fixes, then apply claudelint check-all --fix-dry-run claudelint check-all --fix # Only check uncommitted changes claudelint check-all --changed # Only check files changed since a branch claudelint check-all --since main # Lint a different project claudelint check-all --cwd /path/to/project # Run all rules without a config file claudelint check-all --preset all # Override rule severity from CLI claudelint check-all --rule skill-name:error --rule claude-md-size:off # Pipe JSON to jq (status messages go to stderr) claudelint check-all --format json | jq '.[] | select(.errorCount > 0)' # Validate from stdin (editor integration) cat CLAUDE.md | claudelint check-all --stdin --stdin-filename CLAUDE.md ``` See [Exit Codes](#exit-codes) for return values. ### init Initialize claudelint configuration for your project. Interactive wizard that detects your project structure and generates appropriate config files. **Usage:** ```bash claudelint init [options] ``` **Options:** | Option | Description | |--------|-------------| | `-y, --yes` | Use default configuration without prompts (non-interactive mode) | | `--force` | Overwrite existing configuration files | | `--hooks` | Create a SessionStart validation hook for Claude Code | | `--preset ` | Preset to use with `--yes`: `recommended`, `strict`, or `all` (default: `recommended`) | **Examples:** ```bash # Interactive setup (recommended) claudelint init # Non-interactive with defaults claudelint init --yes # Non-interactive with SessionStart hook claudelint init --yes --hooks # Non-interactive with strict preset claudelint init --yes --preset strict --hooks # Overwrite existing config claudelint init --yes --force ``` **What it creates:** * `.claudelintrc.json` - Configuration file with rules * `.claudelintignore` - Patterns for files to ignore * `.claude/hooks/hooks.json` - SessionStart validation hook (with `--hooks`) * Optional: npm scripts in `package.json` ## Config Management ### print-config Display the resolved configuration that claudelint is using. Useful for debugging config file loading and cascading. **Usage:** ```bash claudelint print-config [options] ``` **Options:** | Option | Description | Default | |--------|-------------|---------| | `--format ` | Output format: `json` or `table` | `json` | | `--config ` | Path to config file to print | Auto-detect | **Examples:** ```bash # Print config as JSON claudelint print-config # Print config as table claudelint print-config --format table # Print specific config file claudelint print-config --config custom.json ``` ### resolve-config Show the effective configuration for a specific file. Takes into account config file cascading, overrides, and file-specific rules. **Usage:** ```bash claudelint resolve-config [options] ``` **Arguments:** * `` - Path to the file to resolve config for **Options:** | Option | Description | Default | |--------|-------------|---------| | `--format ` | Output format: `json` or `table` | `json` | | `--config ` | Path to config file | Auto-detect | **Examples:** ```bash # Resolve config for CLAUDE.md claudelint resolve-config .claude/CLAUDE.md # Resolve config for a skill claudelint resolve-config .claude/skills/test/test.sh # Table format claudelint resolve-config .claude/CLAUDE.md --format table ``` ### validate-config Validate a configuration file against the claudelint schema. Checks for unknown rules, invalid options, and schema violations. **Usage:** ```bash claudelint validate-config [options] ``` **Options:** | Option | Description | Default | |--------|-------------|---------| | `--config ` | Path to config file to validate | Auto-detect | **Examples:** ```bash # Validate default config claudelint validate-config # Validate specific config claudelint validate-config --config custom.json ``` ## Rule Management ### list-rules List all available validation rules with their metadata (severity, category, fixable status). **Usage:** ```bash claudelint list-rules [options] ``` **Options:** | Option | Description | Default | |--------|-------------|---------| | `--category ` | Filter by category: `CLAUDE.md`, `Skills`, `Settings`, `Hooks`, `MCP`, `Plugin` | All | | `--fixable` | Show only rules that support auto-fix | `false` | | `--format ` | Output format: `table` or `json` | `table` | **Examples:** ```bash # List all rules claudelint list-rules # List only Skills rules claudelint list-rules --category Skills # List only fixable rules claudelint list-rules --fixable # Combine filters claudelint list-rules --category Skills --fixable # JSON output claudelint list-rules --format json ``` **Output includes:** * Rule ID * Rule name * Description * Category * Severity (error, warning) * Fixable status ### explain Display the full documentation for a specific rule, including summary, details, examples, fix instructions, and metadata. This is Tier 3 of the progressive disclosure model. **Usage:** ```bash claudelint explain ``` **Arguments:** * `` - The ID of the rule to explain (e.g., `skill-name`, `claude-md-size`) **Examples:** ```bash # Show full docs for a rule claudelint explain skill-frontmatter-unknown-keys # Show docs for a CLAUDE.md rule claudelint explain claude-md-import-missing ``` **Output includes:** * Rule title and summary * Detailed explanation * How to fix * Incorrect and correct examples * Metadata (severity, category, fixable, since version, docs URL) * When not to use (if applicable) * Related rules **Exit Codes:** * `0` - Rule found and documentation displayed * `1` - Rule not found (shows available rule categories) **Progressive disclosure model:** | Tier | Command | What it shows | |------|---------|---------------| | 1 | `claudelint check-all` | Problem + rule ID (table format) | | 2 | `claudelint check-all --explain` | Why: + Fix: lines per issue | | 3 | `claudelint explain ` | Full documentation page | ## Deprecation Management ### check-deprecated Check your configuration file for deprecated rules that need to be updated or removed. **Usage:** ```bash claudelint check-deprecated [options] ``` **Options:** | Option | Description | Default | |--------|-------------|---------| | `--config ` | Path to config file | Auto-detect | | `--format ` | Output format: `table` or `json` | `table` | **Examples:** ```bash # Check current config for deprecated rules claudelint check-deprecated # Check specific config file claudelint check-deprecated --config .claudelintrc.json # JSON output for CI/CD claudelint check-deprecated --format json ``` **Output includes:** * Rule ID * Deprecation reason * Replacement rule(s) * Deprecated since version * Removal version (if scheduled) * Migration guide URL (if available) **Exit codes:** * `0` - No deprecated rules found * `1` - Deprecated rules found (needs attention) * `2` - Error (invalid config, file not found, etc.) ### migrate Automatically migrate deprecated rules in your configuration file. Auto-replaces 1:1 rule renames, warns when manual intervention is needed (1:many splits or removals). **Usage:** ```bash claudelint migrate [options] ``` **Options:** | Option | Description | Default | |--------|-------------|---------| | `--config ` | Path to config file | Auto-detect | | `--dry-run` | Preview changes without writing to file | `false` | | `--format ` | Output format: `table` or `json` | `table` | **Examples:** ```bash # Preview what would change claudelint migrate --dry-run # Apply migrations claudelint migrate ``` **Exit codes:** * `0` - Successfully migrated (or no deprecated rules found) * `1` - Manual intervention needed (multiple replacements) * `2` - Error (invalid config, file not found, etc.) ## Cache Management ### cache-clear Clear the validation cache. Use this if you're seeing stale validation results or after upgrading claudelint. **Usage:** ```bash claudelint cache-clear [options] ``` **Options:** | Option | Description | Default | |--------|-------------|---------| | `--cache-location ` | Cache directory to clear | `.claudelint-cache` | **Examples:** ```bash # Clear default cache claudelint cache-clear # Clear custom cache location claudelint cache-clear --cache-location /tmp/my-cache ``` **When to use:** * After upgrading claudelint * After changing rules or config * If seeing stale validation results * Before CI/CD runs (optional) ## Individual Validators Run a specific validator instead of all at once. Usage: `claudelint validate- [options]` **Shared Options** (available on all validators): | Option | Description | Default | |--------|-------------|---------| | `--path ` | Custom path to the target file or directory | Auto-detect | | `-v, --verbose` | Verbose output | `false` | | `--warnings-as-errors` | Treat warnings as errors | `false` | | `-c, --config ` | Path to configuration file | Auto-detect | | `--no-config` | Disable configuration file loading | - | | `--max-warnings ` | Fail if warning count exceeds this limit | Unlimited | | `--no-collapse` | Show all issues without collapsing repeated rules | `false` | **Available validators:** | Command | Validates | |---------|-----------| | `validate-claude-md` | CLAUDE.md files (supports `--explain`) | | `validate-skills` | Skill structure and frontmatter (supports `--skill `) | | `validate-agents` | Agent structure and frontmatter | | `validate-hooks` | hooks.json files | | `validate-mcp` | MCP server configuration | | `validate-settings` | settings.json files | | `validate-plugin` | Plugin manifest files | | `validate-lsp` | LSP configuration | | `validate-output-styles` | Output style structure and frontmatter | | `validate-commands` | Deprecated commands (suggests migration to skills) | **Examples:** ```bash # Validate CLAUDE.md with explanations claudelint validate-claude-md --verbose --explain # Validate a specific skill claudelint validate-skills --skill my-skill # Validate hooks with custom path claudelint validate-hooks --path ./config/hooks.json # Any validator with shared options claudelint validate-mcp --warnings-as-errors --max-warnings 0 ``` ## Formatting ### format Format Claude Code files using a three-tier formatting pipeline: 1. **markdownlint** - CLAUDE.md and skill markdown files 2. **prettier** - Markdown, JSON, and YAML files 3. **shellcheck** - Shell scripts (optional, requires system install) **Usage:** ```bash claudelint format [options] ``` **Options:** | Option | Description | Default | |--------|-------------|---------| | `--check` | Check formatting without making changes | `false` | | `--fix` | Apply formatting fixes | `true` | | `--fix-dry-run` | Preview what would be fixed without writing | `false` | | `-v, --verbose` | Show detailed output per file | `false` | **Modes:** * **Default** (no flags): Apply fixes and write corrected files * `--check`: Report pass/fail without modifying files * `--fix-dry-run`: Report which files would change, without writing **Examples:** ```bash # Check formatting (no changes) claudelint format --check # Preview what would be fixed claudelint format --fix-dry-run # Apply formatting fixes claudelint format --fix # Verbose output to see per-file results claudelint format --verbose ``` See [File Discovery](/guide/file-discovery) for the full list of file patterns discovered by claudelint. ## Development ### watch Watch for file changes and automatically re-validate. Runs an initial full validation, then monitors the working directory and triggers only the relevant validators when files change. **Usage:** ```bash claudelint watch [options] ``` **Options:** | Option | Description | Default | |--------|-------------|---------| | `-v, --verbose` | Verbose output | `false` | | `--warnings-as-errors` | Treat warnings as errors | `false` | | `-c, --config ` | Path to configuration file | Auto-detect | | `--no-config` | Disable configuration file loading | - | | `--debounce ` | Debounce interval in milliseconds | `300` | **File triggers:** Changes to specific files trigger only the relevant validator: | File Pattern | Validator Triggered | |-------------|-------------------| | `CLAUDE.md` | CLAUDE.md validator | | `SKILL.md`, `*.sh` | Skills validator | | `settings.json` | Settings validator | | `hooks.json` | Hooks validator | | `.mcp.json` | MCP validator | | `plugin.json` | Plugin validator | Changes to other `.md`, `.json`, or `.sh` files trigger all validators. Files in `node_modules/` and `.claudelint-cache/` are ignored. **Examples:** ```bash # Start watching with defaults claudelint watch # Custom debounce for slower file systems claudelint watch --debounce 500 # Watch with specific config claudelint watch --config strict.json # Watch with warnings treated as errors claudelint watch --warnings-as-errors ``` Press `Ctrl+C` to stop watching. ### install-plugin Show instructions for installing claudelint as a Claude Code plugin. Auto-detects whether claudelint is installed locally in `node_modules` and shows the appropriate installation command. **Usage:** ```bash claudelint install-plugin ``` **No options.** This is an informational command that prints installation instructions. **Output varies based on context:** * Shows `claude --plugin-dir ./node_modules/claude-code-lint` for local loading * Shows marketplace install syntax for distribution See the [Claude Code Plugin Guide](/integrations/claude-code-plugin) for detailed setup instructions. ## Output Streams claudelint separates data output from status messages for clean piping: * **stdout**: Lint results (formatted output from `--format json`, `--format sarif`, `--format github`) * **stderr**: Status messages, progress indicators, timing info, "Using config file: ..." This enables piping to other tools: ```bash # Pipe JSON to jq claudelint check-all --format json | jq '.[] | select(.errorCount > 0)' # Save SARIF while still seeing progress claudelint check-all --format sarif > results.sarif # GitHub annotations to stdout, progress to stderr claudelint check-all --format github ``` ## Environment Variables | Variable | Description | |----------|-------------| | `NO_COLOR` | Disable color output (respected per [no-color.org](https://no-color.org) standard) | | `FORCE_COLOR` | Force color output even when not a TTY | | `CI` | Suppress update notifications when running in CI environments | | `NO_UPDATE_NOTIFIER` | Suppress update notifications explicitly | Color is auto-detected based on TTY status. The `--color` and `--no-color` flags override environment variables. claudelint checks the npm registry for newer versions once every 24 hours and displays a notification if an update is available. Set `CI=true` or `NO_UPDATE_NOTIFIER=1` to suppress this behavior. ## Exit Codes claudelint uses standard POSIX exit codes: | Exit Code | Meaning | When It Happens | |-----------|---------|-----------------| | `0` | Success | No issues found, all checks passed | | `1` | Issues found | Errors or warnings detected (depending on flags) | | `2` | Fatal error | Invalid config, command failure, or internal error | | `130` | Interrupted | Process terminated by SIGINT (Ctrl+C) or SIGTERM | **Exit code 1 is returned when:** * Any errors are found (always) * Warnings are found AND `--warnings-as-errors` is set * Any issues are found AND `--strict` is set * Warning count exceeds `--max-warnings` threshold **Exit code 0 is returned when:** * No errors or warnings found * Only warnings found (without `--warnings-as-errors` or `--strict`) * Warnings found but under `--max-warnings` threshold **Exit code 2 is returned when:** * Config file is invalid or cannot be loaded * Command syntax is incorrect * Internal error or exception occurs ## See Also * [Configuration Guide](./configuration.md) - Config file format and options * [Rules Catalog](/rules/overview) - All validation rules * [Auto-fix Guide](./auto-fix.md) - Using auto-fix safely * [CI/CD Integration](/integrations/ci) - GitHub Actions, GitLab CI, and pre-commit setup * [npm Scripts](/integrations/npm-scripts) - Adding claudelint to your package.json * [Troubleshooting](./troubleshooting.md) - Common issues and solutions --- --- url: /guide/file-discovery.md description: >- Understand how claudelint automatically discovers Claude Code configuration files across project layouts, monorepos, and plugin directories. --- # File Discovery claudelint automatically discovers project-level and plugin-level Claude Code configuration files using predefined glob patterns. Global user configurations (`~/.claude/`) are out of scope. Discovery respects `.claudelintignore`, `.gitignore` patterns, and always excludes `node_modules/` and `.git/`. ## File Type Reference | File Type | Locations | Validator | Recursive | |---|---|---|---| | CLAUDE.md | `CLAUDE.md`, `.claude/CLAUDE.md`, `CLAUDE.local.md` | claude-md | Yes (`**/`) | | Rules | `.claude/rules/**/*.md` | claude-md | Yes | | Skills | `.claude/skills//SKILL.md`, `skills//SKILL.md` | skills | Yes (`**/`) for `.claude/` | | Agents | `.claude/agents/.md`, `agents/.md` | agents | No | | Output Styles | `.claude/output-styles//*.md`, `output-styles//*.md` | output-styles | No | | Settings | `.claude/settings.json`, `.claude/settings.local.json` | settings | No | | Hooks | `hooks/hooks.json` (plugin, auto-loaded) | hooks | No | | MCP | `.mcp.json` | mcp | No | | LSP | `.claude/lsp.json`, `.lsp.json` | lsp | No | | Plugin | `plugin.json`, `.claude-plugin/plugin.json` | plugin | No | | Commands | `.claude/commands/**/*`, `commands/**/*` | commands | Yes | Recursive patterns (`**/`) find files in nested directories, supporting monorepo layouts where packages have their own `.claude/` directories. ## Monorepo Support claudelint supports monorepo-style projects where multiple packages each have their own Claude Code configuration. All `CLAUDE.md` and `CLAUDE.local.md` files are discovered recursively, and skills inside `.claude/skills/` are discovered within nested packages. For workspace detection, config inheritance, and per-package validation, see [Monorepo Support](/integrations/monorepos). ## Plugin File Discovery When building a Claude Code plugin, files use a different directory structure at the plugin root: ```text my-plugin/ plugin.json # Plugin manifest skills/ my-skill/SKILL.md # Plugin skill agents/ my-agent.md # Plugin agent hooks/ hooks.json # Plugin hooks output-styles/ concise/style.md # Plugin output style commands/ deploy.md # Plugin command ``` claudelint detects both the standard `.claude/` project structure and the plugin root structure. See [Plugin Manifest: Auto-discovery](/api/schemas/plugin#auto-discovery) for how Claude Code loads plugin config files. ## Ignoring Files ### .claudelintignore Create a `.claudelintignore` file in your project root using `.gitignore` syntax: ```text # Ignore build artifacts dist/ build/ # Ignore a specific CLAUDE.md packages/legacy/CLAUDE.md # Ignore all files in a directory experiments/** ``` Syntax rules: * `#` for comments * `*` matches any characters except `/` * `**` matches any characters including `/` * Trailing `/` matches directories * Blank lines are ignored Default ignores (always applied): `node_modules/**`, `.git/**`, `dist/**`, `build/**`. You can also add patterns in your config file with the `ignorePatterns` field: ```json { "ignorePatterns": ["**/*.generated.ts", ".cache/", "coverage/"] } ``` ### .gitignore Patterns in `.gitignore` are also respected automatically. Files matched by `.gitignore` will not be discovered. --- --- url: /guide/auto-fix.md description: >- Automatically fix claudelint validation issues using --fix. Preview changes with --fix-dry-run, apply fixes safely, and learn which rules are fixable. --- # Auto-fix claudelint can automatically fix certain validation issues. Fixes use atomic file writes and can be previewed before applying. ## Usage ### Preview Fixes See what would be fixed without modifying files: ```bash claudelint check-all --fix-dry-run ``` **Output:** ```text Previewing 3 fixes... Proposed changes: Index: .claude/skills/my-skill/test.sh =================================================================== --- .claude/skills/my-skill/test.sh original +++ .claude/skills/my-skill/test.sh fixed @@ -1,1 +1,2 @@ +#!/usr/bin/env bash echo "Hello" ✓ 3 fixes would be applied to 3 files ``` ### Apply Fixes ```bash claudelint check-all --fix ``` ### Fix by Severity ```bash # Fix only errors claudelint check-all --fix --fix-type errors # Fix only warnings claudelint check-all --fix --fix-type warnings # Fix all (default) claudelint check-all --fix --fix-type all ``` ## Fixable Rules Not all rules support auto-fix — only mechanical changes that don't require human judgment. To see which rules are fixable: ```bash claudelint list-rules --fixable ``` You can also browse the [Rules Reference](/rules/overview) — fixable rules are tagged with a green "Fixable" badge. ## Recommended Workflow ```bash claudelint check-all --fix-dry-run # 1. Preview changes claudelint check-all --fix # 2. Apply fixes claudelint check-all # 3. Verify remaining issues ``` ## Tips * **Preview first** — always use `--fix-dry-run` before `--fix` * **Commit first** — ensure you can `git checkout .` to revert if needed * **Fix in batches** — use `--fix-type warnings` or `--fix-type errors` for easier review * **Re-validate** — always run `claudelint check-all` after fixing * **Caching is disabled** during `--fix` runs (fix functions can't be serialized), so expect slightly slower runs ## Limitations * Some rules require human judgment and can't be auto-fixed (e.g., `skill-missing-comments`, `import-circular`) * Fixes are applied sequentially per file — later fixes see the result of earlier ones For troubleshooting auto-fix issues, see [Troubleshooting](./troubleshooting.md#auto-fix-not-applying). ## See Also * [Rules Reference](/rules/overview) - See which rules are fixable * [Configuration](/guide/configuration) - Configure validation rules * [CLI Reference](/guide/cli-reference) - All command-line options * [CI/CD Integration](/integrations/ci) - Using auto-fix in CI pipelines --- --- url: /guide/inline-disables.md description: >- Disable claudelint rules for specific lines, blocks, or entire files using inline HTML comment syntax without changing your global configuration. --- # Inline Disable Directives claudelint supports inline comments to disable specific validation rules for parts of your files. Valid rule IDs can be found in the [Rules Reference](/rules/overview) or by running `claudelint list-rules`. ## Syntax ### Disable Entire File Disable a specific rule for the entire file: ```markdown @import non-existent-file.md @import another-missing-file.md ``` Disable all rules for the entire file: ```markdown This file won't be validated at all. ``` ### Disable Next Line Disable a specific rule for the next line only: ```markdown @import non-existent-file.md This line will still be validated. ``` Disable all rules for the next line: ```markdown @import non-existent-file.md ``` ### Disable Current Line Disable a specific rule on the same line as the comment: ```markdown This is a very long line... ``` Disable all rules on the current line: ```markdown Any violation on this line is ignored ``` ### Disable Range Disable a specific rule for a block of lines: ```markdown @import file1.md @import file2.md @import file3.md Validation resumes here. ``` Disable all rules for a block: ```markdown Content in this block won't be validated. ``` **Note:** Unclosed disable blocks extend to the end of the file. ## Unused Disable Detection claudelint can warn about disable directives that don't suppress any violations: ```json { "reportUnusedDisableDirectives": true } ``` When enabled, unnecessary disables produce a warning: ```text ! Warning: Unused disable directive for 'size-error' [unused-disable] at: CLAUDE.md:3 Fix: Remove the unused disable comment ``` This helps keep disable comments clean by catching stale directives left over after violations are fixed. ## Best Practices * **Use sparingly** — if you're disabling rules frequently, consider adjusting your config in `.claudelintrc.json` instead * **Be specific** — prefer `` over `` so only the necessary rule is suppressed * **Document why** — add a comment above the disable explaining the reason: ```markdown @import generated-content.md ``` * **Place close to the violation** — use `disable-next-line` rather than broad range disables * **Enable `reportUnusedDisableDirectives`** to catch stale disables, especially in CI ## Advanced Examples ### Multiple Rules Each rule needs its own disable comment: ```markdown @import very-large-non-existent-file.md ``` ### Nested Ranges Range disables can overlap: ```markdown @import file1.md @import file2.md @import file3.md ``` For troubleshooting inline disables (wrong line numbers, disables not working), see [Troubleshooting](./troubleshooting.md). ## See Also * [Configuration Guide](/guide/configuration) - Complete configuration reference * [Rules Reference](/rules/overview) - Available validation rules and their IDs --- --- url: /guide/troubleshooting.md description: >- Fix common claudelint errors including CLAUDE.md issues, skill misconfigurations, cache problems, CI failures, and custom rule debugging. --- # Troubleshooting Solutions for common errors, cache issues, CI failures, and custom rule debugging. If your issue isn't listed here, [open a GitHub issue](https://github.com/pdugan20/claudelint/issues). ## Reading Error Output claudelint error messages follow this format: ```text /path/to/file.md (1 error) 12 error Referenced skill not found: authentication skill-referenced-file-not-found 1 problem (1 error, 0 warnings) ``` * **Path**: `/path/to/file.md (1 error)` — File with the issue and count * **Line**: `12` — Line number (0 for file-level issues) * **Severity**: `error` or `warning` * **Message**: `Referenced skill not found: authentication` — What's wrong * **Rule ID**: `skill-referenced-file-not-found` — Which rule triggered this Every rule ID links to a documentation page with examples and fix guidance. Browse the [Rules Reference](/rules/overview) or use `claudelint check-all --explain` for inline details. ## Common Errors by Category Errors grouped by validator. Each entry links to the full rule documentation. ### File exceeds size limit **Problem:** CLAUDE.md file exceeds the recommended 40KB limit (configurable). **Solution:** Split content into smaller files using `@import`: ```markdown @import ./docs/architecture.md @import ./docs/api-reference.md ``` Also check for embedded data (base64 images, large code blocks) and use external links instead of inline content. **See:** [claude-md-size](/rules/claude-md/claude-md-size) ### Imported file not found **Problem:** `@import` statement references a file that doesn't exist. **Solution:** 1. Check file path is correct (relative to CLAUDE.md) 2. Verify file exists in the repository 3. Check for typos in filename and file extension **See:** [claude-md-import-missing](/rules/claude-md/claude-md-import-missing) ### Circular import detected **Problem:** File A imports File B, which imports File A (directly or indirectly). **Solution:** 1. Restructure imports to be hierarchical (tree, not graph) 2. Extract shared content to a common file 3. Remove redundant imports **See:** [claude-md-import-circular](/rules/claude-md/claude-md-import-circular) ### Missing version field **Problem:** SKILL.md missing required `version` field in frontmatter. **Solution:** Add version to frontmatter: ```yaml --- name: my-skill description: Does something version: 1.0.0 --- ``` Run `claudelint check-all --fix` to auto-fix. **See:** [skill-missing-version](/rules/skills/skill-missing-version) ### Skill name-directory mismatch **Problem:** Skill's `name` field doesn't match its directory name. **Solution:** Either rename the directory to match the skill name, or update the `name` field in frontmatter to match the directory. **See:** [skill-name-directory-mismatch](/rules/skills/skill-name-directory-mismatch) ### Missing shebang **Problem:** Executable `.sh` file doesn't start with a shebang line. **Solution:** Add `#!/usr/bin/env bash` as the first line of the script. Run `claudelint check-all --fix` to auto-fix. **See:** [skill-missing-shebang](/rules/skills/skill-missing-shebang) ### Referenced path not found **Problem:** Settings file references a path that doesn't exist on disk. **Solution:** 1. Create the missing directory or file 2. Fix the path in settings.json 3. Remove the reference if no longer needed **See:** [settings-file-path-not-found](/rules/settings/settings-file-path-not-found) ### Hook script not found **Problem:** hooks.json references a command script that doesn't exist. **Solution:** 1. Create the missing script 2. Fix the path in hooks.json 3. Verify the path is relative to `.claude/hooks.json` **See:** [hooks-missing-script](/rules/hooks/hooks-missing-script) ## CI/CD Issues ### Hook not running at session start **Problem:** SessionStart hook runs but Claude doesn't mention validation results. SessionStart command hooks send output to Claude's context, not your terminal. If Claude doesn't mention results: **Solution:** 1. Verify `.claude/hooks.json` (or `.claude/hooks/hooks.json`) exists 2. Validate: `claudelint validate-hooks` 3. Check event name is `"SessionStart"` (capital S) 4. Test the command manually: `claudelint check-all --format json` ### Environment variables in CI **Problem:** Color or notification behavior is wrong in CI environments. **Solution:** * **Suppress update notifications:** Set `CI=true` or `NO_UPDATE_NOTIFIER=1` * **Force color:** `FORCE_COLOR=1 claudelint check-all` or `claudelint check-all --color` * **Disable color:** `NO_COLOR=1 claudelint check-all` or `claudelint check-all --no-color` ## Cache Issues ### Stale results after upgrade **Problem:** After upgrading claudelint, you still see old validation results or missing new rules. The cache stores results keyed by version and build fingerprint. In rare cases (e.g., reinstalling the same version), stale entries may persist. **Solution:** `claudelint cache-clear` ### Cache not invalidating **Problem:** You edited a file but claudelint still reports old results. Cache invalidation is mtime-based. If a file's modification time didn't change (e.g., `git checkout` restoring a file), the cache considers it unchanged. **Solution:** 1. Clear the cache: `claudelint cache-clear` 2. Bypass for one run: `claudelint check-all --no-cache` 3. Touch the file: `touch CLAUDE.md` ### Auto-fix not applying **Problem:** Running `--fix` reports issues but doesn't modify files. The rule likely doesn't support auto-fix. Only rules with `fixable: true` apply changes. **Solution:** `claudelint list-rules --fixable` to see which rules support auto-fix. ### Fixes failed **Problem:** "N fixes failed" message appears after running `--fix`. Possible causes: file doesn't exist, invalid file content (can't parse frontmatter), or permission denied. **Solution:** Run with `--verbose` to see detailed error messages. Check file permissions with `ls -l`. ### Auto-fix makes unexpected changes **Problem:** A fix modifies files in an unintended way. **Solution:** Always use `--fix-dry-run` first to preview changes. Use `git checkout .` to revert if needed. [Report an issue](https://github.com/pdugan20/claudelint/issues) if a fix is incorrect, including original content and the diff from `--fix-dry-run`. ## Inline Disable Issues ### Disable directive not working **Problem:** `` doesn't suppress the violation. **Solution:** 1. Verify syntax: `` 2. Check rule ID spelling: run `claudelint list-rules` 3. Confirm the directive is immediately before the violation (no blank lines between them) ### Unused disable warnings **Problem:** claudelint warns about a disable directive that doesn't suppress any violations. `reportUnusedDisableDirectives` is enabled and the targeted rule no longer triggers on that line. **Solution:** 1. Remove the disable if the violation has been fixed 2. Fix the underlying issue instead of disabling 3. Set `"reportUnusedDisableDirectives": false` in config to turn off detection ### Wrong line affected by disable **Problem:** `disable-next-line` doesn't suppress the expected violation. `disable-next-line` affects the line immediately after the comment. If there's a blank line between the comment and the violation, it won't work. Use `disable-line` to disable the current line instead. ## Custom Rules Issues For in-depth custom rule debugging, see the [Custom Rules Troubleshooting](/development/custom-rules-troubleshooting) guide. ### Custom rule not loading **Problem:** `Failed to load custom rule` error. **Solution:** 1. Verify file is in `.claudelint/rules/` directory 2. Check file extension is `.ts` or `.js` (not `.d.ts`, `.test.ts`) 3. Ensure a named `rule` export is used: ```typescript import type { Rule } from 'claude-code-lint'; export const rule: Rule = { meta: { /* ... */ }, validate: async (context) => { /* ... */ }, }; ``` 4. Check for syntax errors in the rule file ### Custom rule not executing **Problem:** Rule loads without error but doesn't report any violations. **Solution:** 1. Check rule is enabled in `.claudelintrc.json`: ```json { "rules": { "my-custom-rule": "error" } } ``` 2. Verify `context.report()` is being called 3. Add `console.log` statements to trace execution ## stdin and Editor Integration ### stdin not reading input **Problem:** `claudelint check-all --stdin` hangs or times out. stdin mode expects piped input. Running it interactively (without piped data) will timeout after 5 seconds. **Solution:** ```bash cat CLAUDE.md | claudelint check-all --stdin --stdin-filename CLAUDE.md ``` ### No matching validator **Problem:** `Exit code 2` with error about no matching validator. The `--stdin-filename` doesn't match any validator's file patterns. **Solution:** Use a filename that matches a known pattern: ```bash # CLAUDE.md files cat content.md | claudelint check-all --stdin --stdin-filename CLAUDE.md # Settings cat settings.json | claudelint check-all --stdin --stdin-filename .claude/settings.json # Hooks cat hooks.json | claudelint check-all --stdin --stdin-filename .claude/hooks.json ``` ## Incremental Linting ### Slow on large projects **Problem:** `claudelint check-all` takes a long time because it checks every file. **Solution:** Use VCS-aware flags to check only changed files: ```bash # Check only uncommitted changes claudelint check-all --changed # Check only files changed since a branch claudelint check-all --since main # Check only files changed since a tag claudelint check-all --since v0.1.0 ``` These flags require a git repository. If you're not in a git repo, you'll see a helpful error message. ## Getting More Help If you can't find a solution here: 1. **Search existing issues:** [GitHub Issues](https://github.com/pdugan20/claudelint/issues) 2. **Check documentation:** [Getting Started](./getting-started.md), [Configuration](./configuration.md), [CLI Reference](./cli-reference.md) 3. **Enable verbose output:** `claudelint check-all --verbose` 4. **Open a new issue** with: command you ran, error message, OS and Node version, verbose output --- --- url: /validators/overview.md description: >- Understand how claudelint organizes validation rules into categories covering CLAUDE.md, skills, settings, hooks, MCP servers, plugins, agents, LSP, and more. --- # Validators Each validator targets a specific Claude Code file type and runs its rules in parallel. Configure them via `.claudelintrc.json`. ## Featured Validators Browse the sidebar for the full list of validators (Agents, LSP, Output Styles, Commands), or jump to the [Rules Reference](/rules/overview) for individual rule pages. --- --- url: /validators/claude-md.md description: >- Validate your CLAUDE.md files for size limits, import integrity, circular imports, and content structure using claudelint's CLAUDE.md validator rules. --- # CLAUDE.md Validator The CLAUDE.md validator checks your project's CLAUDE.md files for correctness, size limits, import integrity, and content structure. ## What It Checks * File size limits (40KB default) * `@import` directive syntax and referenced file existence * Circular import detection * Import depth limits (max 5 levels) * YAML frontmatter in `.claude/rules/*.md` files * `paths` glob pattern validity ## Rules This validator includes rules. See the [CLAUDE.md rules category](/rules/claude-md/claude-md-content-too-many-sections) for the complete list. ## CLI Usage ```bash # Validate CLAUDE.md files only claudelint validate-claude-md # With verbose output claudelint validate-claude-md --verbose # With auto-fix claudelint validate-claude-md --fix ``` ## Plugin Skill If you have the [claudelint plugin](/integrations/claude-code-plugin) installed, you can run this validator inside Claude Code with `/validate-cc-md` or by asking "Is my CLAUDE.md ok?" ## See Also * [Claude Code Memory](https://code.claude.com/docs/en/memory) - Official CLAUDE.md documentation * [Configuration](/guide/configuration) - Customize rule severity * [Troubleshooting](/guide/troubleshooting) - Common issues --- --- url: /validators/skills.md description: >- Validate Claude Code skill definitions for naming conventions, required fields, shell script security, and documentation quality with the Skills validator. --- # Skills Validator The Skills validator checks Claude Code skill definitions for correctness, security, documentation quality, and best practices. ## What It Checks * SKILL.md frontmatter schema compliance * Required fields (name, description) * Version format validation * Shell script security (dangerous commands, eval usage) * Referenced file existence * Documentation quality (CHANGELOG, examples, README) * Naming conventions ## Rules This validator includes rules. See the [Skills rules category](/rules/skills/skill-agent) for the complete list. ## CLI Usage ```bash # Validate all skills claudelint validate-skills # Validate with auto-fix claudelint validate-skills --fix # Verbose output claudelint validate-skills --verbose ``` ## Plugin Skill If you have the [claudelint plugin](/integrations/claude-code-plugin) installed, you can run this validator inside Claude Code with `/validate-skills` or by asking "Why is my skill not loading?" ## See Also * [Claude Code Skills](https://code.claude.com/docs/en/skills) - Official skills documentation * [Configuration](/guide/configuration) - Customize rule severity --- --- url: /validators/settings.md description: >- Validate .claude/settings.json files for schema compliance, permission rule syntax, environment variable names, and file path references with claudelint. --- # Settings Validator The Settings validator checks `.claude/settings.json` files for schema compliance, permission rules, and environment variable configuration. ## What It Checks * JSON schema validation * Permission rule syntax and validity * Environment variable names * File path references * Tool name validity ## Rules This validator includes rules. See the [Settings rules category](/rules/settings/settings-file-path-not-found) for the complete list. ## CLI Usage ```bash claudelint validate-settings claudelint validate-settings --verbose ``` ## Plugin Skill If you have the [claudelint plugin](/integrations/claude-code-plugin) installed, you can run this validator inside Claude Code with `/validate-settings` or by asking "Check my settings." ## See Also * [Claude Code Settings](https://code.claude.com/docs/en/settings) - Official settings documentation * [Configuration](/guide/configuration) - Customize rule severity --- --- url: /validators/hooks.md description: >- Validate Claude Code hooks.json files for schema compliance, valid event names, hook types, script file existence, and matcher pattern syntax. --- # Hooks Validator The Hooks validator checks hooks configuration files for schema compliance, event validity, and script references. It discovers `hooks/hooks.json` at the plugin root (auto-loaded by Claude Code) and any additional hooks files referenced in plugin.json. ## What It Checks * hooks.json schema validation * Valid event names (PreToolUse, PostToolUse, SessionStart, etc.) * Hook type correctness * Script file existence * Matcher pattern syntax ## Rules This validator includes rules. See the [Hooks rules category](/rules/hooks/hooks-invalid-config) for the complete list. ## CLI Usage ```bash claudelint validate-hooks claudelint validate-hooks --verbose ``` ## Plugin Skill If you have the [claudelint plugin](/integrations/claude-code-plugin) installed, you can run this validator inside Claude Code with `/validate-hooks` or by asking "Why is my hook not firing?" ## See Also * [Claude Code Hooks](https://code.claude.com/docs/en/hooks) - Official hooks documentation * [Claude Code Hooks Integration](/integrations/hooks) - Using hooks with claudelint --- --- url: /validators/mcp.md description: >- Validate .mcp.json configuration files for transport types, URL formats, environment variable syntax, and server command validity with claudelint. --- # MCP Servers Validator The MCP validator checks `.mcp.json` configuration files for transport types, URLs, environment variables, and server configuration. ## What It Checks * Transport type validity (stdio, SSE, HTTP, WebSocket) * URL format validation per transport type * Environment variable syntax * Variable expansion patterns * Command validation for stdio transport ## Rules This validator includes rules. See the [MCP rules category](/rules/mcp/mcp-http-empty-url) for the complete list. ## CLI Usage ```bash claudelint validate-mcp claudelint validate-mcp --verbose ``` ## Plugin Skill If you have the [claudelint plugin](/integrations/claude-code-plugin) installed, you can run this validator inside Claude Code with `/validate-mcp` or by asking "Validate my MCP config." ## See Also * [Claude Code MCP Servers](https://code.claude.com/docs/en/mcp) - Official MCP documentation * [Configuration](/guide/configuration) - Customize rule severity --- --- url: /validators/plugin.md description: >- Validate Claude Code plugin.json manifest files for schema compliance, semantic versioning, required fields, and component file references with claudelint. --- # Plugin Validator The Plugin validator checks `.claude-plugin/plugin.json` manifest files for schema compliance, versioning, and component references. ## What It Checks * plugin.json schema validation * Semantic versioning format * Required fields (name, version, description) * Skill, agent, and hook references * Component file existence * Directory structure * marketplace.json schema ## Rules This validator includes rules. See the [Plugin rules category](/rules/plugin/plugin-commands-deprecated) for the complete list. ## CLI Usage ```bash claudelint validate-plugin claudelint validate-plugin --verbose ``` ## Plugin Skill If you have the [claudelint plugin](/integrations/claude-code-plugin) installed, you can run this validator inside Claude Code with `/validate-plugin` or by asking "Check my plugin manifest." ## See Also * [Claude Code Plugins Reference](https://code.claude.com/docs/en/plugins-reference) - Official plugin documentation * [Claude Code Plugin Integration](/integrations/claude-code-plugin) - Plugin usage guide --- --- url: /validators/agents.md description: >- Validate Claude Code agent definitions for naming conventions, required fields, model configuration, tool references, and skill references with claudelint. --- # Agents Validator The Agents validator checks Claude Code agent definitions for correctness, including names, descriptions, tools, and model configuration. ## What It Checks * Agent frontmatter schema compliance * Required fields (name, description) * Name/filename consistency * Tool references * Model configuration * Skill references * Hook configuration * Body content length ## Rules This validator includes rules. See the [Agents rules category](/rules/agents/agent-body-too-short) for the complete list. ## CLI Usage ```bash # Validate all agents claudelint validate-agents # Verbose output claudelint validate-agents --verbose ``` ::: info Agent files vs AGENTS.md Claude Code agent files (`.claude/agents/.md`) are single markdown files with YAML frontmatter that define sub-agents. Not to be confused with OpenAI's [AGENTS.md](https://developers.openai.com/codex/guides/agents-md/), which provides project-wide instructions for Codex agents (similar to Claude Code's `CLAUDE.md`). ::: ## See Also * [Claude Code Sub-agents](https://code.claude.com/docs/en/sub-agents) - Official sub-agents documentation * [Configuration](/guide/configuration) - Customize rule severity --- --- url: /validators/lsp.md description: >- Validate Language Server Protocol configuration for transport settings, language IDs, file extensions, and server commands in Claude Code projects. --- # LSP Validator The LSP validator checks Language Server Protocol configuration files for transport settings, language IDs, file extensions, and server commands. ## What It Checks * Transport configuration (stdio, TCP) * Language ID format and validity * File extension format * Server command existence * Configuration file paths ## Rules This validator includes rules. See the [LSP rules category](/rules/lsp/lsp-command-bare-name) for the complete list. ## CLI Usage ```bash # Validate LSP configuration claudelint validate-lsp # Verbose output claudelint validate-lsp --verbose ``` ## See Also * [Claude Code LSP Servers](https://code.claude.com/docs/en/plugins-reference#lsp-servers) - Official LSP documentation * [Configuration](/guide/configuration) - Customize rule severity --- --- url: /validators/output-styles.md description: >- Validate Claude Code output style definitions for name consistency, directory matching, and required guidelines content using claudelint's Output Styles validator. --- # Output Styles Validator The Output Styles validator checks Claude Code output style definitions for name validation and content requirements. ## What It Checks * OUTPUT\_STYLE.md frontmatter schema * Name and directory consistency * Guidelines content requirements ## Rules This validator includes rules. See the [Output Styles rules category](/rules/output-styles/output-style-body-too-short) for the complete list. ## CLI Usage ```bash # Validate all output styles claudelint validate-output-styles # Verbose output claudelint validate-output-styles --verbose ``` ## See Also * [Claude Code Output Styles](https://code.claude.com/docs/en/output-styles) - Official output styles documentation * [Configuration](/guide/configuration) - Customize rule severity --- --- url: /validators/commands.md description: >- Check for deprecated .claude/commands/ directory usage and get migration guidance for moving to the skills-based approach with claudelint's Commands validator. --- # Commands Validator The Commands validator checks for deprecated command directory usage and helps migrate to the newer skills-based approach. ## What It Checks * Deprecated `.claude/commands/` directory detection * Migration guidance to skills ## Rules This validator includes rules. See the [Commands rules category](/rules/commands/commands-deprecated-directory) for the complete list. ## CLI Usage ```bash # Check for deprecated commands claudelint validate-commands # Verbose output claudelint validate-commands --verbose ``` ## See Also * [Claude Code Slash Commands](https://code.claude.com/docs/en/slash-commands) - Official commands documentation * [Configuration](/guide/configuration) - Customize rule severity --- --- url: /rules/overview.md description: >- Browse all claudelint validation rules organized by category. Covers severity levels, auto-fixable rules, and featured rules for CLAUDE.md, Skills, MCP, Agents, and Plugin. --- # Rules Reference Browse every validation rule by category. Each rule page includes severity, examples of correct and incorrect usage, and how to fix violations. ## Featured Rules Browse the sidebar for the complete list of rules organized by category, or see the [Validators Overview](/validators/overview) for a summary of what each category checks. ## Severity Levels * **error** - Must be fixed. Causes non-zero exit code. * **warning** - Should be fixed. Does not affect exit code. * **info** - Informational suggestion. ## Auto-fixable Rules Some rules support automatic fixing: ```bash claudelint check-all --fix ``` ## See Also * [Validators Overview](/validators/overview) - How validators work * [Configuration](/guide/configuration) - Customize rule severity * [Custom Rules](/development/custom-rules) - Write your own rules * [CLI Reference](/guide/cli-reference) - All CLI commands and flags --- --- url: /rules/claude-md/claude-md-content-too-many-sections.md description: CLAUDE.md has too many sections making it hard to navigate --- # claude-md-content-too-many-sections ## Rule Details Large CLAUDE.md files with many sections become difficult for both humans and Claude Code to navigate. When the number of markdown headings exceeds the configured threshold (default: 40), this rule warns that the file should be reorganized. The recommended approach is to split content into topic-specific files under `.claude/rules/` and use `@import` directives to include them. This keeps each file focused and easier to maintain. The rule only checks top-level CLAUDE.md files, not files already in the `.claude/rules/` directory. ### Incorrect A CLAUDE.md with too many sections (over 40 headings) ```markdown # Project Instructions ## Git Workflow ... ## Code Style ... ## Testing ... ## API Guidelines ... ## Database ... ## Auth ... ## Logging ... ## Error Handling ... ## Deployment ... ## Monitoring ... ## Security ... ## Performance ... ## Accessibility ... ## i18n ... ## CI/CD ... ## Docker ... ## Kubernetes ... ## AWS ... ## Terraform ... ## Documentation ... ## Reviews ... ``` ### Correct A CLAUDE.md that imports topic-specific rule files ```markdown # Project Instructions ## Overview Brief project description. @import .claude/rules/git.md @import .claude/rules/code-style.md @import .claude/rules/testing.md @import .claude/rules/deployment.md ``` ## How To Fix Split the CLAUDE.md file into smaller, topic-specific files in the `.claude/rules/` directory. Use `@import` directives in the main CLAUDE.md to include them. For example, move git-related instructions to `.claude/rules/git.md` and testing guidelines to `.claude/rules/testing.md`. ## Options Default options: ```json { "maxSections": 40 } ``` Allow up to 30 sections before warning: ```json { "maxSections": 30 } ``` Strict mode: warn after 10 sections: ```json { "maxSections": 10 } ``` ## When Not To Use It Disable this rule if your project intentionally maintains a single large CLAUDE.md file and the team finds the flat structure easier to manage. ## Related Rules * [`claude-md-import-missing`](/rules/claude-md/claude-md-import-missing) * [`claude-md-size`](/rules/claude-md/claude-md-size) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-content-too-many-sections.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-content-too-many-sections.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-file-not-found.md description: Specified CLAUDE.md file path does not exist --- # claude-md-file-not-found ## Rule Details This rule verifies that the CLAUDE.md file targeted for linting actually exists on disk. Without a CLAUDE.md file, Claude Code has no project-level instructions to load, which means the AI assistant operates without any custom guidance. This is the most fundamental check: if the file is missing, no other rules can run against it. ### Incorrect Running claudelint when CLAUDE.md does not exist ```text $ claudelint Error: File not found: /path/to/project/CLAUDE.md ``` ### Correct A project with a CLAUDE.md file present at the root ```markdown # CLAUDE.md Project instructions for Claude Code. ``` ## How To Fix Create a CLAUDE.md file at the project root (or at the path specified in your configuration). Add project-specific instructions that guide Claude Code behavior. ## Options This rule does not have any configuration options. ## When Not To Use It Disable this rule only if you are intentionally running claudelint against a path that may not yet have a CLAUDE.md file, such as during project scaffolding. ## Related Rules * [`claude-md-import-missing`](/rules/claude-md/claude-md-import-missing) * [`claude-md-file-reference-invalid`](/rules/claude-md/claude-md-file-reference-invalid) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-file-not-found.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-file-not-found.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-file-reference-invalid.md description: File path referenced in CLAUDE.md does not exist --- # claude-md-file-reference-invalid ## Rule Details CLAUDE.md files often reference project files using inline code (backticks) or in bash code blocks. When these file paths point to files that do not exist, the instructions become misleading -- Claude Code may attempt to read or modify non-existent files. This rule extracts file-like paths from inline code and bash/shell code blocks, resolves them relative to the CLAUDE.md location, and verifies they exist on disk. It intelligently skips URLs, glob patterns, template variables, version strings, and common non-path patterns to minimize false positives. ### Incorrect Inline code referencing a file that does not exist ```markdown # Project Setup Configuration is in `src/config/settigns.ts` (check for typos). ``` Bash code block referencing a non-existent script ````markdown # Testing ```bash ./scripts/run-tets.sh ``` ```` ### Correct Inline code referencing a file that exists ```markdown # Project Setup Configuration is in `src/config/settings.ts`. ``` Bash code block referencing an existing script ````markdown # Testing ```bash ./scripts/run-tests.sh ``` ```` ## How To Fix Verify the file path is correct. Check for typos in the filename or directory. If the file was moved or renamed, update the reference to match the new location. If the file was intentionally deleted, remove the reference from CLAUDE.md. ## Options This rule does not have any configuration options. ## When Not To Use It Disable this rule if your CLAUDE.md intentionally references files that will be generated later (e.g., build outputs) or if you reference example paths that are illustrative rather than literal. ## Related Rules * [`claude-md-file-not-found`](/rules/claude-md/claude-md-file-not-found) * [`claude-md-npm-script-not-found`](/rules/claude-md/claude-md-npm-script-not-found) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-file-reference-invalid.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-file-reference-invalid.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-filename-case-sensitive.md description: >- Filename differs only in case from another file, causing conflicts on case-insensitive filesystems --- # claude-md-filename-case-sensitive ## Rule Details On case-insensitive filesystems like macOS (HFS+/APFS) and Windows (NTFS), files named `Rules.md` and `rules.md` resolve to the same file. However, on Linux (ext4), they are distinct files. When a CLAUDE.md import tree contains paths that differ only in case, the project will behave differently depending on the operating system. This rule recursively walks the import tree and tracks all resolved paths in a case-insensitive map. If two imports resolve to paths that differ only in case, an error is reported. ### Incorrect Two imports that differ only in case ```markdown # CLAUDE.md @import .claude/rules/Git-Workflow.md @import .claude/rules/git-workflow.md ``` ### Correct Imports with consistent, unique casing ```markdown # CLAUDE.md @import .claude/rules/git-workflow.md @import .claude/rules/code-style.md ``` ## How To Fix Rename one of the conflicting files so the names are distinct even when compared case-insensitively. Use a consistent naming convention (e.g., all lowercase with hyphens) for all imported files. ## Options This rule does not have any configuration options. ## When Not To Use It Disable this rule only if your project exclusively targets Linux and you intentionally maintain files that differ only in case. This is rare and generally discouraged. ## Related Rules * [`claude-md-import-missing`](/rules/claude-md/claude-md-import-missing) * [`claude-md-import-circular`](/rules/claude-md/claude-md-import-circular) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-filename-case-sensitive.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-filename-case-sensitive.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-glob-pattern-backslash.md description: Path pattern uses backslashes instead of forward slashes --- # claude-md-glob-pattern-backslash ## Rule Details Files in `.claude/rules/` can include YAML frontmatter with a `paths` field that specifies glob patterns for when the rule should apply. Glob patterns should always use forward slashes (`/`) as path separators, even on Windows. Backslashes (`\`) are treated as escape characters by most glob implementations and will not match paths correctly on macOS or Linux. This rule inspects the `paths` array in frontmatter and reports any pattern that contains a backslash. ### Incorrect Frontmatter path pattern using backslashes ```markdown --- paths: - src\components\**\*.tsx --- Component guidelines here. ``` ### Correct Frontmatter path pattern using forward slashes ```markdown --- paths: - src/components/**/*.tsx --- Component guidelines here. ``` ## How To Fix Replace all backslashes (`\`) with forward slashes (`/`) in the `paths` array of your rule file frontmatter. Forward slashes work correctly on all operating systems. ## Options This rule does not have any configuration options. ## When Not To Use It There is no reason to disable this rule. Backslashes in glob patterns are always incorrect. ## Related Rules * [`claude-md-glob-pattern-too-broad`](/rules/claude-md/claude-md-glob-pattern-too-broad) * [`claude-md-paths`](/rules/claude-md/claude-md-paths) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-glob-pattern-backslash.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-glob-pattern-backslash.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-glob-pattern-too-broad.md description: Path pattern is overly broad --- # claude-md-glob-pattern-too-broad ## Rule Details Files in `.claude/rules/` include YAML frontmatter with a `paths` field that controls which files the rule applies to. Using `**` or `*` as a path pattern matches every file in the project, which is almost never the intended behavior for a scoped rule. Overly broad patterns defeat the purpose of file-scoped rules and can cause Claude Code to apply guidelines in contexts where they are not relevant. This rule flags bare `**` and `*` patterns and suggests more specific alternatives. ### Incorrect Frontmatter with a catch-all glob pattern ```markdown --- paths: - "**" --- These guidelines apply to React components. ``` Frontmatter with a single-star catch-all ```markdown --- paths: - "*" --- TypeScript coding standards. ``` ### Correct Frontmatter with a specific glob pattern ```markdown --- paths: - src/components/**/*.tsx --- These guidelines apply to React components. ``` ## How To Fix Replace the broad pattern with a more specific glob that targets the files the rule should apply to. For example, use `src/**/*.ts` for all TypeScript files or `src/components/**/*.tsx` for React components. ## Options This rule does not have any configuration options. ## When Not To Use It Disable this rule if you intentionally want a rule file to apply to every file in the project. In that case, consider placing the content in the main CLAUDE.md instead. ## Related Rules * [`claude-md-glob-pattern-backslash`](/rules/claude-md/claude-md-glob-pattern-backslash) * [`claude-md-paths`](/rules/claude-md/claude-md-paths) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-glob-pattern-too-broad.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-glob-pattern-too-broad.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-import-circular.md description: Circular import detected between Claude.md files --- # claude-md-import-circular ## Rule Details When CLAUDE.md files use `@import` directives to include other files, it is possible to create circular dependencies where file A imports file B, which imports file A again. This would cause infinite recursion during import resolution. This rule walks the full import tree, tracking each file in the chain. If a file appears twice in the same import path, a circular dependency is reported. The rule also detects self-imports where a file imports itself. ### Incorrect File A imports file B, which imports file A (circular) ```markdown # .claude/rules/api.md API guidelines. @import .claude/rules/auth.md # .claude/rules/auth.md Auth guidelines. @import .claude/rules/api.md ``` A file that imports itself ```markdown # .claude/rules/style.md Style guidelines. @import .claude/rules/style.md ``` ### Correct A linear import chain with no cycles ```markdown # CLAUDE.md @import .claude/rules/api.md @import .claude/rules/auth.md ``` ## How To Fix Remove the import that creates the cycle. Reorganize shared content into a separate file that both files can import independently, or merge the circularly dependent files into a single file. ## Options This rule does not have any configuration options. ## When Not To Use It There is no reason to disable this rule. Circular imports always indicate a structural problem that should be resolved. ## Related Rules * [`claude-md-import-missing`](/rules/claude-md/claude-md-import-missing) * [`claude-md-import-depth-exceeded`](/rules/claude-md/claude-md-import-depth-exceeded) * [`claude-md-import-read-failed`](/rules/claude-md/claude-md-import-read-failed) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-import-circular.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-import-circular.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-import-depth-exceeded.md description: Import depth exceeds maximum, possible circular import --- # claude-md-import-depth-exceeded ## Rule Details Deeply nested import chains make CLAUDE.md configurations difficult to understand and may indicate accidental circular dependencies that the circular-import rule has not yet caught. This rule tracks the depth of the import tree as it recursively resolves `@import` directives. When the depth exceeds the configured maximum (default: 5), an error is reported. A depth of 5 means file A imports B, which imports C, which imports D, which imports E, which imports F -- at that point the nesting is flagged. ### Incorrect An import chain that is too deep (depth > 5) ```markdown # CLAUDE.md @import .claude/rules/a.md # a.md imports b.md, b.md imports c.md, # c.md imports d.md, d.md imports e.md, # e.md imports f.md -- depth 6 exceeds the limit ``` ### Correct A flat import structure with minimal nesting ```markdown # CLAUDE.md @import .claude/rules/git.md @import .claude/rules/testing.md @import .claude/rules/api.md ``` ## How To Fix Flatten the import hierarchy by importing files directly from the main CLAUDE.md instead of chaining imports through intermediate files. If files genuinely need to share content, extract the shared content into a common file imported by both. ## Options Default options: ```json { "maxDepth": 5 } ``` Allow deeper nesting up to 10 levels: ```json { "maxDepth": 10 } ``` Strict mode: limit to 3 levels of nesting: ```json { "maxDepth": 3 } ``` ## When Not To Use It Disable this rule only if your project has a legitimate reason for deeply nested imports, such as a multi-team monorepo with layered configuration. ## Related Rules * [`claude-md-import-circular`](/rules/claude-md/claude-md-import-circular) * [`claude-md-import-missing`](/rules/claude-md/claude-md-import-missing) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-import-depth-exceeded.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-import-depth-exceeded.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-import-in-code-block.md description: Import statement found inside code block --- # claude-md-import-in-code-block ## Rule Details Claude Code processes `@import` directives to include content from other files. However, when an `@import` appears inside a fenced code block (\`\`\` or ~~~), it is treated as literal text and will not be resolved. This is almost always a mistake -- the author intended the import to be active but accidentally placed it inside a code fence. This rule scans for `@` references inside code blocks and reports them so the import can be moved outside the fence. ### Incorrect An @import inside a fenced code block (will not be processed) ````markdown # CLAUDE.md ```markdown @import .claude/rules/testing.md ``` ```` ### Correct An @import outside of code blocks (will be processed) ```markdown # CLAUDE.md @import .claude/rules/testing.md ``` Documenting import syntax in a code block with explanatory text ````markdown # CLAUDE.md @import .claude/rules/testing.md Import syntax example: ```text # This is just documentation, not an active import ``` ```` ## How To Fix Move the `@import` directive outside of the code block. If the import is inside a code block as documentation or an example, this is a false positive and the warning can be ignored. ## Options This rule does not have any configuration options. ## When Not To Use It Disable this rule if your CLAUDE.md includes code block examples that intentionally show import syntax for documentation purposes. ## Related Rules * [`claude-md-import-missing`](/rules/claude-md/claude-md-import-missing) * [`claude-md-import-circular`](/rules/claude-md/claude-md-import-circular) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-import-in-code-block.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-import-in-code-block.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-import-missing.md description: Imported file does not exist --- # claude-md-import-missing ## Rule Details When a CLAUDE.md file uses `@import` to include another file, the referenced file must exist on disk. A missing import means Claude Code will silently skip the content, leading to incomplete instructions being loaded. This rule resolves each import path relative to the importing file and verifies the target exists. Common causes include typos in the path, renamed files, or files that were deleted but not removed from imports. ### Incorrect An @import referencing a file that does not exist ```markdown # CLAUDE.md @import .claude/rules/coding-standarts.md ``` ### Correct An @import referencing a file that exists on disk ```markdown # CLAUDE.md @import .claude/rules/coding-standards.md ``` ## How To Fix Verify the import path is correct and the target file exists. Check for typos in the filename or directory. If the file was moved or renamed, update the `@import` path to match. If the file was intentionally deleted, remove the `@import` directive. ## Options This rule does not have any configuration options. ## When Not To Use It There is no reason to disable this rule. Broken imports always indicate a problem that should be resolved. ## Related Rules * [`claude-md-import-circular`](/rules/claude-md/claude-md-import-circular) * [`claude-md-import-read-failed`](/rules/claude-md/claude-md-import-read-failed) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-import-missing.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-import-missing.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-import-read-failed.md description: Failed to read imported file --- # claude-md-import-read-failed ## Rule Details This rule complements `claude-md-import-missing` by catching a different failure mode: the imported file exists on disk, but reading its contents fails. Common causes include insufficient file permissions, the file being a directory instead of a regular file, binary files that cannot be read as text, or filesystem-level errors. The rule first confirms the file exists (deferring to `claude-md-import-missing` otherwise), then attempts to read it and reports any errors encountered. ### Incorrect Importing a file that exists but is not readable ```markdown # CLAUDE.md @import .claude/rules/secrets.md # Where secrets.md has permissions set to 000 (no read access) ``` ### Correct Importing a file that exists and is readable ```markdown # CLAUDE.md @import .claude/rules/coding-standards.md ``` ## How To Fix Check the file permissions with `ls -la` and ensure the file is readable. If the file is a binary file, it should not be imported into CLAUDE.md. Verify the path does not point to a directory. ## Options This rule does not have any configuration options. ## When Not To Use It There is no reason to disable this rule. An unreadable import always indicates a problem that needs to be fixed. ## Related Rules * [`claude-md-import-missing`](/rules/claude-md/claude-md-import-missing) * [`claude-md-import-circular`](/rules/claude-md/claude-md-import-circular) ## Resources * [Rule Implementation](https://github.com/pdugan20/claudelint/blob/main/src/rules/claude-md/claude-md-import-read-failed.ts) * [Rule Tests](https://github.com/pdugan20/claudelint/blob/main/tests/rules/claude-md/claude-md-import-read-failed.test.ts) ## Version Available since: v0.2.0 --- --- url: /rules/claude-md/claude-md-npm-script-not-found.md description: npm run script referenced in CLAUDE.md does not exist in package.json --- # claude-md-npm-script-not-found ## Rule Details CLAUDE.md files frequently instruct Claude Code to run npm scripts for testing, linting, or building. If a referenced script does not exist in the nearest `package.json`, Claude Code will fail when attempting to run it. This rule extracts all `npm run