// Invoke for complex multi-step tasks requiring intelligent planning and multi-agent coordination. Use when tasks need decomposition, dependency mapping, parallel/sequential/swarm/iterative execution strategies, or coordination of multiple specialized agents with quality gates and dynamic optimization.
| name | goap-agent |
| description | Invoke for complex multi-step tasks requiring intelligent planning and multi-agent coordination. Use when tasks need decomposition, dependency mapping, parallel/sequential/swarm/iterative execution strategies, or coordination of multiple specialized agents with quality gates and dynamic optimization. |
Enable intelligent planning and execution of complex multi-step tasks through systematic decomposition, dependency mapping, and coordinated multi-agent execution.
Always use the plans/ folder for all files.
Use this skill when facing:
1. ANALYZE โ Understand goals, constraints, resources
2. DECOMPOSE โ Break into atomic tasks with dependencies
3. STRATEGIZE โ Choose execution pattern (parallel/sequential/swarm/hybrid/iterative)
4. COORDINATE โ Assign tasks to specialized agents
5. EXECUTE โ Run with monitoring and quality gates
6. SYNTHESIZE โ Aggregate results and validate success
## Task Analysis
**Primary Goal**: [Clear statement of what success looks like]
**Constraints**:
- Time: [Urgent / Normal / Flexible]
- Resources: [Available agents, tools, data]
- Dependencies: [External systems, prerequisites]
**Complexity Level**:
- Simple: Single agent, <3 steps
- Medium: 2-3 agents, some dependencies
- Complex: 4+ agents, mixed execution modes
- Very Complex: Multiple phases, many dependencies
**Quality Requirements**:
- Testing: [Unit / Integration / E2E]
- Standards: [AGENTS.md compliance, formatting, linting]
- Documentation: [API docs, examples, guides]
- Performance: [Speed, memory, scalability]
Use the task-decomposition skill to break down the goal:
## Task Decomposition: [Task Name]
### Main Goal
[Clear statement of primary objective]
### Sub-Goals
1. [Component 1] - Priority: P0
- Success Criteria: [How to verify]
- Dependencies: [Prerequisites]
- Complexity: [Low/Medium/High]
2. [Component 2] - Priority: P1
- Success Criteria: [How to verify]
- Dependencies: [Component 1]
- Complexity: [Low/Medium/High]
### Atomic Tasks
**Component 1: [Name]**
- Task 1.1: [Action] (Agent: type, Deps: none)
- Task 1.2: [Action] (Agent: type, Deps: 1.1)
### Dependency Graph
Task 1.1 โ Task 1.2 โ Task 2.1 โ Task 1.3 (parallel) โ Task 2.2
Choose execution strategy based on task characteristics. See execution-strategies.md for detailed guide.
| Strategy | When to Use | Speed | Complexity |
|---|---|---|---|
| Parallel | Independent tasks, time-critical | Nx | High |
| Sequential | Dependent tasks, order matters | 1x | Low |
| Swarm | Many similar tasks | ~Nx | Medium |
| Hybrid | Mixed requirements | 2-4x | Very High |
| Iterative | Progressive refinement, convergence | Varies | Medium |
Needs iterative refinement?
โโ Yes (until criteria met or converged) โ ITERATIVE
โโ No โ Is time critical?
โโ Yes โ Can tasks run in parallel?
โ โโ Yes โ PARALLEL
โ โโ No โ SEQUENTIAL (prioritize critical path)
โโ No โ Are tasks similar?
โโ Yes (many similar) โ SWARM
โโ No (mixed) โ HYBRID
โโ Simple linear โ SEQUENTIAL
| Agent Type | Capabilities | Best For |
|---|---|---|
| feature-implementer | Design, implement, test features | New functionality |
| debugger | Diagnose, fix runtime issues | Bug fixes, performance |
| test-runner | Execute tests, diagnose failures | Test validation |
| refactorer | Improve code quality, structure | Code improvements |
| code-reviewer | Review quality, compliance | Quality assurance |
| loop-agent | Iterative refinement, convergence detection | Progressive improvements |
## Execution Plan: [Task Name]
### Overview
- Strategy: [Parallel/Sequential/Swarm/Hybrid/Iterative]
- Total Tasks: [N]
- Estimated Duration: [Time]
- Quality Gates: [N checkpoints]
### Phase 1: [Phase Name]
**Tasks**:
- Task 1: [Description] (Agent: type)
- Task 2: [Description] (Agent: type)
**Quality Gate**: [Validation criteria]
### Phase 2: [Phase Name]
**Tasks**:
- Task 3: [Description] (Agent: type)
**Quality Gate**: [Validation criteria]
### Overall Success Criteria
- [ ] All tasks complete
- [ ] Quality gates passed
- [ ] Tests passing
- [ ] Documentation updated
### Contingency Plans
- If Phase 1 fails โ [Recovery plan]
- If tests fail โ [Diagnostic approach]
**Launching parallel agents:**
- Agent 1 (feature-implementer) โ Task A
- Agent 2 (feature-implementer) โ Task B
- Agent 3 (test-runner) โ Task C
**Coordination**:
- All agents work simultaneously
- Monitor progress independently
- Aggregate results when all complete
**Launching sequential agents:**
Phase 1: Agent 1 (debugger) โ Diagnose issue
โ Quality Gate: Root cause identified
Phase 2: Agent 2 (refactorer) โ Apply fix
โ Quality Gate: Tests pass
Phase 3: Agent 3 (code-reviewer) โ Validate
## Execution Summary: [Task Name]
### โ Completed Tasks
- [Task 1]: Success
- [Task 2]: Success
### ๐ฆ Deliverables
- [File/Feature 1]
- [File/Feature 2]
### โ
Quality Validation
- Tests: [Pass/Fail] ([coverage]%)
- Linting: [Pass/Fail]
- Standards: [Compliant]
### ๐ Performance Metrics
- Duration: [actual vs estimated]
- Efficiency: [parallel speedup if applicable]
### ๐ก Recommendations
- [Improvement 1]
- [Improvement 2]
### ๐ Lessons Learned
- [What worked well]
- [What to improve]
Phase 1 (Sequential): Research
- Explore agent โ Understand codebase
- Quality Gate: Architecture documented
Phase 2 (Parallel): Implement
- feature-implementer (A) โ Module 1
- feature-implementer (B) โ Module 2
- Quality Gate: Implementations complete
Phase 3 (Sequential): Validate
- test-runner โ All tests
- code-reviewer โ Final review
- Quality Gate: Ready for merge
Phase 1: Investigate
- debugger โ Reproduce issue
- Quality Gate: Issue reproduced
Phase 2: Diagnose
- debugger โ Root cause analysis
- Quality Gate: Root cause identified
Phase 3: Fix
- refactorer โ Apply fix
- Quality Gate: Fix implemented
Phase 4: Verify
- test-runner โ Regression tests
- Quality Gate: Tests pass
Phase 1: Audit
- code-reviewer โ Quality audit
- Quality Gate: Issues identified
Phase 2 (Swarm): Improve
- Multiple refactorer agents
- Work queue: [issue list]
- Quality Gate: All issues addressed
Phase 3: Validate
- test-runner โ Full test suite
- code-reviewer โ Final check
- Quality Gate: Quality targets met
**If agent fails:**
1. Log failure reason
2. Check quality gate status
3. Options:
- Retry same agent (transient error)
- Assign to different agent (agent issue)
- Modify task (requirements issue)
- Escalate to user (blocking issue)
**If quality gate fails:**
1. Identify failing criteria
2. Diagnose root cause
3. Options:
- Re-run previous phase with fixes
- Adjust quality criteria (if appropriate)
- Change strategy (e.g., parallel โ sequential for debugging)
**If dependency blocks progress:**
1. Identify blocking task
2. Prioritize unblocking
3. Options:
- Execute dependency first (re-order)
- Remove dependency (refactor plan)
- Parallel work on independent tasks
โ Break tasks into atomic, testable units โ Define clear quality gates between phases โ Match agent capabilities to task requirements โ Monitor progress and validate incrementally โ Document decisions and rationale โ Learn from execution for future planning โ Use parallel execution where safe โ Validate dependencies before execution
โ Create monolithic tasks (break them down) โ Skip quality gates (leads to cascading failures) โ Assume tasks are independent (verify carefully) โ Ignore agent failures (address immediately) โ Over-complicate simple tasks (use sequential) โ Under-estimate coordination overhead โ Forget to aggregate and synthesize results
Task: Implement authentication system
## GOAP Plan
### Phase 1: Analysis (Sequential)
- goap-agent โ Define requirements
- Quality Gate: Requirements clear
### Phase 2: Implementation (Parallel)
- Agent A โ User model + database
- Agent B โ Auth middleware
- Agent C โ API endpoints
- Quality Gate: All components implemented
### Phase 3: Integration (Sequential)
- feature-implementer โ Wire components together
- test-runner โ Integration tests
- Quality Gate: Tests pass
### Phase 4: Validation (Sequential)
- code-reviewer โ Security review
- Quality Gate: Approved for deployment
If during execution:
Then:
GOAP enables systematic planning and execution of complex tasks through:
Use GOAP when facing complex, multi-step challenges requiring coordination, optimization, and quality assurance.