ClaudeForge
May 19, 2026 ยท View on GitHub
Automated CLAUDE.md creation, enhancement, and maintenance for Claude Code projects
ClaudeForge is a comprehensive toolkit that eliminates the tedious process of manually creating and maintaining CLAUDE.md files. With intelligent analysis, automated generation, and background maintenance, your CLAUDE.md files stay perfectly synchronized with your codebase.
๐ What's New
- Installable Claude Code plugin โ manifest at
.claude-plugin/plugin.json; install with/plugin marketplace add alirezarezvani/ClaudeForge && /plugin install claudeforge - Hard 150-line cap per CLAUDE.md โ enforced deterministically by
hooks/hooks.jsononPostToolUse(Edit|Write)andInstructionsLoaded(everyload_reason); larger projects spread content across chained sub-files via@pathimports /sync-claude-mdโ walks every CLAUDE.md, prunes stale references, splits when over the cap, repairs root โ sub chains/sync-claude-md --weeklyโ orchestrates three forked task-style skills in parallel:claude-md-drift-audit,claude-md-link-check,claude-md-dependency-rescan- Karpathy behavioural guidelines auto-embedded in every generated CLAUDE.md and installed as a standalone
~/.claude/skills/karpathy-guidelines/skill scoped to code-file globs AGENTS.md/.cursorrules/.windsurfrulesinterop โ/enhance-claude-mddetects sibling instruction files and chains them via@-imports instead of overwritingCLAUDE.local.mdpersonal tier โ per-developer overrides exempt from the cap, gitignored automatically- Layered hook config โ
hooks/hooks-config.json(committed defaults) +hooks/hooks-config.local.json(gitignored) lets developers opt out per machine - Lifecycle hooks:
SessionStart,PreToolUse,PostToolUse,InstructionsLoaded,Stop(one-line drift summary at session end) - Guardian agent runs
model: haikuwith a fail-closed contract (Skill-tool only, never auto-commits, aborts on missing validated output)
๐ Upgrading from v1.x? See docs/MIGRATION_V2.md.
โจ Features
- ๐ Interactive Initialization - Explores your repository, detects project context, and creates customized CLAUDE.md files through conversational workflow
- โ Intelligent Analysis - Scans and evaluates existing CLAUDE.md files with quality scoring (0-100) and actionable recommendations
- ๐ง Smart Enhancement - Adds missing sections and improves structure automatically
- ๐ก๏ธ Background Maintenance - Guardian agent keeps CLAUDE.md synchronized with codebase changes
- ๐ฆ Modular Architecture - Supports complex projects with context-specific files (backend/, frontend/, database/)
- ๐ฏ 100% Native Format - All generated files follow official Claude Code format with project structure diagrams, setup instructions, and architecture sections
- ๐ ๏ธ Tech Stack Customization - Tailors guidelines to TypeScript, Python, Go, React, Vue, FastAPI, and more
- ๐ฅ Team Size Adaptation - Adjusts complexity based on team size (solo, small, medium, large)
๐ฆ What's Included
Skills
claudeforge-skill(skill/SKILL.md) โ core analysis / validation / generation engine; runs onmodel: haiku. Scoped viapaths:toCLAUDE.md,CLAUDE.local.md,AGENTS.md,.cursorrules,.windsurfrules, and.claude/rules/*.mdso it auto-loads only when those files are touched.karpathy-guidelines(skill/karpathy-guidelines/SKILL.md) โ Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution. Embedded into every generated CLAUDE.md and installed as a standalone skillpaths:-scoped to ~23 source-file extensions. Adapted with attribution from the MIT-licensed forrestchang/andrej-karpathy-skills.claude-md-drift-audit(skill/claude-md-drift-audit/SKILL.md, forked +agent: Explore) โ walks the last N days of git history and flags every CLAUDE.md line that references deleted paths, renamed paths, or removed dependencies. Read-only./claude-md-drift-audit [days=7].claude-md-link-check(skill/claude-md-link-check/SKILL.md, forked +agent: Explore) โ verifies every@pathchain import and every relative markdown link inside every CLAUDE.md resolves. Read-only./claude-md-link-check [path-glob].claude-md-dependency-rescan(skill/claude-md-dependency-rescan/SKILL.md, forked +agent: Explore) โ diffs declared dependencies (package.json/requirements.txt/pyproject.toml/go.mod/Cargo.toml) against the Tech Stack section of every CLAUDE.md. Read-only./claude-md-dependency-rescan [manifest].
Slash commands
/enhance-claude-md(command/enhance-claude-md.md) โ multi-phase init/enhance workflow withargument-hint,when_to_use,allowed-tools, anddisallowedTools(blocksWebFetch/WebSearch). Delegates deep codebase scans to the Explore subagent./sync-claude-md(command/sync-claude-md.md) โ inventory โ prune stale refs โ enforce the 150-line cap โ repair root โ sub chain. New--weeklyflag orchestrates the three audit skills in parallel before doing sync work./claude-to-agents(command/claude-to-agents.md) โ convert the project's CLAUDE.md tree into anAGENTS.mdfor Codex / Gemini Code Assist / any tool honouring the AGENTS.md convention. Three modes:--symlink(one source of truth, default on macOS/Linux),--copy(snapshot),--inline-chain(flattens the@pathchain into one self-contained file โ recommended for modular projects since Codex/Gemini don't auto-resolve@imports). Backs up an existing AGENTS.md before overwrite.
Agent
claude-md-guardian(agent/claude-md-guardian.md) โ background maintenance. Runsmodel: haikuwith a fail-closed contract: Skill-tool only, aborts on missing validated output, never auto-commits, respects the local hook config.
Hooks
hooks/hooks.jsonโ wiresPostToolUse(Write|Edit),InstructionsLoaded(all fiveload_reasonvalues), andStopevents to scripts underhooks/.hooks/validate-claude-md.pyโ enforces the 150-line cap deterministically at load time and write time; exempts*.local.md; exits with stderr feedback on violation.hooks/audit-claude-md.pyโStophook; one-line CLAUDE.md health summary printed at session end (total tracked / over cap / near cap).hooks/hooks-config.json+hooks/hooks-config.local.jsonโ layered config; per-developer overrides without forking the shipped manifest.
๐ Quick Start
Installation
Claude Code Plugin (recommended)
ClaudeForge ships as a Claude Code plugin. From any Claude Code session:
/plugin marketplace add alirezarezvani/ClaudeForge
/plugin install claudeforge
This installs every component (skills, slash commands, guardian agent) and registers /enhance-claude-md and /sync-claude-md for any project. Works the same at the user level (available everywhere) or scoped to a single project.
macOS / Linux
curl -fsSL https://raw.githubusercontent.com/alirezarezvani/ClaudeForge/main/install.sh | bash
Windows (PowerShell)
iwr https://raw.githubusercontent.com/alirezarezvani/ClaudeForge/main/install.ps1 -useb | iex
Manual Installation
git clone https://github.com/alirezarezvani/ClaudeForge.git
cd ClaudeForge
./install.sh # or .\install.ps1 on Windows
Usage
After installation, restart Claude Code and run:
/enhance-claude-md
That's it! The command will:
- โ Explore your project structure
- โ Detect tech stack and project type
- โ Show discoveries and ask for confirmation
- โ Create customized CLAUDE.md file(s)
- โ Apply best practices and native format
๐ก Use Cases
New Project (No CLAUDE.md)
/enhance-claude-md
# Claude explores your repository and responds:
#
# "Based on my exploration, here's what I discovered:
#
# ๐ฆ Project Type: Full-Stack Application
# ๐ ๏ธ Tech Stack: TypeScript, React, Node.js, PostgreSQL, Docker
# ๐ฅ Team Size: Small (5 developers)
# ๐ Development Phase: MVP
#
# ๐ Recommended Structure:
# - Root CLAUDE.md (navigation hub, ~100 lines)
# - backend/CLAUDE.md (API guidelines, ~150 lines)
# - frontend/CLAUDE.md (React guidelines, ~175 lines)
#
# Would you like me to create these files?"
#
# You: "Yes"
#
# โ
CLAUDE.md created (108 lines)
# โ
backend/CLAUDE.md created (156 lines)
# โ
frontend/CLAUDE.md created (182 lines)
Existing Project (Needs Improvement)
/enhance-claude-md
# Claude analyzes your current CLAUDE.md:
#
# "Quality Score: 65/100
#
# Missing Sections:
# - Project Structure (ASCII diagram)
# - Setup & Installation
# - Architecture
#
# Would you like me to enhance your CLAUDE.md with these sections?"
#
# You: "Yes"
#
# โ
CLAUDE.md enhanced (+2 sections, quality score: 65 โ 88)
Background Maintenance
# You start a new Claude Code session
# Guardian agent automatically checks for changes
#
# โ
CLAUDE.md updated:
# - Tech Stack: Added 2 dependencies (react-query, tailwindcss)
# - Project Structure: Updated diagram with new components/ directory
# - Setup & Installation: New environment variables
#
# Changes: 3 sections, 12 lines
๐ Documentation
| Document | Description |
|---|---|
| Quick Start Guide | 5-minute tutorial to get started |
| Installation Guide | Detailed installation instructions and troubleshooting |
| Architecture Overview | How components work together |
| GitHub Workflows | CI/CD automation and quality gates |
| Branching Strategy | Branch flow and protection rules |
| Troubleshooting | Common issues and solutions |
| Contributing Guide | How to contribute to ClaudeForge |
๐ Examples
See the examples/ directory for:
- Basic usage scenarios
- Modular architecture setup
- Integration with existing projects
- Advanced customization
๐ง Components Deep Dive
Skill: claudeforge-skill
Core Capabilities:
- Analysis - Scans existing CLAUDE.md files for quality and completeness
- Validation - Checks against Anthropic guidelines and best practices
- Generation - Creates new CLAUDE.md files from scratch
- Enhancement - Adds missing sections and improves structure
- Template Selection - Chooses appropriate templates based on project context
Quality Scoring (0-100):
- Length appropriateness (25 pts)
- Section completeness (25 pts)
- Formatting quality (20 pts)
- Content specificity (15 pts)
- Modular organization (15 pts)
Slash Command: /enhance-claude-md
Multi-phase workflow (Discovery โ Analysis โ Task). Discovery delegates the deep codebase walk to the Explore subagent so it doesn't bloat the calling session. Phase 1 also detects sibling AGENTS.md / .cursorrules / .windsurfrules and chains them via @-imports rather than overwriting. Phase 3 invokes claudeforge-skill via the Skill tool.
Slash Command: /sync-claude-md (with --weekly)
Default mode: inventory every CLAUDE.md, prune stale references, enforce the 150-line cap by splitting into sub-files, repair the root โ sub chain. With --weekly, Phase 0 issues the three forked audit skills (claude-md-drift-audit, claude-md-link-check, claude-md-dependency-rescan) in parallel via the Skill tool, aggregates their findings under ## Weekly Audit Summary, then proceeds. Each forked skill runs in an isolated subagent context (context: fork, agent: Explore) so audit work doesn't bloat the calling session.
Agent: claude-md-guardian
Runs model: haiku, fork_safe: true. Hook frontmatter uses Anthropic's canonical keyed-object schema (events: SessionStart, PreToolUse, PostToolUse, InstructionsLoaded). Fail-closed contract: invokes claudeforge-skill exclusively through the Skill tool (never inlines SKILL.md), aborts on missing validated output, never auto-commits, respects hooks/hooks-config.local.json.
๐ฏ Requirements
- Claude Code 2.0 or later
- Git (recommended for change detection)
- Operating Systems: macOS, Linux, Windows (PowerShell)
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Quick Contribution Steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ Issues & Support
- Bug Reports: GitHub Issues
- Feature Requests: GitHub Discussions
- Documentation: docs/
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright ยฉ 2025 Alireza Rezvani
๐ Acknowledgments
- Built for the Claude Code community.
- The behavioural-guardrail skill adapts the four principles from the MIT-licensed forrestchang/andrej-karpathy-skills (inspired by Andrej Karpathy's commentary on LLM coding pitfalls). Original prose; attribution preserved in
skill/karpathy-guidelines/SKILL.md. - Several plugin conventions (layered hook config,
Stopaudit hook, command discovery metadata,paths:scoping on skills, fail-closed contracts) are adapted from the MIT-licensed shanraisshan/claude-code-best-practice. Patterns implemented in original code with attribution inCHANGELOG.md. - Anthropic's Claude Code documentation drove the load-event integrations (
InstructionsLoaded, all fiveload_reasonmatchers) and thecontext: forktask-style skills.
๐ฆ Project Status
Version: 2.1.0 (see CHANGELOG.md)
Status: โ
Stable & Production-Ready
Requires: Claude Code 2.1.4+ for hooks/InstructionsLoaded/paths: features
๐ Quick Stats
- 5 skills (
claudeforge-skill,karpathy-guidelines, plus three forked audit skills) - 3 slash commands (
/enhance-claude-md,/sync-claude-mdwith--weekly,/claude-to-agents) - 1 agent (
claude-md-guardian, fail-closed contract) - 3 hook scripts wired across
PostToolUse,InstructionsLoaded,Stop - 5 Python modules under
skill/(analyzer, validator, generator, template_selector, workflow) - 7 reference CLAUDE.md templates under
skill/examples/ - 150 โ hard line cap per CLAUDE.md, enforced at load time and write time
๐ Star History
If you find ClaudeForge helpful, please consider giving it a star on GitHub!
Made with โค๏ธ for the Claude Code community