claude-code-bootstrap
v1.1.1
Published
Bootstrap Protocol: Self-hydrating AI Infrastructure-as-Code for Claude Code
Maintainers
Readme
claude-code-bootstrap
The Bootstrap Protocol: AI Infrastructure-as-Code A reusable framework to instantly configure any repository for high-performance AI-assisted development.
The Core Concept
Most AI configuration is static and brittle. The Bootstrap Protocol introduces a Generator Pattern: you maintain a master library of generic templates, and a single /claude-code-bootstrap command hydrates them by scanning your project's stack. This transforms Claude AI from a general-purpose chatbot into a specialized Project Architect that understands your specific paths, patterns, and dependencies.
Quick Start
# 1. In your project root — sets up the .claude/ folder
npx claude-code-bootstrap
# 2. Open Claude Code in this directory, then run:
/claude-code-bootstrapThat's it. 60+ commands tailored to your stack are ready to use.
The Three-Phase /claude-code-bootstrap Logic
Phase 1 — Discovery (The Scan)
The AI performs a rapid, multi-layered environment check:
- Stack Check — Identifies languages and frameworks (
package.json,go.mod,requirements.txt) - Path Check — Maps where components, routes, and tests live
- Env Check — Reads
.env.exampleto identify required service integrations
Phase 2 — Hydration (The Fill)
Discovered data is mapped to template placeholders:
{{BE_TEST_COMMAND}} → npm run test:unit
{{FE_PATH_COMPONENTS}} → src/app/components
{{GRAPH_IMPORTANCE_LOGIC}} → (maps to high-traffic files identified by Graphify)Phase 3 — Deployment (The Output)
The AI generates three foundational artifacts:
CLAUDE.md— The Session Warm-up. Stack, paths, and commands baked-in so every new session starts with zero re-discovery..claudeignore— The Token Shield. Automatically excludesnode_modules,dist,.venv, and secrets to optimize the context window.commands/— A pruned library of executable instructions. No Docker files? No cloud commands generated.
After hydration, .claude/templates/ is automatically deleted — only your project-specific commands/ remains.
System Structure
.claude/
├── templates/ # SOURCE: Pristine generic templates (temporary)
│ ├── backend/ # FastAPI, Express, Django patterns
│ ├── frontend/ # React, Next.js, Vue patterns
│ ├── cloud/ # Docker, K8s, CI/CD patterns
│ ├── chains/ # Multi-step workflow playbooks
│ ├── general/ # Cross-stack logic
│ └── review/ # Quality gates & audits
├── commands/ # LIVE: Hydrated project-specific commands
│ ├── claude-code-bootstrap.md # The Architect — run this first
│ └── ... # Pruned, project-ready commands
├── settings.json # Global Claude settings
└── settings.local.json # THE GUARDRAILS: Safety overridesAdvanced Features
Knowledge Graph Integration
Run /graphify before /claude-code-bootstrap for deeper intelligence:
/graphify # generates graphify-out/GRAPH_REPORT.md
/claude-code-bootstrap # reads graph output to inject importance scoresCommands like /general:research_codebase read this cached snapshot to understand "Core Nodes" and file relationships without re-crawling, saving thousands of tokens.
Intelligent Model Routing
| Model | Commands |
|-------|----------|
| Haiku (Fast/Cheap) | /commit, /describe_pr, /create_handoff |
| Sonnet (Balanced) | Most implementation and testing tasks |
| Opus (Deep Reasoning) | /create_plan, /smart-debug, /research_codebase |
Workflow Chains
End-to-end playbooks instead of micro-managing:
| Chain | Steps |
|-------|-------|
| /chains:feature-workflow | Onboard → Research → Plan → Implement → Test → PR |
| /chains:bugfix-workflow | Debug → Smart-Debug → Fix → Test → Validate → PR |
| /chains:migration-workflow | Research → Migrate → DB Migrate → Test → Deploy |
| /chains:security-workflow | Backend → Frontend → Cloud → Compliance → Deps → Deploy |
Safety & Governance (settings.local.json)
Policy-Based Access Control lets the AI work autonomously without risking your repository:
| Policy | Operations | Reason |
|--------|-----------|--------|
| Hard Deny | git force-push, rebase, merge, reset --hard | Preserve human Source of Truth |
| Ask | rm -rf, destructive deletes | Require manual confirmation |
| Allow | Read, Edit, Write, Grep, Glob | Friction-free for maximum velocity |
Template Library (63 templates)
| Category | Count | Examples |
|----------|-------|---------|
| backend/ | 11 | api-scaffold, db-migrate, security-scan, test-harness |
| frontend/ | 11 | component-scaffold, accessibility-audit, performance-audit |
| cloud/ | 8 | docker-optimize, k8s-manifest, monitor-setup |
| general/ | 21 | create_plan, smart-debug, research_codebase, issue |
| review/ | 7 | pr-enhance, deps-audit, compliance-check |
| chains/ | 5 | feature-workflow, bugfix-workflow, security-workflow |
Re-initialization
If you add Docker, switch frameworks, or onboard a new service:
npx claude-code-bootstrap --templates-only # restore templates
/claude-code-bootstrap # re-hydrate for new stackOptions
npx claude-code-bootstrap # full setup, skip existing files
npx claude-code-bootstrap --force # overwrite all files
npx claude-code-bootstrap --dry-run # preview what would be copied
npx claude-code-bootstrap --settings-only # copy only settings files
npx claude-code-bootstrap --templates-only # restore templates to re-run /claude-code-bootstrapDeveloper Benefits
| Feature | Benefit |
|---------|---------|
| Portability | Drop into 100 repos — adapts to each stack instantly |
| Idempotency | Re-run when stack changes — preserves custom notes |
| Safety | Destructive Git ops blocked by default |
| Consistency | Same commands (/test, /create_plan) regardless of language |
License
MIT © Truedax
