@tianhai/pi-workflow-kit 0.13.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/plans/completed/2026-05-08-checkpoint-gates-design.md +235 -0
- package/docs/plans/completed/2026-05-08-checkpoint-gates-implementation.md +83 -0
- package/docs/plans/completed/2026-05-08-checkpoint-gates-progress.md +11 -0
- package/docs/plans/completed/2026-05-20-generic-lessons-design.md +70 -0
- package/docs/plans/completed/2026-05-20-generic-lessons-implementation.md +114 -0
- package/docs/plans/completed/2026-05-20-generic-lessons-progress.md +11 -0
- package/package.json +1 -1
- package/skills/brainstorming/SKILL.md +1 -1
- package/skills/diagnose/SKILL.md +1 -1
- package/skills/executing-tasks/SKILL.md +119 -67
- package/skills/finalizing/SKILL.md +2 -0
- package/skills/writing-plans/SKILL.md +150 -17
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ brainstorm → plan → execute → finalize
|
|
|
47
47
|
|-------|---------|--------------|
|
|
48
48
|
| **Brainstorm** | `/skill:brainstorming` | Explore approaches, debate tradeoffs, produce a design doc |
|
|
49
49
|
| **Plan** | `/skill:writing-plans` | Break design into bite-sized TDD tasks with file paths and acceptance criteria |
|
|
50
|
-
| **Execute** | `/skill:executing-tasks` | Implement tasks one-by-one with TDD discipline and
|
|
50
|
+
| **Execute** | `/skill:executing-tasks` | Implement tasks one-by-one with TDD discipline and pre-commit checkpoint review gates |
|
|
51
51
|
| **Finalize** | `/skill:finalizing` | Archive plan docs, update README/CHANGELOG, create PR |
|
|
52
52
|
| **Diagnose** | `/skill:diagnose` | 6-phase debugging loop: reproduce → hypothesize → instrument → fix → verify |
|
|
53
53
|
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Design: Checkpoint gates and pre-commit discipline
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
The `executing-tasks` skill instructs the agent to pause at checkpoints for human review before committing. In practice, the agent commits first then presents the review, defeating the purpose of checkpoints.
|
|
6
|
+
|
|
7
|
+
Root causes in executing-tasks:
|
|
8
|
+
1. "PAUSE if" reads as optional — the agent interprets it as "if you remember"
|
|
9
|
+
2. Steps 6-12 flow together as implement→commit — the pause gets swallowed
|
|
10
|
+
3. The diff format asks for committed state — nudges the agent to commit first
|
|
11
|
+
|
|
12
|
+
Root causes in writing-plans:
|
|
13
|
+
4. Task format says `git commit` after each task — the agent sees the commit line past the checkpoint and skips to it
|
|
14
|
+
5. Refactor and lessons are optional-sounding steps at the end of a long list — the agent skips them
|
|
15
|
+
6. The plan body has no structural enforcement — everything is just text the agent reads at once
|
|
16
|
+
|
|
17
|
+
Secondary issue: the agent skips steps 9 (Refactor if needed) and 10 (Learn from mistakes) because they're optional-sounding steps at the end of a long list.
|
|
18
|
+
|
|
19
|
+
## Key insight
|
|
20
|
+
|
|
21
|
+
The agent follows numbered steps and skips loose sections. **Output requirements** (things the agent has to produce) are stronger than instructions (things the agent is told to do). The checkpoint review format forces the agent to report refactoring and lessons — that's the enforcement mechanism.
|
|
22
|
+
|
|
23
|
+
No-checkpoint tasks are simple enough that refactor/lessons genuinely aren't needed — the task author chose no checkpoint because the task is trivial.
|
|
24
|
+
|
|
25
|
+
## Solution
|
|
26
|
+
|
|
27
|
+
- **writing-plans**: Generate task bodies with numbered steps (including refactor/lessons for checkpointed tasks) and checkpoint gates. Never include `git commit` in the plan.
|
|
28
|
+
- **executing-tasks**: Simplified runner — follow the plan step by step, pause at checkpoint gates, commit after approval.
|
|
29
|
+
- **Progress file**: Use Status column to enforce checkpoint gates. Agent can't go from `🔄 in-progress` → `✅ done` if the task has a checkpoint — must go through `⏸ test-review` or `⏸ done-review` first.
|
|
30
|
+
|
|
31
|
+
## Design
|
|
32
|
+
|
|
33
|
+
### Writing-plans: task format
|
|
34
|
+
|
|
35
|
+
The plan never includes `git commit`. That's the executing-tasks skill's responsibility.
|
|
36
|
+
|
|
37
|
+
**No-checkpoint task:**
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
## Task 1: Create User model
|
|
41
|
+
|
|
42
|
+
<!-- tdd: new-feature -->
|
|
43
|
+
<!-- checkpoint: none -->
|
|
44
|
+
|
|
45
|
+
Files:
|
|
46
|
+
- `src/user/model.ts`
|
|
47
|
+
- `src/user/model.test.ts`
|
|
48
|
+
|
|
49
|
+
Steps:
|
|
50
|
+
1. Write failing test for User model creation
|
|
51
|
+
2. Run test — confirm it fails
|
|
52
|
+
3. Implement User model
|
|
53
|
+
4. Run test — confirm it passes
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Checkpoint: test task:**
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
## Task 2: Write auth tests
|
|
60
|
+
|
|
61
|
+
<!-- tdd: new-feature -->
|
|
62
|
+
<!-- checkpoint: test -->
|
|
63
|
+
|
|
64
|
+
Files:
|
|
65
|
+
- `src/auth/login.test.ts`
|
|
66
|
+
|
|
67
|
+
Steps:
|
|
68
|
+
1. Write failing test for login with valid credentials
|
|
69
|
+
2. Run test — confirm it fails
|
|
70
|
+
|
|
71
|
+
⏸ **CHECKPOINT: test** — present test review. Wait for human approval before implementing.
|
|
72
|
+
|
|
73
|
+
3. Implement login handler
|
|
74
|
+
4. Run test — confirm it passes
|
|
75
|
+
5. Refactor — check for shallow modules, duplication, seam discipline. Run tests after changes.
|
|
76
|
+
6. Lessons — caught a mistake that applies to future tasks? Add rule to `docs/lessons.md`.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Checkpoint: done task:**
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
## Task 3: Add login endpoint
|
|
83
|
+
|
|
84
|
+
<!-- tdd: new-feature -->
|
|
85
|
+
<!-- checkpoint: done -->
|
|
86
|
+
|
|
87
|
+
Files:
|
|
88
|
+
- `src/auth/login.ts`
|
|
89
|
+
- `src/auth/login.test.ts`
|
|
90
|
+
|
|
91
|
+
Steps:
|
|
92
|
+
1. Write failing test for login with valid credentials
|
|
93
|
+
2. Run test — confirm it fails
|
|
94
|
+
3. Implement login handler
|
|
95
|
+
4. Run test — confirm it passes
|
|
96
|
+
5. Add edge case tests (invalid password, missing email)
|
|
97
|
+
6. Refactor — check for shallow modules, duplication, seam discipline. Run tests after changes.
|
|
98
|
+
7. Lessons — caught a mistake that applies to future tasks? Add rule to `docs/lessons.md`.
|
|
99
|
+
|
|
100
|
+
⏸ **CHECKPOINT: done** — present implementation review. Wait for human approval before committing.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Task with both checkpoints:**
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
## Task 4: Complex auth flow
|
|
107
|
+
|
|
108
|
+
<!-- tdd: new-feature -->
|
|
109
|
+
<!-- checkpoint: test -->
|
|
110
|
+
<!-- checkpoint: done -->
|
|
111
|
+
|
|
112
|
+
Steps:
|
|
113
|
+
1. Write failing test for auth flow
|
|
114
|
+
2. Run test — confirm it fails
|
|
115
|
+
|
|
116
|
+
⏸ **CHECKPOINT: test** — present test review. Wait for human approval before implementing.
|
|
117
|
+
|
|
118
|
+
3. Implement auth flow
|
|
119
|
+
4. Run test — confirm it passes
|
|
120
|
+
5. Refactor — check for shallow modules, duplication, seam discipline. Run tests after changes.
|
|
121
|
+
6. Lessons — caught a mistake that applies to future tasks? Add rule to `docs/lessons.md`.
|
|
122
|
+
|
|
123
|
+
⏸ **CHECKPOINT: done** — present implementation review. Wait for human approval before committing.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Writing-plans: checkpoint labels table
|
|
127
|
+
|
|
128
|
+
| Checkpoint | When to use | What the plan should say |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| *(none)* | Trivial tasks, well-understood changes | Numbered steps only |
|
|
131
|
+
| **`checkpoint: test`** | Test design matters | Steps up to test → `⏸ CHECKPOINT: test` → implement steps (including refactor/lessons) |
|
|
132
|
+
| **`checkpoint: done`** | Implementation review matters | Steps (including refactor/lessons) → `⏸ CHECKPOINT: done` |
|
|
133
|
+
| Both | Non-obvious tests AND complex logic | Steps up to test → `⏸ CHECKPOINT: test` → implement steps (including refactor/lessons) → `⏸ CHECKPOINT: done` |
|
|
134
|
+
|
|
135
|
+
### Executing-tasks: simplified runner
|
|
136
|
+
|
|
137
|
+
The per-task execution becomes:
|
|
138
|
+
|
|
139
|
+
1. Mark `🔄 in-progress` in progress file
|
|
140
|
+
2. Read the current task from the plan
|
|
141
|
+
3. Execute each numbered step in order
|
|
142
|
+
4. When hitting `⏸ CHECKPOINT` in the plan:
|
|
143
|
+
- Update progress to `⏸ test-review` or `⏸ done-review`
|
|
144
|
+
- Present the checkpoint review (see format below)
|
|
145
|
+
- Wait for human approval
|
|
146
|
+
- On approval, update progress back to `🔄 in-progress`
|
|
147
|
+
- Continue with the next step
|
|
148
|
+
5. After all steps are done (or for no-checkpoint tasks, after steps + commit):
|
|
149
|
+
- `git add` and commit with a clear message
|
|
150
|
+
- Update progress to `✅ done` + record commit hash
|
|
151
|
+
|
|
152
|
+
### Progress file: Status-enforced gates
|
|
153
|
+
|
|
154
|
+
Status values:
|
|
155
|
+
|
|
156
|
+
| Status | Meaning |
|
|
157
|
+
|--------|---------|
|
|
158
|
+
| `⬜ pending` | Not started |
|
|
159
|
+
| `🔄 in-progress` | Currently executing plan steps |
|
|
160
|
+
| `⏸ test-review` | Paused at checkpoint: test, waiting for human approval |
|
|
161
|
+
| `⏸ done-review` | Paused at checkpoint: done, waiting for human approval |
|
|
162
|
+
| `✅ done` | Committed successfully |
|
|
163
|
+
| `❌ failed` | Could not complete |
|
|
164
|
+
| `⏭ skipped` | User chose to skip |
|
|
165
|
+
|
|
166
|
+
Enforcement rules:
|
|
167
|
+
- Agent cannot go from `🔄 in-progress` → `✅ done` if the task has a checkpoint
|
|
168
|
+
- Must go through `⏸ test-review` or `⏸ done-review` first
|
|
169
|
+
- Can only return to `🔄 in-progress` after human says "approve"
|
|
170
|
+
- Can only go to `✅ done` after commit
|
|
171
|
+
|
|
172
|
+
Example progress file:
|
|
173
|
+
|
|
174
|
+
```markdown
|
|
175
|
+
# Progress: Auth feature
|
|
176
|
+
|
|
177
|
+
Plan: docs/plans/2026-05-08-auth-implementation.md
|
|
178
|
+
Branch: auth-feature
|
|
179
|
+
Started: 2026-05-08T10:00:00Z
|
|
180
|
+
Last updated: 2026-05-08T10:05:00Z
|
|
181
|
+
|
|
182
|
+
| # | Status | Task | Commit |
|
|
183
|
+
|---|--------|------|--------|
|
|
184
|
+
| 1 | ✅ done | Create User model | abc123 |
|
|
185
|
+
| 2 | ⏸ done-review | Add login endpoint (checkpoint: done) | — |
|
|
186
|
+
| 3 | ⬜ pending | Add auth middleware (checkpoint: done) | — |
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Checkpoint review format
|
|
190
|
+
|
|
191
|
+
For `checkpoint: test`:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
⏸ Paused at checkpoint: test for task [N]
|
|
195
|
+
|
|
196
|
+
**Test written:** [show test code]
|
|
197
|
+
**Expected behavior:** [what this validates]
|
|
198
|
+
**Next:** Continue implementing after approval
|
|
199
|
+
|
|
200
|
+
**Available actions:**
|
|
201
|
+
- **Approve** — continue to implementation
|
|
202
|
+
- **Request changes** — describe what to change
|
|
203
|
+
- **Revert** — undo this task and mark it back to pending
|
|
204
|
+
- `skip` — skip this task
|
|
205
|
+
- `stop` — pause here, resume later with `/skill:executing-tasks`
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
For `checkpoint: done`:
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
⏸ Paused at checkpoint: done for task [N]
|
|
212
|
+
|
|
213
|
+
**What was done:** [brief summary]
|
|
214
|
+
**Refactoring done:** [what changed, or "none needed — [reason]"]
|
|
215
|
+
**Lessons learned:** [new rule added, or "none"]
|
|
216
|
+
**Diff:** [run `git diff --cached` or `git diff` — do NOT commit first]
|
|
217
|
+
**Next:** Commit after approval
|
|
218
|
+
|
|
219
|
+
**Available actions:**
|
|
220
|
+
- **Approve** — commit and move to next task
|
|
221
|
+
- **Request changes** — describe what to change
|
|
222
|
+
- **Revert** — undo this task and mark it back to pending
|
|
223
|
+
- `skip` — skip this task
|
|
224
|
+
- `stop` — pause here, resume later with `/skill:executing-tasks`
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Files to change
|
|
228
|
+
|
|
229
|
+
- `skills/writing-plans/SKILL.md` — update task format template and checkpoint labels section
|
|
230
|
+
- `skills/executing-tasks/SKILL.md` — simplify per-task execution to plan-following runner, update progress file status values
|
|
231
|
+
|
|
232
|
+
## What stays the same
|
|
233
|
+
|
|
234
|
+
- executing-tasks: Before you start, First run, Resume, User override commands, Receiving code review, If you're stuck, After all tasks — all unchanged
|
|
235
|
+
- writing-plans: Process steps, vertical slices, TDD section — all unchanged
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Implementation: Checkpoint gates and pre-commit discipline
|
|
2
|
+
|
|
3
|
+
Design: `docs/plans/2026-05-08-checkpoint-gates-design.md`
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Update two skill files so that:
|
|
8
|
+
1. `writing-plans` generates task bodies with checkpoint gates and numbered refactor/lessons steps, never includes `git commit`
|
|
9
|
+
2. `executing-tasks` becomes a simplified plan-following runner with status-enforced checkpoint gates
|
|
10
|
+
|
|
11
|
+
## Task 1: Update writing-plans task format and checkpoint labels
|
|
12
|
+
|
|
13
|
+
<!-- tdd: trivial -->
|
|
14
|
+
<!-- checkpoint: none -->
|
|
15
|
+
|
|
16
|
+
Files:
|
|
17
|
+
- `skills/writing-plans/SKILL.md`
|
|
18
|
+
|
|
19
|
+
Changes:
|
|
20
|
+
|
|
21
|
+
### Task format section
|
|
22
|
+
|
|
23
|
+
Replace the task format section. Key changes:
|
|
24
|
+
- Remove `git commit` from bullet points (commit is the executing-tasks skill's responsibility)
|
|
25
|
+
- Remove `<!-- checkpoint: none -->` from the default template (omit when no checkpoint)
|
|
26
|
+
- Add task body examples for each checkpoint type (none, test, done, both)
|
|
27
|
+
- For checkpointed tasks, include numbered refactor and lessons steps
|
|
28
|
+
- For checkpointed tasks, include `⏸ CHECKPOINT` gate in the task body
|
|
29
|
+
- No task body should include `git commit`
|
|
30
|
+
|
|
31
|
+
### Checkpoint labels section
|
|
32
|
+
|
|
33
|
+
Replace the checkpoint labels table. Change the last column from "What happens during execution" to "What the plan should include", showing the gate structure for each checkpoint type.
|
|
34
|
+
|
|
35
|
+
### TDD section
|
|
36
|
+
|
|
37
|
+
Remove "→ commit" from the Instructions column — commit is not part of the plan.
|
|
38
|
+
|
|
39
|
+
## Task 2: Update executing-tasks per-task execution and progress file
|
|
40
|
+
|
|
41
|
+
<!-- tdd: trivial -->
|
|
42
|
+
<!-- checkpoint: done -->
|
|
43
|
+
|
|
44
|
+
Files:
|
|
45
|
+
- `skills/executing-tasks/SKILL.md`
|
|
46
|
+
|
|
47
|
+
Changes:
|
|
48
|
+
|
|
49
|
+
### Per-task execution section
|
|
50
|
+
|
|
51
|
+
Replace the current 15-step list with a simplified plan-following runner:
|
|
52
|
+
|
|
53
|
+
1. Mark `🔄 in-progress` in progress file
|
|
54
|
+
2. Read the current task from the plan
|
|
55
|
+
3. Execute each numbered step in order
|
|
56
|
+
4. When hitting `⏸ CHECKPOINT` in the plan:
|
|
57
|
+
- Update progress to `⏸ test-review` or `⏸ done-review`
|
|
58
|
+
- Present the checkpoint review
|
|
59
|
+
- Wait for human approval
|
|
60
|
+
- On approval, update progress back to `🔄 in-progress`
|
|
61
|
+
- Continue with the next step
|
|
62
|
+
5. After all steps done:
|
|
63
|
+
- `git add` and commit with a clear message
|
|
64
|
+
- Update progress to `✅ done` + record commit hash
|
|
65
|
+
|
|
66
|
+
Remove the inline refactor/lessons steps — they're now in the plan for checkpointed tasks.
|
|
67
|
+
|
|
68
|
+
### Progress file section
|
|
69
|
+
|
|
70
|
+
Add `⏸ test-review` and `⏸ done-review` status values. Add enforcement rule: agent cannot go from `🔄 in-progress` → `✅ done` if task has a checkpoint.
|
|
71
|
+
|
|
72
|
+
### Checkpoint review section
|
|
73
|
+
|
|
74
|
+
Update `checkpoint: done` review to include:
|
|
75
|
+
- **Refactoring done:** field
|
|
76
|
+
- **Lessons learned:** field
|
|
77
|
+
- **Diff:** uses `git diff --cached` or `git diff`, with "do NOT commit first"
|
|
78
|
+
|
|
79
|
+
Simplify available actions (remove "Adjust plan" since the plan drives execution).
|
|
80
|
+
|
|
81
|
+
### Keep unchanged
|
|
82
|
+
|
|
83
|
+
- Before you start, First run, Resume, User override commands, Receiving code review, If you're stuck, After all tasks
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Progress: Checkpoint gates and pre-commit discipline
|
|
2
|
+
|
|
3
|
+
Plan: docs/plans/2026-05-08-checkpoint-gates-implementation.md
|
|
4
|
+
Branch: main
|
|
5
|
+
Started: 2026-05-08T20:00:00Z
|
|
6
|
+
Last updated: 2026-05-08T20:12:00Z
|
|
7
|
+
|
|
8
|
+
| # | Status | Task | Commit |
|
|
9
|
+
|---|--------|------|--------|
|
|
10
|
+
| 1 | ✅ done | Update writing-plans task format and checkpoint labels | d39510c |
|
|
11
|
+
| 2 | ✅ done | Update executing-tasks per-task execution and progress file (checkpoint: done) | 7c84f59 |
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Design: Enforce Generic Lessons in `docs/lessons.md`
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
During `executing-tasks`, the agent writes lessons to `docs/lessons.md` scoped to the task at hand. In a monorepo, this produces domain-specific rules that are only useful within one feature or sprint — for example:
|
|
6
|
+
|
|
7
|
+
> "Always validate `userId` before calling `UserProfile.Get`"
|
|
8
|
+
|
|
9
|
+
The real lesson — applicable across any domain — would be:
|
|
10
|
+
|
|
11
|
+
> "Always validate required ID fields at the service boundary — missing IDs should return 400, not 500"
|
|
12
|
+
|
|
13
|
+
Domain-specific rules decay immediately after the feature is done and pollute the lessons file for future work.
|
|
14
|
+
|
|
15
|
+
## Goal
|
|
16
|
+
|
|
17
|
+
Rules in `docs/lessons.md` should be generic patterns applicable to any domain or feature in the repo, not instances of a pattern tied to one service or entity.
|
|
18
|
+
|
|
19
|
+
## Affected files
|
|
20
|
+
|
|
21
|
+
- `skills/executing-tasks/SKILL.md`
|
|
22
|
+
- `skills/finalizing/SKILL.md`
|
|
23
|
+
|
|
24
|
+
## Changes
|
|
25
|
+
|
|
26
|
+
### 1. `executing-tasks` — Step 6 "Learn from mistakes"
|
|
27
|
+
|
|
28
|
+
Add a **generalization test** after "Only add rules that would change future behavior."
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Before writing, apply the **generalization test**: would this rule apply equally to a
|
|
32
|
+
completely different feature or domain in this repo? If not, rewrite it — strip out
|
|
33
|
+
specific service names, entity types, and domain concepts, and express the underlying
|
|
34
|
+
pattern instead. If you can't express a generic form, don't write the rule.
|
|
35
|
+
|
|
36
|
+
❌ Domain-specific (only survives this sprint):
|
|
37
|
+
"Always validate `userId` before calling `UserProfile.Get`"
|
|
38
|
+
|
|
39
|
+
✅ Generic (applies across the whole repo):
|
|
40
|
+
"Always validate required ID fields at the service boundary — missing IDs should
|
|
41
|
+
return 400, not 500"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. `executing-tasks` — `docs/lessons.md` format template comment
|
|
45
|
+
|
|
46
|
+
Add one line to the comment block so the constraint is visible every time the agent opens the file:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Rules must be generic patterns applicable to any domain or feature — not specific to
|
|
50
|
+
one service, entity, or use case.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. `finalizing` — Step 2 "Review lessons learned"
|
|
54
|
+
|
|
55
|
+
Add a generalization audit bullet between "Add any lessons..." and "Retire rules...":
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
- Generalize domain-specific rules — if a rule names a specific service, entity, or
|
|
59
|
+
feature, either rewrite it as a generic pattern or remove it if no generic form exists
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 4. `finalizing` — `docs/lessons.md` format template comment
|
|
63
|
+
|
|
64
|
+
Same addition as change 2 — keep both template definitions consistent.
|
|
65
|
+
|
|
66
|
+
## Slice summary
|
|
67
|
+
|
|
68
|
+
One end-to-end slice:
|
|
69
|
+
|
|
70
|
+
> **Lessons stay generic** — at write-time (executing-tasks step 6) the agent is required to generalize before writing; the file's own comment reinforces the constraint; at finalization the agent audits and cleans up anything that slipped through.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Implementation Plan: Enforce Generic Lessons in `docs/lessons.md`
|
|
2
|
+
|
|
3
|
+
Design: docs/plans/2026-05-20-generic-lessons-design.md
|
|
4
|
+
|
|
5
|
+
Two skill files need four text edits total. No tests (markdown-only changes). Both
|
|
6
|
+
tasks are trivial — exact old/new text is specified so the executor can apply them
|
|
7
|
+
without guessing.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Task 1: Add generalization test + update format comment in `executing-tasks`
|
|
12
|
+
|
|
13
|
+
<!-- tdd: trivial -->
|
|
14
|
+
|
|
15
|
+
File: `skills/executing-tasks/SKILL.md`
|
|
16
|
+
|
|
17
|
+
Two edits in one file:
|
|
18
|
+
|
|
19
|
+
### Edit A — Step 6 "Learn from mistakes"
|
|
20
|
+
|
|
21
|
+
Replace:
|
|
22
|
+
```
|
|
23
|
+
6. **Learn from mistakes** — if you caught yourself making a mistake during this task that you've made before or that would apply to future tasks, append a rule to `docs/lessons.md`. Only add rules that would change future behavior. If the file doesn't exist, create it with the standard format (see below).
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
With:
|
|
27
|
+
```
|
|
28
|
+
6. **Learn from mistakes** — if you caught yourself making a mistake during this task that you've made before or that would apply to future tasks, append a rule to `docs/lessons.md`. Only add rules that would change future behavior. If the file doesn't exist, create it with the standard format (see below).
|
|
29
|
+
|
|
30
|
+
Before writing, apply the **generalization test**: would this rule apply equally to a completely different feature or domain in this repo? If not, rewrite it — strip out specific service names, entity types, and domain concepts, and express the underlying pattern instead. If you can't express a generic form, don't write the rule.
|
|
31
|
+
|
|
32
|
+
❌ **Domain-specific** (only survives this sprint):
|
|
33
|
+
> "Always validate `userId` before calling `UserProfile.Get`"
|
|
34
|
+
|
|
35
|
+
✅ **Generic** (applies across the whole repo):
|
|
36
|
+
> "Always validate required ID fields at the service boundary — missing IDs should return 400, not 500"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Edit B — `docs/lessons.md` format template comment
|
|
40
|
+
|
|
41
|
+
Replace:
|
|
42
|
+
```
|
|
43
|
+
<!--
|
|
44
|
+
Agent: read this at the start of each task during executing-tasks.
|
|
45
|
+
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
46
|
+
Retire rules that no longer apply during finalizing.
|
|
47
|
+
-->
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
With:
|
|
51
|
+
```
|
|
52
|
+
<!--
|
|
53
|
+
Agent: read this at the start of each task during executing-tasks.
|
|
54
|
+
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
55
|
+
Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
|
|
56
|
+
Retire rules that no longer apply during finalizing.
|
|
57
|
+
-->
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Steps:
|
|
61
|
+
1. Apply Edit A to `skills/executing-tasks/SKILL.md`
|
|
62
|
+
2. Apply Edit B to `skills/executing-tasks/SKILL.md`
|
|
63
|
+
3. Verify: open the file and confirm both edits are present and the surrounding text is intact
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Task 2: Add generalization audit bullet + update format comment in `finalizing`
|
|
68
|
+
|
|
69
|
+
<!-- tdd: trivial -->
|
|
70
|
+
|
|
71
|
+
File: `skills/finalizing/SKILL.md`
|
|
72
|
+
|
|
73
|
+
Two edits in one file:
|
|
74
|
+
|
|
75
|
+
### Edit A — Step 2 "Review lessons learned"
|
|
76
|
+
|
|
77
|
+
Replace:
|
|
78
|
+
```
|
|
79
|
+
- Add any lessons from this session that were missed during execution
|
|
80
|
+
- Retire rules that no longer apply (remove the bullet)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
With:
|
|
84
|
+
```
|
|
85
|
+
- Add any lessons from this session that were missed during execution
|
|
86
|
+
- **Generalize domain-specific rules** — if a rule names a specific service, entity, or feature, either rewrite it as a generic pattern or remove it if no generic form exists
|
|
87
|
+
- Retire rules that no longer apply (remove the bullet)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Edit B — `docs/lessons.md` format template comment
|
|
91
|
+
|
|
92
|
+
Replace:
|
|
93
|
+
```
|
|
94
|
+
<!--
|
|
95
|
+
Agent: read this at the start of each task during executing-tasks.
|
|
96
|
+
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
97
|
+
Retire rules that no longer apply during finalizing.
|
|
98
|
+
-->
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
With:
|
|
102
|
+
```
|
|
103
|
+
<!--
|
|
104
|
+
Agent: read this at the start of each task during executing-tasks.
|
|
105
|
+
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
106
|
+
Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
|
|
107
|
+
Retire rules that no longer apply during finalizing.
|
|
108
|
+
-->
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Steps:
|
|
112
|
+
1. Apply Edit A to `skills/finalizing/SKILL.md`
|
|
113
|
+
2. Apply Edit B to `skills/finalizing/SKILL.md`
|
|
114
|
+
3. Verify: open the file and confirm both edits are present and the surrounding text is intact
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Progress: generic-lessons
|
|
2
|
+
|
|
3
|
+
Plan: docs/plans/2026-05-20-generic-lessons-implementation.md
|
|
4
|
+
Branch: generic-lessons
|
|
5
|
+
Started: 2026-05-20T00:00:00Z
|
|
6
|
+
Last updated: 2026-05-20T00:00:00Z
|
|
7
|
+
|
|
8
|
+
| # | Status | Task | Commit |
|
|
9
|
+
|---|--------|------|--------|
|
|
10
|
+
| 1 | ✅ done | Add generalization test + update format comment in `executing-tasks` | 96010f7 |
|
|
11
|
+
| 2 | ✅ done | Add generalization audit bullet + update format comment in `finalizing` | 72f088d |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: brainstorming
|
|
3
|
-
description: "Use this before any creative work — creating features, building components, adding functionality, or modifying behavior. Explores intent and design before implementation."
|
|
3
|
+
description: "Use this before any creative work — creating features, building components, adding functionality, or modifying behavior. Explores intent and design before implementation. Use this skill whenever the user describes something they want to build, change, or improve, even if they don't say 'brainstorm' — phrases like 'I want to add X', 'let's build Y', 'we need a way to Z', or 'help me design' all apply."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Brainstorming
|
package/skills/diagnose/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: diagnose
|
|
3
|
-
description: "Disciplined debugging loop for hard bugs and performance regressions. Use when a test fails unexpectedly, a bug is found during execution, or something is broken."
|
|
3
|
+
description: "Disciplined debugging loop for hard bugs and performance regressions. Use when a test fails unexpectedly, a bug is found during execution, or something is broken. Use this skill whenever the user reports a bug, says 'this doesn't work', 'something's wrong', 'help me debug', or when tests fail for unclear reasons. Works at any point in the workflow — brainstorm, execute, or standalone."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Diagnose
|
|
@@ -131,14 +131,20 @@ Implement the plan from `docs/plans/*-implementation.md` task by task, with file
|
|
|
131
131
|
| Status | Meaning |
|
|
132
132
|
|--------|---------|
|
|
133
133
|
| `⬜ pending` | Not started |
|
|
134
|
-
| `🔄 in-progress` | Currently
|
|
134
|
+
| `🔄 in-progress` | Currently executing plan steps |
|
|
135
|
+
| `⏸ test-review` | Paused at checkpoint: test, waiting for human approval |
|
|
136
|
+
| `⏸ done-review` | Paused at checkpoint: done, waiting for human approval |
|
|
135
137
|
| `✅ done` | Committed successfully |
|
|
136
138
|
| `❌ failed` | Could not complete (append `Failed: <reason>`) |
|
|
137
139
|
| `⏭ skipped` | User chose to skip |
|
|
138
140
|
|
|
139
141
|
**Update rules:**
|
|
140
142
|
- Mark `🔄 in-progress` immediately when starting a task
|
|
143
|
+
- Mark `⏸ test-review` or `⏸ done-review` when the agent reaches a `⏸ CHECKPOINT` gate in the plan — this must happen BEFORE any `git add` or `git commit`
|
|
144
|
+
- Can only return to `🔄 in-progress` after the human explicitly says "approve"
|
|
141
145
|
- Mark `✅ done` + record commit hash only after successful `git commit`
|
|
146
|
+
- Cannot go from `🔄 in-progress` → `✅ done` if the task has a checkpoint — must go through the review status first
|
|
147
|
+
- `git add` and `git commit` happen AFTER human approval, never before
|
|
142
148
|
- Mark `❌ failed` + append reason when the agent can't proceed after retrying
|
|
143
149
|
- Mark `⏭ skipped` when the user says "skip"
|
|
144
150
|
- Update `Last updated` timestamp on every change
|
|
@@ -146,97 +152,143 @@ Implement the plan from `docs/plans/*-implementation.md` task by task, with file
|
|
|
146
152
|
|
|
147
153
|
## Per-task execution
|
|
148
154
|
|
|
149
|
-
For each task
|
|
155
|
+
For each task:
|
|
150
156
|
|
|
151
157
|
1. **Mark in-progress** — update the progress file: `🔄 in-progress`
|
|
152
|
-
2. **Read the plan
|
|
153
|
-
3. **
|
|
154
|
-
4. **
|
|
155
|
-
5.
|
|
156
|
-
6. **Implement** — write the code to make the test pass.
|
|
157
|
-
7. **Run tests** — verify everything passes. If tests fail and you cannot fix them after retrying, see [If you're stuck](#if-youre-stuck). If still stuck, mark the task `❌ failed` with the reason in the progress file and move to the next task.
|
|
158
|
-
8. **Verify against task description** — re-read the task from the plan. Does the implementation satisfy every requirement in the description? If not, fix before proceeding.
|
|
159
|
-
9. **Refactor if needed** — after all tests pass, check for refactoring opportunities:
|
|
158
|
+
2. **Read the plan** — read the plan's overview section (everything before `## Task 1:`). Skim all `## Task N:` headings for dependency awareness. Then read the current task's body in full. **Read `docs/lessons.md` if it exists** — follow all rules listed there while working on this task.
|
|
159
|
+
3. **Execute the plan steps** — follow each numbered step in the task body, in order. Stop at any `⏸ CHECKPOINT` gate (see [Checkpoint gates](#checkpoint-gates--when-the-plan-says-stop)).
|
|
160
|
+
4. **Verify against task description** — re-read the task from the plan. Does the implementation satisfy every requirement listed? If not, fix before proceeding.
|
|
161
|
+
5. **Refactor** — after all tests pass, look for:
|
|
160
162
|
- **Shallow modules** — is the interface nearly as complex as the implementation? Can complexity be hidden behind a simpler interface?
|
|
161
163
|
- **Deletion test** — if you deleted this module, would complexity vanish (pass-through) or reappear across callers (earning its keep)?
|
|
162
164
|
- **Duplication** — extract repeated patterns
|
|
163
165
|
- **Seam discipline** — don't introduce abstraction unless something actually varies across it. One adapter = hypothetical seam. Two adapters = real seam
|
|
164
166
|
|
|
165
167
|
Run tests after each refactor step. Never refactor while tests are failing.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
168
|
+
6. **Learn from mistakes** — if you caught yourself making a mistake during this task that you've made before or that would apply to future tasks, append a rule to `docs/lessons.md`. Only add rules that would change future behavior. If the file doesn't exist, create it with the standard format (see below).
|
|
169
|
+
|
|
170
|
+
Before writing, apply the **generalization test**: would this rule apply equally to a completely different feature or domain in this repo? If not, rewrite it — strip out specific service names, entity types, and domain concepts, and express the underlying pattern instead. If you can't express a generic form, don't write the rule.
|
|
171
|
+
|
|
172
|
+
❌ **Domain-specific** (only survives this sprint):
|
|
173
|
+
> "Always validate `userId` before calling `UserProfile.Get`"
|
|
174
|
+
|
|
175
|
+
✅ **Generic** (applies across the whole repo):
|
|
176
|
+
> "Always validate required ID fields at the service boundary — missing IDs should return 400, not 500"
|
|
177
|
+
7. **Commit** — after all steps are done (no checkpoint gates remain in the task), `git add` the relevant files and commit with a clear message.
|
|
178
|
+
8. **Update progress** — mark `✅ done` + record the commit hash.
|
|
179
|
+
9. **Suggest session break if needed** — after completing ~3-5 tasks since the last break, suggest:
|
|
180
|
+
```
|
|
181
|
+
✅ Tasks N-M done (commits: abc, def)
|
|
182
|
+
Progress: X/Y tasks done
|
|
183
|
+
⏭ Next: Task [N+1] — [description]
|
|
184
|
+
💡 Context is building up. For clean context on remaining tasks:
|
|
185
|
+
/new then /skill:executing-tasks
|
|
186
|
+
(or just say "continue" to keep going here)
|
|
187
|
+
```
|
|
188
|
+
Also suggest at checkpoint review pauses when multiple tasks have been completed since the last break. Respect the user's choice if they say "continue".
|
|
189
|
+
10. **Loop** — go back to step 1 for the next `⬜ pending` task, or see [After all tasks](#after-all-tasks) if none remain.
|
|
190
|
+
|
|
191
|
+
### `docs/lessons.md` format
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
# Lessons Learned
|
|
195
|
+
|
|
196
|
+
<!--
|
|
197
|
+
Agent: read this at the start of each task during executing-tasks.
|
|
198
|
+
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
199
|
+
Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
|
|
200
|
+
Retire rules that no longer apply during finalizing.
|
|
201
|
+
-->
|
|
202
|
+
|
|
203
|
+
## Rules
|
|
204
|
+
|
|
205
|
+
- <new rule here>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Checkpoint gates — when the plan says STOP
|
|
209
|
+
|
|
210
|
+
The plan marks certain steps with `⏸ **CHECKPOINT: test**` or `⏸ **CHECKPOINT: done**`. These are hard stop points. When you reach one:
|
|
211
|
+
|
|
212
|
+
1. **Stop executing immediately.** Do not proceed to the next step in the task. Do not pass go.
|
|
213
|
+
2. **Do NOT run `git add` or `git commit`.** The code stays uncommitted until the human approves.
|
|
214
|
+
3. Update the progress file to `⏸ test-review` or `⏸ done-review`.
|
|
215
|
+
4. Present the checkpoint review (see below).
|
|
216
|
+
5. **Wait for the human to respond.** Do not continue executing steps, do not commit, do not move to the next task.
|
|
217
|
+
6. On approval, update progress back to `🔄 in-progress` and continue with the next step in the task.
|
|
218
|
+
|
|
219
|
+
The whole point of checkpoints is that the human reviews code at critical moments before the agent proceeds further. If you skip past a checkpoint without waiting, you defeat this purpose.
|
|
220
|
+
|
|
221
|
+
| Checkpoint type | What the agent has done at this point | What needs human approval |
|
|
222
|
+
|---|---|---|
|
|
223
|
+
| `checkpoint: test` | Written failing tests, confirmed they fail | The test design — are the right things being tested? |
|
|
224
|
+
| `checkpoint: done` | Implemented, refactored, written lessons | The implementation approach, the refactoring choices |
|
|
225
|
+
|
|
226
|
+
**For `checkpoint: test`:** Only the test file should exist at this point. No implementation code yet. The human reviews the test to confirm the right behavior is being specified.
|
|
227
|
+
|
|
228
|
+
**For `checkpoint: done`:** All code changes are made but NOT committed. Run `git diff` (not `git diff --cached` — nothing should be staged) to show the human what changed. The human reviews before anything is committed.
|
|
196
229
|
|
|
197
230
|
## Checkpoint review
|
|
198
231
|
|
|
199
|
-
When
|
|
232
|
+
When you hit a checkpoint gate, present a review to the human and **stop all execution** until they respond.
|
|
233
|
+
|
|
234
|
+
### At `checkpoint: test`
|
|
200
235
|
|
|
236
|
+
You have written the failing tests and confirmed they fail. No implementation code exists yet.
|
|
237
|
+
|
|
238
|
+
Present:
|
|
201
239
|
```
|
|
202
240
|
⏸ Paused at checkpoint: test for task [N]
|
|
203
241
|
|
|
204
|
-
**Test
|
|
205
|
-
|
|
242
|
+
**Test file:** `path/to/test.ts`
|
|
243
|
+
|
|
244
|
+
**Test code:**
|
|
245
|
+
[show the full test code]
|
|
246
|
+
|
|
247
|
+
**Test results:** [paste the failing test output showing which tests fail and why]
|
|
206
248
|
|
|
207
|
-
**
|
|
208
|
-
**Next:**
|
|
249
|
+
**What this validates:** [summarize the behavior these tests specify]
|
|
250
|
+
**Next step after approval:** Write the implementation to make these tests pass
|
|
209
251
|
|
|
210
|
-
|
|
211
|
-
- **
|
|
212
|
-
- **
|
|
213
|
-
- **
|
|
214
|
-
- **
|
|
215
|
-
-
|
|
216
|
-
-
|
|
217
|
-
- `status` — show the full progress table
|
|
252
|
+
What would you like to do?
|
|
253
|
+
- **approve** — I'll implement to make these tests pass
|
|
254
|
+
- **request changes** — tell me what to change in the tests
|
|
255
|
+
- **revert** — undo this task and go back to pending
|
|
256
|
+
- **skip** — skip this task entirely
|
|
257
|
+
- **stop** — pause here, resume later with /skill:executing-tasks
|
|
258
|
+
- **status** — show the full progress table
|
|
218
259
|
```
|
|
219
260
|
|
|
220
|
-
|
|
261
|
+
### At `checkpoint: done`
|
|
221
262
|
|
|
263
|
+
You have implemented the code, run the refactor step, and written any lessons. Nothing is committed yet.
|
|
264
|
+
|
|
265
|
+
Present:
|
|
222
266
|
```
|
|
223
267
|
⏸ Paused at checkpoint: done for task [N]
|
|
224
268
|
|
|
225
|
-
**What was done:** [brief summary]
|
|
226
|
-
|
|
227
|
-
**
|
|
228
|
-
|
|
229
|
-
**
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
269
|
+
**What was done:** [brief summary — what feature/fix was implemented]
|
|
270
|
+
|
|
271
|
+
**Test results:** [run tests now, paste the passing output]
|
|
272
|
+
|
|
273
|
+
**Diff:** [run `git diff` — the unstaged changes are what this task produced]
|
|
274
|
+
[paste the full diff]
|
|
275
|
+
|
|
276
|
+
**Refactoring done:** [what changed during refactor, or "none needed — [reason]"]
|
|
277
|
+
**Lessons learned:** [new rule added to docs/lessons.md, or "none"]
|
|
278
|
+
**Next step after approval:** git add, commit, and move to next task
|
|
279
|
+
|
|
280
|
+
What would you like to do?
|
|
281
|
+
- **approve** — I'll commit and move to the next task
|
|
282
|
+
- **request changes** — tell me what to change, I'll update and re-present
|
|
283
|
+
- **revert** — undo this task and go back to pending
|
|
284
|
+
- **skip** — skip this task entirely
|
|
285
|
+
- **stop** — pause here, resume later with /skill:executing-tasks
|
|
286
|
+
- **status** — show the full progress table
|
|
237
287
|
```
|
|
238
288
|
|
|
239
|
-
|
|
289
|
+
**Do not commit before the human approves.** The diff you show at `checkpoint: done` is the uncommitted work. If the human requests changes, make the edits, re-run tests, and re-present the updated diff at the same checkpoint. Repeat until they say "approve".
|
|
290
|
+
|
|
291
|
+
Only after approval: `git add` the relevant files, commit, and mark the task `✅ done`.
|
|
240
292
|
|
|
241
293
|
## Progress file updates
|
|
242
294
|
|
|
@@ -37,6 +37,7 @@ Wait for the user to confirm before proceeding.
|
|
|
37
37
|
|
|
38
38
|
2. **Review lessons learned** — if `docs/lessons.md` exists, review it:
|
|
39
39
|
- Add any lessons from this session that were missed during execution
|
|
40
|
+
- **Generalize domain-specific rules** — if a rule names a specific service, entity, or feature, either rewrite it as a generic pattern or remove it if no generic form exists
|
|
40
41
|
- Retire rules that no longer apply (remove the bullet)
|
|
41
42
|
- If no changes are needed, leave it as-is
|
|
42
43
|
|
|
@@ -48,6 +49,7 @@ Wait for the user to confirm before proceeding.
|
|
|
48
49
|
<!--
|
|
49
50
|
Agent: read this at the start of each task during executing-tasks.
|
|
50
51
|
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
52
|
+
Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
|
|
51
53
|
Retire rules that no longer apply during finalizing.
|
|
52
54
|
-->
|
|
53
55
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: writing-plans
|
|
3
|
-
description: "Use this to break a design into an implementation plan with bite-sized TDD tasks. Works with or without a prior brainstorm."
|
|
3
|
+
description: "Use this to break a design into an implementation plan with bite-sized TDD tasks. Works with or without a prior brainstorm. Use this skill when the user says 'let's plan', 'break this down', 'write a plan', 'create tasks', or after a brainstorm session when they want to move to implementation. Also use when the user has a clear idea and wants to jump straight to a structured plan."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Writing Plans
|
|
@@ -15,22 +15,20 @@ You may only create or edit files under `docs/plans/`. Do not modify source code
|
|
|
15
15
|
|
|
16
16
|
## Task format
|
|
17
17
|
|
|
18
|
-
Each task should produce one
|
|
18
|
+
Each task should produce one testable change. The executing-tasks skill handles committing — do not include `git commit` in the task body.
|
|
19
19
|
|
|
20
|
+
Each task must include:
|
|
20
21
|
- Exact file paths to create/modify
|
|
21
|
-
-
|
|
22
|
-
- Exact commands with expected output
|
|
23
|
-
-
|
|
24
|
-
- Optional `checkpoint: test` or `checkpoint: done` label
|
|
25
|
-
- Each task's tests should cover the happy path and at least one edge case or error path
|
|
22
|
+
- **Concrete code** — include the actual implementation, not a summary. Write out SQL schemas, type definitions, function signatures with bodies, route handler code, and test assertions. A developer should be able to copy-paste from the plan and have working code. For tasks that depend on types or utilities from earlier tasks, reference them explicitly (e.g., `import { User } from Task 2`) and include only the new code
|
|
23
|
+
- Exact commands with expected output (e.g., `npx vitest run src/user/model.test.ts` → shows 1 test passing)
|
|
24
|
+
- Each task's tests should cover the happy path and at least one edge case or error path, with concrete assertions
|
|
26
25
|
|
|
27
|
-
Each task must use a numbered heading:
|
|
26
|
+
Each task must use a numbered heading with optional metadata comments:
|
|
28
27
|
|
|
29
28
|
```markdown
|
|
30
29
|
## Task N: <description>
|
|
31
30
|
|
|
32
31
|
<!-- tdd: new-feature -->
|
|
33
|
-
<!-- checkpoint: none -->
|
|
34
32
|
```
|
|
35
33
|
|
|
36
34
|
...where N starts at 1 and incrementally numbers each task in the plan.
|
|
@@ -41,6 +39,140 @@ Valid TDD values: `new-feature`, `modifying-tested-code`, `trivial`
|
|
|
41
39
|
|
|
42
40
|
Valid checkpoint values: `none`, `test`, `done`
|
|
43
41
|
|
|
42
|
+
### Level of detail
|
|
43
|
+
|
|
44
|
+
This is the #1 thing to get right. The plan is not a high-level outline — it's a detailed recipe that the executing-tasks skill will follow step by step. If you write "implement login handler" without showing the code, the executing agent has to guess, and that defeats the purpose of the plan.
|
|
45
|
+
|
|
46
|
+
Think of it this way: the plan author (you, now) has the full design context, the domain model, and the architecture in mind. The plan executor (a future agent session) will have none of that context — just the plan file. Write accordingly.
|
|
47
|
+
|
|
48
|
+
**What "concrete code" means in practice:**
|
|
49
|
+
- SQL: `CREATE TABLE` statements with all columns, types, and constraints
|
|
50
|
+
- Types/interfaces: full type definitions with fields
|
|
51
|
+
- Functions: signature + body (the logic, not just the name)
|
|
52
|
+
- Tests: concrete assertions (`expect(result.status).toBe(409)`) not descriptions ("test that it returns an error")
|
|
53
|
+
- Routes: the actual handler code with validation, error handling, and response format
|
|
54
|
+
- Config: exact values, not "configure appropriately"
|
|
55
|
+
|
|
56
|
+
**Bad** (too vague — the executor must guess):
|
|
57
|
+
```
|
|
58
|
+
3. Implement bookmark model
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Good** (executor can copy-paste):
|
|
62
|
+
```
|
|
63
|
+
3. Implement `src/db/bookmarks.ts`:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import db from '../db.js';
|
|
67
|
+
|
|
68
|
+
export function createBookmarksTable() {
|
|
69
|
+
db.exec(`
|
|
70
|
+
CREATE TABLE IF NOT EXISTS bookmarks (
|
|
71
|
+
id TEXT PRIMARY KEY,
|
|
72
|
+
userId TEXT NOT NULL,
|
|
73
|
+
messageId TEXT NOT NULL,
|
|
74
|
+
createdAt TEXT DEFAULT (datetime('now')),
|
|
75
|
+
UNIQUE(userId, messageId)
|
|
76
|
+
)
|
|
77
|
+
`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function insertBookmark(userId: string, messageId: string) {
|
|
81
|
+
const id = crypto.randomUUID();
|
|
82
|
+
db.prepare('INSERT INTO bookmarks (id, userId, messageId) VALUES (?, ?, ?)').run(id, userId, messageId);
|
|
83
|
+
return { id, userId, messageId };
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Task body structure
|
|
89
|
+
|
|
90
|
+
The examples below show the structure — headings, metadata comments, checkpoints, and step numbering. For the code content within steps, follow the detail level described above.
|
|
91
|
+
|
|
92
|
+
**No checkpoint** — numbered steps only:
|
|
93
|
+
```markdown
|
|
94
|
+
## Task 1: Create User model
|
|
95
|
+
|
|
96
|
+
<!-- tdd: new-feature -->
|
|
97
|
+
|
|
98
|
+
Files:
|
|
99
|
+
- `src/user/model.ts`
|
|
100
|
+
- `src/user/model.test.ts`
|
|
101
|
+
|
|
102
|
+
Steps:
|
|
103
|
+
1. Write failing test for User model creation
|
|
104
|
+
2. Run test — confirm it fails
|
|
105
|
+
3. Implement User model
|
|
106
|
+
4. Run test — confirm it passes
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**`checkpoint: test`** — gate after test, before implementing:
|
|
110
|
+
```markdown
|
|
111
|
+
## Task 2: Write auth tests
|
|
112
|
+
|
|
113
|
+
<!-- tdd: new-feature -->
|
|
114
|
+
<!-- checkpoint: test -->
|
|
115
|
+
|
|
116
|
+
Files:
|
|
117
|
+
- `src/auth/login.test.ts`
|
|
118
|
+
|
|
119
|
+
Steps:
|
|
120
|
+
1. Write failing test for login with valid credentials
|
|
121
|
+
2. Run test — confirm it fails
|
|
122
|
+
|
|
123
|
+
⏸ **CHECKPOINT: test** — present test review. Wait for human approval before implementing.
|
|
124
|
+
|
|
125
|
+
3. Implement login handler
|
|
126
|
+
4. Run test — confirm it passes
|
|
127
|
+
5. Refactor — check for shallow modules, duplication, seam discipline. Run tests after changes.
|
|
128
|
+
6. Lessons — caught a mistake that applies to future tasks? Add rule to `docs/lessons.md`.
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**`checkpoint: done`** — gate after all steps including refactor/lessons:
|
|
132
|
+
```markdown
|
|
133
|
+
## Task 3: Add login endpoint
|
|
134
|
+
|
|
135
|
+
<!-- tdd: new-feature -->
|
|
136
|
+
<!-- checkpoint: done -->
|
|
137
|
+
|
|
138
|
+
Files:
|
|
139
|
+
- `src/auth/login.ts`
|
|
140
|
+
- `src/auth/login.test.ts`
|
|
141
|
+
|
|
142
|
+
Steps:
|
|
143
|
+
1. Write failing test for login with valid credentials
|
|
144
|
+
2. Run test — confirm it fails
|
|
145
|
+
3. Implement login handler
|
|
146
|
+
4. Run test — confirm it passes
|
|
147
|
+
5. Add edge case tests (invalid password, missing email)
|
|
148
|
+
6. Refactor — check for shallow modules, duplication, seam discipline. Run tests after changes.
|
|
149
|
+
7. Lessons — caught a mistake that applies to future tasks? Add rule to `docs/lessons.md`.
|
|
150
|
+
|
|
151
|
+
⏸ **CHECKPOINT: done** — present implementation review. Wait for human approval before committing.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Both checkpoints** — gate after test, then gate after refactor/lessons:
|
|
155
|
+
```markdown
|
|
156
|
+
## Task 4: Complex auth flow
|
|
157
|
+
|
|
158
|
+
<!-- tdd: new-feature -->
|
|
159
|
+
<!-- checkpoint: test -->
|
|
160
|
+
<!-- checkpoint: done -->
|
|
161
|
+
|
|
162
|
+
Steps:
|
|
163
|
+
1. Write failing test for auth flow
|
|
164
|
+
2. Run test — confirm it fails
|
|
165
|
+
|
|
166
|
+
⏸ **CHECKPOINT: test** — present test review. Wait for human approval before implementing.
|
|
167
|
+
|
|
168
|
+
3. Implement auth flow
|
|
169
|
+
4. Run test — confirm it passes
|
|
170
|
+
5. Refactor — check for shallow modules, duplication, seam discipline. Run tests after changes.
|
|
171
|
+
6. Lessons — caught a mistake that applies to future tasks? Add rule to `docs/lessons.md`.
|
|
172
|
+
|
|
173
|
+
⏸ **CHECKPOINT: done** — present implementation review. Wait for human approval before committing.
|
|
174
|
+
```
|
|
175
|
+
|
|
44
176
|
|
|
45
177
|
## Vertical slices
|
|
46
178
|
|
|
@@ -69,19 +201,20 @@ Label each task with its TDD scenario:
|
|
|
69
201
|
|
|
70
202
|
| Scenario | When | Instructions in the task |
|
|
71
203
|
|---|---|---|
|
|
72
|
-
| **New feature** | Adding new behavior | Write failing test → run it → implement → run it
|
|
73
|
-
| **Modifying tested code** | Changing existing behavior | Run existing tests first → modify → verify they pass
|
|
74
|
-
| **Trivial** | Config, docs, naming | Use judgment
|
|
204
|
+
| **New feature** | Adding new behavior | Write failing test → run it → implement → run it |
|
|
205
|
+
| **Modifying tested code** | Changing existing behavior | Run existing tests first → modify → verify they pass |
|
|
206
|
+
| **Trivial** | Config, docs, naming | Use judgment |
|
|
75
207
|
|
|
76
208
|
## Checkpoint labels
|
|
77
209
|
|
|
78
|
-
|
|
210
|
+
Label each task with a `checkpoint` to require human review before proceeding. The checkpoint gate (`⏸ CHECKPOINT`) goes in the task body — the agent follows the plan step by step and pauses when it reaches the gate.
|
|
79
211
|
|
|
80
|
-
| Checkpoint | When to use | What
|
|
212
|
+
| Checkpoint | When to use | What the plan should include |
|
|
81
213
|
|---|---|---|
|
|
82
|
-
| *(none)* | Trivial tasks, well-understood changes |
|
|
83
|
-
| **`checkpoint: test`** | Test design matters (API contracts, edge cases, complex behavior) |
|
|
84
|
-
| **`checkpoint: done`** | Implementation review matters (complex logic, security, performance) |
|
|
214
|
+
| *(none)* | Trivial tasks, well-understood changes | Numbered steps only |
|
|
215
|
+
| **`checkpoint: test`** | Test design matters (API contracts, edge cases, complex behavior) | Steps up to test → `⏸ CHECKPOINT: test` → implement steps (including refactor/lessons) |
|
|
216
|
+
| **`checkpoint: done`** | Implementation review matters (complex logic, security, performance) | Steps (including refactor/lessons) → `⏸ CHECKPOINT: done` |
|
|
217
|
+
| Both | Non-obvious tests AND complex logic | Steps up to test → `⏸ CHECKPOINT: test` → implement steps (including refactor/lessons) → `⏸ CHECKPOINT: done` |
|
|
85
218
|
|
|
86
219
|
Use judgment when assigning checkpoints. Prefer `checkpoint: test` for new features with non-obvious test design. Prefer `checkpoint: done` for tasks where the implementation approach is debatable. Most tasks should not need a checkpoint. The user can adjust checkpoints when reviewing the plan.
|
|
87
220
|
|