From design-docs
Validate CLAUDE.md structure, formatting, and quality. Use when checking context files for compliance, ensuring proper structure, or verifying before commits.
How this skill is triggered — by the user, by Claude, or both
Slash command
/design-docs:context-validateThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Validates CLAUDE.md files for structure, formatting, and quality compliance
Validates CLAUDE.md files for structure, formatting, and quality compliance with Claude Code best practices.
This skill validates LLM context files by:
Extract parameters from the user's request:
Required:
target: Path to CLAUDE.md file, or "all" for all context filesOptional:
strict: Enable strict mode with additional quality checks (default: false)check-refs: Validate design doc references exist (default: true)Examples:
"Validate the root CLAUDE.md"
CLAUDE.md"Validate CLAUDE.md for effect-type-registry"
pkgs/effect-type-registry/CLAUDE.md"Strict validation of all CLAUDE.md files"
allRead .claude/design/design.config.json to understand:
quality.context)Example config:
{
"quality": {
"context": {
"rootMaxLines": 500,
"childMaxLines": 300,
"requireDesignDocPointers": true
}
}
}
Based on target parameter:
Specific file:
# Validate single file
read {file-path}
All files:
# Find all CLAUDE.md files
glob "**/CLAUDE.md" --path="."
Typical locations:
CLAUDE.mdpkgs/*/CLAUDE.mdwebsite/CLAUDE.mdFor each CLAUDE.md file, perform validation checks:
Required Sections (Root CLAUDE.md):
Required Sections (Package CLAUDE.md):
Validation:
Markdown Quality:
Line Length:
Organization:
Project/Package Overview:
Commands Section:
Architecture/Development Notes:
Design Doc References:
If requireDesignDocPointers: true, validate:
@./.claude/design/{module}/{doc}.mdWhen strict: true, perform additional checks:
Conciseness:
Relevance:
Specificity:
Design Doc Integration:
If check-refs: true, validate:
Design Doc References:
@./.claude/design/... referencesFile Path References:
src/foo.ts)Command References:
Run markdown linter:
pnpm lint:md --config './lib/configs/.markdownlint-cli2.jsonc' -- {file-path}
Report any linting errors with line numbers.
Generate validation report:
Report Format:
# CLAUDE.md Validation Report
**Target:** {file-path|all}
**Files Validated:** {count}
**Status:** ✅ PASS / ⚠️ WARNINGS / ❌ FAIL
## Summary
- Errors: {count}
- Warnings: {count}
- Info: {count}
## Issues by File
### {file-path}
**Status:** ✅ PASS / ⚠️ WARNINGS / ❌ FAIL
**Lines:** {count} / {limit}
**Type:** Root / Package
#### Errors
- [Line X] Missing required section: {section}
- [Structure] Heading level skipped (H1 → H3)
- [References] Broken design doc reference: {path}
#### Warnings
- [Line X] Line limit exceeded ({actual} > {limit})
- [Content] Overview is verbose (350 words, recommend <200)
- [References] Design doc not referenced (observability.md exists)
#### Info
- Consider splitting into child CLAUDE.md files
- Add design doc pointer for {topic}
- Update command examples to use latest syntax
## Recommendations
1. {actionable fix recommendation}
2. {actionable fix recommendation}
| Rule | Validation |
|---|---|
| Max lines | 500 (configurable) |
| Required sections | Project Overview, Commands, Architecture, Tooling |
| Design doc refs | Optional but recommended |
| Heading level | Must start with H1 |
| Organization | Logical section order |
| Rule | Validation |
|---|---|
| Max lines | 300 (configurable) |
| Required sections | Package Overview, API/Exports, Development, Testing |
| Design doc refs | Required if design docs exist |
| File paths | Should reference package-relative paths |
| Scope | Package-specific, not general project info |
ERROR: Missing required section: {section}
- Expected: ## {section}
- File type: {Root|Package}
- Fix: Add section following CLAUDE.md template
WARNING: File exceeds line limit
- Limit: {limit} lines
- Actual: {actual} lines
- Overage: {actual - limit} lines
- Fix: Split into child CLAUDE.md files or remove redundant content
ERROR: Referenced design doc does not exist
- Reference: @./.claude/design/{path}
- Fix: Create the design doc or fix the reference path
WARNING: Design doc exists but not referenced in CLAUDE.md
- Design doc: .claude/design/{module}/{doc}.md
- Category: {category}
- Fix: Add reference in relevant section with when-to-load guidance
ERROR: Heading level skipped
- Line: {line}
- Found: H3
- Expected: H2 (after H1)
- Fix: Use proper heading progression (H1 → H2 → H3)
WARNING: Section is verbose
- Section: {section}
- Word count: {count}
- Recommended: <{limit}
- Fix: Make content more concise and imperative
User request:
Validate the root CLAUDE.md
Execution:
Output:
# CLAUDE.md Validation Report
**Target:** CLAUDE.md
**Files Validated:** 1
**Status:** ⚠️ WARNINGS
## Summary
- Errors: 0
- Warnings: 2
- Info: 1
## Issues by File
### CLAUDE.md
**Status:** ⚠️ WARNINGS
**Lines:** 487 / 500
**Type:** Root
#### Errors
None found.
#### Warnings
- [Line 234] Design doc exists but not referenced (performance-observability.md)
- [Content] Commands section verbose (280 words, recommend <150)
#### Info
- Consider adding design doc pointer for build architecture
## Recommendations
1. Add reference to performance-observability.md in relevant section
2. Condense Commands section to focus on essentials
3. Add pointer to build-architecture.md with when-to-load guidance
User request:
Strict validation of pkgs/effect-type-registry/CLAUDE.md
Execution:
Output:
# CLAUDE.md Validation Report
**Target:** pkgs/effect-type-registry/CLAUDE.md
**Files Validated:** 1
**Status:** ❌ FAIL
## Summary
- Errors: 3
- Warnings: 2
- Info: 1
## Issues by File
### pkgs/effect-type-registry/CLAUDE.md
**Status:** ❌ FAIL
**Lines:** 245 / 300
**Type:** Package
#### Errors
- [Line 12] Missing required section: Testing
- [Line 89] Broken design doc reference:
@./.claude/design/effect-type-registry/caching.md
- [Structure] Heading level skipped (H1 → H3 at line 45)
#### Warnings
- [References] Design doc exists but not referenced (observability.md)
- [Content] Package Overview is generic boilerplate
#### Info
- Add when-to-load guidance for design doc references
## Recommendations
1. Add Testing section documenting test strategy
2. Fix broken reference: create caching.md or update reference
3. Fix heading hierarchy at line 45 (use H2 instead of H3)
4. Reference observability.md in Development Notes
5. Customize Package Overview with specific purpose and features
User request:
Validate all CLAUDE.md files
Execution:
Output:
# CLAUDE.md Validation Report
**Target:** all
**Files Validated:** 4
**Status:** ⚠️ WARNINGS
## Summary
- Errors: 1
- Warnings: 5
- Info: 3
## Files by Status
- ✅ PASS: 2 files
- ⚠️ WARNINGS: 1 file
- ❌ FAIL: 1 file
## Issues by File
### CLAUDE.md (Root)
**Status:** ⚠️ WARNINGS
**Lines:** 487 / 500
**Type:** Root
#### Warnings
- [References] 2 design docs not referenced
- [Content] Commands section verbose
### pkgs/effect-type-registry/CLAUDE.md
**Status:** ❌ FAIL
**Lines:** 245 / 300
**Type:** Package
#### Errors
- [Line 12] Missing required section: Testing
### pkgs/rspress-plugin-api-extractor/CLAUDE.md
**Status:** ✅ PASS
**Lines:** 278 / 300
**Type:** Package
No issues found.
### website/CLAUDE.md
**Status:** ✅ PASS
**Lines:** 156 / 300
**Type:** Package
No issues found.
## Recommendations
1. Fix missing Testing section in effect-type-registry/CLAUDE.md
2. Add design doc references to root CLAUDE.md
3. Condense Commands section in root CLAUDE.md
Packages without existing CLAUDE.md:
INFO: No CLAUDE.md found for package
- Package: {package-name}
- Expected location: {path}/CLAUDE.md
- Recommendation: Create CLAUDE.md using package template
Some packages may have CLAUDE.local.md or other child files:
Modules marked as archived in config:
A valid CLAUDE.md file has:
Works well with:
/context-review - Fix issues before validation/context-update - Update files based on validation/context-split - Split overlimit files/design-validate - Ensure referenced design docs are valid/design-review - Check design doc healthCan be integrated into workflows:
# Pre-commit hook
claude code --skill context-validate --args "all"
# CI pipeline
- name: Validate CLAUDE.md files
run: claude code --skill context-validate --args "all --strict"
Exit codes:
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Applies a firm's KYC/AML rules grid to parsed onboarding records: assigns risk rating, checks required documents, outputs rule outcomes with citations, and routes for escalation.
Generates daily or weekly digests of activity from connected sources (chat, email, docs, tasks, CRM), highlighting action items, decisions, mentions, and project updates.
npx claudepluginhub spencerbeggs/bot --plugin design-docs