Catch CLAUDE.md drift before Claude misbehaves. A fast linter for the configuration files Claude Code actually reads โ CLAUDE.md, skills, subagents, and hooks โ so silent context bugs stop costing you sessions.
- Stale or invalid model IDs in subagents (e.g.
claude-3-5-sonnetflagged as deprecated;claude-opus-4-7recognized) - Unresolved
@pathimports and circular import chains - Dangerous bash in code blocks (
rm -rf /,curl | bash, fork bombs) - Duplicate content across parent / sibling CLAUDE.md files in monorepos
- Skill / subagent / hook structural errors before Claude Code loads them
- Vague instructions ("follow best practices") that degrade model adherence
- Built for Claude Code โ knows the spec, not just markdown syntax
- Fast โ TypeScript + Vitest, lints in milliseconds
- Extensible โ plugin API for custom rules
- CI-ready โ GitHub Action, JSON output, exit codes
- Auto-fix โ
--fixand interactive-imodes for common issues
npm install -g @felixgeelhaar/cclintnpm install --save-dev @felixgeelhaar/cclintnpx @felixgeelhaar/cclint lint your-claude.md# Lint a CLAUDE.md file
cclint lint CLAUDE.md
# Lint with JSON output
cclint lint CLAUDE.md --format json
# Set custom file size limit
cclint lint CLAUDE.md --max-size 5000๐ Linting results for CLAUDE.md:
โ error: Missing required section: "Development Commands" at 1:1 [structure]
โ ๏ธ warning: File size (12,543 characters) exceeds maximum allowed size (10,000 characters) at 1:1 [file-size]
โ ๏ธ warning: Missing required content: TypeScript usage (expected: "TypeScript") at 1:1 [content]
Summary: 1 errors, 2 warnings
Validates Anthropic's @path/to/file import syntax for CLAUDE.md files.
- Checks:
- Import syntax outside code blocks/spans
- Path format validation (relative, absolute,
~/) - Duplicate import detection
- Max depth violations (5 hops)
- Severity: Mixed (errors for syntax, warnings for patterns)
- Enabled: By default
Validates content quality and structure following Anthropic best practices.
- Checks:
- Heading hierarchy (h1 โ h2 โ h3, no skipping)
- Bullet point usage for organization
- Vague language detection ("properly" โ specific instructions)
- Emphasis markers (IMPORTANT, YOU MUST)
- Specificity (measurements, tool names)
- Severity: Info (suggestions for improvement)
- Purpose: Ensures clear, actionable instructions
Validates file placement and naming conventions.
- Checks:
- CLAUDE.local.md deprecation warnings
- File naming (CLAUDE.md required)
- Location recommendations (user vs project)
- Git awareness (.gitignore suggestions)
- Severity: Mixed (errors for naming, warnings/info for recommendations)
- Enabled: By default
Validates that imports resolve to existing files and detects circular dependencies.
- Checks:
- File existence validation for all @path imports
- Circular dependency detection (A โ B โ A)
- Recursive depth limit enforcement (5 hops max)
- Path resolution (relative, absolute, home directory)
- Severity: Error for missing files and cycles
- Enabled: By default
Ensures content is specific, actionable, and belongs in CLAUDE.md.
- Checks:
- Generic instructions detection ("follow best practices")
- File size recommendations (~5KB limit)
- Content placement (README vs CLAUDE.md)
- Section size optimization
- Actionable vs passive language
- Severity: Warning for size, Info for suggestions
- Enabled: By default
Validates CLAUDE.md file relationships in monorepos.
- Checks:
- Parent/child CLAUDE.md conflict detection
- Duplicate content across hierarchy
- Organization recommendations for multi-package repos
- Import-based consolidation suggestions
- Severity: Warning for conflicts, Info for guidance
- Enabled: By default
Validates bash command safety in code blocks.
- Checks:
- Dangerous commands (
rm -rf /,curl | bash, fork bombs) - Error handling (
set -e,|| exit 1) - Variable quoting in destructive operations
- Unsafe
sudousage warnings
- Dangerous commands (
- Severity: Error for dangerous commands, Warning for safety issues
- Enabled: By default
Validates Claude Code skill files (.claude/skills/*.md).
- Checks:
- Frontmatter presence and validity
- Name format (kebab-case required)
- Description length (10-200 characters)
- Content structure after frontmatter
- Severity: Error for missing required fields, Warning for style issues
- Enabled: By default
Validates Claude Code subagent files (.claude/agents/*.md).
- Checks:
- Frontmatter presence with name and description
- Valid tool names (Read, Edit, Bash, Glob, etc.)
- Valid model identifiers (claude-3-5-sonnet, opus, haiku, etc.)
- Prompt content presence and minimum length
- Severity: Error for missing required fields, Warning for invalid tools/models
- Enabled: By default
Validates Claude Code hook configuration (.claude/settings.json).
- Checks:
- Valid JSON syntax
- Hook structure (matcher and command fields)
- Dangerous command detection (
rm -rf,curl | sh, fork bombs) - Command safety (warnings for
&&withoutset -e)
- Severity: Error for JSON/structure issues, Warning for dangerous commands
- Enabled: By default
Validates that CLAUDE.md files don't exceed size limits for optimal performance.
- Default: 10,000 characters
- Severity: Warning
- Configurable:
--max-size <number>
Ensures required sections are present in CLAUDE.md files.
- Required Sections:
- "Project Overview"
- "Development Commands"
- "Architecture"
- Severity: Error
- Purpose: Maintains consistent documentation structure
Note: This rule is deprecated in v0.5.0. Use
content-organizationinstead.
Technology-specific content validation (deprecated in favor of content-organization).
- Status: Maintained for backward compatibility
- Migration: Switch to
content-organizationrule
Validates Markdown syntax and formatting best practices.
- Checks:
- Header spacing (
# Headernot#Header) - Trailing whitespace
- Consecutive empty lines (max 2)
- Code block formatting
- File ending with newline
- Header spacing (
- Severity: Mixed (errors for syntax, warnings for style)
Validates fenced code blocks inside CLAUDE.md.
- Checks:
- Language tag present (
```bashnot bare```) - Matched fence delimiters
- Indentation consistency inside the block
- Language tag present (
- Severity: Warning
- Fixable: Yes โ
--fixcan add missing language tags - Why: Untyped code blocks degrade Claude's ability to parse intent and surface bash code blocks for the
command-safetyrule.
Run cclint inside any MCP-compatible client (Claude Desktop, Claude Code, Cursor) โ no global install required. Add to your MCP config:
{
"mcpServers": {
"cclint": {
"command": "npx",
"args": ["@felixgeelhaar/cclint", "mcp"]
}
}
}Tools exposed:
lint_fileโ lint a file on disklint_stringโ lint inline content (e.g. before saving an edit)list_rulesโ list every cclint ruleexplain_ruleโ get rationale + examples for a rule
Or run as a standalone bin: npx cclint-mcp.
Get plain-language explanations and AI-generated fix suggestions for any violation:
cclint why CLAUDE.md # all violations
cclint why CLAUDE.md --rule command-safety # filter by rule
cclint why CLAUDE.md --line 41 # filter by line
cclint why CLAUDE.md --ai # AI-generated fix (needs ANTHROPIC_API_KEY)Without --ai, prints the rule rationale and good example. With --ai, sends the offending line + rule context to Claude Haiku 4.5 and prints a focused 3โ6 line fix suggestion.
cclint lint [options] <file>
Options:
-f, --format <format> Output format (text, json) (default: "text")
--max-size <size> Maximum file size in characters (default: "10000")
-c, --config <path> Path to configuration file
--fix Automatically fix problems where possible
-h, --help Display help for command
cclint install [options]
Options:
--hooks Install pre-commit git hooks (default: true)
--pre-push Install pre-push quality check hooks (default: true)
-h, --help Display help for command0: No errors (warnings allowed)1: Errors found or execution failed
CC Linter follows a hexagonal architecture with clean separation of concerns:
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ CLI Adapter โ โ VS Code Extensionโ
โ โ โ (Future) โ
โโโโโโโโโโโฌโโโโโโโโ โโโโโโโโโโโฌโโโโโโโโ
โ โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโผโโโโโโโโโโโโ
โ Core Engine โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ Rules Engine โ โ
โ โ - FileSizeRule โ โ
โ โ - StructureRule โ โ
โ โ - ContentRule โ โ
โ โ - FormatRule โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโ
- ContextFile: Represents a CLAUDE.md file with parsing capabilities
- Rule: Interface for validation logic
- Violation: Represents a rule violation with location and severity
- LintingResult: Aggregates all violations for a file
- Node.js 18+
- npm or yarn
# Clone the repository
git clone https://github.com/felixgeelhaar/cclint.git
cd cclint
# Install dependencies
npm install
# Run tests
npm test
# Build the project
npm run build
# Run the linter on itself
npm run dev -- lint CLAUDE.md
# Or after global install
cclint lint CLAUDE.mdnpm test # Run test suite with Vitest
npm run test:watch # Run tests in watch mode
npm run test:coverage # Generate coverage report
npm run typecheck # Type check with TypeScript
npm run lint # Lint source code
npm run build # Build for production
npm run dev # Run development versionCC Linter follows Test-Driven Development (TDD):
- โ 371 tests with comprehensive coverage
- ๐ Vitest for ultra-fast test execution
- ๐ฏ Unit tests for domain logic
- ๐ Integration tests for CLI functionality
- ๐ Coverage reporting for quality assurance
We welcome contributions! Please read our Contributing Guide for details on:
- Code of conduct
- Development process
- Pull request requirements
- Testing guidelines
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with tests
- Run the test suite (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- ๐ Documentation
- ๐ Report Issues
- ๐ฌ Discussions
- ๐ง Email Support
- Consistency: Maintain standardized CLAUDE.md files across projects
- Quality: Catch common issues before they impact AI interactions
- Speed: Fast feedback loop with instant validation
- Integration: Works with CI/CD pipelines and development workflows
- Standards: Enforce documentation standards across repositories
- Onboarding: Help new developers understand project structure
- Maintenance: Keep context files up-to-date and effective
- Automation: Integrate with existing development processes
Create a .cclintrc.json file to customize rules for your project:
{
"rules": {
"file-size": {
"enabled": true,
"severity": "warning",
"options": {
"maxSize": 15000
}
},
"structure": {
"enabled": true,
"options": {
"requiredSections": ["Overview", "Commands", "Architecture"]
}
}
},
"ignore": ["*.backup.md"]
}Automatically fix common formatting issues:
cclint lint CLAUDE.md --fixInstall pre-commit hooks to lint files automatically:
cclint install --hooksInstall pre-push hooks for comprehensive quality checks:
cclint install --pre-pushInstall both hooks:
cclint install --hooks --pre-pushThe pre-push hook runs:
- TypeScript type checking
- ESLint linting
- Prettier formatting check
- Full test suite
Add automated linting to your CI/CD pipeline:
- name: Lint CLAUDE.md
uses: felixgeelhaar/cclint@v0.14.0
with:
files: 'CLAUDE.md'
format: 'text'๐ GitHub Action Guide
Create your own validation rules with the powerful Custom Rules API:
import { CustomRule } from '@felixgeelhaar/cclint';
class MyCustomRule extends CustomRule {
constructor() {
super('my-rule', 'Description of my custom rule');
}
validateInternal(file) {
const violations = [];
// Your validation logic here
return violations;
}
generateFixes(violations, content) {
// Your auto-fix logic here
return [];
}
}
// Plugin export
export default {
name: 'my-plugin',
version: '1.0.0',
rules: [new MyCustomRule()],
};Configuration (.cclintrc.json):
{
"plugins": [
{
"name": "./my-plugin.js",
"enabled": true
}
],
"rules": {
"my-rule": {
"enabled": true,
"severity": "warning"
}
}
}Features:
- ๐ Plugin System: Load custom rules dynamically
- ๐ฏ TypeScript Support: Full type safety and IntelliSense
- ๐ง Auto-fix Integration: Custom rules support automatic fixes
- โ๏ธ Configurable: Enable/disable and configure custom rules
- ๐ Multiple Severities: Error, warning, or info levels
๐ View Example Custom Rules
- VS Code Extension - Real-time linting in your editor
- Custom Rules API - Plugin system for custom validation logic โ
- Enhanced Auto-fix - More intelligent fixes and suggestions โ
- Configuration Files -
.cclintrc.jsonfor project-specific rules โ - Auto-fix Suggestions - Automatic fixes for common issues โ
- Pre-push Quality Hooks - Comprehensive quality checks before push โ
- Git Hooks Integration - Pre-commit validation โ
- GitHub Action - Easy CI/CD integration โ
Made with โค๏ธ by Felix Geelhaar for the Claude AI developer community
โญ Star us on GitHub โข ๐ฆ View on npm โข ๐ Report Bug