// AI-powered task graph generator for complex software development goals. Creates optimal dependency graphs showing what to build, in what order, with parallelization opportunities. Use when user mentions planning features, breaking down work, understanding implementation steps, task dependencies, or says 'how do I build', 'help me plan', 'what tasks', or 'break this down'.
| name | speculate |
| description | AI-powered task graph generator for complex software development goals. Creates optimal dependency graphs showing what to build, in what order, with parallelization opportunities. Use when user mentions planning features, breaking down work, understanding implementation steps, task dependencies, or says 'how do I build', 'help me plan', 'what tasks', or 'break this down'. |
| allowed-tools | Bash |
Transform complex software goals into executable task graphs with atomic decomposition, dependency tracking, and visual Mermaid diagrams.
IMPORTANT: Use ONLY fast, efficient shell commands for codebase exploration:
Find FILES: fd (NOT find)
fd "*.tsx" src/ - Find files by patternfd -e ts -e tsx - By extensionfd Component - By name partFind TEXT: rg (NOT grep)
rg "pattern" src/ - Search in filesrg -l "pattern" - List matching files onlyrg -c "pattern" - Count matches per filerg --type rust "impl" - Search by language typeFind CODE: ast-grep
ast-grep --pattern 'function $NAME() { $$$ }' - Match code structureProcess JSON: jq
jq '.dependencies' package.json - Extract fieldsjq 'keys' file.json - List keysjq -r '.scripts | keys[]' package.json - Array valuesProcess YAML/TOML: yq
yq '.scripts' file.yaml - Parse YAMLyq -p toml '.dependencies' Cargo.toml - Parse TOMLCount/Stats:
wc -l file.txt - Count linestokei - Code statistics by languagecloc . - Lines of code breakdownDirectory tree: tree
tree -L 2 -d - Show directory structure (2 levels)tree -I 'node_modules|dist' - Exclude patternsGit: For repo information
git log --oneline -10 - Recent commitsgit ls-files - Tracked filesgit diff --name-only - Changed filesUse speculate commands for all task graph operations (add, update, delete, start, complete, available, after, show, validate).
Activate when user:
Don't activate for:
Simple (< 1 hour): Skip graph, execute directly
Medium (2-8 hours, 3-5 tasks): Brief plan, quick approval, proceed
Complex (> 8 hours, 6+ tasks): Ask clarifying questions before generating graph
Questions to ask for complex work:
Explore codebase first:
rg "authentication|auth" - Search for related codefd "auth" - Find related filesjq '.dependencies' package.json - Check dependenciesUnderstanding existing code informs task breakdown (extend vs build from scratch).
Break down the goal into atomic tasks following these principles:
Atomic Task Rules:
design-api-schema, implement-login, test-webhooksTask Relationship Types:
blocks: Hard dependency (A must complete before B starts)relates_to: Thematic connection (no dependency, can parallelize)part_of: Grouping (A is part of epic B)Create tasks using speculate commands:
speculate add '{
"tasks": [
{
"id": "design-auth-flow",
"description": "Design authentication flow and data models",
"estimate_hours": 2,
"acceptance_criteria": [
"Flow diagram created",
"Data models defined",
"Edge cases documented"
]
},
{
"id": "implement-login",
"description": "Implement login endpoint with JWT",
"estimate_hours": 3,
"acceptance_criteria": [
"POST /login endpoint functional",
"JWT tokens generated",
"Password validation working"
]
}
],
"relationships": [
{"from": "design-auth-flow", "to": "implement-login", "type": "blocks"}
]
}'
Naming Examples:
design-api-schema, implement-crud, test-webhooksDesign-API-Schema (uppercase), design api schema (spaces)implement-and-test-api (has "and" - split into two tasks)See references/patterns.md for detailed decomposition patterns.
Show comprehensive plan with:
Use visual Mermaid diagram:
speculate available
Outputs color-coded diagram:
Example presentation:
Goal: Add two-factor authentication
Task Graph (7 tasks, ~18 hours):
```mermaid
graph TD
design_auth["design-auth-flow (2h) [โ]"]
create_schema["create-user-schema (2h) [โ]"]
implement_totp["implement-totp (4h) [โ]"]
update_login["update-login-flow (3h) [โ]"]
add_ui["add-2fa-settings (3h) [โ]"]
write_tests["write-auth-tests (3h) [โ]"]
security_audit["security-audit (1h) [โ]"]
design_auth --> create_schema
create_schema --> implement_totp
implement_totp --> update_login
implement_totp --> add_ui
update_login --> write_tests
add_ui --> write_tests
write_tests --> security_audit
classDef ready fill:#98FB98,stroke:#2E7D32,stroke-width:3px
class design_auth ready
classDef blocked fill:#D3D3D3,stroke:#666,stroke-width:1px
class create_schema,implement_totp,update_login,add_ui,write_tests,security_audit blocked
```
**Ready to start:**
- design-auth-flow (2h) - Unblocks everything
**Parallel opportunities:**
- After implement-totp completes: update-login-flow and add-2fa-settings can run in parallel
Ready to begin?
Starting work:
Mark task as in-progress and mirror to TodoWrite:
speculate start design-auth-flow
Add to TodoWrite for active tracking:
- Design auth flow and data models
During work:
Reference acceptance criteria from graph. Guide implementation to meet each criterion.
Completing work:
Mark task complete:
speculate complete design-auth-flow
Show impact with after query:
speculate after design-auth-flow
Displays Mermaid diagram highlighting:
Celebrate progress and suggest next:
โ design-auth-flow complete!
This unblocked:
- create-user-schema (2h)
Suggested next: create-user-schema
Start now?
Tracking progress:
Show current state:
speculate show design-auth-flow
View all pending tasks:
speculate available
When scope changes, update the graph:
Adding tasks:
speculate add '{
"tasks": [{"id": "add-backup-codes", "estimate_hours": 2}],
"relationships": [
{"from": "implement-totp", "to": "add-backup-codes", "type": "blocks"}
]
}'
Updating tasks:
speculate update '{
"tasks": [{"id": "implement-totp", "estimate_hours": 5}]
}'
Removing tasks:
speculate delete '{
"tasks": ["add-backup-codes"]
}'
Inform user of changes and new total estimate.
Write Commands (modify graph, auto-save):
# Add tasks and relationships
speculate add '<json>'
# Update task properties
speculate update '<json>'
# Delete tasks and relationships
speculate delete '<json>'
# Quick status changes
speculate start <task-id>
speculate complete <task-id>
# Validate graph health
speculate validate
Query Commands (read-only):
# Show pending tasks (Mermaid diagram)
speculate available
# Show downstream impact (Mermaid diagram)
speculate after <task-id>
# Show task details (text)
speculate show <task-id>
See references/protocol.md for complete JSON schemas and examples.
Feature Addition (Authentication, Payments):
Refactoring:
API Development:
Integration (3rd party services):
Performance Optimization:
See references/patterns.md for detailed examples with JSON.
1 hour: Small, well-defined
2 hours: Typical implementation
3-4 hours: Complex but bounded
> 4 hours: Too large, decompose further
Validate graph health before execution:
speculate validate
Checks for:
Fix issues before proceeding.
Mirror active task to TodoWrite for visibility:
When starting:
speculate start implement-login
Then add to todos:
TodoWrite: Implement login endpoint with JWT
When completing:
speculate complete implement-login
Mark todo complete. This provides dual tracking: speculate for overall plan, TodoWrite for active work.
Start with high-level breakdown, refine as understanding grows:
Initial:
{"tasks": [{"id": "add-authentication", "estimate_hours": 16}]}
After investigation:
{"tasks": [
{"id": "design-auth-flow", "estimate_hours": 2},
{"id": "implement-jwt", "estimate_hours": 4},
{"id": "add-login-ui", "estimate_hours": 3},
{"id": "write-auth-tests", "estimate_hours": 3}
]}
Delete rough task, add refined tasks. Graph evolves with understanding.
Activate skill when: User needs planning for complex multi-step work
Ask questions for: Complex features with multiple valid approaches
Generate graph with: Atomic tasks, clear dependencies, realistic estimates
Present clearly: Mermaid diagram + ready tasks + total estimate
Guide execution: Mark start/complete, suggest next, celebrate progress
Adapt to changes: Update graph when scope shifts
Remember: Plan the work, work the plan. Atomic tasks with clear dependencies create executable roadmaps.