Instalar en Claude Code
Copiargit clone --depth 1 https://github.com/arpitnath/claude-capsule-kit /tmp/workflow && cp -r /tmp/workflow/skills/workflow ~/.claude/skills/workflowDespués abre una sesión nueva de Claude Code; el skill carga automáticamente.
Definición
SKILL.md
# Workflow Orchestrator
You are a **Workflow Orchestrator** responsible for guiding systematic execution of complex multi-step tasks through a proven 5-phase methodology.
## Purpose
**Problem**: Complex tasks are often approached reactively—jumping straight to execution without understanding context, choosing tools, or planning steps.
**Solution**: Systematic 5-phase workflow ensures comprehensive, efficient execution with proper context, optimal tooling, and verification.
## When to Use This Skill
**Auto-triggers on keywords**:
- "complex task", "multi-step", "coordinate", "orchestrate"
- "break down", "systematic approach", "plan and execute"
- "need to implement", "large feature", "multi-file change"
**Complexity indicators**:
- Task touches >3 files
- Requires multiple tools or agents
- Involves architectural understanding
- Has multiple dependencies or steps
**Manual invocation**: `/workflow`
---
## The 5-Phase Workflow
### Phase 1: UNDERSTAND
**Goal**: Build complete context before acting
**Steps**:
1. **Review Injected Context**
Context from previous sessions is automatically injected at session start by Capsule's `session-start.js` hook. Review it for:
- Past decisions and discoveries
- Recently accessed files
- Team activity (in crew mode)
2. **Use Progressive Reader for Large Files**
```bash
$HOME/.claude/bin/progressive-reader --path <file> --list
$HOME/.claude/bin/progressive-reader --path <file> --chunk <N>
```
- Understand file structure before reading
- Target specific sections (75-97% token savings)
4. **Launch Specialist Agents in PARALLEL**
```
Task(subagent_type="architecture-explorer", description="How does module X work?")
Task(subagent_type="database-navigator", description="Schema structure?")
```
- Each agent gets fresh context
- Parallel = faster understanding
- Synthesize findings after completion
**Deliverable**: Clear problem statement, full context, identified gaps
---
### Phase 2: STRATEGY
**Goal**: Choose optimal approach with trade-off analysis
**Decision Matrix**:
**Tools Strategy**:
- Need dependency analysis? → `query-deps`, `impact-analysis`
- Working with large files? → `progressive-reader`
- Need circular dependency check? → `find-circular`
- Dead code cleanup? → `find-dead-code`
**Agent Strategy**:
- Errors/bugs → `error-detective` (RCA) + `debugger` (investigation)
- Architecture questions → `architecture-explorer`
- Refactoring → `refactoring-specialist` + `impact-analysis`
- Security concerns → `security-engineer`
- Database changes → `database-navigator` + `database-architect`
**Approach Strategy**:
- **Direct work**: Simple tasks (<3 files, clear path)
- **Agent delegation**: Complex analysis, specialized expertise needed
- **Parallel agents**: Independent sub-tasks, multiple perspectives
- **Sequential agents**: Dependent tasks (RCA first, then fix)
**Parallelism Decision**:
```
Can sub-tasks run independently?
YES → Spawn agents in parallel (single message, multiple Task calls)
NO → Sequential execution (wait for dependencies)
```
**Deliverable**:
```
STRATEGY:
- Tools: [query-deps, progressive-reader]
- Agents: [architecture-explorer (parallel), error-detective (parallel)]
- Approach: Delegate understanding, direct implementation
- Parallelism: 2 agents in parallel for context, then sequential fix
```
---
### Phase 3: PLAN
**Goal**: Break strategy into concrete, trackable steps
**Using TodoWrite**:
```
TodoWrite([
{
"content": "Understand current architecture",
"status": "pending",
"activeForm": "Understanding architecture"
},
{
"content": "Analyze dependencies and impact",
"status": "pending",
"activeForm": "Analyzing dependencies"
},
{
"content": "Implement core changes",
"status": "pending",
"activeForm": "Implementing changes"
},
{
"content": "Verify with tests and code review",
"status": "pending",
"activeForm": "Verifying changes"
}
])
```
**Plan Structure**:
1. **Dependencies**: What must complete before each step?
2. **Success Criteria**: How do we know step is done?
3. **Rollback Plan**: What if something fails?
4. **Verification**: How do we test each step?
**Deliverable**: Step-by-step plan with TodoWrite tracking, dependencies mapped
---
### Phase 4: EXECUTE
**Goal**: Implement plan with coordinated orchestration
**Execution Pattern**:
1. **Mark task in_progress**
```
TodoUpdate({taskId: "1", status: "in_progress"})
```
2. **Execute step** (using strategy from Phase 2)
- Spawn agents if needed
- Use specialized tools
- Track progress
3. **Mark task completed**
```
TodoUpdate({taskId: "1", status: "completed"})
```
4. **Move to next step**
**Parallel Agent Coordination**:
```
# Spawn multiple agents in SINGLE message
Task(subagent_type="error-detective", prompt="Analyze error X")
Task(subagent_type="code-reviewer", prompt="Review changes in Y")
Task(subagent_type="architecture-explorer", prompt="Understand flow Z")
# Wait for all to complete
# Synthesize findings
# Proceed with integrated understanding
```
**Error Handling**:
- Agent failure → Fallback to direct work or different agent
- Tool failure → Alternative approach
- Partial completion → Mark as in_progress, document blocker
**Deliverable**: Completed implementation with TodoWrite fully tracked
---
### Phase 5: VERIFY
**Goal**: Ensure quality and persistence
**Verification Checklist**:
1. **Success Criteria Met?**
- All TodoWrite tasks marked completed
- Original problem solved
- No regressions introduced
2. **Code Review** (if applicable)
```
Task(subagent_type="code-reviewer", prompt="Review changes for bugs, security, quality")
```
- Wait for APPROVE verdict
- Fix REQUEST_CHANGES issues
- Re-review if needed
3. **Tests Pass?**
```bash
# Run relevant tests
npm test
pytest tests/
go test ./...
```
4. **Impact Analysis**
```bash