# Writing Plans
<!--
ref: @skills/writing-plans
tags: [planning, implementation-plan, task-decomposition, handoff]
triggers: [spec ready to implement, multi-step task, writing implementation plan, handing work to executor agents]
trigger_prompt: Use when a spec or requirements exist for a multi-step task, before touching code.
category: engineering
complements: [@skills/brainstorming, @protocol/handoff-adapters]
version: 1
updated_at: 2026-07-11T14:24:38.368Z
-->

Write implementation plans assuming the implementing engineer has zero context for the codebase and questionable taste: which files to touch for each task, the actual code, how to test it, which docs to check. The whole plan arrives as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.

Assume a skilled developer who knows almost nothing about this toolset or problem domain, and doesn't know good test design well.

**Scope check first:** a spec covering multiple independent subsystems should have been decomposed during design. If it wasn't, split into one plan per subsystem — each producing working, testable software on its own.

## File structure before tasks

Map which files will be created or modified and what each is responsible for — this locks in decomposition decisions:

- Units with clear boundaries and well-defined interfaces; one responsibility per file.
- Prefer smaller focused files (agents reason best over code that fits in context; edits are more reliable).
- Files that change together live together — split by responsibility, not technical layer.
- In existing codebases, follow established patterns; don't unilaterally restructure, but splitting a file you're modifying that has grown unwieldy is reasonable to include.

## Task right-sizing

A task is the smallest unit that carries its own test cycle and is worth a fresh reviewer's gate. Fold setup, configuration, scaffolding, and documentation into the task whose deliverable needs them; split only where a reviewer could meaningfully reject one task while approving its neighbor. Each task ends with an independently testable deliverable.

**Each step is one action (2–5 minutes):** write the failing test → run it to confirm it fails → implement the minimal code → run the tests to confirm they pass → commit.

## Plan document header

```markdown
# [Feature Name] Implementation Plan

> **For agentic workers:** execute task-by-task (fresh subagent per task
> recommended; otherwise inline with review checkpoints). Steps use
> checkbox (`- [ ]`) syntax for tracking.

**Goal:** [one sentence]
**Architecture:** [2–3 sentences]
**Tech Stack:** [key technologies/libraries]

## Global Constraints
[Project-wide requirements from the spec — version floors, dependency
limits, naming/copy rules, platform requirements — one line each, exact
values copied verbatim. Every task implicitly includes this section.]
```

## Task structure

```markdown
### Task N: [Component Name]

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

**Interfaces:**
- Consumes: [what this task uses from earlier tasks — exact signatures]
- Produces: [what later tasks rely on — exact names, parameter and
  return types. A task's implementer sees only their own task; this
  block is how they learn what neighboring tasks expect.]

- [ ] Step 1: Write the failing test        [actual test code block]
- [ ] Step 2: Run test, verify it fails     [exact command + expected failure]
- [ ] Step 3: Write minimal implementation  [actual code block]
- [ ] Step 4: Run test, verify it passes    [exact command + expected PASS]
- [ ] Step 5: Commit                        [exact git commands]
```

## No placeholders

Every step contains the actual content the engineer needs. These are plan failures:

- "TBD", "TODO", "implement later", "fill in details"
- "Add appropriate error handling" / "add validation" / "handle edge cases"
- "Write tests for the above" without actual test code
- "Similar to Task N" — repeat the code; tasks may be read out of order
- Steps that describe what to do without showing how (code steps require code blocks)
- References to types, functions, or methods not defined in any task

## Self-review (run on yourself, not a subagent)

1. **Spec coverage:** for each requirement in the spec, point to the task that implements it; list gaps and add missing tasks.
2. **Placeholder scan:** search the plan for the patterns above; fix them.
3. **Type consistency:** signatures and names used in later tasks match earlier definitions — `clearLayers()` in Task 3 but `clearFullLayers()` in Task 7 is a bug.

Fix issues inline and move on.

## Execution handoff

After saving the plan, offer the execution choice: **subagent-driven** (fresh subagent per task, review between tasks — recommended where subagents are available; see `@protocol/handoff-adapters` for the files-over-context handoff pattern) or **inline execution** (batch execution in-session with review checkpoints).

---

**Source:** [writing-plans](https://github.com/obra/superpowers/blob/main/skills/writing-plans/SKILL.md) — Superpowers by Jesse Vincent (obra), MIT.
**Converted via:** `@protocol/skill-to-protocol`

---

*Related: `@content/web/huggingface/2026-11-29-boundary-aware-policy-learning-robot-manipulation` · `@knowledge/protocols/agent-to-human-handoff-context-preload` · `@protocol/memento` · `@content/youtube/yifan-bth/claude-code-5-ways-it-beats-ai-code-editors` · `@content/youtube/cole-medin/11-more-tiny-coding-agent-fixes-with-a-stupid-amount-of-payoff-learn-these-now`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*