agentleFS
maccydeemaccydee/claude-planning-skills/writing-plans/SKILL.md

writing-plans

Skill3 starsChanged 3 months agoMITView on GitHub

Write an implementation plan (PLAN-*.md) that a zero-context executor can follow to completion: exact file paths, complete code, test-first cycles, and verification steps. Use when asked to "write a plan", "make a plan", "draft a plan", or to turn a design into an implementation plan. Follows brainstorming; precedes executing-plans.

187 other projects use a version of this, 52 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • ryanportfolioSkill

    addskill

    Create, import, update, or install repo or personal skills: runtime ownership, resources, discovery checks.

    Also in 6 projects that use this

  • ryanportfolioSkill

    apply-firmware

    Bring current folder (plain folder, existing repo, old or partial firmware copy) up to full Harness Firmware in place. Mirror external repo → adopt-repo.

    Also in 6 projects that use this

  • +2 more from Leodorareluctant259
  • +6 more from ryanportfolio

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 9 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 169 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Provided: create the directory if missing, write to {OUTPUT_DIR}/PLAN.md.

    line 25
  2. Very specific:

    Standalone: write to docs/plans/YYYY-MM-DD-PLAN-<feature>.md.

    line 26
  3. Distinctive:

    Write the failing test

    line 32
  4. Distinctive:

    Run it, confirm it fails for the right reason

    line 33
  5. Distinctive:

    Write the minimal code to pass

    line 34
  6. Distinctive:

    Run it, confirm it passes

    line 35
  7. Distinctive:

    Every plan opens with this, so the executor knows the goal and can see progress at a glance:

    line 40
  8. Distinctive:

    Keep the header's Progress counts in sync with the task totals.

    line 72
  9. Distinctive:

    When a task creates an HTTP/gRPC server, a consumer/producer, or a background worker, specify its logging so observability isn't silently …

    line 141
  10. Very specific:

    If Tech Stack contains Go (\bgo\b/\bgolang\b), read ${CLAUDE_SKILL_DIR}/patterns/execution-context-go.md and embed it as a Language Rules: …

    line 148
  11. Very specific:

    If it contains Python (\bpython\b/\bpy\b), do the same with ${CLAUDE_SKILL_DIR}/patterns/execution-context-python.md.

    line 150
  12. Distinctive:

    When you write code examples in a plan, mark intent an executor would otherwise "clean away", because non-annotated complexity is …

    line 158
  13. Very specific:

    [RFC NNNN §N.N]: when a snippet touches an external protocol (HTTP headers, tokens, TLS, encoding), citing any compliance point that …

    line 162
  14. Very specific:

    When you write requirements with modal verbs (MUST/SHOULD/MAY), frame them positively, state what to do rather than what to avoid.

    line 168
  15. Distinctive:

    If the requirements fully dictate every decision, skip the file, don't create it for its own sake.

    line 180
  16. Very specific:

    All tasks start 🔴 NOT_STARTED, and the Progress counts match the task total.

    line 187

“Common” is measured: kept by at least 6 in 10 of the 169 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Writing Plans

What a plan is for

A plan is documentation for whoever implements it, and that implementer has zero context for this codebase. It might be a fresh session, a teammate, or you in a month. So everything they need goes on the page: which files to touch, the actual code, how to test it, and how to know it worked. If the plan says "add validation" instead of showing the validation, the plan has failed, because the executor now has to guess, and guessing is where plans go wrong.

Assume the executor is a capable developer who knows almost nothing about this project's tools, conventions, or domain, and isn't a strong test designer. Write for that person. Spell out the boundaries; stay quiet about internals they can figure out.

The habits that keep plans executable: DRY, YAGNI, test-first, small tasks, frequent commits.

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

Think the approach through before you write, including the alternatives and edge cases, so the plan reflects a considered design rather than the first idea.

Where the plan is saved

--output-dir <path> (parse with --output-dir\s+(\S+)):

  • Provided: create the directory if missing, write to {OUTPUT_DIR}/PLAN.md.
  • Standalone: write to docs/plans/YYYY-MM-DD-PLAN-<feature>.md.

Task size

Each step is one action, roughly 2-5 minutes. That granularity is what lets an executor make steady, verifiable progress instead of taking a large leap and landing somewhere wrong. A typical test-first task breaks down as:

  • Write the failing test
  • Run it, confirm it fails for the right reason
  • Write the minimal code to pass
  • Run it, confirm it passes
  • Commit

Plan header

Every plan opens with this, so the executor knows the goal and can see progress at a glance:

# [Feature] Implementation Plan

> **For the executor:** implement this task-by-task with the executing-plans skill.

**Goal:** [one sentence: what this builds]
**Architecture:** [2-3 sentences: the approach]
**Tech Stack:** [key technologies/libraries]

## Progress

| Status | Count |
|--------|-------|
| 🔴 NOT_STARTED | N |
| 🟡 IN_PROGRESS | 0 |
| 🟢 COMPLETED | 0 |
| ⚪ BLOCKED | 0 |

Progress markers

Each task carries its status inline (updated in place, not tracked in a separate section):

EmojiStatusMeaning
🔴NOT_STARTEDNot yet claimed
🟡IN_PROGRESSBeing implemented
🟢COMPLETEDVerified and committed
⚪BLOCKEDCan't proceed (dependency or issue)

Keep the header's Progress counts in sync with the task totals.

Task structure

### Task N: [Component] 🔴 NOT_STARTED

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

**Behavioral contract:**
| Input | Expected output |
|-------|-----------------|
| `<value>` | `<concrete result, or error containing "phrase">` |

**Step 1: Write the failing test (RED)**
```python
def test_specific_behavior():
    assert function(input) == expected

Step 2: Run it, confirm it fails (verify RED) Run: pytest tests/path/test.py::test_name -v Expected: FAIL ("function not defined"). If it passes or errors, fix the test before moving on.

Step 3: Minimal implementation (GREEN)

def function(input):
    return expected

Only enough to pass. No extra features.

Step 4: Run it, confirm it passes (verify GREEN) Run: pytest tests/path/test.py::test_name -v Expected: PASS, no warnings.

Step 5: Commit

git add tests/path/test.py src/path/file.py
git commit -m "feat: add specific behavior"

Step 6: Refactor if needed, remove duplication, improve names, keep tests green.


The test-first cycle (RED → verify RED → GREEN → verify GREEN → refactor) is the spine of every code task. Writing the test first is what forces the behavioral contract to be concrete before any implementation exists to rationalize.

## How much implementation code to write

Write out the full Step 3 implementation when the logic is non-obvious: a tricky algorithm, an external protocol, concurrency, security-sensitive handling, or anything with more than one reasonable shape, since that's where an executor's guess and your intent can diverge. For a simple, mechanical task — a pure function with an obvious shape from its signature, wiring an existing piece to a new call site, a straightforward CRUD handler — the behavioral contract table and the test are enough; let the executor write the few lines that satisfy it rather than transcribing code you'd have written identically anyway. The contract still has to be concrete either way; what's optional is dictating the implementation, not the behavior.

By the time execution reaches a later task, the codebase has moved under any code written this far in advance anyway (renamed symbols, shifted line numbers) — so prescribe verbatim code where getting it wrong is costly, and leave the rest to the executor's judgment against the contract.

## Behavioral contracts must be concrete

State behavior as `(input, expected output)` pairs, not prose. Prose like "handles invalid input gracefully" isn't verifiable; `(input: "", expected: error containing "required")` is. Every task's contract table covers the boundaries: empty input, invalid input, not-found, and the happy path.

## Mock topology (for tasks mocking 3+ external dependencies)

Executor difficulty tracks mock surface area far more than business-logic complexity, so when a task mocks three or more external dependencies, map the test boundary explicitly:

| Dependency | Mock entry point | Method chain | Side effects |
|------------|------------------|--------------|--------------|
| `pulsar.Client` | `mock_client` | `Client → subscribe → consumer` | `create_producer.side_effect = [prod, dlq]` |

## Operational logging (for service components)

When a task creates an HTTP/gRPC server, a consumer/producer, or a background worker, specify its logging so observability isn't silently dropped:
- Lifecycle: startup, ready, shutdown, shutdown-complete (with ports, counts, addresses)
- Error wrapping: exported functions wrap errors with call-site context (e.g. `fmt.Errorf("loading config: %w", err)`)
- State transitions: reload success/failure with before/after counts, circuit-breaker changes

## Language-specific rules

If **Tech Stack** contains Go (`\bgo\b`/`\bgolang\b`), read `${CLAUDE_SKILL_DIR}/patterns/execution-context-go.md` and embed it as a `**Language Rules:**` block in every task.

If it contains Python (`\bpython\b`/`\bpy\b`), do the same with `${CLAUDE_SKILL_DIR}/patterns/execution-context-python.md`.

## Production readiness (for service projects)

If the tech stack or description mentions a service (`API`, `server`, `HTTP`, `gRPC`, `worker`, `consumer`, `producer`), read `${CLAUDE_SKILL_DIR}/patterns/production-readiness-checklist.md` and give each of its six domains (Observability, Health & Lifecycle, Resilience, Security, Configuration, Deployment) a disposition: covered by task N, a new task added, or explicitly N/A. Don't skip a domain silently, a silent gap reads as "handled" when it wasn't. For a CLI, library, or script, skip this section.

## Operational fidelity annotations

When you write code examples in a plan, mark intent an executor would otherwise "clean away", because non-annotated complexity is invisible, and invisible complexity gets simplified out:

- **`(MEASURED, what)`** on any field whose name implies measurement (`*_ms`, `duration`, `elapsed`, `count`, `latency`). A hardcoded zero passes the type checker and every test while quietly destroying the metric.
- **`(WHY: ...)`** on a pattern more complex than the obvious alternative, so it survives an executor optimizing for "clean code" (e.g. a lazy import for an optional dependency, a fail-fast guard).
- **`[RFC NNNN §N.N]`** when a snippet touches an external protocol (HTTP headers, tokens, TLS, encoding), citing any compliance point that diverges from a naive reading (e.g. header lookups are case-insensitive).

These doubly serve as model-routing signals: executing-plans picks a model per task (haiku for mechanical, sonnet for most, opus for the rest), and a task carrying a `(WHY: ...)` tag, a mock topology table, or an explicit high-risk flag is routed to opus rather than the default. Mark a task that way when it is, so it lands with the right model without you having to say so twice.

## Requirement wording

When you write requirements with modal verbs (MUST/SHOULD/MAY), frame them positively, state what to do rather than what to avoid. Positive requirements are easier to verify and harder to misread.

## Planning assumptions (ASSUMPTIONS.md)

If any decision was made where the requirements were silent or contradictory, record it in `ASSUMPTIONS.md` next to the plan, one entry per assumption: what was assumed, what the alternatives were, and why this choice. This is what lets a reviewer catch a wrong assumption before it's built rather than after.

```markdown
## A-001 | gap-fill | OPEN
Requirements don't specify config format. Assumed YAML, 3 of 4 existing config files use it.
Alternatives: TOML, JSON, env-only.

If the requirements fully dictate every decision, skip the file, don't create it for its own sake.

Before you finish

  • Exact file paths, every time.
  • Complete code in the plan, not "add validation."
  • Exact commands with their expected output.
  • All tasks start 🔴 NOT_STARTED, and the Progress counts match the task total.
  • Batch independent tool calls (read all the files you need in one message, then make the edits), sequential round-trips waste time when the calls don't depend on each other.

Next step

Once the plan is saved, ask what to do next with AskUserQuestion:

  • Execute now, load executing-plans and implement it task-by-task in this session.
  • Fresh session, open a new session and paste the plan path; a clean context often executes more reliably.
  • Stop here, the plan is saved.

Related skills

SkillWhen
brainstormingBefore this, when the design isn't settled yet
executing-plansAfter this, to implement the plan in reviewed batches
skepticTo pressure-test the plan's scope before building it

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.