Splits the 518-line root CLAUDE.md into a 70-line root plus four chained sub-files (skill/, command/, agent/, docs/), all under the 150-line cap, and prunes stale references uncovered by the audit. - CLAUDE.md (518 -> 70): project overview, navigation with @-imports, behavioural guidelines summary, naming reference, license link - skill/CLAUDE.md (85): component flow, Python module architecture, modifying modules, adding templates, tech-stack detection, quality scoring, karpathy skill - command/CLAUDE.md (38): slash command development, top-level .md install layout, skill <-> command integration - agent/CLAUDE.md (70): guardian frontmatter, hook responsibilities, skill <-> agent integration, git triggers - docs/CLAUDE.md (109): install verification, smoke test, manual e2e tests, common operations, release process Stale content removed: - 'Dual Directory Structure' section (claude-md-enhancer/ legacy dir does not exist on disk) - '20-300 lines' / '300-line cap' references rewritten to 150 - '~/.claude/commands/enhance-claude-md/' bundle paths rewritten to top-level '.md' files (matching the new installer layout) - 'Three integrated components' updated to five - 'Current Version: 2.0.0' updated to 2.1.0 - '6 examples' in sample_input.json claim corrected (file has 1 scenario) Each sub-file opens with a markdown back-link and @../CLAUDE.md import; root contains @-imports for all four sub-files. Validator passes (status pass) for every file.
3.9 KiB
Parent context: see the root CLAUDE.md for project-wide guidelines and behavioural rules. Chained import:
@../CLAUDE.md
Skill Development
Guidelines for the claudeforge-skill Python modules and the karpathy-guidelines skill.
Component Interaction Flow
User Project
↓
/enhance-claude-md (Slash Command) → Explore subagent (deep scan)
↓
[Discovery] → [Analysis] → [Task]
↓
claude-md-guardian (Agent) OR Direct Skill Invocation
↓
claudeforge-skill (Python Modules)
↓
workflow.py → analyzer.py → validator.py → template_selector.py → generator.py
↓
CLAUDE.md ≤ 150 lines, chained via `@path` imports
Python Module Architecture
Five modules live under skill/:
workflow.py—InitializationWorkflow: orchestrates interactive setup, detects project type / tech stack / team size / phase / workflows, returns a context dict.analyzer.py—CLAUDEMDAnalyzer: analyses existing files; quality scoring (0–100) across length, completeness, formatting, specificity, modularity.validator.py—BestPracticesValidator: checks file length (hard cap 150, warning at 120), required sections, formatting, anti-patterns.template_selector.py—TemplateSelector: maps project type + team size to a template; all team-size targets are ≤ 150 lines.generator.py—ContentGenerator: writes root + context files, emits@pathchain imports, prepends sub-file back-links, idempotentmerge_with_existing.
Required Output Sections
Every generated CLAUDE.md must contain:
- Project structure (ASCII tree, for projects that need it)
- Setup & installation
- Architecture (for non-trivial projects)
## Behavioral Guidelines(Karpathy summary — inserted automatically)- Cross-check against reference examples in
skill/examples/
Modifying Python Modules
- Edit files in
skill/. - Run the smoke test (see
docs/CLAUDE.md→ Testing & Validation). - Re-install for live testing:
./install.sh(project-level scope). - Test slash command:
/enhance-claude-md. - Validate output against
skill/examples/. - Update
CHANGELOG.md.
Adding Reference Templates
- Add a new file under
skill/examples/. - Follow the native format (project structure, setup, architecture, tech guidelines).
- Update
skill/examples/README.md. - Teach
template_selector.pyhow to detect the new template. - Add a scenario to
skill/sample_input.json.
Quality Scoring (analyzer.py)
calculate_quality_score() breakdown:
- length_appropriateness: 25 pts (50–150 lines ideal; the 150-line hard cap is enforced here)
- section_completeness: 25 pts (required sections present)
- formatting_quality: 20 pts (markdown, heading hierarchy, code blocks)
- content_specificity: 15 pts (project-specific, not generic)
- modular_organization: 15 pts (chained sub-files when needed)
Tech Stack Detection
skill/workflow.py → _detect_tech_stack() reads these signals:
- Frontend — React/Vue/Angular via
package.json; Angular viaangular.json; TypeScript viatsconfig.json. - Backend — Node (
package.json), Python (requirements.txt/pyproject.toml/setup.py), Go (go.mod), Java (pom.xml/build.gradle), Rust (Cargo.toml). - Database — Postgres (
pg/psycopg2), MongoDB (mongoose/pymongo), Redis (redis/ioredis).
Add new detectors there, not in the template selector.
Karpathy Guidelines Skill
skill/karpathy-guidelines/SKILL.md is the standalone skill installed at ~/.claude/skills/karpathy-guidelines/. Adapted with attribution from the MIT-licensed forrestchang/andrej-karpathy-skills repo. The four principles are inserted automatically into every generated CLAUDE.md via template_selector._generate_karpathy_guidelines() and generator._generate_karpathy_guidelines(). Do not strip the embedded section during enhancement.