$npx -y skills add obra/superpowers --skill writing-plansUse when you have a spec or requirements for a multi-step task, before touching code
| 1 | # Writing Plans |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste. Document everything they need to know: which files to touch for each task, code, testing, docs they might need to check, how to test it. Give them the whole plan as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits. |
| 6 | |
| 7 | Assume they are a skilled developer, but know almost nothing about our toolset or problem domain. Assume they don't know good test design very well. |
| 8 | |
| 9 | **Announce at start:** "I'm using the writing-plans skill to create the implementation plan." |
| 10 | |
| 11 | **Context:** If working in an isolated worktree, it should have been created via the `superpowers:using-git-worktrees` skill at execution time. |
| 12 | |
| 13 | **Save plans to:** `docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md` |
| 14 | - (User preferences for plan location override this default) |
| 15 | |
| 16 | ## Scope Check |
| 17 | |
| 18 | If the spec covers multiple independent subsystems, it should have been broken into sub-project specs during brainstorming. If it wasn't, suggest breaking this into separate plans — one per subsystem. Each plan should produce working, testable software on its own. |
| 19 | |
| 20 | ## File Structure |
| 21 | |
| 22 | Before defining tasks, map out which files will be created or modified and what each one is responsible for. This is where decomposition decisions get locked in. |
| 23 | |
| 24 | - Design units with clear boundaries and well-defined interfaces. Each file should have one clear responsibility. |
| 25 | - You reason best about code you can hold in context at once, and your edits are more reliable when files are focused. Prefer smaller, focused files over large ones that do too much. |
| 26 | - Files that change together should live together. Split by responsibility, not by technical layer. |
| 27 | - In existing codebases, follow established patterns. If the codebase uses large files, don't unilaterally restructure - but if a file you're modifying has grown unwieldy, including a split in the plan is reasonable. |
| 28 | |
| 29 | This structure informs the task decomposition. Each task should produce self-contained changes that make sense independently. |
| 30 | |
| 31 | ## Task Right-Sizing |
| 32 | |
| 33 | A task is the smallest unit that carries its own test cycle and is worth a |
| 34 | fresh reviewer's gate. When drawing task boundaries: fold setup, |
| 35 | configuration, scaffolding, and documentation steps into the task whose |
| 36 | deliverable needs them; split only where a reviewer could meaningfully |
| 37 | reject one task while approving its neighbor. Each task ends with an |
| 38 | independently testable deliverable. |
| 39 | |
| 40 | ## Bite-Sized Task Granularity |
| 41 | |
| 42 | **Each step is one action (2-5 minutes):** |
| 43 | - "Write the failing test" - step |
| 44 | - "Run it to make sure it fails" - step |
| 45 | - "Implement the minimal code to make the test pass" - step |
| 46 | - "Run the tests and make sure they pass" - step |
| 47 | - "Commit" - step |
| 48 | |
| 49 | ## Plan Document Header |
| 50 | |
| 51 | **Every plan MUST start with this header:** |
| 52 | |
| 53 | ```markdown |
| 54 | # [Feature Name] Implementation Plan |
| 55 | |
| 56 | > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| 57 | |
| 58 | **Goal:** [One sentence describing what this builds] |
| 59 | |
| 60 | **Architecture:** [2-3 sentences about approach] |
| 61 | |
| 62 | **Tech Stack:** [Key technologies/libraries] |
| 63 | |
| 64 | ## Global Constraints |
| 65 | |
| 66 | [The spec's project-wide requirements — version floors, dependency limits, |
| 67 | naming and copy rules, platform requirements — one line each, with exact |
| 68 | values copied verbatim from the spec. Every task's requirements implicitly |
| 69 | include this section.] |
| 70 | |
| 71 | --- |
| 72 | ``` |
| 73 | |
| 74 | ## Task Structure |
| 75 | |
| 76 | ````markdown |
| 77 | ### Task N: [Component Name] |
| 78 | |
| 79 | **Files:** |
| 80 | - Create: `exact/path/to/file.py` |
| 81 | - Modify: `exact/path/to/existing.py:123-145` |
| 82 | - Test: `tests/exact/path/to/test.py` |
| 83 | |
| 84 | **Interfaces:** |
| 85 | - Consumes: [what this task uses from earlier tasks — exact signatures] |
| 86 | - Produces: [what later tasks rely on — exact function names, parameter |
| 87 | and return types. A task's implementer sees only their own task; this |
| 88 | block is how they learn the names and types neighboring tasks use.] |
| 89 | |
| 90 | - [ ] **Step 1: Write the failing test** |
| 91 | |
| 92 | ```python |
| 93 | def test_specific_behavior(): |
| 94 | result = function(input) |
| 95 | assert result == expected |
| 96 | ``` |
| 97 | |
| 98 | - [ ] **Step 2: Run test to verify it fails** |
| 99 | |
| 100 | Run: `pytest tests/path/test.py::test_name -v` |
| 101 | Expected: FAIL with "function not defined" |
| 102 | |
| 103 | - [ ] **Step 3: Write minimal implementation** |
| 104 | |
| 105 | ```python |
| 106 | def function(input): |
| 107 | return expected |
| 108 | ``` |
| 109 | |
| 110 | - [ ] **Step 4: Run test to verify it passes** |
| 111 | |
| 112 | Run: `pytest tests/path/test.py::test_name -v` |
| 113 | Expected: PASS |
| 114 | |
| 115 | - [ ] **Step 5: Commit** |
| 116 | |
| 117 | ```bash |
| 118 | git add tests/path/test.py src/path/file.py |
| 119 | git commit -m "feat: add specific feature" |
| 120 | ``` |
| 121 | ```` |
| 122 | |
| 123 | ## No Placeholders |
| 124 | |
| 125 | Every step must contain the actual content an engineer needs. These are **plan failures** — never write them: |
| 126 | - "TBD", "TODO", "implement later", "fill in details" |
| 127 | - |