name: 02-plan description: "Turn requirements into an execution-ready plan with TDD-gated implementation units. Use when a brainstorm artifact exists and is ready for planning."
Plan
Use this skill when requirements are ready to become an execution-ready plan.
See shared pipeline instructions for model routing and pipeline behavior.
Core rules
- Load project rules (4 steps):
- Load
rules/common/development-workflow.mdandrules/common/testing.md - Detect project language via language detection
- Load matching language-specific rules (e.g.,
rules/typescript/) - If frontend/browser concerns, also load
rules/web/files
- Load
- Priority: project-level
{repo-root}/rules/overrides package defaults - Search
docs/brainstorms/for relevant requirements first - Run solution search (see
references/solution-search.md):- Extract keywords →
grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/ - Read frontmatter only (first 15 lines) of matches → score by severity + tag relevance
- Fully read top 3 candidates
- Extract keywords →
- Write plan to
docs/plans/ - If plan exists, use
plan_diffto compare and patch incrementally - End by recommending
03-work
Hard gates — TDD enforcement
Every unit follows RED → GREEN → REFACTOR:
TDD violation rejection criteria — reject and revise if any unit:
- Implements code before failing test
- Lacks RED step verification
- Lacks GREEN step verification
- Skips verification
- Uses placeholders or unstated assumptions
Planning flow
- Load context: consume latest handoff before any broad file reads —
context_handoff loador read.context/compound-engineering/handoffs/latest.md. If found, useactiveFilesandblockeras starting point. If not found, proceed normally (new project). - Read relevant brainstorm from
docs/brainstorms/ - Run solution search (keywords → grep frontmatter → read top 3)
- Gather repository context
- Source-driven check: For each unit that involves framework/library APIs, add a note: "Verify against official docs before implementing."
- If plan exists: use
plan_diffcompare→ review with user →patch - If no plan: write new plan under
docs/plans/usingreferences/plan-template.md - Structure work using
references/implementation-unit-template.md - Verify every unit follows TDD gates
Optional: CEO Review
After plan is written, offer strategic review:
Plan ready. How to review?
- A) Just go — trust the plan
- B) CEO Review — challenge premises, dream-state mapping
- C) Strict Review — CEO + error maps, failure modes, test diagrams
If B or C: read references/ceo-review-mode.md and execute review flow.
After review: update plan artifact, then handoff to 03-work.
Artifact output
- Plan:
docs/plans/<slug>.md - Use
references/plan-template.mdstructure - Implementation units follow
references/implementation-unit-template.md
Before finishing this skill, apply the completion checklist in shared pipeline instructions.