Skip to content

CLI Reference

Complete reference for all claudelint commands, options, and usage patterns.

Table of Contents

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:

OptionDescriptionDefault
--cwd <path>Run as if claudelint was started in this directoryCurrent directory
-v, --verboseShow detailed output including skipped validators and timingfalse
-q, --quietSuppress warnings, show only errorsfalse
--format <format>Output format: stylish, json, compact, sarif, or githubstylish
--config <path>Path to custom config fileAuto-detect
--no-configDisable configuration file loading-
--preset <name>Built-in preset when no config file: recommended, strict, or allrecommended
--strictExit with error on any issues (errors, warnings, or info)false
--max-warnings <number>Fail if warning count exceeds this limitUnlimited
--no-collapseShow all issues without collapsing repeated rulesfalse
--warnings-as-errorsTreat all warnings as errorsfalse
--explainShow Why: and Fix: lines under each issue (Tier 2 progressive disclosure)false
--fixAutomatically fix problemsfalse
--fix-dry-runPreview fixes without applying themfalse
--fix-type <type>Fix errors, warnings, or allall
--cacheEnable validation cachingtrue
--no-cacheDisable validation caching-
--cache-location <path>Cache directory location.claudelint-cache
--colorForce color outputAuto-detect
--no-colorDisable color output-
--debug-configShow configuration loading debug infofalse
--show-docs-urlShow documentation URLs for rulesfalse
--fastFast mode: skip expensive checksfalse
--no-deprecated-warningsSuppress warnings about deprecated rulesfalse
--error-on-deprecatedTreat usage of deprecated rules as errorsfalse
--timingShow per-validator timing breakdownfalse
--allow-empty-inputExit 0 when no files are found to checkfalse
-o, --output-file <path>Write results to file (in addition to stdout)-
--ignore-pattern <pattern>Additional pattern to ignore (repeatable)-
--no-ignoreDisable ignore file and pattern processingfalse
--rule <rule:severity>Override rule severity from CLI (repeatable)-
--cache-strategy <strategy>Cache invalidation strategy: metadata or contentmetadata
--changedOnly check files with uncommitted git changesfalse
--since <ref>Only check files changed since a git ref (branch, tag, or SHA)-
--statsInclude per-rule statistics in outputfalse
--stdinRead input from stdin instead of filesfalse
--stdin-filename <path>Provide filename context for stdin input (e.g., CLAUDE.md)-
--workspace <name>Validate specific workspace package by name-
--workspacesValidate all workspace packagesfalse

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 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:

OptionDescription
-y, --yesUse default configuration without prompts (non-interactive mode)
--forceOverwrite existing configuration files
--hooksCreate a SessionStart validation hook for Claude Code
--preset <name>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

Display the resolved configuration that claudelint is using. Useful for debugging config file loading and cascading.

Usage:

bash
claudelint print-config [options]

Options:

OptionDescriptionDefault
--format <format>Output format: json or tablejson
--config <path>Path to config file to printAuto-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 <file> [options]

Arguments:

  • <file> - Path to the file to resolve config for

Options:

OptionDescriptionDefault
--format <format>Output format: json or tablejson
--config <path>Path to config fileAuto-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:

OptionDescriptionDefault
--config <path>Path to config file to validateAuto-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:

OptionDescriptionDefault
--category <category>Filter by category: CLAUDE.md, Skills, Settings, Hooks, MCP, PluginAll
--fixableShow only rules that support auto-fixfalse
--format <format>Output format: table or jsontable

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 <rule-id>

Arguments:

  • <rule-id> - 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:

TierCommandWhat it shows
1claudelint check-allProblem + rule ID (table format)
2claudelint check-all --explainWhy: + Fix: lines per issue
3claudelint explain <rule-id>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:

OptionDescriptionDefault
--config <path>Path to config fileAuto-detect
--format <format>Output format: table or jsontable

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:

OptionDescriptionDefault
--config <path>Path to config fileAuto-detect
--dry-runPreview changes without writing to filefalse
--format <format>Output format: table or jsontable

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:

OptionDescriptionDefault
--cache-location <path>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-<type> [options]

Shared Options (available on all validators):

OptionDescriptionDefault
--path <path>Custom path to the target file or directoryAuto-detect
-v, --verboseVerbose outputfalse
--warnings-as-errorsTreat warnings as errorsfalse
-c, --config <path>Path to configuration fileAuto-detect
--no-configDisable configuration file loading-
--max-warnings <number>Fail if warning count exceeds this limitUnlimited
--no-collapseShow all issues without collapsing repeated rulesfalse

Available validators:

CommandValidates
validate-claude-mdCLAUDE.md files (supports --explain)
validate-skillsSkill structure and frontmatter (supports --skill <name>)
validate-agentsAgent structure and frontmatter
validate-hookshooks.json files
validate-mcpMCP server configuration
validate-settingssettings.json files
validate-pluginPlugin manifest files
validate-lspLSP configuration
validate-output-stylesOutput style structure and frontmatter
validate-commandsDeprecated 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:

OptionDescriptionDefault
--checkCheck formatting without making changesfalse
--fixApply formatting fixestrue
--fix-dry-runPreview what would be fixed without writingfalse
-v, --verboseShow detailed output per filefalse

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 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:

OptionDescriptionDefault
-v, --verboseVerbose outputfalse
--warnings-as-errorsTreat warnings as errorsfalse
-c, --config <path>Path to configuration fileAuto-detect
--no-configDisable configuration file loading-
--debounce <ms>Debounce interval in milliseconds300

File triggers:

Changes to specific files trigger only the relevant validator:

File PatternValidator Triggered
CLAUDE.mdCLAUDE.md validator
SKILL.md, *.shSkills validator
settings.jsonSettings validator
hooks.jsonHooks validator
.mcp.jsonMCP validator
plugin.jsonPlugin 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 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

VariableDescription
NO_COLORDisable color output (respected per no-color.org standard)
FORCE_COLORForce color output even when not a TTY
CISuppress update notifications when running in CI environments
NO_UPDATE_NOTIFIERSuppress 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 CodeMeaningWhen It Happens
0SuccessNo issues found, all checks passed
1Issues foundErrors or warnings detected (depending on flags)
2Fatal errorInvalid config, command failure, or internal error
130InterruptedProcess 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