Writing plans enhanced

From markus41/claude · View interactive version

Writing plans enhanced is an AI agent skill from the GitHub repository markus41/claude. Enhanced plan-authoring skill with Pre-Writing context gathering, task metadata, non-TDD templates, Red Flags, telemetry, and an automated plan linter. Use when you have a spec or requirements for a multi-step task, before touching code.

How to use this skill

Skill file

Writing Plans (Enhanced)

Overview

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, code to write, commands to run, and how to verify each step. Give them the whole plan as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.

Assume they are a skilled developer, but know almost nothing about our toolset or problem domain. Assume they don't know good test design well.

Announce at start: "I'm using the writing-plans skill to create the implementation plan."

Context: This should be run in a dedicated worktree (created by brainstorming skill).

Save plans to: docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md

When to Use

digraph when_to_use {
    "Have spec or requirements?" [shape=diamond];
    "Single-step or exploratory?" [shape=diamond];
    "Covers multiple subsystems?" [shape=diamond];
    "writing-plans (this skill)" [shape=box];
    "Just implement directly" [shape=box];
    "Split into sub-plans first" [shape=box];
    "Use brainstorming skill first" [shape=box];

    "Have spec or requirements?" -> "Single-step or exploratory?" [label="yes"];
    "Have spec or requirements?" -> "Use brainstorming skill first" [label="no"];
    "Single-step or exploratory?" -> "Just implement directly" [label="yes"];
    "Single-step or exploratory?" -> "Covers multiple subsystems?" [label="no, multi-step"];
    "Covers multiple subsystems?" -> "Split into sub-plans first" [label="yes"];
    "Covers multiple subsystems?" -> "writing-plans (this skill)" [label="no, single subsystem"];
}

The Process

Write plans in five phases. Each phase has outputs the next phase depends on.

  1. Pre-Writing — Gather Context: read spec, study codebase, identify patterns.
  2. Scope Check: verify this is a single subsystem sized right for one plan.
  3. File Structure: map files to create/modify before decomposing tasks.
  4. Task Decomposition: bite-sized TDD steps (and non-TDD variants where appropriate).
  5. Self-Review: check against spec, scan for placeholders, verify type consistency.

Phase 1: Pre-Writing — Gather Context

Don't skip this. A plan written without context produces tasks that conflict with the codebase and force the implementer to guess.

Read the spec twice. The first read builds intuition. The second catches the details you glossed over. Note every explicit requirement and every implicit assumption.

Study the codebase before decomposing tasks:

Identify risks and unknowns:

Capture findings briefly at the top of the plan under Context (codebase conventions, reference patterns, known risks). The implementer reads this before touching code.

Phase 2: Scope Check

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.

Plan size guidance:

| Task count | Shape | Notes |

|------------|-------|-------|

| 3–10 | Single plan | Normal size — keep tasks in one file |

| 11–20 | Single plan with phases | Group tasks under ## Phase N: headings |

| 20+ | Split into multiple plans | One per phase or subsystem; link them |

If the plan keeps growing past 20 tasks, stop and ask: is this actually multiple features? Split before writing tasks you don't need yet (YAGNI).

Phase 3: File Structure

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.

This structure informs the task decomposition. Each task should produce self-contained changes that make sense independently.

Phase 4: Task Decomposition

Bite-Sized Step Granularity

Each step is one action (2–5 minutes):

Task Metadata

Every task should carry metadata that tells the implementer (or a subagent) how to execute it:

### Task N: [Component Name]

**Type:** TDD | Config | Refactor | Migration | Documentation | Infrastructure
**Depends on:** Task M (or: none)
**Parallel-safe:** yes | no
**Risk:** low | medium | high — [one-line reason if medium/high]

Non-TDD Task Patterns

Not every task fits the red–green–commit loop. For non-code tasks, substitute a verification style that proves the task succeeded. See ./task-templates.md for full templates.

| Task type | Verification instead of test |

|-----------|------------------------------|

| Config change | Load config, print resolved value, assert expected |

| File move/rename | git status shows the rename; imports still resolve; tests still pass |

| Documentation | Cross-links resolve; code blocks parse; examples runnable |

| Infrastructure / IaC | terraform plan / kubectl diff shows expected delta; dry-run |

| Refactor (no behavior change) | All pre-existing tests still pass; no new tests needed |

| Migration (data/schema) | Dry-run succeeds; rollback plan present; applied on copy first |

For any non-TDD task, state the verification command and expected output explicitly.

Plan Document Header

Every plan MUST start with this header:

# [Feature Name] Implementation Plan

> **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.

**Goal:** [One sentence describing what this builds]

**Architecture:** [2-3 sentences about approach]

**Tech Stack:** [Key technologies/libraries]

**Context:**
- Codebase conventions: [one line]
- Reference pattern: [file path to similar feature]
- Known risks: [one line or "none"]

---

Task Structure

Standard TDD Task

### Task N: [Component Name]

**Type:** TDD
**Depends on:** none
**Parallel-safe:** yes
**Risk:** low

**Files:**
- Create: `exact/path/to/file.py`
- Modify: `exact/path/to/existing.py:123-145`
- Test: `tests/exact/path/to/test.py`

- [ ] **Step 1: Write the failing test**

def test_specific_behavior():

result = function(input)

assert result == expected


- [ ] **Step 2: Run test to verify it fails**

Run: `pytest tests/path/test.py::test_name -v`
Expected: FAIL with "function not defined"

- [ ] **Step 3: Write minimal implementation**

def function(input):

return expected


- [ ] **Step 4: Run test to verify it passes**

Run: `pytest tests/path/test.py::test_name -v`
Expected: PASS

- [ ] **Step 5: Commit**

git add tests/path/test.py src/path/file.py

git commit -m "feat: add specific feature"

For non-TDD task templates (config, migration, refactor, documentation, infrastructure), see ./task-templates.md.

No Placeholders

Every step must contain the actual content an engineer needs. These are plan failures — never write them:

Remember

Phase 5: Self-Review

After writing the complete plan, look at the spec with fresh eyes and check the plan against it. This is a checklist you run yourself — not a subagent dispatch.

1. Spec coverage: Skim each section/requirement in the spec. Can you point to a task that implements it? List any gaps.

2. Placeholder scan: Search your plan for red flags — any of the patterns from the "No Placeholders" section above. Fix them.

3. Type consistency: Do the types, method signatures, and property names you used in later tasks match what you defined in earlier tasks? A function called clearLayers() in Task 3 but clearFullLayers() in Task 7 is a bug.

4. Dependency ordering: Does every Depends on: Task M refer to a task that comes before it? No forward references.

5. Verification completeness: Does every task have a verification step? TDD tasks need a "test passes" step. Non-TDD tasks need their specific verification (see Non-TDD Task Patterns).

6. Commit granularity: Does each task end with a commit? Are the commit messages specific ("feat: add foo") rather than vague ("wip", "update")?

7. Parallel-safe accuracy: For tasks marked Parallel-safe: yes, do they really not touch the same files or shared state as any other parallel-safe task?

If you find issues, fix them inline. No need to re-review — just fix and move on. If you find a spec requirement with no task, add the task.

Optional: Dispatch the plan-document reviewer subagent (see ./plan-document-reviewer-prompt.md) for an independent read. Recommended for high-risk plans or when the implementer will be a fresh subagent with no spec exposure.

Red Flags

Plan is not ready to hand off when:

Never:

Handling Plan Updates During Execution

Plans encounter reality. When execution reveals the plan is wrong:

Never let the plan drift from what's actually being built. A plan that doesn't match the code is worse than no plan.

Observability: Telemetry Per Task

Plans improve when you measure how they executed. For each task, capture at minimum:

| Metric | Why it matters |

|--------|----------------|

| Wall-clock duration | Compare to the 2–5 min step assumption; very long tasks were too big |

| Pass on first attempt? | Low first-pass-pass rate = tasks are ambiguous |

| Retry count before green | Each retry is a signal the plan missed something |

| Test count added | Under-tested tasks are risk hotspots |

| Commits per task | More than 1 = task was not atomic |

| Blocker reason (if stuck) | Feeds future Pre-Writing context notes |

Persist these as a sibling execution-log.md next to the plan file. When writing the next plan, read the previous log to spot patterns (e.g., "tasks involving migrations always needed 2+ retries — budget more context there"). This closes the Plan → Execute → Learn → Plan loop.

Automated Plan Validation

Run the linter on every plan before handing it off:

bash ./scripts/plan-lint.sh docs/superpowers/plans/YYYY-MM-DD-feature.md

Exit codes: 0 = clean, 1 = issues found (prints file:line: issue), 2 = usage error. The linter catches: placeholders (TBD/TODO/"fill in"/"implement later"), missing **Context:** block, tasks missing metadata, forward dependencies (Task 3 depends on Task 7), and vague commit messages ("wip", "update", <10 chars).

Linter passing is necessary but not sufficient — it catches mechanical errors; it cannot validate spec coverage. Run Self-Review (Phase 5) regardless.

Execution Handoff

After saving the plan, offer execution choice:

"Plan complete and saved to docs/superpowers/plans/<filename>.md. Two execution options:

1. Subagent-Driven (recommended) — I dispatch a fresh subagent per task, review between tasks, fast iteration

2. Inline Execution — Execute tasks in this session using executing-plans, batch execution with checkpoints

Which approach?"

If Subagent-Driven chosen:

If Inline Execution chosen:

Integration

Before this skill:

During this skill:

After this skill:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.