apps/docs/capabilities/rpg-method.mdx
The RPG (Repository Planning Graph) method is an advanced approach to creating Product Requirements Documents that generate highly-structured, dependency-aware task graphs. It's based on Microsoft Research's methodology for scalable codebase generation.
Use the RPG template (example_prd_rpg.md) for:
For simpler features or smaller projects, the standard example_prd.md template may be more appropriate.
Separate functional thinking (WHAT) from structural thinking (HOW):
Functional: "Data Validation capability with schema checking and rule enforcement"
↓
Structural: "src/validation/ with schema-validator.js and rule-validator.js"
This separation prevents mixing concerns and creates clearer module boundaries.
Never assume dependencies - always state them explicitly:
Good:
Module: data-ingestion
Depends on: [schema-validator, config-manager]
Bad:
Module: data-ingestion
(Assumes schema-validator exists somewhere)
Explicit dependencies enable:
Build foundation layers before higher layers:
Phase 0 (Foundation): error-handling, base-types, config
↓
Phase 1 (Data): validation, ingestion (depend on Phase 0)
↓
Phase 2 (Core): algorithms, pipelines (depend on Phase 1)
↓
Phase 3 (API): routes, handlers (depend on Phase 2)
Task Master automatically orders tasks based on this dependency chain.
Start broad, refine iteratively:
The RPG template guides you through 7 key sections:
Example:
Capability: Data Management
Feature: Schema validation
Description: Validate JSON against defined schemas
Inputs: JSON object, schema definition
Outputs: Validation result + error details
Behavior: Iterate fields, check types, enforce constraints
Example:
Capability: Data Management
→ Maps to: src/data/
├── schema-validator.js (Schema validation feature)
├── rule-validator.js (Rule validation feature)
└── index.js (Exports)
Example:
Foundation Layer (Phase 0):
- error-handling: No dependencies
- base-types: No dependencies
Data Layer (Phase 1):
- schema-validator: Depends on [base-types, error-handling]
- data-ingestion: Depends on [schema-validator]
Use a code-context-aware tool to fill out the template:
# In Claude Code, Cursor, or similar
"Create a PRD using @.taskmaster/templates/example_prd_rpg.txt for [your project]"
Why code context matters: The AI needs to understand your existing codebase to make informed decisions about:
Recommended tools:
task-master parse-prd .taskmaster/docs/your-prd.md --research
Task Master will:
Result: A dependency-aware task graph ready for topological execution.
task-master analyze-complexity --research
Review the complexity report to identify tasks that need expansion.
task-master expand --all --research
Break down complex tasks into manageable subtasks while preserving dependency chains.
| Aspect | Standard Template | RPG Template |
|---|---|---|
| Best for | Simple features | Complex systems |
| Dependency handling | Implicit | Explicit graph |
| Structure guidance | Minimal | Step-by-step |
| Examples | Few | Inline good/bad examples |
| Module boundaries | Vague | Precise mapping |
| Task ordering | Manual | Automatic (topological) |
| Learning curve | Low | Medium |
| Resulting task quality | Good | Excellent |
The dependency graph section is the most valuable. List all dependencies explicitly, even if they seem obvious.
Each feature should be independently testable. If a feature description is vague ("handle data"), break it into specific features.
Don't try to get everything perfect on the first pass:
task-master expand break down complex tasks furthertask-master parse-prd --research
The --research flag leverages AI to enhance task generation with domain knowledge.
task-master validate-dependencies
Check for circular dependencies or orphaned modules before starting implementation.
Bad: "Capability: validation.js"
Good: "Capability: Data Validation" → maps to "src/validation/"
Bad: "Module: utils"
Good: "Module: string-utilities" with clear exports
Bad: "Module: API handlers (needs validation)"
Good: "Module: API handlers, Depends on: [validation, error-handling]"
Without test strategy, the AI won't know what to test during implementation.
example_prd_rpg.md.taskmaster/docs/your-project.md (use .md for better editor support)task-master parse-prd .taskmaster/docs/your-project.md --researchtask-master analyze-complexity --researchtask-master expand --all --researchtask-master next