Plan
Required Reading
- skill: ts-principles
- Read
ts-principles/SKILL.md.
- Read every linked principle detail document before planning.
- Treat the principle details as binding planning constraints, not optional
background.
- Apply the principles without copying their names or slogans into the plan unless the reader needs the reference.
- skill: ts-technical-writing
- Read
ts-technical-writing/SKILL.md.
- Read every linked technical-writing detail document before writing a plan.
Role
Plan is a judge.
It owns scope, context loading, decisions, task sequencing, verification
strategy, and the saved plan artifact.
The judge may do planning directly. Delegate only when a bounded investigation
can run independently, such as API contract discovery, migration risk, test
inventory, or rollout constraints. Workers return raw notes.
The technical-writing editor is the exception: always spawn a sub-agent with
skill: ts-technical-writing to edit the plan draft before gates. The editor is
not a reviewer and must return edited plan text, not findings.
This skill fits a three-tier workflow:
- router: chooses when to run planning, build, and review
- judge: owns the planning decision and artifact
- worker: answers one bounded planning question
Default to direct execution.
Sub-Agent Selection
Use this section when this skill spawns sub-agent workers.
- Choose the first available entry for the worker role.
- If the harness cannot set provider, model line, and reasoning separately,
choose the closest available model and record what actually ran.
- Do not spawn extra workers just to use every entry.
- Spawn workers only when a worker can produce independent evidence that the
judge can verify and integrate cheaply.
Planning Worker
| Priority |
Provider |
Model line |
Reasoning |
| 1 |
OpenAI |
terra latest |
medium |
| 2 |
Anthropic |
sonnet latest |
medium |
| 3 |
OpenAI |
sol latest |
high |
| 4 |
Cursor |
composer |
high |
Good worker tasks:
- automated test inventory
- affected contract inventory
- migration and rollout constraints
- verification command discovery
- dependency and ownership map
Technical-Writing Editor
Use the first available entry.
| Priority |
Provider |
Model line |
Reasoning |
| 1 |
OpenAI |
terra latest |
medium |
| 2 |
Anthropic |
sonnet latest |
medium |
| 3 |
OpenAI |
sol latest |
high |
| 4 |
Cursor |
composer |
high |
Workflow
- DETERMINE_SCOPE
- LOAD_CONTEXT
- DELEGATE_INVESTIGATIONS
- RESOLVE_DECISIONS
- PLAN_TESTS
- DRAFT_PLAN
- EDIT_TECHNICAL_WRITING
- CHECK_GATES
- WRITE_ARTIFACT
DETERMINE_SCOPE
- Determine the requested change, affected product behavior, planning depth,
and any plausible nearby work the plan intentionally rejects or defers.
- Name the repository root and planned artifact path:
<repository-root>/docs/plans/YYYY-MM-DD_HH:MM_<plan-name>.md.
- If the request revises an existing plan, use that existing plan path as the
artifact path.
- Create
docs/plans/ if it does not exist.
LOAD_CONTEXT
- Use skill: ts-project-context to load shared facts and decisions.
- Read relevant source, tests, docs, configs,
AGENTS.md, and local guidance.
- Identify current behavior, affected files, invariants, dependencies,
contracts, test seams, and verification commands.
- Use semantic skill names for external skills, e.g.
skill: ts-principles.
- Use paths for local files. Do not copy reference material into the plan unless
the implementer needs the exact snippet.
- If a required read or repo command fails after the obvious fix, stop and
escalate. Missing context is not a license to plan blindly.
DELEGATE_INVESTIGATIONS
- Skip when direct planning is cheaper.
- Delegate only independent, bounded fact-finding questions.
- Worker prompts must include the question, exact scope, files or skills to
read, assigned provider, model line, reasoning level, expected output shape,
the rule that workers must not write the plan artifact, and the rule that
workers must escalate tooling failures to the judge instead of silently
downgrading output.
- Treat worker output as evidence. Deduplicate and reconcile it before
planning.
RESOLVE_DECISIONS
- Resolve unknowns from repo and shared project context; retain reusable conclusions in project context.
- Keep unresolved decisions only in
Open Questions.
- Do not place alternatives inside implementation tasks.
- If a task depends on an unresolved question, mark that task blocked and name
the dependency.
PLAN_TESTS
- Re-read the
tests are code principle detail before planning test changes.
- For each non-trivial behavior change, decide how automated tests will prove it before drafting tasks.
- Each planned test change must name:
- the behavior or rule it proves
- the interface or user action it exercises
- the bug it would catch
- If no tests are added, name the existing automated check or explain why no lasting automated check is practical.
DRAFT_PLAN
- Write implementation instructions for a skilled engineer with no prior chat
context. Treat review findings, user feedback, and handoffs as inputs to the
plan, not content in the plan.
- Use exact file paths, line numbers when useful, and dependency-ordered tasks.
- Make each task leave the repository coherent after its dependencies are
applied. Do not split a refactor so an earlier task breaks imports, types,
tests, or runtime behavior that a later task repairs.
- If a task cannot be verified honestly before a dependent task, merge the tasks.
- Put tests in the same task as the behavior change or in a dependent test
task. For each test task, include the test description from PLAN_TESTS.
- Use exact paths, symbols, commands, and contract names. Explain intent and reasoning in ordinary prose.
- Use
Details for intent, rules that must remain true, and sequencing. Put exact mechanics in Code Changes; do not
repeat hunks in prose.
Code-in-plan policy:
- Default to diffs. For a small change to a preexisting file, show only the
changed lines as a patch-style hunk with a few lines of surrounding context.
- Use larger code blocks only for new files, or when extra context is needed to
understand the change. New files, new functions, new components, new types,
and heavily rewritten units need full or near-full code.
- Do not dump whole existing files for small edits.
- Do not include generated artifacts, lockfiles, snapshots, or build output
unless they are the subject of the change.
- Do not hide substantive logic behind
....
- Plan
/** ... */ or comments for non-obvious exported contracts, invariants,
edge cases, error handling, concurrency, performance, security, or domain
rules.
- Do not plan comments that repeat names, types, schemas, tests, or obvious
code.
EDIT_TECHNICAL_WRITING
- Always spawn a technical-writing editor sub-agent after drafting the plan and
before running gates.
- Include
skill: ts-technical-writing in the editor prompt.
- The editor owns plan prose, structure, headings, bullets, examples, and
llm-ism removal.
- The editor edits the plan draft directly. It must return the complete edited
plan text, not review findings or suggestions.
- The editor must preserve meaning, exact technical names, scope, task order, file paths, code hunks, verification
commands, open questions, blockers, planned tests, and technical facts. It may rewrite abstract labels and workflow
terms.
- The editor prompt must name the reader as a skilled engineer with no prior chat context and state that the plan should
make implementation and verification unambiguous.
- The judge must not perform the technical-writing edit itself. The judge may
make factual corrections after the edit.
- If factual corrections materially rewrite the plan, run the editor again.
CHECK_GATES
Before writing the artifact, verify:
- The technical-writing editor edited the plan after the latest material draft
change.
- The plan stands alone without prior chat.
- Every non-trivial task lists exact files.
- No task asks the implementer to choose between alternatives.
- Every task's
Verify section is valid immediately after that task and its
dependencies are applied.
Open Questions contains only unresolved decisions.
- Optional sections marked
skip if none are omitted when empty.
- No answered question remains as an open question.
- Blocked tasks name their blocker.
- Verification commands and expected results are explicit.
- Every verification command's underlying tool runs in this repo. Invoke each
tool with a no-op (e.g.,
--help, dry-run, version check, or a no-target
invocation) to confirm availability. For commands that exercise
yet-to-be-implemented code, confirming the tool itself is sufficient. If a
tool cannot run after the obvious fix, escalate.
- Every non-trivial behavior change has a planned automated test, an existing automated check, or an explicit reason no
lasting automated check is practical.
- Task file lists match the snippets or hunks in that task.
- The plan has no notes about the planning, review, handoff, or revision process.
WRITE_ARTIFACT
- Write the final plan to the artifact path chosen in
DETERMINE_SCOPE.
- New plans use
<repository-root>/docs/plans/YYYY-MM-DD_HH:MM_<plan-name>.md.
- Revisions overwrite the existing plan path. Do not create a revised copy or
write a delta.
- Use accepted feedback to rewrite the affected sections: summary, overview,
tasks, planned tests, code changes, verification, open questions, or scope.
- Delete superseded scope instead of describing that it was removed.
Artifact Template
# Plan: <Feature Name>
## Summary
<1-3 sentences describing what this builds and why>
## Prerequisites
<Task-specific setup, dependencies, or docs; skip if none>
## Open Questions
<Unresolved decisions only; skip if none>
## Out of Scope
<Nearby work the reader might reasonably expect from this plan, but this plan rejects or defers; skip if none>
## Overview
<1-2 short paragraphs about architecture, approach, constraints, and sequencing>
## Task <n>: <name>
**Files:** `path/to/file.ts:42`, `path/to/test.ts`
**Depends on:** Task <m>; omit when the task has no dependency
**Blocked by:** <open question or external dependency; omit if unblocked>
**Details:**
- <Intent, rule that must remain true, or sequencing note not obvious from the code>
- <Concrete step only when no code hunk carries it>
**Tests:** <For test tasks only: behavior proved, interface or user action exercised, and bug caught; omit otherwise>
**Code Changes:**
```ts
// Patch-style hunk for small edits; full definition only for new/rewritten code.
```
**Verify:**
- `<command>`
- Expected: <observable result>
1---2name: ts-plan3description: Plan a multi-step code change before editing. Only explicitly triggered by user.4---56# Plan78## Required Reading910- skill: ts-principles11 - Read `ts-principles/SKILL.md`.12 - Read every linked principle detail document before planning.13 - Treat the principle details as binding planning constraints, not optional14 background.15 - Apply the principles without copying their names or slogans into the plan unless the reader needs the reference.16- skill: ts-technical-writing17 - Read `ts-technical-writing/SKILL.md`.18 - Read every linked technical-writing detail document before writing a plan.1920## Role2122Plan is a judge.2324It owns scope, context loading, decisions, task sequencing, verification25strategy, and the saved plan artifact.2627The judge may do planning directly. Delegate only when a bounded investigation28can run independently, such as API contract discovery, migration risk, test29inventory, or rollout constraints. Workers return raw notes.3031The technical-writing editor is the exception: always spawn a sub-agent with32`skill: ts-technical-writing` to edit the plan draft before gates. The editor is33not a reviewer and must return edited plan text, not findings.3435This skill fits a three-tier workflow:3637- router: chooses when to run planning, build, and review38- judge: owns the planning decision and artifact39- worker: answers one bounded planning question4041Default to direct execution.4243## Sub-Agent Selection4445Use this section when this skill spawns sub-agent workers.4647- Choose the first available entry for the worker role.48- If the harness cannot set provider, model line, and reasoning separately,49 choose the closest available model and record what actually ran.50- Do not spawn extra workers just to use every entry.51- Spawn workers only when a worker can produce independent evidence that the52 judge can verify and integrate cheaply.5354### Planning Worker5556| Priority | Provider | Model line | Reasoning |57| --- | --- | --- | --- |58| 1 | OpenAI | `terra` latest | `medium` |59| 2 | Anthropic | `sonnet` latest | `medium` |60| 3 | OpenAI | `sol` latest | `high` |61| 4 | Cursor | `composer` | `high` |6263Good worker tasks:6465- automated test inventory66- affected contract inventory67- migration and rollout constraints68- verification command discovery69- dependency and ownership map7071### Technical-Writing Editor7273Use the first available entry.7475| Priority | Provider | Model line | Reasoning |76| --- | --- | --- | --- |77| 1 | OpenAI | `terra` latest | `medium` |78| 2 | Anthropic | `sonnet` latest | `medium` |79| 3 | OpenAI | `sol` latest | `high` |80| 4 | Cursor | `composer` | `high` |8182## Workflow83841. DETERMINE_SCOPE852. LOAD_CONTEXT863. DELEGATE_INVESTIGATIONS874. RESOLVE_DECISIONS885. PLAN_TESTS896. DRAFT_PLAN907. EDIT_TECHNICAL_WRITING918. CHECK_GATES929. WRITE_ARTIFACT9394### DETERMINE_SCOPE9596- Determine the requested change, affected product behavior, planning depth,97 and any plausible nearby work the plan intentionally rejects or defers.98- Name the repository root and planned artifact path:99 `<repository-root>/docs/plans/YYYY-MM-DD_HH:MM_<plan-name>.md`.100- If the request revises an existing plan, use that existing plan path as the101 artifact path.102- Create `docs/plans/` if it does not exist.103104### LOAD_CONTEXT105106- Use skill: ts-project-context to load shared facts and decisions.107- Read relevant source, tests, docs, configs, `AGENTS.md`, and local guidance.108- Identify current behavior, affected files, invariants, dependencies,109 contracts, test seams, and verification commands.110- Use semantic skill names for external skills, e.g. `skill: ts-principles`.111- Use paths for local files. Do not copy reference material into the plan unless112 the implementer needs the exact snippet.113- If a required read or repo command fails after the obvious fix, stop and114 escalate. Missing context is not a license to plan blindly.115116### DELEGATE_INVESTIGATIONS117118- Skip when direct planning is cheaper.119- Delegate only independent, bounded fact-finding questions.120- Worker prompts must include the question, exact scope, files or skills to121 read, assigned provider, model line, reasoning level, expected output shape,122 the rule that workers must not write the plan artifact, and the rule that123 workers must escalate tooling failures to the judge instead of silently124 downgrading output.125- Treat worker output as evidence. Deduplicate and reconcile it before126 planning.127128### RESOLVE_DECISIONS129130- Resolve unknowns from repo and shared project context; retain reusable conclusions in project context.131- Keep unresolved decisions only in `Open Questions`.132- Do not place alternatives inside implementation tasks.133- If a task depends on an unresolved question, mark that task blocked and name134 the dependency.135136### PLAN_TESTS137138- Re-read the `tests are code` principle detail before planning test changes.139- For each non-trivial behavior change, decide how automated tests will prove it before drafting tasks.140- Each planned test change must name:141 - the behavior or rule it proves142 - the interface or user action it exercises143 - the bug it would catch144- If no tests are added, name the existing automated check or explain why no lasting automated check is practical.145146### DRAFT_PLAN147148- Write implementation instructions for a skilled engineer with no prior chat149 context. Treat review findings, user feedback, and handoffs as inputs to the150 plan, not content in the plan.151- Use exact file paths, line numbers when useful, and dependency-ordered tasks.152- Make each task leave the repository coherent after its dependencies are153 applied. Do not split a refactor so an earlier task breaks imports, types,154 tests, or runtime behavior that a later task repairs.155- If a task cannot be verified honestly before a dependent task, merge the tasks.156- Put tests in the same task as the behavior change or in a dependent test157 task. For each test task, include the test description from PLAN_TESTS.158- Use exact paths, symbols, commands, and contract names. Explain intent and reasoning in ordinary prose.159- Use `Details` for intent, rules that must remain true, and sequencing. Put exact mechanics in `Code Changes`; do not160 repeat hunks in prose.161162Code-in-plan policy:163164- Default to diffs. For a small change to a preexisting file, show only the165 changed lines as a patch-style hunk with a few lines of surrounding context.166- Use larger code blocks only for new files, or when extra context is needed to167 understand the change. New files, new functions, new components, new types,168 and heavily rewritten units need full or near-full code.169- Do not dump whole existing files for small edits.170- Do not include generated artifacts, lockfiles, snapshots, or build output171 unless they are the subject of the change.172- Do not hide substantive logic behind `...`.173- Plan `/** ... */` or comments for non-obvious exported contracts, invariants,174 edge cases, error handling, concurrency, performance, security, or domain175 rules.176- Do not plan comments that repeat names, types, schemas, tests, or obvious177 code.178179### EDIT_TECHNICAL_WRITING180181- Always spawn a technical-writing editor sub-agent after drafting the plan and182 before running gates.183- Include `skill: ts-technical-writing` in the editor prompt.184- The editor owns plan prose, structure, headings, bullets, examples, and185 llm-ism removal.186- The editor edits the plan draft directly. It must return the complete edited187 plan text, not review findings or suggestions.188- The editor must preserve meaning, exact technical names, scope, task order, file paths, code hunks, verification189 commands, open questions, blockers, planned tests, and technical facts. It may rewrite abstract labels and workflow190 terms.191- The editor prompt must name the reader as a skilled engineer with no prior chat context and state that the plan should192 make implementation and verification unambiguous.193- The judge must not perform the technical-writing edit itself. The judge may194 make factual corrections after the edit.195- If factual corrections materially rewrite the plan, run the editor again.196197### CHECK_GATES198199Before writing the artifact, verify:200201- The technical-writing editor edited the plan after the latest material draft202 change.203- The plan stands alone without prior chat.204- Every non-trivial task lists exact files.205- No task asks the implementer to choose between alternatives.206- Every task's `Verify` section is valid immediately after that task and its207 dependencies are applied.208- `Open Questions` contains only unresolved decisions.209- Optional sections marked `skip if none` are omitted when empty.210- No answered question remains as an open question.211- Blocked tasks name their blocker.212- Verification commands and expected results are explicit.213- Every verification command's underlying tool runs in this repo. Invoke each214 tool with a no-op (e.g., `--help`, dry-run, version check, or a no-target215 invocation) to confirm availability. For commands that exercise216 yet-to-be-implemented code, confirming the tool itself is sufficient. If a217 tool cannot run after the obvious fix, escalate.218- Every non-trivial behavior change has a planned automated test, an existing automated check, or an explicit reason no219 lasting automated check is practical.220- Task file lists match the snippets or hunks in that task.221- The plan has no notes about the planning, review, handoff, or revision process.222223### WRITE_ARTIFACT224225- Write the final plan to the artifact path chosen in `DETERMINE_SCOPE`.226- New plans use `<repository-root>/docs/plans/YYYY-MM-DD_HH:MM_<plan-name>.md`.227- Revisions overwrite the existing plan path. Do not create a revised copy or228 write a delta.229- Use accepted feedback to rewrite the affected sections: summary, overview,230 tasks, planned tests, code changes, verification, open questions, or scope.231- Delete superseded scope instead of describing that it was removed.232233## Artifact Template234235````markdown236# Plan: <Feature Name>237238## Summary239<1-3 sentences describing what this builds and why>240241## Prerequisites242<Task-specific setup, dependencies, or docs; skip if none>243244## Open Questions245<Unresolved decisions only; skip if none>246247## Out of Scope248<Nearby work the reader might reasonably expect from this plan, but this plan rejects or defers; skip if none>249250## Overview251<1-2 short paragraphs about architecture, approach, constraints, and sequencing>252253## Task <n>: <name>254**Files:** `path/to/file.ts:42`, `path/to/test.ts`255**Depends on:** Task <m>; omit when the task has no dependency256**Blocked by:** <open question or external dependency; omit if unblocked>257258**Details:**259- <Intent, rule that must remain true, or sequencing note not obvious from the code>260- <Concrete step only when no code hunk carries it>261262**Tests:** <For test tasks only: behavior proved, interface or user action exercised, and bug caught; omit otherwise>263264**Code Changes:**265```ts266// Patch-style hunk for small edits; full definition only for new/rewritten code.267```268269**Verify:**270- `<command>`271- Expected: <observable result>272````