@tianhai/pi-workflow-kit 0.18.1 → 1.1.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 +79 -62
- package/agents/pwk-hazard-reviewer.md +24 -0
- package/agents/pwk-smell-reviewer.md +17 -0
- package/agents/pwk-spec-reviewer.md +14 -0
- package/agents/pwk-tracing-reviewer.md +14 -0
- package/docs/developer-usage-guide.md +39 -44
- package/docs/lessons.md +2 -7
- package/docs/oversight-model.md +20 -14
- package/docs/workflow-phases.md +64 -30
- package/extensions/workflow-guard.ts +194 -92
- package/package.json +20 -4
- package/skills/pwk-brainstorming/SKILL.md +30 -27
- package/skills/pwk-code-review/SKILL.md +46 -0
- package/skills/pwk-diagnose/SKILL.md +5 -2
- package/skills/pwk-executing-tasks/SKILL.md +92 -328
- package/skills/pwk-finalizing/SKILL.md +23 -106
- package/skills/pwk-status/SKILL.md +28 -0
- package/skills/pwk-writing-plans/SKILL.md +49 -328
- package/docs/plans/2026-06-03-karpathy-guidelines-ab-comparison.md +0 -166
- package/docs/plans/completed/2026-04-11-checkpoint-review-gates-design.md +0 -50
- package/docs/plans/completed/2026-04-11-checkpoint-review-gates-implementation.md +0 -98
- package/docs/plans/completed/2026-04-11-finalizing-merge-options-design.md +0 -33
- package/docs/plans/completed/2026-04-11-finalizing-merge-options-implementation.md +0 -75
- package/docs/plans/completed/2026-04-11-workspace-setup-design.md +0 -28
- package/docs/plans/completed/2026-04-11-workspace-setup-implementation.md +0 -57
- package/docs/plans/completed/2026-04-15-bash-guard-design.md +0 -39
- package/docs/plans/completed/2026-04-15-bash-guard-implementation.md +0 -229
- package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-design.md +0 -172
- package/docs/plans/completed/2026-04-21-workflow-guard-safe-commands-implementation.md +0 -168
- package/docs/plans/completed/2026-04-22-go-readonly-safe-commands-implementation.md +0 -54
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-design.md +0 -171
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-implementation.md +0 -208
- package/docs/plans/completed/2026-04-28-executing-tasks-redesign-progress.md +0 -14
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-design.md +0 -154
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-implementation.md +0 -315
- package/docs/plans/completed/2026-05-01-incorporate-mattpocock-skills-progress.md +0 -15
- package/docs/plans/completed/2026-05-08-checkpoint-gates-design.md +0 -235
- package/docs/plans/completed/2026-05-08-checkpoint-gates-implementation.md +0 -83
- package/docs/plans/completed/2026-05-08-checkpoint-gates-progress.md +0 -11
- package/docs/plans/completed/2026-05-08-lessons-learned-design.md +0 -76
- package/docs/plans/completed/2026-05-08-lessons-learned-implementation.md +0 -219
- package/docs/plans/completed/2026-05-08-lessons-learned-progress.md +0 -15
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-design.md +0 -39
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-implementation.md +0 -45
- package/docs/plans/completed/2026-05-08-migrate-earendil-works-progress.md +0 -10
- package/docs/plans/completed/2026-05-08-worktree-handoff-design.md +0 -118
- package/docs/plans/completed/2026-05-08-worktree-handoff-implementation.md +0 -140
- package/docs/plans/completed/2026-05-08-worktree-handoff-progress.md +0 -10
- package/docs/plans/completed/2026-05-20-generic-lessons-design.md +0 -70
- package/docs/plans/completed/2026-05-20-generic-lessons-implementation.md +0 -114
- package/docs/plans/completed/2026-05-20-generic-lessons-progress.md +0 -11
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-design.md +0 -77
- package/docs/plans/completed/2026-05-22-agentic-agile-enhancements-implementation.md +0 -473
- package/docs/plans/completed/2026-05-25-design-review-split-implementation.md +0 -622
- package/docs/plans/completed/2026-05-25-design-review-split-progress.md +0 -16
- package/docs/plans/completed/2026-05-25-pr5-improvements-implementation.md +0 -273
- package/docs/plans/completed/2026-05-25-pr5-improvements-progress.md +0 -17
- package/docs/plans/completed/2026-06-03-add-verify-skill-design.md +0 -51
- package/docs/plans/completed/2026-06-03-add-verify-skill-implementation.md +0 -111
- package/docs/plans/completed/2026-06-03-add-verify-skill-progress.md +0 -11
- package/docs/plans/completed/2026-06-03-verify-skill-design.md +0 -176
- package/docs/plans/completed/2026-06-09-code-review-fixes-implementation.md +0 -74
- package/docs/plans/completed/2026-06-09-code-review-fixes-progress.md +0 -14
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-design.md +0 -186
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-implementation.md +0 -675
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-progress.md +0 -18
- package/docs/plans/completed/2026-06-09-incremental-workflow-and-rename-verification-report.md +0 -81
- package/docs/plans/completed/2026-06-09-verification-fixes-implementation.md +0 -69
- package/docs/plans/completed/2026-06-09-verification-fixes-progress.md +0 -14
- package/skills/pwk-design-review/SKILL.md +0 -115
- package/skills/pwk-verify/SKILL.md +0 -170
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pwk-finalizing
|
|
3
|
-
description: "Use
|
|
3
|
+
description: "Use after all requirements are complete to delete consumed plan docs, curate lessons, update documentation, and ship the work."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Finalizing
|
|
@@ -9,118 +9,35 @@ Ship the completed work.
|
|
|
9
9
|
|
|
10
10
|
## Pre-finalization checks
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
⚠️ Tasks 4 and 7 were skipped. Continue with finalizing, or go back?
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Wait for the user to confirm before proceeding.
|
|
12
|
+
1. **Run the FULL test suite** — every test must pass, and only a green suite ships. Resume spans sessions; re-run the suite yourself rather than trust the previous session's ending state. Anything failing → send the user back to `/skill:pwk-executing-tasks`.
|
|
13
|
+
2. Read the progress file (`docs/plans/*-progress.md`):
|
|
14
|
+
- **Any `❌ failed`** → **block**. Present counts and reasons; continue only when the user sends the task back to executing-tasks, or explicitly types `--force-failed` to acknowledge shipping with incomplete requirements.
|
|
15
|
+
- **Only `⏭ skipped`** → warn and confirm ("Requirement N was skipped. Continue, or go back?").
|
|
21
16
|
|
|
22
17
|
## Process
|
|
23
18
|
|
|
24
|
-
1. **
|
|
19
|
+
1. **Derive the topic** — progress file → `Plan:` ref → plan's `Design:` ref → design-doc filename → `<topic>`. Ambiguous with several designs in flight? Ask.
|
|
20
|
+
2. **Delete consumed plan docs** — only this design's three artifacts, matched by the exact topic slug (with the `YYYY-MM-DD-` prefix) so similarly-named plans for other topics survive:
|
|
25
21
|
|
|
26
|
-
```
|
|
27
|
-
|
|
22
|
+
```bash
|
|
23
|
+
rm -f docs/plans/????-??-??-<topic>-design.md docs/plans/????-??-??-<topic>-implementation.md docs/plans/????-??-??-<topic>-progress.md
|
|
28
24
|
```
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
mv docs/plans/*-design.md docs/plans/completed/ 2>/dev/null || true
|
|
35
|
-
mv docs/plans/*-implementation.md docs/plans/completed/ 2>/dev/null || true
|
|
36
|
-
mv docs/plans/*-progress.md docs/plans/completed/ 2>/dev/null || true
|
|
37
|
-
mv docs/plans/*-verification-report.md docs/plans/completed/ 2>/dev/null || true
|
|
38
|
-
mv docs/plans/adr/*.md docs/plans/completed/adr/ 2>/dev/null || true
|
|
39
|
-
rmdir docs/plans/adr 2>/dev/null || true
|
|
40
|
-
git add docs/plans/ && git commit -m "chore: archive planning docs"
|
|
41
|
-
```
|
|
26
|
+
The `????-??-??-` glob enforces the dated filename; a bare `*<topic>*` would over-match unrelated docs (e.g. topic `auth` would also hit `feature-auth-redesign-design.md`). Verify with `ls docs/plans/` before and after. `rm -f` handles missing files. `docs/adr/`, `docs/lessons.md`, `CHANGELOG.md`, and `README.md` are permanent — leave them entirely out of the delete set.
|
|
27
|
+
3. **Curate lessons (Agile Scrum Master hat)** — if `docs/lessons.md` exists: add missed lessons, generalize domain-specific rules into generic patterns, de-duplicate, categorize, retire stale rules. None exists but lessons were learned? Create it.
|
|
28
|
+
4. **Update documentation** — if the API or surface changed: `README.md`, `CHANGELOG.md`, any inline docs.
|
|
29
|
+
5. **Choose a merge strategy** — ask the human:
|
|
42
30
|
|
|
43
|
-
|
|
31
|
+
1. **Create PR** — `git push origin <branch>` then `gh pr create`.
|
|
32
|
+
2. **Rebase & merge** *(recommended)* — rebase onto parent, `--ff-only` merge, push parent, delete branch.
|
|
33
|
+
3. **Squash & merge** — squash onto parent, push, delete branch.
|
|
34
|
+
4. **Merge commit** — `--no-ff` merge, push parent, delete branch.
|
|
44
35
|
|
|
45
|
-
2
|
|
46
|
-
|
|
47
|
-
- **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
|
|
48
|
-
- **De-duplicate** — combine overlapping or redundant rules into single, sharper entries
|
|
49
|
-
- **Categorize** — group the rules under clear, structured markdown headers (e.g., `## Tool Usage`, `## Testing Patterns`, `## Architecture Rules`) to make the document highly scannable for future sessions. Keep the `## Rules` section as the append target for new entries during execution — categorization moves rules out of `## Rules` into the appropriate category headers.
|
|
50
|
-
- **Retire stale rules** — remove bullets that no longer apply
|
|
51
|
-
- If no changes are needed, leave it as-is
|
|
36
|
+
For 2–4, confirm the detected parent branch before proceeding.
|
|
37
|
+
6. **Clean up** — remove the worktree if one was used: `git worktree remove ../<repo>-<topic>`.
|
|
52
38
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```markdown
|
|
56
|
-
# Lessons Learned
|
|
57
|
-
|
|
58
|
-
<!--
|
|
59
|
-
Agent: read this at the start of each task during executing-tasks.
|
|
60
|
-
Follow every rule. Add new rules when you catch yourself making repeat mistakes.
|
|
61
|
-
Rules must be generic patterns applicable to any domain or feature — not specific to one service, entity, or use case.
|
|
62
|
-
Retire rules that no longer apply during finalizing.
|
|
63
|
-
-->
|
|
64
|
-
|
|
65
|
-
## Rules
|
|
66
|
-
|
|
67
|
-
- <rule 1>
|
|
68
|
-
- <rule 2>
|
|
69
|
-
```
|
|
39
|
+
## Principles
|
|
70
40
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- Update any inline docs
|
|
75
|
-
|
|
76
|
-
4. **Choose a merge strategy** — ask the human which option they prefer:
|
|
77
|
-
|
|
78
|
-
1. **Create PR** — push and open a PR for external review:
|
|
79
|
-
```
|
|
80
|
-
git push origin <branch>
|
|
81
|
-
gh pr create --title "feat: <summary>" --body "<task summary>"
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Use the progress file to generate the summary. Convert the task table to a bulleted list:
|
|
85
|
-
```
|
|
86
|
-
- ✅ Create User model
|
|
87
|
-
- ✅ Write User model tests
|
|
88
|
-
- ⏭ Add auth middleware (skipped)
|
|
89
|
-
- ✅ Add login endpoint
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
2. **Rebase & merge** *(recommended)* — rebase onto parent, fast-forward merge, push parent, delete branch:
|
|
93
|
-
```
|
|
94
|
-
parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
|
|
95
|
-
git checkout "$parent" && git pull
|
|
96
|
-
git checkout - && git rebase "$parent"
|
|
97
|
-
git checkout "$parent" && git merge --ff-only -
|
|
98
|
-
git push origin "$parent"
|
|
99
|
-
git branch -d - && git push origin --delete -
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
3. **Squash & merge** — squash all commits into one on parent, push parent, delete branch:
|
|
103
|
-
```
|
|
104
|
-
parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
|
|
105
|
-
git checkout "$parent" && git pull
|
|
106
|
-
git merge --squash -
|
|
107
|
-
git commit -m "feat: <summary>"
|
|
108
|
-
git push origin "$parent"
|
|
109
|
-
git branch -d - && git push origin --delete -
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
4. **Merge commit** — merge with `--no-ff`, push parent, delete branch:
|
|
113
|
-
```
|
|
114
|
-
parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
|
|
115
|
-
git checkout "$parent" && git pull
|
|
116
|
-
git checkout - && git merge --no-ff -m "Merge branch '<branch>'" -
|
|
117
|
-
git push origin "$parent"
|
|
118
|
-
git branch -d - && git push origin --delete -
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
For options 2–4, confirm the detected parent branch with the human before proceeding.
|
|
122
|
-
|
|
123
|
-
5. **Clean up** — if a worktree was used, remove it:
|
|
124
|
-
```
|
|
125
|
-
git worktree remove ../<repo>-<feature-name>
|
|
126
|
-
```
|
|
41
|
+
- Delete **only** the active design's artifacts — un-started designs (from a split) stay in `docs/plans/`.
|
|
42
|
+
- ADRs are permanent institutional memory — they stay out of archive/rotation forever.
|
|
43
|
+
- Bump the package version if this is a published change (major for breaking changes).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pwk-status
|
|
3
|
+
description: "Show all active pipeline topics and their phase/progress. Use when the user asks 'where are we', 'status', 'what's in flight', or when resuming and unsure which design to continue. Read-only discovery. Not a pipeline phase."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Status
|
|
7
|
+
|
|
8
|
+
Report on all in-flight pipelines (split designs may run in parallel across worktrees). Read-only. This skill **does not unlock the guard** — it needs no writes, so it runs fine inside the brainstorm/plan read-only phase. If you want source edits after a status check, invoke the skill for the next phase yourself (the guard follows the skill).
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
1. Glob `docs/plans/*-design.md`, `*-implementation.md`, `*-progress.md`.
|
|
13
|
+
2. For each `<topic>`, infer the furthest artifact present:
|
|
14
|
+
- only `*-design.md` → brainstorm done, plan next
|
|
15
|
+
- `*-implementation.md` but no progress → plan done, execute next
|
|
16
|
+
- `*-progress.md` → execute phase — show `done/total` requirement count
|
|
17
|
+
3. Print a one-line table, e.g.:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
| Topic | Phase | Progress | Branch |
|
|
21
|
+
|---------|---------|----------|------------------|
|
|
22
|
+
| auth | execute | 2/3 done | auth |
|
|
23
|
+
| billing | plan | — | ../repo-billing |
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
4. If none, say so and suggest `/skill:pwk-brainstorming`.
|
|
27
|
+
|
|
28
|
+
Keep it short — this is orientation, not analysis. No writes; the `<topic>` slug is the identity.
|
|
@@ -1,358 +1,79 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pwk-writing-plans
|
|
3
|
-
description: "
|
|
3
|
+
description: "Turn a design doc's requirements into a behavioral spec — acceptance criteria + integration tests per requirement. Use after pwk-brainstorming, before pwk-executing-tasks. Use when the user says 'let's plan', 'write a plan', 'break this down', or after a brainstorm when ready to move to implementation."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Writing Plans
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Turn the design doc's requirements into a **behavioral spec** the executor implements against.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
1. **Check for a design doc** — look for `docs/plans/*-design.md`. If one exists, use it as the basis for the plan. If the design doc is incomplete, fill gaps by asking the human. If no design doc exists, ask the user to describe what they want to build and read relevant code. **Read `docs/lessons.md`** if it exists — incorporate known patterns into the task breakdown (e.g., if a lesson says "always run lint before commit," include that in relevant task instructions).
|
|
13
|
-
|
|
14
|
-
If the design doc has a `## Features` table, read it to identify the next feature with status `⬜ pending`. Mark that feature as `🔄 planned` by editing the design doc. This plan will cover only that one feature. If the design doc has no Features table, plan the entire design as before.
|
|
10
|
+
One design doc = one plan = one PR. The plan lists **all** the design's requirements in build order; the executor builds them one at a time.
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
Your writes go into `docs/plans/` and nowhere else. Source code and configuration get written later, in `pwk-executing-tasks` — this phase produces the document the executor builds from.
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
- Authentication or authorization logic
|
|
20
|
-
- External API or service integrations
|
|
21
|
-
- Concurrency or batch processing
|
|
22
|
-
- File uploads or large data flows
|
|
23
|
-
- Redis, caching, or message queues
|
|
24
|
-
|
|
25
|
-
If any apply, prompt the user: "This feature involves [list what you found] but hasn't been reviewed for production risks. Run `/skill:pwk-design-review` first, or type 'proceed' to skip."
|
|
14
|
+
## Process
|
|
26
15
|
|
|
27
|
-
|
|
28
|
-
2. **
|
|
16
|
+
1. **Find the design doc** — glob `docs/plans/*-design.md`. If none, ask the user to run `/skill:pwk-brainstorming` first; if several, ask which. **Read `docs/lessons.md`** if it exists — known patterns belong in the acceptance criteria.
|
|
17
|
+
2. **Create the feature branch** — `git checkout -b <topic>` (branch creation is allowed in the plan phase). Design + plan docs live on this branch, committed at the start of `pwk-executing-tasks`.
|
|
18
|
+
3. **Read the `## Requirements` list** — the plan covers **all** of them. If the design has none, derive requirements from its described behaviors and confirm with the human before proceeding.
|
|
19
|
+
4. **Write the plan** — for each requirement:
|
|
20
|
+
- **Acceptance criteria** — `Given/When/Then` behavioral statements defining "done". Write observable behaviors, not implementation steps; cover edge and error cases.
|
|
21
|
+
- **Integration tests** — test name + what each asserts. This is the spec the executor writes tests from.
|
|
22
|
+
- **`### Checkpoints: full | spec | none`** — how many human stops. `full` = tests + complete (default); `spec` = tests stop only (clear spec, low implementation risk — the complete checkpoint is dropped); `none` = trivial only (config line, typo).
|
|
23
|
+
- **`### Review: parallel | inline | skip`** — `parallel` = four reviewers via subagent (default, non-trivial diffs); `inline` = one `pwk-code-review` pass (small/medium diffs); `skip` = trivial diffs with no behavioral surface.
|
|
24
|
+
- Tag every requirement — missing tags default to `full` / `parallel`. **`spec` requires at least `inline` review** — dropping the complete checkpoint is only safe when review covers implementation quality; never combine `spec` with `Review: skip` (use `Checkpoints: none` instead).
|
|
25
|
+
- **Production-risk notes** — carry forward the design's `## Production-risk areas`, if any.
|
|
26
|
+
- **Challenge the design first** *(if production-risk areas exist)* — stress-test the design against the flagged risks before writing criteria. If a risk invalidates a design choice, stop and return to `/skill:pwk-brainstorming` rather than planning around a flawed design.
|
|
27
|
+
- **Ordering** — dependencies come **earlier** in the list; the executor runs in listed order with no dependency graph. Aim for vertical slices that merge cleanly on their own.
|
|
28
|
+
|
|
29
|
+
Save to `docs/plans/YYYY-MM-DD-<topic>-implementation.md`:
|
|
29
30
|
|
|
30
31
|
```markdown
|
|
31
|
-
# Implementation Plan: <
|
|
32
|
+
# Implementation Plan: <topic>
|
|
32
33
|
|
|
33
34
|
## Overview
|
|
34
|
-
|
|
35
35
|
Design: docs/plans/YYYY-MM-DD-<topic>-design.md
|
|
36
|
-
Feature: <feature name> (row N in Features table)
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
If the design is too large for ~15 tasks for a single feature, flag this to the human and ask whether to reduce scope or proceed with the full plan.
|
|
40
|
-
3. **Present the plan** — show the complete plan to the human. Wait for approval before suggesting execution.
|
|
41
|
-
|
|
42
|
-
Before presenting, run the **Plan Acceptance Audit**:
|
|
43
|
-
- **Vertical Slices**: Is every task a complete vertical slice (not horizontal)?
|
|
44
|
-
- **Task Sizing**: Is any single task too large or covering multiple complex behaviors? If so, split it.
|
|
45
|
-
- **QA Coverage**: Does every task have both a Happy Path and at least one Edge Case in its Acceptance Criteria?
|
|
46
|
-
- **Checkpoint Alignment**: Are `checkpoint: test` and `checkpoint: done` gates placed on the most critical or risky tasks?
|
|
47
|
-
- **Risk Enforcement**: If this plan doc's Architectural Review section flagged any hazards as `[TRIGGERED]`, verify the corresponding tasks have `checkpoint: done` and a `Hazard Mitigation Verification` section.
|
|
48
|
-
|
|
49
|
-
If any check fails, fix the plan before presenting.
|
|
50
|
-
|
|
51
|
-
## Task format
|
|
52
|
-
|
|
53
|
-
Each task should produce one testable change. The executing-tasks skill handles committing — do not include `git commit` in the task body.
|
|
54
|
-
|
|
55
|
-
Each task must include:
|
|
56
|
-
- Exact file paths to create/modify
|
|
57
|
-
- **Acceptance Criteria (QA Engineer Hat)** — Put on your **QA Engineer Hat** to design exhaustive test coverage. Explicitly define:
|
|
58
|
-
- **Happy Path**: Expected behavior under normal operations.
|
|
59
|
-
- **Edge Cases & Error Paths**: What happens with empty inputs, limits exceeded, authentication failures, or error states.
|
|
60
|
-
Ensure every criteria block specifies the expected state and returned results using `Given/When/Then` behavioral blocks.
|
|
61
|
-
- **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
|
|
62
|
-
- Exact commands with expected output (e.g., `npx vitest run src/user/model.test.ts` → shows 1 test passing)
|
|
63
|
-
|
|
64
|
-
Each task must use a numbered heading with optional metadata comments:
|
|
65
|
-
|
|
66
|
-
```markdown
|
|
67
|
-
## Task N: <description>
|
|
68
|
-
|
|
69
|
-
<!-- tdd: new-feature -->
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
...where N starts at 1 and incrementally numbers each task in the plan.
|
|
73
|
-
|
|
74
|
-
The metadata comments (placed right after the heading) are optional. If omitted, the executing-tasks skill infers the TDD scenario and checkpoint from context. When in doubt, include them explicitly.
|
|
75
|
-
|
|
76
|
-
Valid TDD values: `new-feature`, `modifying-tested-code`, `trivial`
|
|
77
|
-
|
|
78
|
-
Valid checkpoint values: `none`, `test`, `done`
|
|
79
|
-
|
|
80
|
-
### Level of detail
|
|
81
|
-
|
|
82
|
-
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.
|
|
83
|
-
|
|
84
|
-
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.
|
|
85
|
-
|
|
86
|
-
**What "concrete code" means in practice:**
|
|
87
|
-
- SQL: `CREATE TABLE` statements with all columns, types, and constraints
|
|
88
|
-
- Types/interfaces: full type definitions with fields
|
|
89
|
-
- Functions: signature + body (the logic, not just the name)
|
|
90
|
-
- Tests: concrete assertions (`expect(result.status).toBe(409)`) not descriptions ("test that it returns an error")
|
|
91
|
-
- Routes: the actual handler code with validation, error handling, and response format
|
|
92
|
-
- Config: exact values, not "configure appropriately"
|
|
93
|
-
|
|
94
|
-
**Bad** (too vague — the executor must guess):
|
|
95
|
-
```
|
|
96
|
-
3. Implement bookmark model
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Good** (executor can copy-paste):
|
|
100
|
-
```
|
|
101
|
-
3. Implement `src/db/bookmarks.ts`:
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
import db from '../db.js';
|
|
105
|
-
|
|
106
|
-
export function createBookmarksTable() {
|
|
107
|
-
db.exec(`
|
|
108
|
-
CREATE TABLE IF NOT EXISTS bookmarks (
|
|
109
|
-
id TEXT PRIMARY KEY,
|
|
110
|
-
userId TEXT NOT NULL,
|
|
111
|
-
messageId TEXT NOT NULL,
|
|
112
|
-
createdAt TEXT DEFAULT (datetime('now')),
|
|
113
|
-
UNIQUE(userId, messageId)
|
|
114
|
-
)
|
|
115
|
-
`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function insertBookmark(userId: string, messageId: string) {
|
|
119
|
-
const id = crypto.randomUUID();
|
|
120
|
-
db.prepare('INSERT INTO bookmarks (id, userId, messageId) VALUES (?, ?, ?)').run(id, userId, messageId);
|
|
121
|
-
return { id, userId, messageId };
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Task body structure
|
|
127
|
-
|
|
128
|
-
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.
|
|
129
|
-
|
|
130
|
-
**No checkpoint** — numbered steps only:
|
|
131
|
-
```markdown
|
|
132
|
-
## Task 1: Create User model
|
|
133
|
-
|
|
134
|
-
<!-- tdd: new-feature -->
|
|
135
|
-
|
|
136
|
-
Acceptance Criteria (QA Engineer Hat):
|
|
137
|
-
- **Happy Path**:
|
|
138
|
-
- Given: Valid user data with name and email
|
|
139
|
-
- When: The User model is created
|
|
140
|
-
- Then: The model contains the correct fields and a generated ID
|
|
141
|
-
- **Edge Case (duplicate email)**:
|
|
142
|
-
- Given: A user with email "test@example.com" already exists
|
|
143
|
-
- When: Another user is created with the same email
|
|
144
|
-
- Then: Creation fails with a unique constraint error
|
|
145
|
-
|
|
146
|
-
Files:
|
|
147
|
-
- `src/user/model.ts`
|
|
148
|
-
- `src/user/model.test.ts`
|
|
149
|
-
|
|
150
|
-
Steps:
|
|
151
|
-
1. Write failing test for User model creation
|
|
152
|
-
2. Run test — confirm it fails
|
|
153
|
-
3. Implement User model
|
|
154
|
-
4. Run test — confirm it passes
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
**`checkpoint: test`** — gate after test, before implementing:
|
|
158
|
-
```markdown
|
|
159
|
-
## Task 2: Write auth tests
|
|
160
|
-
|
|
161
|
-
<!-- tdd: new-feature -->
|
|
162
|
-
<!-- checkpoint: test -->
|
|
163
|
-
|
|
164
|
-
Acceptance Criteria (QA Engineer Hat):
|
|
165
|
-
- **Happy Path**:
|
|
166
|
-
- Given: A user with valid credentials exists
|
|
167
|
-
- When: Login is attempted
|
|
168
|
-
- Then: A valid session token is returned
|
|
169
|
-
- **Edge Case (wrong password)**:
|
|
170
|
-
- Given: A user exists but password is incorrect
|
|
171
|
-
- When: Login is attempted
|
|
172
|
-
- Then: An authentication error is returned
|
|
173
36
|
|
|
174
|
-
|
|
175
|
-
- `src/auth/login.test.ts`
|
|
37
|
+
## Requirement 1: <name>
|
|
176
38
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
39
|
+
### Acceptance criteria
|
|
40
|
+
- Given … When … Then …
|
|
41
|
+
- Given … When … Then … (edge cases)
|
|
180
42
|
|
|
181
|
-
|
|
43
|
+
### Integration tests
|
|
44
|
+
- `should <behavior>` — asserts <observable outcome>
|
|
45
|
+
- `should <error case>` — asserts <failure outcome>
|
|
182
46
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
5. Refactor — check for shallow modules, duplication, seam discipline. Run tests after changes.
|
|
186
|
-
6. Lessons — caught a mistake that applies to future tasks? Add rule to `docs/lessons.md`.
|
|
187
|
-
```
|
|
47
|
+
### Checkpoints: full | spec | none
|
|
48
|
+
### Review: parallel | inline | skip
|
|
188
49
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
## Task 3: Add login endpoint
|
|
50
|
+
### Production-risk notes
|
|
51
|
+
- <from the design's Production-risk areas, if any>
|
|
192
52
|
|
|
193
|
-
|
|
194
|
-
|
|
53
|
+
## Requirement 2: <name>
|
|
54
|
+
…
|
|
195
55
|
|
|
196
|
-
|
|
197
|
-
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
- Then: Response returns `200 OK` with a signed JWT token
|
|
201
|
-
- **Edge Case (invalid password)**:
|
|
202
|
-
- Given: A user exists but the password sent is "wrong-pass"
|
|
203
|
-
- When: A POST request is sent to `/api/login`
|
|
204
|
-
- Then: Response returns `401 Unauthorized`
|
|
205
|
-
- **Edge Case (rate limiting)**:
|
|
206
|
-
- Given: 5 failed login attempts from the same IP
|
|
207
|
-
- When: A 6th attempt is sent
|
|
208
|
-
- Then: Response returns `429 Too Many Requests`
|
|
209
|
-
|
|
210
|
-
Files:
|
|
211
|
-
- `src/auth/login.ts`
|
|
212
|
-
- `src/auth/login.test.ts`
|
|
213
|
-
|
|
214
|
-
Steps:
|
|
215
|
-
1. Write failing test for login with valid credentials
|
|
216
|
-
2. Run test — confirm it fails
|
|
217
|
-
3. Implement login handler
|
|
218
|
-
4. Run test — confirm it passes
|
|
219
|
-
5. Add edge case tests (invalid password, missing email)
|
|
220
|
-
6. Refactor — check for shallow modules, duplication, seam discipline. Run tests after changes.
|
|
221
|
-
7. Lessons — caught a mistake that applies to future tasks? Add rule to `docs/lessons.md`.
|
|
222
|
-
|
|
223
|
-
⏸ **CHECKPOINT: done** — present implementation review. Wait for human approval before committing.
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
**Both checkpoints** — gate after test, then gate after refactor/lessons:
|
|
227
|
-
```markdown
|
|
228
|
-
## Task 4: Complex auth flow
|
|
229
|
-
|
|
230
|
-
<!-- tdd: new-feature -->
|
|
231
|
-
<!-- checkpoint: test -->
|
|
232
|
-
<!-- checkpoint: done -->
|
|
233
|
-
|
|
234
|
-
Acceptance Criteria (QA Engineer Hat):
|
|
235
|
-
- **Happy Path**:
|
|
236
|
-
- Given: A valid OAuth2 authorization code
|
|
237
|
-
- When: The auth callback is invoked
|
|
238
|
-
- Then: A user session is created and the user is redirected to the dashboard
|
|
239
|
-
- **Edge Case (expired code)**:
|
|
240
|
-
- Given: An expired or invalid authorization code
|
|
241
|
-
- When: The auth callback is invoked
|
|
242
|
-
- Then: The user is redirected to login with an error message
|
|
243
|
-
|
|
244
|
-
Steps:
|
|
245
|
-
1. Write failing test for auth flow
|
|
246
|
-
2. Run test — confirm it fails
|
|
247
|
-
|
|
248
|
-
⏸ **CHECKPOINT: test** — present test review. Wait for human approval before implementing.
|
|
249
|
-
|
|
250
|
-
3. Implement auth flow
|
|
251
|
-
4. Run test — confirm it passes
|
|
252
|
-
5. Refactor — check for shallow modules, duplication, seam discipline. Run tests after changes.
|
|
253
|
-
6. Lessons — caught a mistake that applies to future tasks? Add rule to `docs/lessons.md`.
|
|
254
|
-
|
|
255
|
-
⏸ **CHECKPOINT: done** — present implementation review. Wait for human approval before committing.
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
## Vertical slices
|
|
260
|
-
|
|
261
|
-
Each task should be a **vertical slice** — a thin path through ALL relevant layers end-to-end, delivering one complete piece of observable behavior.
|
|
262
|
-
|
|
263
|
-
```
|
|
264
|
-
WRONG (horizontal):
|
|
265
|
-
Task 1: Create database schema for users
|
|
266
|
-
Task 2: Write user API endpoints
|
|
267
|
-
Task 3: Build user UI components
|
|
268
|
-
Task 4: Wire everything together
|
|
269
|
-
|
|
270
|
-
RIGHT (vertical):
|
|
271
|
-
Task 1: User can sign up (model + endpoint + validation + test)
|
|
272
|
-
Task 2: User can log in (auth check + token + test)
|
|
273
|
-
Task 3: User can view profile (query + endpoint + test)
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
Order tasks so each one can be verified independently and delivers a complete vertical slice. If a task requires infrastructure (models, types) that no previous task has created, include it in that task — don't create it as a separate task.
|
|
277
|
-
|
|
278
|
-
Vertical slices ensure every committed task leaves the codebase in a testable state and reduces the blast radius of a bad task.
|
|
279
|
-
|
|
280
|
-
## TDD in the plan
|
|
281
|
-
|
|
282
|
-
Label each task with its TDD scenario:
|
|
56
|
+
## Feature acceptance
|
|
57
|
+
Derived from the design doc. One end-to-end test exercising the requirements *together*:
|
|
58
|
+
- `should <the PRD's end-to-end claim>` — Given <starting state>, When <trigger>, Then <composed outcome across requirements>.
|
|
59
|
+
```
|
|
283
60
|
|
|
284
|
-
|
|
285
|
-
|---|---|---|
|
|
286
|
-
| **New feature** | Adding new behavior | Write failing test → run it → implement → run it |
|
|
287
|
-
| **Modifying tested code** | Changing existing behavior | Run existing tests first → modify → verify they pass |
|
|
288
|
-
| **Trivial** | Config, docs, naming | Use judgment |
|
|
61
|
+
**If the design has no `## Feature acceptance` section**, stop and ask the human to run `/skill:pwk-brainstorming` to add one — the feature's definition-of-done is missing. (A trivial single-requirement design may fold the scenario into that requirement's criteria; note it and skip the separate section.)
|
|
289
62
|
|
|
290
|
-
|
|
63
|
+
**If `## Production-risk areas` flagged** schema migrations, new dependencies, external APIs, or seed data, emit a `## Setup` section between `## Overview` and `## Requirement 1` (dependencies, migrations, seed data, and how to verify setup worked).
|
|
291
64
|
|
|
292
|
-
|
|
65
|
+
5. **Audit before presenting:**
|
|
66
|
+
- Every requirement has criteria **and** matching tests, a checkpoint tag, a review tag.
|
|
67
|
+
- No `spec` + `skip` combination.
|
|
68
|
+
- A `## Feature acceptance` section exists (or the trivial-fold note).
|
|
69
|
+
- Production-risk areas from the design are reflected.
|
|
70
|
+
6. **Workspace isolation** — you're on the `<topic>` branch. For larger work, offer a worktree (`git worktree add ../<repo>-<topic> <topic>`) and hand off to a new session there so `pwd` is the worktree. Wait for the user's choice.
|
|
71
|
+
7. **Present the plan** and wait for approval. On approval, hand off: "Ready to execute? Run `/skill:pwk-executing-tasks`" (running it is what exits the gated plan phase).
|
|
293
72
|
|
|
294
|
-
|
|
295
|
-
|---|---|---|
|
|
296
|
-
| *(none)* | Trivial tasks, well-understood changes | Numbered steps only |
|
|
297
|
-
| **`checkpoint: test`** | Test design matters (API contracts, edge cases, complex behavior) | Steps up to test → `⏸ CHECKPOINT: test` → implement steps (including refactor/lessons) |
|
|
298
|
-
| **`checkpoint: done`** | Implementation review matters (complex logic, security, performance) | Steps (including refactor/lessons) → `⏸ CHECKPOINT: done` |
|
|
299
|
-
| Both | Non-obvious tests AND complex logic | Steps up to test → `⏸ CHECKPOINT: test` → implement steps (including refactor/lessons) → `⏸ CHECKPOINT: done` |
|
|
73
|
+
## What belongs in the plan — and what stays out
|
|
300
74
|
|
|
301
|
-
|
|
75
|
+
The plan carries: observable behavior (acceptance criteria), the test names + assertions that prove it, and per-requirement tags. Everything about implementation *how* — code, signatures, file-by-file breakdowns, micro-task decomposition — stays with the executor, which picks structure against the spec. That's the division that keeps the plan stable when a detail shifts mid-implementation.
|
|
302
76
|
|
|
303
77
|
## After the plan
|
|
304
78
|
|
|
305
|
-
Ask: "Ready to execute? Run `/skill:pwk-executing-tasks`"
|
|
306
|
-
|
|
307
|
-
> After executing this feature, the executor will check for more `⬜ pending` features and suggest planning the next one.
|
|
308
|
-
|
|
309
|
-
## Behavioral Guidelines
|
|
310
|
-
|
|
311
|
-
Guidelines to reduce overcomplication and hidden assumptions in plans. Derived from [Andrej Karpathy's observations](https://x.com/karpathy/status/2015883857489522876) on LLM coding pitfalls, adapted for the planning context.
|
|
312
|
-
|
|
313
|
-
**Tradeoff:** These guidelines bias toward caution over speed. For trivial plans (1-2 tasks), use judgment.
|
|
314
|
-
|
|
315
|
-
### Surface Assumptions
|
|
316
|
-
|
|
317
|
-
**When the design is ambiguous, annotate — don't silently pick.**
|
|
318
|
-
|
|
319
|
-
When writing a plan, you'll encounter gaps: the design says "paginated" but doesn't specify how, says "validate input" but doesn't say which fields, or leaves the data layer unspecified. Your instinct will be to fill the gap and keep writing. Resist that.
|
|
320
|
-
|
|
321
|
-
Instead, add a brief `> **Assumption:** ...` note in the plan at the point where you made the call:
|
|
322
|
-
|
|
323
|
-
```
|
|
324
|
-
> **Assumption:** Using offset/limit pagination because the design just says
|
|
325
|
-
> "paginated". Cursor-based would be better for large datasets.
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
```
|
|
329
|
-
> **Assumption:** No service layer — handler calls store directly. Add one
|
|
330
|
-
> if cross-cutting concerns (logging, auth checks) emerge later.
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
This lets the reviewer see what you chose and why, without blocking progress. Common gaps worth annotating:
|
|
334
|
-
- Pagination style, error handling strategy, concurrency model
|
|
335
|
-
- Whether to add a service/middleware layer
|
|
336
|
-
- Whether to add external dependencies
|
|
337
|
-
- Naming conventions when the design doesn't specify
|
|
338
|
-
|
|
339
|
-
### Build Only What Each Task Needs
|
|
340
|
-
|
|
341
|
-
**Minimum code to deliver the task's observable behavior. Nothing more.**
|
|
342
|
-
|
|
343
|
-
- No interface methods that no task exercises yet. If Task 2 creates a `Store` interface, it should have only the methods Task 2 calls. Add methods in the task that first needs them.
|
|
344
|
-
- No layers (service, middleware, repository) unless the design explicitly requires them.
|
|
345
|
-
- No error types, helper files, or shared packages until a task actually uses them.
|
|
346
|
-
- No external dependencies when stdlib suffices. Every `go get` or `npm install` is a choice — default to no.
|
|
347
|
-
- No "flexible" or "configurable" code that wasn't requested.
|
|
348
|
-
|
|
349
|
-
If you find yourself writing a store with 4 methods where only 1 is used in this task, stop. Write 1 method. Add the rest when the tasks that need them arrive.
|
|
350
|
-
|
|
351
|
-
### One Task, One Change
|
|
352
|
-
|
|
353
|
-
**Each task should trace to exactly one user-facing behavior.**
|
|
354
|
-
|
|
355
|
-
- If a task creates more than 4 new files, it's probably doing too much — split it.
|
|
356
|
-
- If a task modifies existing files unrelated to its acceptance criteria, trim the scope.
|
|
357
|
-
- Infrastructure (types, interfaces, module scaffolding) should live in the same task as the first code that uses it, not in a separate "setup" task — unless the infrastructure alone is complex enough to warrant its own task.
|
|
358
|
-
- Every file listed in a task's `Files:` section should be directly necessary for that task's acceptance criteria to pass.
|
|
79
|
+
Ask: "Ready to execute? Run `/skill:pwk-executing-tasks`"
|