writing-plans

/home/avalon/.hermes/skills/software-development/writing-plans/SKILL.md · raw

Writing Implementation Plans

Overview

Write comprehensive implementation plans assuming the implementer has zero context for the codebase and questionable taste. Document everything they need: which files to touch, complete code, testing commands, docs to check, how to verify. Give them bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.

Assume the implementer is a skilled developer but knows almost nothing about the toolset or problem domain. Assume they don't know good test design very well.

Core principle: A good plan makes implementation obvious. If someone has to guess, the plan is incomplete.

When to Use

Always use before: - Implementing multi-step features - Breaking down complex requirements - Delegating to subagents via subagent-driven-development

Don't skip when: - Feature seems simple (assumptions cause bugs) - You plan to implement it yourself (future you needs guidance) - Working alone (documentation matters)

Risk-Adjusted Planning Granularity

Use two levels of detail instead of turning every mechanical action into a separately tracked milestone:

Canonical / user-visible plan

Track outcome-sized milestones that produce something working and verifiable. A milestone should usually combine its internal RED → GREEN → integration work and take roughly 30 minutes to a few hours—not 2–5 minutes.

Examples:

The canonical plan should show current goal, milestone state, hard gates, blockers, and acceptance evidence. Do not expose every test invocation, helper, documentation edit, or commit as a first-class milestone.

Implementer checklist

Inside an active milestone or delegation prompt, mechanical steps may still be 2–5 minutes:

These are execution instructions, not separate program-management phases.

Choose ceremony by risk

If the user says the work is taking too long, the plan has "been in progress all day," or asks to move faster, immediately audit planning overhead. Collapse adjacent internal phases, remove duplicate reviews/status updates, keep only hard safety gates, and state the shorter critical path.

Plan Document Structure

Header (Required)

Every plan MUST start with:

# [Feature Name] Implementation Plan

> **For Hermes:** Use subagent-driven-development skill to implement this plan task-by-task.

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

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

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

---

Task Structure

Each task follows this format:

### Task N: [Descriptive Name]

**Objective:** What this task accomplishes (one sentence)

**Files:**
- Create: `exact/path/to/new_file.py`
- Modify: `exact/path/to/existing.py:45-67` (line numbers if known)
- Test: `tests/path/to/test_file.py`

**Step 1: Write failing test**

```python
def test_specific_behavior():
    result = function(input)
    assert result == expected
```

**Step 2: Run test to verify failure**

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

**Step 3: Write minimal implementation**

```python
def function(input):
    return expected
```

**Step 4: Run test to verify pass**

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

**Step 5: Commit**

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

Writing Process

Step 1: Understand Requirements

Read and understand: - Feature requirements - Design documents or user description - Acceptance criteria - Constraints

Step 2: Explore the Codebase

Use Hermes tools to understand the project:

# Understand project structure
search_files("*.py", target="files", path="src/")

# Look at similar features
search_files("similar_pattern", path="src/", file_glob="*.py")

# Check existing tests
search_files("*.py", target="files", path="tests/")

# Read key files
read_file("src/app.py")

Step 3: Design Approach

Decide: - Architecture pattern - File organization - Dependencies needed - Testing strategy

Step 4: Write Tasks

Create tasks in order: 1. Setup/infrastructure 2. Core functionality (TDD for each) 3. Edge cases 4. Integration 5. Cleanup/documentation

Step 5: Add Complete Details

For each task, include: - Exact file paths (not "the config file" but src/config/settings.py) - Complete code examples (not "add validation" but the actual code) - Exact commands with expected output - Verification steps that prove the task works

Step 6: Review the Plan

Check: - [ ] Canonical milestones are outcome-sized and user-legible - [ ] Mechanical 2–5 minute steps stay inside the active milestone/delegation prompt - [ ] Tasks are sequential and logical - [ ] File paths and commands are exact where implementation detail is needed - [ ] Acceptance evidence is explicit - [ ] Review cadence matches risk instead of repeating after every helper/sub-step - [ ] Status updates occur at meaningful state changes, not after every test or commit - [ ] DRY, YAGNI, TDD, and the shortest safe critical path are preserved

Step 7: Save the Plan

mkdir -p docs/plans
# Save plan to docs/plans/YYYY-MM-DD-feature-name.md
git add docs/plans/
git commit -m "docs: add implementation plan for [feature]"

Principles

DRY (Don't Repeat Yourself)

Bad: Copy-paste validation in 3 places Good: Extract validation function, use everywhere

YAGNI (You Aren't Gonna Need It)

Bad: Add "flexibility" for future requirements Good: Implement only what's needed now

# Bad — YAGNI violation
class User:
    def __init__(self, name, email):
        self.name = name
        self.email = email
        self.preferences = {}  # Not needed yet!
        self.metadata = {}     # Not needed yet!

# Good — YAGNI
class User:
    def __init__(self, name, email):
        self.name = name
        self.email = email

TDD (Test-Driven Development)

Every task that produces code should include the full TDD cycle: 1. Write failing test 2. Run to verify failure 3. Write minimal code 4. Run to verify pass

See test-driven-development skill for details.

Coherent Commits

Commit at coherent checkpoints, not after every mechanical action. A good commit is independently testable and reviewable; it may contain several RED/GREEN microsteps that together deliver one behavior.

Use smaller commits when they materially improve rollback or isolate risky authority changes. Avoid documentation/status-only commit churn unless the plan itself is a durable project artifact.

Common Mistakes

Turning safety into ceremony

Do not confuse a detailed implementation checklist with the canonical delivery roadmap. Warning signs:

Correction: preserve the hard invariant, combine adjacent implementation slices into one working outcome, run one consolidated review at the boundary, and move immediately to the next externally meaningful proof. Put session-specific examples and rationale in references/outcome-sized-delivery.md.

Rushing to implementation before strategic alignment

When the user asks to "go through this from the start," "revisit the planning," or says a previous plan brushed over the important parts, do not jump straight into scaffolding or tactical tasks. First re-read the conversation context, restate the core product/architecture decision, identify explicit tradeoffs and decision gates, then save a strategy plan before implementation. For product/infrastructure planning, the right deliverable may be a strategy roadmap with phases, risks, economics, and gates rather than only bite-sized coding tasks.

Replacing AI product behavior with brittle deterministic shortcuts

For AI-native products, especially Alex-facing agent/chat products, do not write plans where core understanding is regex/string parsing or canned "fast answer" templates masquerading as intelligence. Deterministic code is appropriate for infrastructure boundaries — auth, loading cached artifacts, schema validation, redaction, cache existence checks, queues, and tests — but semantic routing and answer composition should remain model/agent-driven unless the user explicitly asks for a rules engine. If speed is the goal, plan an AI-guided cached-context path: load compact cached facts, pass them to an AI/semantic router or normal agent answer path, and fall back safely to deeper tool runs. Call out non-goals such as "no keyword intent router," "no canned reading as primary answer," and "no fake claims from partial cache."

Vague Tasks

Bad: "Add authentication" Good: "Create User model with email and password_hash fields"

Incomplete Code

Bad: "Step 1: Add validation function" Good: "Step 1: Add validation function" followed by the complete function code

Missing Verification

Bad: "Step 3: Test it works" Good: "Step 3: Run pytest tests/test_auth.py -v, expected: 3 passed"

Missing File Paths

Bad: "Create the model file" Good: "Create: src/models/user.py"

Execution Handoff

After saving the plan, choose the fastest safe execution cadence:

Remember

Outcome-sized canonical milestones
Mechanical detail inside implementer checklists
Exact paths/commands where they prevent guessing
TDD inside the batch
One consolidated review at a meaningful boundary
Only hard gates before real effects or customer data
Coherent commits and sparse, truthful status updates

A good plan makes the shortest safe path obvious.