|
| 1 | +# 🔧 Command Templates |
| 2 | + |
| 3 | +Orchestration templates that enable Claude Code to coordinate multi-agent workflows for different development tasks. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +After reading the [main kit documentation](../README.md), you'll understand how these commands fit into the integrated system. Each command: |
| 8 | + |
| 9 | +- **Auto-loads** the appropriate documentation tier for its task |
| 10 | +- **Spawns specialized agents** based on complexity |
| 11 | +- **Integrates MCP servers** when external expertise helps |
| 12 | +- **Maintains documentation** to keep AI context current |
| 13 | + |
| 14 | +### 🚀 Automatic Context Injection |
| 15 | + |
| 16 | +All commands benefit from automatic context injection via the `subagent-context-injector.sh` hook: |
| 17 | + |
| 18 | +- **Core documentation auto-loaded**: Every command and sub-agent automatically receives `@/docs/CLAUDE.md`, `@/docs/ai-context/project-structure.md`, and `@/docs/ai-context/docs-overview.md` |
| 19 | +- **No manual context loading**: Sub-agents spawned by commands automatically have access to essential project documentation |
| 20 | +- **Consistent knowledge**: All agents start with the same foundational understanding |
| 21 | + |
| 22 | +## Available Commands |
| 23 | + |
| 24 | +### 📊 `/full-context` |
| 25 | +**Purpose**: Comprehensive context gathering and analysis when you need deep understanding or plan to execute code changes. |
| 26 | + |
| 27 | +**When to use**: |
| 28 | +- Starting work on a new feature or bug |
| 29 | +- Need to understand how systems interconnect |
| 30 | +- Planning architectural changes |
| 31 | +- Any task requiring thorough analysis before implementation |
| 32 | + |
| 33 | +**How it works**: Adaptively scales from direct analysis to multi-agent orchestration based on request complexity. Agents read documentation, analyze code, map dependencies, and consult MCP servers as needed. |
| 34 | + |
| 35 | +### 🔍 `/code-review` |
| 36 | +**Purpose**: Get multiple expert perspectives on code quality, focusing on high-impact findings rather than nitpicks. |
| 37 | + |
| 38 | +**When to use**: |
| 39 | +- After implementing new features |
| 40 | +- Before merging important changes |
| 41 | +- When you want security, performance, and architecture insights |
| 42 | +- Need confidence in code quality |
| 43 | + |
| 44 | +**How it works**: Spawns specialized agents (security, performance, architecture) that analyze in parallel. Each agent focuses on critical issues that matter for production code. |
| 45 | + |
| 46 | +### 🧠 `/gemini-consult` *(Requires Gemini MCP Server)* |
| 47 | +**Purpose**: Engage in deep, iterative conversations with Gemini for complex problem-solving and architectural guidance. |
| 48 | + |
| 49 | +**When to use**: |
| 50 | +- Tackling complex architectural decisions |
| 51 | +- Need expert guidance on implementation approaches |
| 52 | +- Debugging intricate issues across multiple files |
| 53 | +- Exploring optimization strategies |
| 54 | +- When you need a thinking partner for difficult problems |
| 55 | + |
| 56 | +**How it works**: Creates persistent conversation sessions with Gemini, automatically attaching project context and MCP-ASSISTANT-RULES.md. Supports iterative refinement through follow-up questions and implementation feedback. |
| 57 | + |
| 58 | +**Key features**: |
| 59 | +- Context-aware problem detection when no arguments provided |
| 60 | +- Persistent sessions maintained throughout problem lifecycle |
| 61 | +- Automatic attachment of foundational project documentation |
| 62 | +- Support for follow-up questions with session continuity |
| 63 | + |
| 64 | +### 📝 `/update-docs` |
| 65 | +**Purpose**: Keep documentation synchronized with code changes, ensuring AI context remains current. |
| 66 | + |
| 67 | +**When to use**: |
| 68 | +- After modifying code |
| 69 | +- After adding new features |
| 70 | +- When project structure changes |
| 71 | +- Following any significant implementation |
| 72 | + |
| 73 | +**How it works**: Analyzes what changed and updates the appropriate CLAUDE.md files across all tiers. Maintains the context that future AI sessions will rely on. |
| 74 | + |
| 75 | +### 📄 `/create-docs` |
| 76 | +**Purpose**: Generate initial documentation structure for existing projects that lack AI-optimized documentation. |
| 77 | + |
| 78 | +**When to use**: |
| 79 | +- Adopting the framework in an existing project |
| 80 | +- Starting documentation from scratch |
| 81 | +- Need to document legacy code |
| 82 | +- Setting up the 3-tier structure |
| 83 | + |
| 84 | +**How it works**: Analyzes your project structure and creates appropriate CLAUDE.md files at each tier, establishing the foundation for AI-assisted development. |
| 85 | + |
| 86 | +### ♻️ `/refactor` |
| 87 | +**Purpose**: Intelligently restructure code while maintaining functionality and updating all dependencies. |
| 88 | + |
| 89 | +**When to use**: |
| 90 | +- Breaking up large files |
| 91 | +- Improving code organization |
| 92 | +- Extracting reusable components |
| 93 | +- Cleaning up technical debt |
| 94 | + |
| 95 | +**How it works**: Analyzes file structure, maps dependencies, identifies logical split points, and handles all import/export updates across the codebase. |
| 96 | + |
| 97 | +### 🤝 `/handoff` |
| 98 | +**Purpose**: Preserve context when ending a session or when the conversation becomes too long. |
| 99 | + |
| 100 | +**When to use**: |
| 101 | +- Ending a work session |
| 102 | +- Context limit approaching |
| 103 | +- Switching between major tasks |
| 104 | +- Supplementing `/compact` with permanent storage |
| 105 | + |
| 106 | +**How it works**: Updates the handoff documentation with session achievements, current state, and next steps. Ensures smooth continuation in future sessions. |
| 107 | + |
| 108 | +## Integration Patterns |
| 109 | + |
| 110 | +### Typical Workflow |
| 111 | +```bash |
| 112 | +/full-context "implement user notifications" # Understand |
| 113 | +# ... implement the feature ... |
| 114 | +/code-review "review notification system" # Validate |
| 115 | +/update-docs "document notification feature" # Synchronize |
| 116 | +/handoff "completed notification system" # Preserve |
| 117 | +``` |
| 118 | + |
| 119 | +### Quick Analysis |
| 120 | +```bash |
| 121 | +/full-context "why is the API slow?" # Investigate |
| 122 | +# ... apply fixes ... |
| 123 | +/update-docs "document performance fixes" # Update context |
| 124 | +``` |
| 125 | + |
| 126 | +### Major Refactoring |
| 127 | +```bash |
| 128 | +/full-context "analyze authentication module" # Understand current state |
| 129 | +/refactor "@auth/large-auth-file.ts" # Restructure |
| 130 | +/code-review "review refactored auth" # Verify quality |
| 131 | +/update-docs "document new auth structure" # Keep docs current |
| 132 | +``` |
| 133 | + |
| 134 | +### Complex Problem Solving |
| 135 | +```bash |
| 136 | +/gemini-consult "optimize real-time data pipeline" # Start consultation |
| 137 | +# ... implement suggested approach ... |
| 138 | +/gemini-consult # Follow up with results |
| 139 | +/update-docs "document optimization approach" # Capture insights |
| 140 | +``` |
| 141 | + |
| 142 | +## Customization |
| 143 | + |
| 144 | +Each command template can be adapted: |
| 145 | + |
| 146 | +- **Adjust agent strategies** - Modify how many agents spawn and their specializations |
| 147 | +- **Change context loading** - Customize which documentation tiers load |
| 148 | +- **Tune MCP integration** - Adjust when to consult external services |
| 149 | +- **Modify output formats** - Tailor results to your preferences |
| 150 | + |
| 151 | +Commands are stored in `.claude/commands/` and can be edited directly. |
| 152 | + |
| 153 | +## Key Principles |
| 154 | + |
| 155 | +1. **Commands work together** - Each command builds on others' outputs |
| 156 | +2. **Documentation stays current** - Commands maintain their own context |
| 157 | +3. **Complexity scales naturally** - Simple tasks stay simple, complex tasks get sophisticated analysis |
| 158 | +4. **Context is continuous** - Information flows between sessions through documentation |
| 159 | + |
| 160 | +--- |
| 161 | + |
| 162 | +*For detailed implementation of each command, see the individual command files in this directory.* |
0 commit comments