Files
ClaudeForge/command/CLAUDE.md
T
Claude c374cc28a1 docs(claude-md): dogfood /sync-claude-md on root CLAUDE.md
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.
2026-05-19 02:04:00 +00:00

39 lines
2.2 KiB
Markdown

> Parent context: see the root [CLAUDE.md](../CLAUDE.md) for project-wide guidelines and behavioural rules.
> Chained import: `@../CLAUDE.md`
# Slash Command Development
Guidelines for the `/enhance-claude-md` and `/sync-claude-md` slash commands.
## Files
- `command/enhance-claude-md.md` — interactive initialise / enhance workflow.
- `command/sync-claude-md.md` — walks every CLAUDE.md, prunes stale references, enforces the 150-line cap, repairs the root ↔ sub chain.
Both install as top-level `~/.claude/commands/<name>.md` so they register as `/enhance-claude-md` and `/sync-claude-md`. There is no `enhance-claude-md/` bundle directory anymore — legacy bundles are backed up automatically on upgrade.
## Modifying `/enhance-claude-md`
1. Edit `command/enhance-claude-md.md`.
2. Key phases:
- **Phase 1 (Discovery)** — bash inventory + Explore-subagent delegation for deep codebase walks. Keep the calling session's context lean.
- **Phase 2 (Analysis)** — branches initialise (no CLAUDE.md) vs. enhance (CLAUDE.md exists).
- **Phase 3 (Task)** — invokes the `claude-md-enhancer` skill or `claude-md-guardian` agent.
3. Always-on requirement: every generated/enhanced CLAUDE.md must include `## Behavioral Guidelines`. The skill inserts it automatically — do not strip it.
4. Re-install for testing: `./install.sh` (project-level) or copy the file manually to `~/.claude/commands/enhance-claude-md.md`.
5. Restart Claude Code (commands hot-reload, but restart guarantees a clean state) and test.
## Modifying `/sync-claude-md`
1. Edit `command/sync-claude-md.md`.
2. Phases: inventory → per-file audit → enforce 150-line cap (split into sub-files via `generator.generate_context_file()`) → re-chain root ↔ subs → cleanup report.
3. Sync should never commit on its own; leave the diff staged-but-uncommitted for the user.
## Skill ↔ Slash Command Integration
`command/enhance-claude-md.md` Phase 3 invokes the skill by name:
> I can invoke the `claude-md-enhancer` skill directly to handle the appropriate workflow based on what I discovered above.
Claude Code resolves `claude-md-enhancer` from the YAML frontmatter `name:` field in `skill/SKILL.md` (kept for backwards compatibility — the installed directory is `claudeforge-skill/`).