The complete guide to Claude Code setup. 100+ hours saved. 370x optimization. Production-tested patterns for skills, hooks, and MCP integration.
Evidence: Production MASTER-PLAN Phase 3 Difficulty: Intermediate Time: 20 minutes setup ROI: Auto-load relevant blueprints per branch
Large projects have many blueprints (system architecture docs):
Central registry defining which blueprints load for which branch.
memory-bank/blueprints/blueprint-registry.json
{
"blueprints": {
"CONTEXT-SYSTEM": {
"location": "Library/context/CONTEXT-SYSTEM-BLUEPRINT.md",
"type": "domain",
"branches": ["dev-Knowledge"],
"auto_load": true,
"size_tokens": 2500
},
"TRUE-AI-SYSTEM": {
"location": "system/TRUE-AI-SYSTEM-BLUEPRINT.md",
"type": "core",
"branches": ["dev-feature", "dev-MERGE"],
"auto_load": true,
"size_tokens": 5400
},
"DATABASE-SCHEMA": {
"location": "core/DATABASE-SCHEMA-BLUEPRINT.md",
"type": "core",
"branches": ["dev-Data", "dev-feature", "dev-MERGE"],
"auto_load": true,
"size_tokens": 3200
}
},
"branch_blueprints": {
"dev-Knowledge": ["CONTEXT-SYSTEM", "SKILLS-SYSTEM"],
"dev-feature": ["TRUE-AI-SYSTEM", "DATABASE-SCHEMA"],
"dev-Data": ["DATABASE-SCHEMA", "GAP-SYSTEM"],
"dev-MERGE": ["DEPLOYMENT", "MULTI-BRANCH"],
"dev-UI": ["UI-THEME", "DASHBOARD-PATTERNS"]
}
}
Add to .claude/hooks/session-start.sh:
CRITICAL: The hook must WRITE to CLAUDE.md, not just print to terminal!
The @ symbol only triggers file loading when itβs IN CLAUDE.md.
load_branch_blueprints() {
local current_branch=$(git branch --show-current 2>/dev/null)
local registry="memory-bank/blueprints/blueprint-registry.json"
if [ ! -f "$registry" ]; then
return 0
fi
local blueprints=$(jq -r ".branch_blueprints[\"$current_branch\"][]?" "$registry" 2>/dev/null)
if [ -z "$blueprints" ]; then
return 0
fi
# WRITE section header TO CLAUDE.md (not just display!)
cat >> CLAUDE.md << EOF
## π AUTO-LOADED BLUEPRINTS ($current_branch)
EOF
# Display for user visibility
echo ""
echo "βββ AUTO-LOADED BLUEPRINTS βββ"
while IFS= read -r bp_name; do
local bp_path=$(jq -r ".blueprints[\"$bp_name\"].location" "$registry")
if [ -f "memory-bank/blueprints/$bp_path" ]; then
echo "@memory-bank/blueprints/$bp_path" >> CLAUDE.md # WRITES TO FILE!
echo " π $bp_name" # Display for user
fi
done <<< "$blueprints"
echo "" >> CLAUDE.md
echo "_Auto-generated from blueprint-registry.json_" >> CLAUDE.md
}
# Call in hook (writes to CLAUDE.md AND displays)
load_branch_blueprints
Key Difference:
echo "@$path" - Prints to terminal (files NOT loaded)echo "@$path" >> CLAUDE.md - Writes to file (files ARE loaded)Recommended directory structure:
memory-bank/blueprints/
βββ blueprint-registry.json # Central registry
βββ core/ # System-wide
β βββ DATABASE-SCHEMA-BLUEPRINT.md
β βββ TRUE-AI-SYSTEM-BLUEPRINT.md
βββ features/ # Feature-specific
β βββ LABOR-COST-BLUEPRINT.md
β βββ FEEDBACK-SYSTEM-BLUEPRINT.md
βββ infrastructure/ # Infrastructure
β βββ MULTI-BRANCH-BLUEPRINT.md
β βββ DEPLOYMENT-BLUEPRINT.md
βββ Library/ # Domain patterns
βββ context/
βββ database/
βββ testing/
Add blueprints to your branch manifest:
{
"ondemand_files": {
"branch_context": ["...ROADMAP.md"],
"blueprints": [
"memory-bank/blueprints/Library/context/CONTEXT-SYSTEM-BLUEPRINT.md"
]
}
}
This generates:
@memory-bank/blueprints/Library/context/CONTEXT-SYSTEM-BLUEPRINT.md
mkdir -p memory-bank/blueprints
cat > memory-bank/blueprints/blueprint-registry.json << 'EOF'
{
"blueprints": {},
"branch_blueprints": {}
}
EOF
For each blueprint:
"BLUEPRINT-NAME": {
"location": "path/to/BLUEPRINT.md",
"type": "core|feature|domain",
"branches": ["branch1", "branch2"],
"auto_load": true,
"size_tokens": 2500
}
"branch_blueprints": {
"your-branch": ["BLUEPRINT-1", "BLUEPRINT-2"]
}
Reference blueprints in your branch manifest.
| Type | Purpose | Example |
|---|---|---|
| core | System-wide, multiple branches need | DATABASE-SCHEMA |
| feature | Feature-specific, recreatable | LABOR-COST |
| domain | Domain patterns | TESTING-BLUEPRINT |
| infrastructure | DevOps/deployment | DEPLOYMENT |
# List all blueprints in registry
jq '.blueprints | keys[]' memory-bank/blueprints/blueprint-registry.json
# Check blueprints for current branch
jq ".branch_blueprints[\"$(git branch --show-current)\"]" \
memory-bank/blueprints/blueprint-registry.json
# Verify blueprint file exists
for bp in $(jq -r '.blueprints[].location' memory-bank/blueprints/blueprint-registry.json); do
[ -f "memory-bank/blueprints/$bp" ] && echo "β
$bp" || echo "β $bp MISSING"
done
Related Chapters:
Previous: 29: Branch Context System Next: 31: Branch-Aware Development