Monorepo Support
claudelint provides full support for monorepo projects with workspace detection and configuration inheritance.
File Discovery
claudelint recursively discovers files throughout your project tree, matching how Claude Code itself discovers CLAUDE.md files in monorepos:
| File Type | Discovery Pattern | Recursive? |
|---|---|---|
CLAUDE.md | **/CLAUDE.md | Yes |
CLAUDE.local.md | **/CLAUDE.local.md | Yes |
| Rules | .claude/rules/**/*.md | Yes (within .claude/rules/) |
| Skills | **/.claude/skills/*/SKILL.md | Yes |
| Settings | .claude/settings.json | Root only |
| Hooks | .claude/hooks/hooks.json | Root only |
| MCP | .mcp.json | Root only |
| Agents | .claude/agents/*/AGENT.md | Root only |
This means CLAUDE.md files in subdirectories (e.g., packages/api/CLAUDE.md, src/CLAUDE.md) are automatically found and validated. Skills in nested .claude/skills/ directories are also discovered, matching Claude Code's on-demand subdirectory skill loading.
Quick Start
1. Config Inheritance
Share configuration across packages using the extends field:
{
"extends": "./base-config.json",
"rules": {
"claude-md-size": "warn"
}
}2. Workspace Validation
Validate specific packages or all packages in your monorepo:
claudelint check-all --workspace my-package
claudelint check-all --workspacesConfiguration Inheritance
Basic Usage
Create a base configuration that child packages can extend:
{
"extends": "../.claudelintrc.json",
"rules": {
"skill-missing-version": "error"
}
}Supported Formats
Relative paths:
{
"extends": "../../.claudelintrc.json"
}Node modules packages:
{
"extends": "claudelint-config-standard"
}{
"extends": "@company/claudelint-config"
}Multiple extends:
{
"extends": ["./base.json", "./strict.json"]
}Merge Behavior
When extending configs, claudelint merges configurations in this order:
- Base config (first in extends array)
- Additional extended configs (in order)
- Current config (overrides everything)
Each field type merges differently:
| Field | Strategy |
|---|---|
rules | Deep merged (child can override specific rules) |
overrides | Arrays concatenated (all overrides apply) |
ignorePatterns | Arrays concatenated and deduplicated |
output | Child completely replaces parent |
| Scalars | Child value wins |
Example Monorepo Structure
monorepo/
├── CLAUDE.md # Root project context
├── .claudelintrc.json # Root config
├── pnpm-workspace.yaml
├── packages/
│ ├── app-1/
│ │ ├── CLAUDE.md # Package-specific context
│ │ └── .claudelintrc.json # Extends root
│ └── app-2/
│ ├── CLAUDE.md # Package-specific context
│ └── .claudelintrc.json # Extends root
└── libs/
└── shared/
├── CLAUDE.md # Package-specific context
└── .claudelintrc.json # Extends root{
"rules": {
"claude-md-size": "warn",
"skill-missing-version": "error"
},
"ignorePatterns": [
"node_modules/**",
"dist/**"
]
}{
"extends": "../../.claudelintrc.json"
}{
"extends": "../../.claudelintrc.json",
"rules": {
"claude-md-size": "warn"
}
}Workspace Detection
claudelint automatically detects monorepo workspaces from:
- pnpm-workspace.yaml (pnpm)
- package.json workspaces field (npm/Yarn)
Supported Package Managers
packages:
- 'packages/*'
- 'apps/*'{
"workspaces": [
"packages/*",
"apps/*"
]
}{
"workspaces": {
"packages": [
"packages/*",
"apps/*"
]
}
}CLI Flags
Validate specific package:
claudelint check-all --workspace my-packageThis finds the workspace package with directory name my-package and runs validation only for that package.
Validate all packages:
claudelint check-all --workspacesThis runs validation for every package in the workspace and aggregates results.
Output:
Validating 3 workspace packages
=== Package: app-1 ===
Checked 4 files across 3 categories (claude-md, settings, hooks) in 32ms. No problems found.
=== Package: app-2 ===
claude-md (28ms)
src/CLAUDE.md (1 error)
0 error File exceeds 40KB limit (66669 bytes) claude-md-size
Checked 3 files across 2 categories (claude-md, skills) in 28ms.
1 problem (1 error, 0 warnings)
=== Package: shared ===
Checked 2 files across 2 categories (claude-md, settings) in 18ms. No problems found.
=== Workspace Summary ===
Total packages: 3
Failed packages: 1
Total errors: 1
Total warnings: 0The summary line for each package shows exactly which categories were validated and how many files were checked, giving you visibility into coverage across the monorepo.
Troubleshooting
No workspace detected
Error: No workspace detected in current directory.
Workspace detection supports pnpm-workspace.yaml and package.json workspaces.
Please run this command from a monorepo root directory.Solution: Run the command from your monorepo root (where pnpm-workspace.yaml or package.json with workspaces field exists).
Package not found
Error: Workspace package not found: my-pkg
Available packages:
- app-1
- app-2
- sharedSolution: Use the exact directory name of the package (shown in "Available packages" list).
Extended config not found
Error: Extended config not found: ./base.json
Resolved to: /path/to/base.json
Referenced from: /path/to/dirSolution: Check that the relative path is correct and the file exists.
Circular dependency
Error: Circular dependency detected in config extends:
1. /path/to/a.json
2. /path/to/b.json
3. /path/to/a.jsonSolution: Remove the circular reference from your config extends chain.
Migration Guide
Upgrading existing monorepos:
packages/
├── app-1/.claudelintrc.json (full config)
├── app-2/.claudelintrc.json (full config)
└── shared/.claudelintrc.json (full config).claudelintrc.json (shared rules)
packages/
├── app-1/.claudelintrc.json (extends root)
├── app-2/.claudelintrc.json (extends root)
└── shared/.claudelintrc.json (extends root)Steps:
Create root .claudelintrc.json with common rules
Update package configs to extend root:
json{ "extends": "../../.claudelintrc.json" }Keep only package-specific overrides in child configs
Test with
claudelint check-all --workspaces
Backward compatibility: All existing configs continue to work without changes. The extends field is optional, workspaces are auto-detected, and there are no breaking changes to existing functionality.
Best Practices
- Keep root config minimal - only shared rules
- Use extends for consistency - avoid duplicating rules
- Override sparingly - only when packages truly differ
- Test with --workspaces - catch issues across all packages
- Version shared configs - treat them like dependencies
- Document overrides - explain why packages differ