Claude Code Setup Guide
What is CLAUDE.md?
Section titled “What is CLAUDE.md?”CLAUDE.md is Claude Code’s project memory — a file at your repo root that tells Claude about your project, conventions, and workflows. Claude reads it at every session start.
Recommended CLAUDE.md Structure
Section titled “Recommended CLAUDE.md Structure”Based on production configurations across multiple projects:
## Quick Start- Dev environment setup- Key commands- Where to find things
## Methodology (Forgeplan)- Route → Shape → Validate → Code → Evidence → Activate- Depth calibration table- Artifact creation flow
## Git Workflow- Branching strategy (main ← dev ← feat/*)- Commit format (conventional commits + Refs)- PR pipeline: Code → Audit → Fix → Test → PR
## Enforcement Hooks- forge-safety-hook.sh — blocks dangerous commands- pre-commit-fmt.sh — format check- commit-test-check.sh — tests for new functions
## Memory (Hindsight)- Session start: memory_recall("project")- After decisions: memory_retain("what we decided")- Analysis: memory_reflect("what patterns")
## Hard Requirements- Language-specific rules- Architecture constraints- Testing standardsForgeplan Section
Section titled “Forgeplan Section”Add this to any project’s CLAUDE.md to integrate Forgeplan:
## Forgeplan
### Session startforgeplan health # blind spots, orphans — fix FIRST
### Before any taskforgeplan route "task description" # determines depth
### Full cycle (Standard+)1. forgeplan new prd "Title" # create artifact2. Fill MUST sections # Problem, Goals, FR3. forgeplan validate PRD-XXX # quality gates4. forgeplan reason PRD-XXX # ADI: 3+ hypotheses5. Code + test every pub fn6. forgeplan new evidence "..." # create proof7. forgeplan link EVID-XXX PRD-XXX # connect8. forgeplan score PRD-XXX # R_eff > 09. forgeplan activate PRD-XXX # draft → active
### Tactical depthJust code. No artifacts needed.Enforcement Hooks
Section titled “Enforcement Hooks”Hooks in .claude/hooks/ automate quality checks:
# Blocks: git push --force, rm -rf /, cargo publish, DROP TABLE
# .claude/hooks/pre-commit-fmt.sh# Blocks commit if code not formatted
# .claude/hooks/commit-test-check.sh# Warns if new pub fn has no testSetting Up Hooks
Section titled “Setting Up Hooks”{ "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [".claude/hooks/forge-safety-hook.sh"] } ] }}MCP Server Configuration
Section titled “MCP Server Configuration”Add Forgeplan as MCP server for AI agents:
{ "mcpServers": { "forgeplan": { "command": "forgeplan", "args": ["serve"] } }}This gives AI agents access to 28 tools: create, validate, score, search, graph, reason, route.
Memory Integration (Hindsight)
Section titled “Memory Integration (Hindsight)”Save knowledge between sessions:
| When | Tool | Example |
|---|---|---|
| Session start | memory_recall | ”What did we decide about auth?” |
| After decision | memory_retain | ”Chose JWT over sessions because…” |
| Analysis | memory_reflect | ”What patterns work best here?” |
Recommended Permissions
Section titled “Recommended Permissions”{ "permissions": { "allow": [ "Bash(cargo:*)", "Bash(forgeplan:*)", "Bash(git:add,commit,status,diff,log,branch,checkout)", "Bash(npm:*)", "Read", "Glob", "Grep" ], "deny": [ "Bash(git push --force*)", "Bash(rm -rf /*)", "Bash(cargo publish*)" ] }}Multi-Project Setup
Section titled “Multi-Project Setup”For monorepo or multi-project setup, each subdirectory can have its own CLAUDE.md:
project/├── CLAUDE.md ← root config (git, methodology)├── packages/│ ├── core/│ │ └── CLAUDE.md ← package-specific rules│ └── web/│ └── CLAUDE.md ← frontend-specific rules└── .claude/ ├── hooks/ ← shared hooks └── settings.json ← permissionsBest Practices
Section titled “Best Practices”- Keep CLAUDE.md under 500 lines — Claude reads it every session. Too long = wasted context.
- Put details in docs/, not CLAUDE.md — reference
docs/guides/X.mdfor deep content. - Update after decisions — new convention? Add it to CLAUDE.md immediately.
- Hooks over instructions — “never force push” in CLAUDE.md is a suggestion. A hook is enforcement.
- Forgeplan health first — always start session with
forgeplan healthto catch blind spots.