---
name: to-phased-plan
description: Produce a phased implementation plan — a detailed, technical, TDD-driven breakdown of a single unit of work into self-contained phases, each with test cases, abstractions (types, interfaces, signatures), and a small-commit plan governed by strict commit hygiene. Use when planning the actual implementation of a discrete chunk of work. Triggers include "phased plan", "phased implementation plan", "break this into phases", "plan the implementation of X".
title: to-phased-plan
canonical_url: https://skilld.dev/gh/mohasarc/mo-skills/to-phased-plan
last_updated: 2026-10-18T12:07:55.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install mohasarc/mo-skills/to-phased-plan`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/to-phased-plan`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/mohasarc/mo-skills/to-phased-plan) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/to-phased-plan`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/to-phased-plan --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/to-phased-plan --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

A phased plan is a **detailed, technical** breakdown of a single unit of work into an ordered sequence of phases. It includes the types, interfaces, and snippets needed to actually build the work, decomposed further into individually reviewable commits.

The unit of work is whatever discrete chunk needs implementing — a feature, a refactor, a migration, a bug-fix campaign — described to the skill in whatever form it arrives.

## Concerns

This document focuses on:

1. **High-quality, readable, testable code.** Plan the implementation to favor reuse, simplicity, and verifiability.
2. **TDD ordering for behavior.** A phase that adds, changes, or removes behavior begins with test cases before production code. A routine phase (wiring, option threading, re-exports, type plumbing) lists none; code commit first, test-update commit after if existing tests need it.
3. **Minimal, reviewable commits.** Each commit does **one thing** and is easy to review on its own. A commit may span a whole phase, a single step within a phase, or a handful of steps — whatever keeps it minimal.
4. **One concern per phase — a concern is a behavior, not a layer.** A phase delivers one behavior observable where the work is consumed, every layer included. Two behaviors joined by "and" are two phases; one behavior spanning layers is one.

## Slicing

Slice vertically: a phase named after a structural part is horizontal; one named after an observable behavior change is vertical.

- Infrastructure rides in the first slice that consumes it; a standalone infrastructure phase needs justification that no slice can carry it.
- First slice is the minimal end-to-end happy path; later slices deepen it. Test cases spanning distinct behaviors signal a split.
- Order by dependency; among independent slices, most uncertain integration first.
- Work with no observable behavior of its own — refactor, migration — slices by risk or subsystem; record the classification.

## Commit hygiene rules

Every commit in the plan must satisfy these. They exist because every violation makes a diff harder to review:

- **Don't move and change at the same time.** Move a file, function, or block in one commit; change its contents in the next. Reviewers can verify a pure move at a glance; a move-with-edits forces them to reconstruct what changed inside the move.
- **Don't introduce a type and use it at the same time.** Add the type definition in one commit; introduce its first use in the next. The reader sees the type's shape on its own before having to follow it to a callsite.
- **Don't refactor and add new functionality at the same time.** Refactor surrounding code first; add new behavior on top. Mixing them obscures whether a behavior change rode in on the refactor.
- **One logical change per commit.** If a commit description needs the word "and" to capture what it does, split it.

## Inputs to gather before writing

1. **The unit of work** — the chunk being phased. What it is, what it delivers, where it ends.
2. **Relevant codebase context** — existing patterns, modules, types, and test infrastructure this work plugs into. Read the code; plan against reality, not assumptions.
3. **Constraints** — files or systems off-limits, performance budgets, public-API stability requirements, anything that bounds the implementation.
4. **Test infrastructure** — the runner, fixture conventions, and which test levels (unit / integration / e2e) are in scope.

If anything load-bearing is missing, ask.

## Output location

Write to a descriptively-named subfolder under `plans/`:

- Default: `plans/<highest-numbered>/<descriptive-slug>/phased-plan.md`, where the slug names the unit of work.
- If no `plans/` directory exists, create `plans/000/<descriptive-slug>/phased-plan.md`.
- If it's ambiguous which folder this belongs to, ask.

## Document structure

### 1. Header

Title and one-sentence description of the unit being phased. Link to its source (if one exists in the project).

### 2. Goal

What this plan delivers when all phases are complete. State the observable outcome — what works after that didn't work before. One paragraph.

### 3. Context

Just enough about the surrounding codebase to read the rest cold: which modules are touched, which types and interfaces are reused, where the new code plugs in, what tests already exist that this work extends. Reference real symbols and files. Tight.

### 4. Phases

One section per phase, ordered. Each phase is self-contained — at the end of a phase the codebase is in a consistent state with passing tests, and is observably more capable than before. Use the phase template below.

### 5. Out of scope

Adjacent work this plan does **not** do. Point at the future work that owns each item.

## Phase template

Every phase entry uses this shape:

```
## Phase N — <name>

**Behavior delivered.** What works after this phase that didn't work before, observable where the work is consumed.

**Test cases.** The tests that drive this phase, written *first*. For each test:
- What is being tested (the scenario or contract).
- The assertion(s).
- The level (unit / integration / e2e).
- Any fixture, stub, or harness work the test requires.

**Components.** The *shape* of what this phase introduces or modifies — abstractions and contracts, not implementations. Include:
- Full type and interface definitions.
- Full function and method signatures.
- Constants, config shapes, and declarative values when they form part of the contract.

Do **not** include function bodies, control flow, or algorithm implementations. If a non-obvious algorithm needs to be communicated, describe it in prose — *what* it does, not *how* — so the implementer writes the code during execution.

**Commit plan.** Ordered list of commits implementing this phase. For each commit:
- A short imperative commit-message-style title.
- One sentence on what changes and why.
- A note on which hygiene rule it preserves (e.g. "type-only, no callsites yet"; "pure move, no edits"; "refactor only, no behavior change").

**Done when.** Observable acceptance criteria. Tests green. Specific behaviors verified.
```

## Hard rules

1. **TDD ordering is structural, not just prose.** In a behavior phase the *Test cases* subsection precedes *Components* and the commit plan starts with a failing-test commit. A routine phase has no *Test cases* subsection and no red commit.
2. **Phases are self-contained.** At the end of each phase the codebase is consistent and tests pass. No "this finishes in the next phase" arrangements.
3. **Commits obey the hygiene rules above.** If a commit's description needs an "and," split it.
4. **One concern per phase.** A concern is one observable behavior, never a layer. If a phase's name joins two behaviors with "and," split it.
5. **Abstractions, not implementations.** The plan shows the shape of what to build — types, interfaces, signatures, declarative values — in the project's actual language and conventions. It does not contain function bodies, control flow, or algorithm implementations. Implementation happens during execution; the plan exists to direct that execution, not to do it.
6. **Reuse before invention.** Prefer existing patterns and modules in the codebase. Justify new abstractions when introducing them.
7. **Out-of-scope items are named explicitly.** Don't let adjacent work creep silently in.
8. **No invented constraints, conventions, or APIs.** Only state what's true of the codebase or what the user has committed to.
