@tianhai/pi-workflow-kit 1.0.0 → 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 +3 -3
- package/docs/developer-usage-guide.md +7 -6
- package/docs/oversight-model.md +5 -3
- package/docs/workflow-phases.md +16 -5
- package/extensions/workflow-guard.ts +12 -8
- package/package.json +3 -2
- package/skills/pwk-brainstorming/SKILL.md +29 -27
- package/skills/pwk-code-review/SKILL.md +2 -2
- package/skills/pwk-diagnose/SKILL.md +3 -1
- package/skills/pwk-executing-tasks/SKILL.md +57 -67
- package/skills/pwk-finalizing/SKILL.md +19 -54
- package/skills/pwk-status/SKILL.md +1 -1
- package/skills/pwk-writing-plans/SKILL.md +31 -35
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ Enforces phase-appropriate tool access — not just guidelines, but hard blocks:
|
|
|
41
41
|
|
|
42
42
|
The agent can read code and discuss design with you during brainstorm/plan, but it physically cannot modify source files. Bash during gated phases is governed by a simple common-blacklist (a command is allowed unless it matches a destructive pattern), and a short phase reminder is shown once when the gated phase begins so the model self-restricts.
|
|
43
43
|
|
|
44
|
-
Phases transition only when you invoke a skill (`/skill:pwk-brainstorming` → read-only; `/skill:pwk-executing-tasks` → unrestricted) — no message keyword unlocks the guard. Need to override it? `/pwk-guard on` forces a read-only lock, `off` disables the guard entirely, `auto` (default) returns to skill-driven phases. The subcommands autocomplete after the command.
|
|
44
|
+
Phases transition only when you invoke a skill (`/skill:pwk-brainstorming` → read-only; `/skill:pwk-executing-tasks` → unrestricted) — no message keyword unlocks the guard. Unlocking skills: `pwk-executing-tasks`, `pwk-finalizing`, `pwk-code-review`, `pwk-diagnose` (all need source writes); `pwk-status` deliberately stays gated (read-only orientation). The canonical list is the exported `UNLOCK_SKILLS` in `extensions/workflow-guard.ts`, lint-asserted against the skills by `npm run check`. Need to override it? `/pwk-guard on` forces a read-only lock, `off` disables the guard entirely, `auto` (default) returns to skill-driven phases. The subcommands autocomplete after the command.
|
|
45
45
|
|
|
46
46
|
### 🧠 7 Workflow Skills
|
|
47
47
|
|
|
@@ -63,8 +63,8 @@ A **design doc is one PR**; a **requirement is one testable slice within it**. F
|
|
|
63
63
|
| **Execute** | `/skill:pwk-executing-tasks` | Per requirement: write tests (red) → **checkpoint: tests** → implement (green) → **checkpoint: complete** → code-review |
|
|
64
64
|
| **Code review** | `/skill:pwk-code-review` | Per requirement: code tracing, spec alignment, code smells (applies fixes), production hazard check |
|
|
65
65
|
| **Finalize** | `/skill:pwk-finalizing` | Delete consumed plan docs, update README/CHANGELOG, create PR |
|
|
66
|
-
| **Diagnose** | `/skill:pwk-diagnose` | Debugging loop: reproduce → hypothesise → instrument → fix → cleanup |
|
|
67
|
-
| **Status** | `/skill:pwk-status` | Read-only overview of all active design topics — phase + progress. Use when resuming or juggling several designs in parallel worktrees. Not a pipeline phase
|
|
66
|
+
| **Diagnose** | `/skill:pwk-diagnose` | Debugging loop: reproduce → hypothesise → instrument → fix → cleanup. **Exits the gated phase** (debugging writes tests/instrumentation) |
|
|
67
|
+
| **Status** | `/skill:pwk-status` | Read-only overview of all active design topics — phase + progress. Use when resuming or juggling several designs in parallel worktrees. Not a pipeline phase; **does not exit the gated phase**. |
|
|
68
68
|
|
|
69
69
|
## The Workflow in Detail
|
|
70
70
|
|
|
@@ -90,7 +90,7 @@ pi install npm:pi-subagents
|
|
|
90
90
|
/skill:pwk-diagnose
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
A debugging loop you invoke when something is broken. Not a pipeline phase.
|
|
93
|
+
A debugging loop you invoke when something is broken. Not a pipeline phase. **Invoking it exits the gated brainstorm/plan phase** — diagnosis needs to write failing tests and debug instrumentation. If you only want read-only investigation mid-design, use `pwk-status` or re-lock with `/pwk-guard on`.
|
|
94
94
|
|
|
95
95
|
### Status (on demand)
|
|
96
96
|
|
|
@@ -98,15 +98,15 @@ A debugging loop you invoke when something is broken. Not a pipeline phase.
|
|
|
98
98
|
/skill:pwk-status
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
A read-only overview of all active design topics — which phase each is in and how far along. Use when resuming work or juggling several designs in parallel (e.g. across worktrees) and you're unsure which topic to continue. Not a pipeline phase.
|
|
101
|
+
A read-only overview of all active design topics — which phase each is in and how far along. Use when resuming work or juggling several designs in parallel (e.g. across worktrees) and you're unsure which topic to continue. Not a pipeline phase, and **it does not exit the gated phase** — it needs no writes, so the brainstorm/plan write boundary stays up.
|
|
102
102
|
|
|
103
103
|
## What the extension does
|
|
104
104
|
|
|
105
105
|
The `workflow-guard` extension watches `write`/`edit` and `bash` tool calls:
|
|
106
106
|
|
|
107
107
|
- **During brainstorm and writing-plans**: blocks writes outside `docs/plans/`, and blocks destructive bash via a simple common-blacklist (a command is allowed unless it matches a destructive pattern). A short phase reminder is shown once when the gated phase begins so the model self-restricts.
|
|
108
|
-
- **During executing-tasks, code-review, finalizing**: no restrictions.
|
|
109
|
-
- **Phases are skill-driven**: the guard follows the skill you invoke — it never unlocks on message keywords. To override, run `/pwk-guard on` (force read-only), `off` (disable), or `auto` (default; skill-driven). Subcommands autocomplete.
|
|
108
|
+
- **During executing-tasks, code-review, finalizing, diagnose**: no restrictions.
|
|
109
|
+
- **Phases are skill-driven**: the guard follows the skill you invoke — it never unlocks on message keywords. The exact unlock set is `pwk-executing-tasks`, `pwk-finalizing`, `pwk-code-review`, `pwk-diagnose`; `pwk-status` stays gated. To override, run `/pwk-guard on` (force read-only), `off` (disable), or `auto` (default; skill-driven). Subcommands autocomplete.
|
|
110
110
|
|
|
111
111
|
The destructive blacklist covers common file-mutating vectors (redirects, `tee`, `cp`/`mv`/`touch`/`rm`, `git commit`/`apply`, `npm install`, in-place editors like `sed -i`/`perl -i`, `patch`, `find -delete`). Exotic vectors (interpreter escapes like `node -e`, `python -c`, `| bash`) rely on the phase reminder — the guard is advisory, not a security boundary.
|
|
112
112
|
|
|
@@ -120,5 +120,6 @@ Plans specify *what* (acceptance criteria + integration tests); the executor wri
|
|
|
120
120
|
|
|
121
121
|
- Start with brainstorming for anything non-trivial.
|
|
122
122
|
- The plan is a behavioral spec, not an implementation recipe — let the executor choose how.
|
|
123
|
-
- Each requirement has two mandatory checkpoints: use them to steer test design and implementation.
|
|
124
|
-
-
|
|
123
|
+
- Each requirement has two mandatory checkpoints by default: use them to steer test design and implementation.
|
|
124
|
+
- **Right-size each requirement at plan time** with the `### Checkpoints` (`full`/`spec`/`none`) and `### Review` (`parallel`/`inline`/`skip`) tags — defaults are conservative (`full` + `parallel`), so behavior is unchanged unless you opt in. `spec` keeps the cheap spec-correctness gate and drops the complete checkpoint (covered by review), so it's the lowest-iteration option that doesn't sacrifice quality — but it requires at least `inline` review. A trivial fix can also use the brainstorming trivial fast-path (one-turn brainstorm, minimal design doc).
|
|
125
|
+
- Put all plan artifacts under `docs/plans/`; ADRs under `docs/adr/`.
|
package/docs/oversight-model.md
CHANGED
|
@@ -27,12 +27,14 @@ The `workflow-guard` extension enforces one rule:
|
|
|
27
27
|
|
|
28
28
|
The agent can still use `read` and `bash` for investigation. During those gated phases, `bash` is governed by a simple destructive-command blacklist (`rm`, `>`, `git commit`, `npm install`, in-place editors, etc.) — a command is allowed unless it matches a destructive pattern. A short phase reminder is shown once when the gated phase begins so the model self-restricts.
|
|
29
29
|
|
|
30
|
-
During executing-tasks, code-review,
|
|
30
|
+
During executing-tasks, code-review, finalizing, **and diagnose**, nothing is restricted (diagnosis needs to write failing tests and debug instrumentation, so it exits the gate). `pwk-status` stays inside the gate.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Reviewer-agent checklists live only in `agents/pwk-*-reviewer.md` (single source of truth); `pwk-executing-tasks` passes each reviewer just the requirement scope + diff and names the agent.
|
|
33
|
+
|
|
34
|
+
Phases follow the skill you invoke — there is no message-keyword unlock. Invoking `/skill:pwk-executing-tasks`, `pwk-finalizing`, `pwk-code-review`, or `pwk-diagnose` exits the gated phase (those skills write source); `pwk-status` deliberately does **not** (read-only orientation). `/pwk-guard on|off|auto` manually overrides the guard.
|
|
33
35
|
|
|
34
36
|
## Enforcement style
|
|
35
37
|
|
|
36
|
-
Hard block for write boundaries during gated phases. No warnings, no escalation, no prompts. Either the tool call is allowed or it's blocked.
|
|
38
|
+
Hard block for write boundaries during gated phases. No warnings, no escalation, no prompts. Either the tool call is allowed or it's blocked. The unlock list is hard-coded in the extension and verified by `tests/skill-lint.mjs` against the skills' claims, so a skill that promises "read-only" can't silently unlock.
|
|
37
39
|
|
|
38
40
|
TDD, checkpoints, debugging, and code review are guidance in the skill instructions, not runtime-enforced. The bash blacklist covers common destructive vectors only; exotic escapes (interpreter one-liners, piped shells) rely on the phase reminder — the guard is advisory, not a security boundary.
|
package/docs/workflow-phases.md
CHANGED
|
@@ -16,7 +16,7 @@ A design doc is one PR; a requirement is one testable slice within it. For multi
|
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
- Explore requirements and shape the design.
|
|
19
|
-
- Produce `docs/plans/YYYY-MM-DD-<topic>-design.md` — descriptive, opening with a `## Requirements` list.
|
|
19
|
+
- Produce `docs/plans/YYYY-MM-DD-<topic>-design.md` — descriptive, opening with a `## Requirements` list, ending with a `## Feature acceptance` section (end-to-end scenarios that prove the requirements compose into the PRD's behavior — the feature's definition-of-done).
|
|
20
20
|
- May split a large issue into multiple design docs (human-approved).
|
|
21
21
|
- ADRs go to `docs/adr/` (permanent, never archived).
|
|
22
22
|
|
|
@@ -30,6 +30,7 @@ Write boundary: only `docs/plans/` is writable. Source files are hard-blocked.
|
|
|
30
30
|
|
|
31
31
|
- Creates the feature branch first (`git checkout -b <topic>`), so design + plan docs live on the branch, not `main`.
|
|
32
32
|
- Reads the design doc's `## Requirements`; for each, derives **acceptance criteria + integration-test cases** (a behavioral spec, no implementation code), lists requirements in build order (dependencies positioned earlier), and challenges the design when `## Production-risk areas` is present.
|
|
33
|
+
- Derives a **`## Feature acceptance` section** in the plan from the design's Feature acceptance — an end-to-end integration test that exercises the requirements together (distinct from per-requirement tests). If the design has none, stops and asks the human to brainstorm one.
|
|
33
34
|
- Produce `docs/plans/YYYY-MM-DD-<topic>-implementation.md`.
|
|
34
35
|
|
|
35
36
|
Write boundary: only `docs/plans/` is writable.
|
|
@@ -41,12 +42,22 @@ Write boundary: only `docs/plans/` is writable.
|
|
|
41
42
|
```
|
|
42
43
|
|
|
43
44
|
- Per requirement: write the integration tests (red) → **⏸ checkpoint: tests** → implement to green (full autonomy — the executor chooses structure/signatures/internals) → **⏸ checkpoint: complete** → commit → **per-requirement review** (four parallel reviewers via the `subagent` tool; falls back to inline `/skill:pwk-code-review` when `pi-subagents` is absent — see [code-review](#code-review)).
|
|
44
|
-
- Two **mandatory** human checkpoints per requirement.
|
|
45
|
+
- Two **mandatory** human checkpoints per requirement — unless the plan tags a requirement lighter (see [Proportionality](#proportionality)).
|
|
46
|
+
- **Composition check after each commit** — if a requirement touched shared code, the executor runs the full suite now and fixes cross-requirement regressions immediately, rather than discovering them only at the integration gate.
|
|
45
47
|
- Progress tracked in `docs/plans/*-progress.md`.
|
|
46
|
-
- After all requirements: **integration gate** — run the full suite and confirm the requirements compose into the feature before `/skill:pwk-finalizing`.
|
|
48
|
+
- After all requirements: **integration gate** — run the full suite, **run the feature-acceptance test** (the end-to-end check from the plan's `## Feature acceptance` section), and confirm the requirements compose into the feature before `/skill:pwk-finalizing`.
|
|
47
49
|
|
|
48
50
|
No write restrictions. All tools available.
|
|
49
51
|
|
|
52
|
+
## Proportionality
|
|
53
|
+
|
|
54
|
+
The defaults preserve the 1.0.0 behavior (two checkpoints + parallel review per requirement). At plan time the human can tag each requirement lighter to right-size the workflow:
|
|
55
|
+
|
|
56
|
+
- **Checkpoints** — `full` (both stops, default) | `spec` (tests stop only — cheap spec-correctness gate, implementation covered by review) | `none` (no stops, trivial only). Test-first is preserved either way: even `none` writes tests first (red) and implements to green; only the human *stops* are optional. `spec` requires at least `inline` review (never combine with `skip`).
|
|
57
|
+
- **Review** — `parallel` (four fresh-context reviewers, default) | `inline` (single `pwk-code-review` pass) | `skip` (trivial diffs with no behavioral surface only).
|
|
58
|
+
|
|
59
|
+
A trivial fix can also skip the multi-turn brainstorm dialogue via the brainstorming trivial fast-path (compress to one turn, minimal design doc) — the guard still enforces read-only. Tags default conservatively, so nothing changes unless the human opts in.
|
|
60
|
+
|
|
50
61
|
## code-review
|
|
51
62
|
|
|
52
63
|
```
|
|
@@ -77,7 +88,7 @@ No write restrictions.
|
|
|
77
88
|
/skill:pwk-status
|
|
78
89
|
```
|
|
79
90
|
|
|
80
|
-
Read-only overview of all active pipeline topics (phase + progress) when several designs are in flight. Not a pipeline phase.
|
|
91
|
+
Read-only overview of all active pipeline topics (phase + progress) when several designs are in flight. Not a pipeline phase — and it **does not exit the gated phase** (`pwk-status` is read-only; it runs fine under the brainstorm/plan write block, so the boundary stays up).
|
|
81
92
|
|
|
82
93
|
## diagnose
|
|
83
94
|
|
|
@@ -85,7 +96,7 @@ Read-only overview of all active pipeline topics (phase + progress) when several
|
|
|
85
96
|
/skill:pwk-diagnose
|
|
86
97
|
```
|
|
87
98
|
|
|
88
|
-
Not a pipeline phase. A utility skill invoked on demand when debugging is needed.
|
|
99
|
+
Not a pipeline phase. A utility skill invoked on demand when debugging is needed. Invoking it **exits the gated phase** — diagnosis needs to write failing tests and `[DEBUG-…]` instrumentation. To stay read-only mid-brainstorm, use `/skill:pwk-status` instead, or re-lock with `/pwk-guard on`.
|
|
89
100
|
|
|
90
101
|
No write restrictions.
|
|
91
102
|
|
|
@@ -128,6 +128,10 @@ const SKILL_TO_PHASE: Record<string, Phase> = {
|
|
|
128
128
|
"pwk-writing-plans": "plan",
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
/** Skills whose invocation exits a gated phase (used by the input handler; exported for tests/
|
|
132
|
+
* skill-lint). Deliberately excludes pwk-status (read-only by design; stays gated). */
|
|
133
|
+
export const UNLOCK_SKILLS = ["pwk-executing-tasks", "pwk-finalizing", "pwk-code-review", "pwk-diagnose"] as const;
|
|
134
|
+
|
|
131
135
|
/** Phase-aware reminder appended after the user's message each turn while a gated phase is active.
|
|
132
136
|
* Returned as a message (not a system-prompt change) so it sits at the tail of the request and
|
|
133
137
|
* never invalidates the cached prefix. */
|
|
@@ -247,14 +251,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
247
251
|
}
|
|
248
252
|
}
|
|
249
253
|
// Phase transitions happen only via skills — no message keyword unlocks the plan phase.
|
|
250
|
-
// Run /skill:pwk-executing-tasks (or
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
) {
|
|
254
|
+
// Run /skill:pwk-executing-tasks (or another write-needing skill) to leave a gated phase.
|
|
255
|
+
//
|
|
256
|
+
// Unlock list rationale: execute/finalize/code-review/diagnose all need to write source
|
|
257
|
+
// (implement, edit review fixes, add [DEBUG-] instrumentation), so they exit the gate.
|
|
258
|
+
// pwk-status is NOT here on purpose: it is read-only orientation, so it stays inside the
|
|
259
|
+
// gated phase and never drops the write boundary the user is relying on.
|
|
260
|
+
// (Orientation never needs write access; see skills/pwk-status.)
|
|
261
|
+
if (UNLOCK_SKILLS.some((s) => text.startsWith(`/skill:${s}`))) {
|
|
258
262
|
phase = null;
|
|
259
263
|
}
|
|
260
264
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tianhai/pi-workflow-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Enforce structured brainstorm→plan→execute→finalize workflow with TDD discipline in AI coding agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "vitest run",
|
|
18
18
|
"lint": "biome check .",
|
|
19
|
-
"
|
|
19
|
+
"skill-lint": "node tests/skill-lint.mjs",
|
|
20
|
+
"check": "biome check . && vitest run && node tests/skill-lint.mjs"
|
|
20
21
|
},
|
|
21
22
|
"license": "MIT",
|
|
22
23
|
"author": "yinloo-ola",
|
|
@@ -5,56 +5,58 @@ description: "Use this before any creative work — creating features, building
|
|
|
5
5
|
|
|
6
6
|
# Brainstorming
|
|
7
7
|
|
|
8
|
-
Read-only exploration
|
|
8
|
+
Read-only exploration of source code; every file you create or edit goes under `docs/plans/`. (Once an ADR is approved by the human, `docs/adr/` becomes writable too — ask the user to unlock or run the write.) Planning produces the document the executor builds from; source-writing happens in later phases.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Proportionality: trivial vs non-trivial
|
|
11
|
+
|
|
12
|
+
Classify the change at the start.
|
|
11
13
|
|
|
12
|
-
**
|
|
14
|
+
- **Trivial** — typo or obvious bugfix with no open design questions, config/version bump, single-function change, or anything the human flags as trivial. Skip steps 3–5; write a **minimal** design doc in one turn (one-line context, a `## Requirements` list with the single requirement, optional `## Production-risk areas` line), and hand off to `/skill:pwk-writing-plans`. The guard still enforces read-only — trivial compresses the phase to one turn, it doesn't skip it.
|
|
15
|
+
- **Non-trivial** — open design questions, multiple approaches, cross-module impact, or new behavior. Run the full process below.
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
When unsure, ask: "This looks trivial — fast-path it, or full brainstorm?" Default to full.
|
|
18
|
+
|
|
19
|
+
## Granularity
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
**One design doc = one PR; one requirement = one testable slice within it.**
|
|
22
|
+
|
|
23
|
+
- Split into **multiple design docs** only when each part could ship as its own PR (independently reviewable and mergeable). Each runs its own plan → execute → finalize pipeline.
|
|
24
|
+
- Within a doc, decompose into **requirements**, each one testable behavior. Decision rule: could this part be reviewed and merged on its own? Yes → separate design doc. No → one doc, multiple requirements. Most work is a single doc; splitting is opt-in.
|
|
18
25
|
|
|
19
26
|
## Process
|
|
20
27
|
|
|
21
|
-
1. **Check git state** —
|
|
22
|
-
2. **Discovery** *(skip
|
|
23
|
-
3. **Understand the idea** — read
|
|
24
|
-
4. **Explore approaches** — propose 2
|
|
25
|
-
5. **Present the design**
|
|
28
|
+
1. **Check git state** — `git status` + `git log --oneline -5`. Uncommitted work? Ask the user what to do first.
|
|
29
|
+
2. **Discovery** *(skip in a brand-new repo with no `docs/plans/`)* — glob `docs/plans/*-design.md`; report in-flight topics. If the new idea continues an existing topic, ask whether to extend it or start fresh.
|
|
30
|
+
3. **Understand the idea** — read only enough code/docs/commits to ground the design. **Check `docs/lessons.md`** — known constraints may shape it. Ask questions one at a time, prefer multiple choice. Once you can articulate what/why/constraints, present a short summary and ask: "Should I proceed, or is there more?" The human decides when to move on.
|
|
31
|
+
4. **Explore approaches** — propose 2–3, leading with your recommendation. Sketch the concrete interface (types, signatures, example caller) for each so the comparison is grounded in code, not abstractions.
|
|
32
|
+
5. **Present the design** in one pass, organized into sections (architecture, components, data flow, error handling, testing) — the human comments on any section; re-present only revised sections.
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
Identified a significant architectural decision? Offer an ADR in `docs/adr/`. Only when all three hold: **hard to reverse**, **surprising without context**, **a real trade-off**. Format: title + 1–3 sentences of context/decision/why. ADRs are permanent institutional memory — they stay out of archive/rotation forever. (Guard note: `docs/adr/` is outside the writable `docs/plans/`; write it only after the user approves and unlocks.)
|
|
35
|
+
6. **Write the design doc** — `docs/plans/YYYY-MM-DD-<topic>-design.md`, descriptive (not a task list). **Open with `## Requirements`** — one testable behavior each; `pwk-writing-plans` derives acceptance criteria and tests from these. Then: problem, approaches considered, architecture, components, data flow, error handling, testing.
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
2. **Surprising without context** — a future reader will wonder "why?"
|
|
31
|
-
3. **A real trade-off** — there were genuine alternatives
|
|
37
|
+
Touches a production-risk area (DB schema/migrations, auth, external APIs, concurrency/batch, uploads/large data flows, Redis/caching/queues)? Add a brief `## Production-risk areas` — `pwk-writing-plans` carries it into the plan and `pwk-code-review` audits it per requirement.
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
**End with `## Feature acceptance`** — one or more end-to-end `Given/When/Then` scenarios proving the requirements *compose* into the feature. This is the feature's definition-of-done; the human approves it as what "the feature works" means. `pwk-writing-plans` derives a feature-level test from it; `pwk-executing-tasks` runs it at the integration gate. Treat "I can write this scenario" as the green light to finish designing — if you can't, keep designing because the requirements don't yet compose into a coherent feature.
|
|
34
40
|
|
|
35
41
|
```markdown
|
|
36
|
-
|
|
42
|
+
## Feature acceptance
|
|
37
43
|
|
|
38
|
-
<
|
|
44
|
+
- Given <starting state>, When <trigger>, Then <end-to-end outcome the feature promises>.
|
|
39
45
|
```
|
|
40
46
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
6. **Write the design doc** — save it to `docs/plans/YYYY-MM-DD-<topic>-design.md` as a descriptive document (not a task list). **Open with a `## Requirements` list** — each requirement one testable behavior the user will get (`pwk-writing-plans` derives acceptance criteria + integration tests per requirement). Then cover: problem, approaches considered, architecture, components, data flow, error handling, and testing.
|
|
44
|
-
|
|
45
|
-
If the design touches any production-risk area — database schema changes or migrations, authentication or authorization, external API or service integrations, concurrency or batch processing, file uploads or large data flows, Redis/caching/message queues — add a short `## Production-risk areas` section noting them. `pwk-writing-plans` carries these notes into the plan, and `pwk-code-review` audits them after each requirement.
|
|
47
|
+
Example (rate limiting): "Given a new API consumer with no prior usage, When they exceed 100 requests/minute for 3 consecutive minutes, Then they're throttled, a `rate_limited` event is emitted, and further requests return 429."
|
|
46
48
|
|
|
47
|
-
**Splitting large issues:**
|
|
49
|
+
**Splitting large issues:** propose multiple design docs (one `<topic>` per sub-issue) and get human approval first — see [Granularity](#granularity). Each runs its own pipeline.
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
The session stays read-only and uncommitted through brainstorm and plan: branch creation happens at the end of `/skill:pwk-writing-plans`; plan docs are committed at the start of `pwk-executing-tasks`.
|
|
50
52
|
|
|
51
53
|
## Principles
|
|
52
54
|
|
|
53
55
|
- One question at a time
|
|
54
56
|
- YAGNI — remove unnecessary features
|
|
55
57
|
- Design for testability
|
|
56
|
-
-
|
|
58
|
+
- Explore alternatives before settling
|
|
57
59
|
|
|
58
60
|
## After the design
|
|
59
61
|
|
|
60
|
-
Ask: "Ready to plan? Run `/skill:pwk-writing-plans`"
|
|
62
|
+
Ask: "Ready to plan? Run `/skill:pwk-writing-plans`"
|
|
@@ -38,8 +38,8 @@ Review the code just implemented for a requirement. **Unlocked** — you may edi
|
|
|
38
38
|
## Principles
|
|
39
39
|
|
|
40
40
|
- **Tracing and spec alignment are the core** — they catch what tests miss: untested branches, missing criteria, scope creep.
|
|
41
|
-
- **Fix smells in place; flag everything else.**
|
|
42
|
-
- **Be proportional** — a one-function change doesn't need the depth of a batch pipeline.
|
|
41
|
+
- **Fix smells in place; flag everything else.** Keep the review scoped — the goal is polish on the requirement that just landed, not a redesign pass.
|
|
42
|
+
- **Be proportional** — a one-function change doesn't need the depth of a batch pipeline. When this skill runs as the inline path because the plan tagged the requirement `Review: inline`, that was a deliberate call at plan time — keep the review focused and don't second-guess the tag.
|
|
43
43
|
|
|
44
44
|
## After the review
|
|
45
45
|
|
|
@@ -7,6 +7,8 @@ description: "Disciplined debugging loop for hard bugs and performance regressio
|
|
|
7
7
|
|
|
8
8
|
A 6-phase debugging discipline. Phase 1 is the skill — spend disproportionate effort here.
|
|
9
9
|
|
|
10
|
+
Invoking `/skill:pwk-diagnose` **exits the gated brainstorm/plan phase** (the workflow guard unlocks) — diagnosis needs to write failing tests and `[DEBUG-…]` instrumentation. If you only wanted read-only investigation, use `/skill:pwk-status` (stays gated) or reinstate the lock with `/pwk-guard on`.
|
|
11
|
+
|
|
10
12
|
## Phase 1 — Build a feedback loop
|
|
11
13
|
|
|
12
14
|
Create a fast, deterministic, agent-runnable pass/fail signal for the bug before doing anything else. Try in this order: failing test, curl script, CLI invocation, headless browser script.
|
|
@@ -19,7 +21,7 @@ The loop must produce the failure mode the **user** described — not a nearby b
|
|
|
19
21
|
|
|
20
22
|
If you genuinely cannot build a loop, stop and say so. List what you tried. Ask for access to a reproducing environment or a captured artifact.
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
Hold at Phase 1 until you have a loop you believe in. Everything downstream — hypotheses, instrumentation, the fix — depends on that loop actually reproducing the user's symptom.
|
|
23
25
|
|
|
24
26
|
## Phase 2 — Reproduce
|
|
25
27
|
|
|
@@ -5,24 +5,21 @@ description: "Implement a plan requirement-by-requirement with test-first discip
|
|
|
5
5
|
|
|
6
6
|
# Executing Tasks
|
|
7
7
|
|
|
8
|
-
Implement the plan from `docs/plans/*-implementation.md` requirement
|
|
8
|
+
Implement the plan from `docs/plans/*-implementation.md` requirement by requirement, tracking progress in a file.
|
|
9
9
|
|
|
10
|
-
The plan is a **behavioral spec** (acceptance criteria + integration tests)
|
|
10
|
+
The plan is a **behavioral spec** (acceptance criteria + integration tests) — it deliberately contains no implementation steps. You choose structure, signatures, and internals; the criteria define *what*, you decide *how*.
|
|
11
11
|
|
|
12
12
|
## Before you start
|
|
13
13
|
|
|
14
|
-
1. **
|
|
15
|
-
2. **Find the plan
|
|
16
|
-
3. **Workspace
|
|
14
|
+
1. **Git state** — `git status` + `git log --oneline -5`; note uncommitted changes.
|
|
15
|
+
2. **Find the plan** — glob `docs/plans/*-implementation.md`; if several, ask which. Report one line, e.g. `Found: design "auth" — execute phase (1/3 done)`. A matching `*-progress.md` means this is a **resume** (see [Resume](#resume)).
|
|
16
|
+
3. **Workspace** — `pwk-writing-plans` already created the branch/worktree. If you're still on `main`, tell the user the workspace wasn't set up and suggest fixing that before executing.
|
|
17
17
|
|
|
18
18
|
## First run
|
|
19
19
|
|
|
20
|
-
1. **Parse the plan** — read
|
|
21
|
-
2. **Setup pre-flight**
|
|
22
|
-
|
|
23
|
-
- **request changes** → revise and re-present.
|
|
24
|
-
(Only runs on the first `First run` — the progress file is created after this step, so a resumed session skips setup.)
|
|
25
|
-
3. **Create the progress file** at `docs/plans/<plan-name>-progress.md`:
|
|
20
|
+
1. **Parse the plan** — read every `## Requirement N:` heading and its `### Checkpoints` / `### Review` tags (defaults `full` / `parallel`). Requirements run in **listed order** — the plan is already in build order; do not reorder.
|
|
21
|
+
2. **Setup pre-flight** *(only if the plan has a `## Setup` section)* — install dependencies, apply migrations, seed data, then run the existing test suite. **⏸ CHECKPOINT: setup** — present results and wait for approval. Record `setup: done` in the progress-file header so a resume can confirm it rather than assume it.
|
|
22
|
+
3. **Create the progress file** `docs/plans/<plan-name>-progress.md`:
|
|
26
23
|
|
|
27
24
|
```markdown
|
|
28
25
|
# Progress: <topic>
|
|
@@ -37,97 +34,96 @@ The plan is a **behavioral spec** (acceptance criteria + integration tests). You
|
|
|
37
34
|
| 1 | ⬜ pending | <requirement name> | — |
|
|
38
35
|
```
|
|
39
36
|
4. **Commit the plan docs** — `git add docs/plans/ && git commit -m "docs: add implementation plan"`.
|
|
40
|
-
5.
|
|
37
|
+
5. Start requirement 1.
|
|
41
38
|
|
|
42
39
|
## Resume
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- `⬜ pending` → start it.
|
|
41
|
+
Find the first row that is `⬜ pending`, `🔄 in-progress`, `⏸ tests-review`, or `⏸ complete-review`:
|
|
42
|
+
- `⏸ *-review` → re-present that checkpoint and wait.
|
|
43
|
+
- `🔄 in-progress` → continue the requirement.
|
|
44
|
+
- `⬜ pending` → start it.
|
|
49
45
|
|
|
50
46
|
## Progress file
|
|
51
47
|
|
|
52
|
-
|
|
48
|
+
Update the matching row directly (not via pattern matching that could corrupt the table). Update `Last updated` on every change.
|
|
53
49
|
|
|
54
50
|
| Status | Meaning |
|
|
55
51
|
|--------|---------|
|
|
56
52
|
| `⬜ pending` | Not started |
|
|
57
53
|
| `🔄 in-progress` | Writing tests or implementing |
|
|
58
|
-
| `⏸ tests-review` | Paused at checkpoint
|
|
59
|
-
| `⏸ complete-review` | Paused at checkpoint
|
|
60
|
-
| `🔎 review` | Committed;
|
|
61
|
-
| `✅ done` |
|
|
62
|
-
| `❌ failed` |
|
|
54
|
+
| `⏸ tests-review` | Paused at tests checkpoint, awaiting approval |
|
|
55
|
+
| `⏸ complete-review` | Paused at complete checkpoint, awaiting approval |
|
|
56
|
+
| `🔎 review` | Committed; code review in progress |
|
|
57
|
+
| `✅ done` | Reviewed (smells fixed, hazards noted), all green |
|
|
58
|
+
| `❌ failed` | Abandoned; partial work discarded/reverted (append `Failed: <reason>`) |
|
|
63
59
|
| `⏭ skipped` | User chose to skip |
|
|
64
60
|
|
|
65
61
|
## Per-requirement execution
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Gather the requirement's scope: acceptance criteria, integration test cases, and git diff (`git log --oneline -5 && git diff HEAD~N..HEAD`).
|
|
83
|
-
|
|
84
|
-
**If the `subagent` tool is available**, invoke it with parallel tasks:
|
|
63
|
+
1. **Mark 🔄 in-progress** and read this requirement's `### Checkpoints` / `### Review` tags.
|
|
64
|
+
2. **Write the integration tests (red).** Encode the acceptance criteria + test cases from the plan as real test files; run them; confirm they **fail**. If they pass immediately, the behavior may already exist or the tests are wrong — investigate before proceeding.
|
|
65
|
+
3. **⏸ CHECKPOINT: tests** *(fires for `full` and `spec`)* — mark `⏸ tests-review`, present the tests + failing output, wait. **request changes** → revise, re-run, re-present. With `none`, show the red output inline and proceed.
|
|
66
|
+
4. **Implement (green)** with full autonomy. Run tests after each meaningful change; refactor for clarity (deep modules, no duplication, seam discipline) while tests stay green.
|
|
67
|
+
5. **Learn.** Caught a repeat mistake? Append a **generic** rule to `docs/lessons.md` (strip domain specifics).
|
|
68
|
+
6. **⏸ CHECKPOINT: complete** *(fires for `full` only)* — mark `⏸ complete-review`, show passing tests + `git diff`, wait. With `spec`/`none`, show them inline and proceed (**review** covers implementation quality; `spec` requires at least `inline` review).
|
|
69
|
+
7. **Commit** the relevant files with a clear message. Status stays `🔄 in-progress` — not done yet.
|
|
70
|
+
8. **Composition check** — if this diff touched code shared with other requirements in the plan, run the **full test suite** now and fix any cross-requirement regression while the context is fresh. Otherwise keep running just this requirement's tests.
|
|
71
|
+
9. **Code review** — mark `🔎 review`; drive review by the `### Review` tag (`parallel | inline | skip`):
|
|
72
|
+
- **`parallel`** — four fresh-context reviewers via the `subagent` tool (see below).
|
|
73
|
+
- **`inline`** — run `/skill:pwk-code-review` as a single pass.
|
|
74
|
+
- **`skip`** — mark `✅ done` and move to the next requirement.
|
|
75
|
+
|
|
76
|
+
**Parallel path** — gather scope (acceptance criteria, test cases, `git log --oneline -5 && git diff HEAD~N..HEAD`) and invoke:
|
|
85
77
|
```json
|
|
86
78
|
{
|
|
87
79
|
"tasks": [
|
|
88
|
-
{"agent": "pwk-spec-reviewer", "task": "<scope + diff here
|
|
89
|
-
{"agent": "pwk-tracing-reviewer", "task": "<scope + diff here
|
|
90
|
-
{"agent": "pwk-smell-reviewer", "task": "<scope + diff here
|
|
91
|
-
{"agent": "pwk-hazard-reviewer", "task": "<scope + diff here
|
|
80
|
+
{"agent": "pwk-spec-reviewer", "task": "<scope + diff here>"},
|
|
81
|
+
{"agent": "pwk-tracing-reviewer", "task": "<scope + diff here>"},
|
|
82
|
+
{"agent": "pwk-smell-reviewer", "task": "<scope + diff here>"},
|
|
83
|
+
{"agent": "pwk-hazard-reviewer", "task": "<scope + diff here>"}
|
|
92
84
|
],
|
|
93
85
|
"agentScope": "both",
|
|
94
86
|
"cwd": "<repo-root>"
|
|
95
87
|
}
|
|
96
88
|
```
|
|
89
|
+
The reviewer checklists live only in `agents/pwk-*-reviewer.md` — don't restate them in the task strings (duplication guarantees drift). Reviewers are read-only reporters; the executing agent applies fixes and commits.
|
|
97
90
|
|
|
98
|
-
**On success
|
|
91
|
+
**On success** — apply smell fixes yourself (re-run integration tests, must stay green, commit), flag trace/spec/hazard findings as follow-ups for the human, mark `✅ done`.
|
|
99
92
|
|
|
100
|
-
**Fallback**
|
|
101
|
-
|
|
93
|
+
**Fallback** — subagent tool unavailable or errors → run `/skill:pwk-code-review` inline instead.
|
|
94
|
+
10. **Loop** to step 1 for the next `⬜ pending` requirement, or see [After all requirements](#after-all-requirements).
|
|
102
95
|
|
|
103
|
-
### Checkpoint gates are mandatory
|
|
96
|
+
### Checkpoint gates are mandatory (when the tag says so)
|
|
104
97
|
|
|
105
|
-
|
|
106
|
-
- Stop
|
|
107
|
-
- **Never** `git add` or `git commit` before
|
|
98
|
+
`### Checkpoints` accepted values: `full | spec | none` → both stops / tests stop only / no stops. When a checkpoint fires it is a **hard stop**:
|
|
99
|
+
- Stop immediately; never proceed without explicit human approval.
|
|
100
|
+
- **Never** `git add` or `git commit` before approval at a checkpoint.
|
|
108
101
|
- Mark the progress file to the review status **before** pausing.
|
|
109
102
|
|
|
103
|
+
`Checkpoints: spec` with `Review: skip` is invalid (nothing would cover implementation quality) — stop and ask the human to fix the tags; use `Checkpoints: none` for truly trivial diffs.
|
|
104
|
+
|
|
110
105
|
## User override commands
|
|
111
106
|
|
|
112
107
|
| User says | Agent does |
|
|
113
108
|
|-----------|-----------|
|
|
114
109
|
| `skip` | Mark current requirement `⏭ skipped`, move to next |
|
|
115
110
|
| `status` | Show the progress table |
|
|
116
|
-
| `stop` | Restore current requirement to its pre-in-progress state, suggest `/new`
|
|
111
|
+
| `stop` | Restore current requirement to its pre-in-progress state, suggest `/new` |
|
|
117
112
|
| `retry` | Re-read the requirement, start over |
|
|
118
113
|
|
|
119
114
|
## Receiving feedback (outside a checkpoint)
|
|
120
115
|
|
|
121
|
-
|
|
116
|
+
Verify the criticism against the code, evaluate the suggestion, then implement (with tests) or push back with evidence. Don't blindly apply.
|
|
122
117
|
|
|
123
118
|
## After all requirements
|
|
124
119
|
|
|
125
|
-
When no `⬜ pending` or
|
|
120
|
+
When no `⬜ pending` or `🔄 in-progress` requirements remain, run the **integration gate** before suggesting finalize — per-requirement review only saw each diff in isolation; this proves the requirements *compose* into the feature:
|
|
126
121
|
|
|
127
|
-
1. **Run the FULL test suite
|
|
128
|
-
2. **
|
|
122
|
+
1. **Run the FULL test suite.** A failure here means one requirement regressed another — fix it now, in execute context.
|
|
123
|
+
2. **Run the feature-acceptance test.** The plan's `## Feature acceptance` section specifies one end-to-end test exercising the requirements *together* against the design's claim. Write it if missing; run it; it must pass. If the plan has no such section, stop and tell the human — the gate has nothing concrete to verify.
|
|
124
|
+
3. **Confirm composition.** Do the requirements together deliver the end-to-end behavior the design doc described? Fix gaps here, with tests, before shipping.
|
|
129
125
|
|
|
130
|
-
|
|
126
|
+
Then present:
|
|
131
127
|
|
|
132
128
|
```
|
|
133
129
|
✅ All requirements complete — integration verified!
|
|
@@ -143,12 +139,6 @@ Only when the full suite is green and the feature works end-to-end:
|
|
|
143
139
|
## If you're stuck
|
|
144
140
|
|
|
145
141
|
1. Re-read the requirement's acceptance criteria — you may have drifted.
|
|
146
|
-
2. Check `git log` for context.
|
|
147
|
-
3.
|
|
148
|
-
4.
|
|
149
|
-
- Discard uncommitted changes (`git restore .`).
|
|
150
|
-
- If the requirement has already been committed (step 7 completed), also revert its commit(s) so partial work leaves no trace on the shipped branch (`git revert HEAD --no-edit` if only the requirement commit; `git revert HEAD~N..HEAD --no-edit` if multiple commits including code-review smell fixes).
|
|
151
|
-
|
|
152
|
-
**Never leave a failed requirement's partial work on the shipped branch.** Dead code from incomplete requirements must be cleaned up before moving on.
|
|
153
|
-
5. Mark `❌ failed` with the reason and move on.
|
|
154
|
-
6. Check `docs/lessons.md` — a prior lesson may apply.
|
|
142
|
+
2. Check `git log` for context. Ask the user — clarify beats guessing.
|
|
143
|
+
3. Still stuck → discard uncommitted changes (`git restore .`); if already committed, also `git revert` the requirement's commit(s). **Never leave a failed requirement's partial work on the shipped branch.**
|
|
144
|
+
4. Mark `❌ failed` with the reason and move on. Check `docs/lessons.md` — a prior lesson may apply.
|
|
@@ -9,70 +9,35 @@ Ship the completed work.
|
|
|
9
9
|
|
|
10
10
|
## Pre-finalization checks
|
|
11
11
|
|
|
12
|
-
1. **Run the FULL test suite
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- **Any `❌ failed`** → **block**. Present the count and reasons to the user. Do not continue until one of:
|
|
17
|
-
- The user sends the task back to `/skill:pwk-executing-tasks` to fix the failures, or
|
|
18
|
-
- The user explicitly types `--force-failed` to acknowledge shipping with known incomplete requirements.
|
|
19
|
-
|
|
20
|
-
Never merge a branch that carries incomplete requirements without explicit acknowledgment.
|
|
21
|
-
|
|
22
|
-
- **Only `⏭ skipped`** (no `❌ failed`) → present a warning and confirm:
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
⚠️ Requirement 4 was skipped. Continue with finalizing, or go back?
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Continue on confirmation; abort otherwise.
|
|
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?").
|
|
29
16
|
|
|
30
17
|
## Process
|
|
31
18
|
|
|
32
|
-
1. **Derive the topic** —
|
|
33
|
-
|
|
34
|
-
2. **Delete consumed plan docs** — only this design's artifacts; leave other (un-started) design docs in place:
|
|
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:
|
|
35
21
|
|
|
36
22
|
```bash
|
|
37
|
-
rm -f docs/plans
|
|
38
|
-
rm -f docs/plans/*<topic>*-implementation.md
|
|
39
|
-
rm -f docs/plans/*<topic>*-progress.md
|
|
23
|
+
rm -f docs/plans/????-??-??-<topic>-design.md docs/plans/????-??-??-<topic>-implementation.md docs/plans/????-??-??-<topic>-progress.md
|
|
40
24
|
```
|
|
41
25
|
|
|
42
|
-
|
|
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:
|
|
43
30
|
|
|
44
|
-
|
|
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.
|
|
45
35
|
|
|
46
|
-
4
|
|
47
|
-
|
|
48
|
-
5. **Choose a merge strategy** — ask the human which they prefer:
|
|
49
|
-
|
|
50
|
-
1. **Create PR** — push and open a PR for external review:
|
|
51
|
-
```
|
|
52
|
-
git push origin <branch>
|
|
53
|
-
gh pr create --title "feat: <summary>" --body "<summary>"
|
|
54
|
-
```
|
|
55
|
-
2. **Rebase & merge** *(recommended)* — rebase onto parent, fast-forward merge, push parent, delete branch:
|
|
56
|
-
```
|
|
57
|
-
parent=$(git show-branch -a 2>/dev/null | grep '\*' | grep -v "$(git branch --show-current)" | head -1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//')
|
|
58
|
-
git checkout "$parent" && git pull
|
|
59
|
-
git checkout - && git rebase "$parent"
|
|
60
|
-
git checkout "$parent" && git merge --ff-only -
|
|
61
|
-
git push origin "$parent"
|
|
62
|
-
git branch -d - && git push origin --delete -
|
|
63
|
-
```
|
|
64
|
-
3. **Squash & merge** — squash all commits into one on parent, push, delete branch.
|
|
65
|
-
4. **Merge commit** — merge with `--no-ff`, push parent, delete branch.
|
|
66
|
-
|
|
67
|
-
For options 2–4, confirm the detected parent branch before proceeding.
|
|
68
|
-
|
|
69
|
-
6. **Clean up** — if a worktree was used, remove it:
|
|
70
|
-
```
|
|
71
|
-
git worktree remove ../<repo>-<topic>
|
|
72
|
-
```
|
|
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>`.
|
|
73
38
|
|
|
74
39
|
## Principles
|
|
75
40
|
|
|
76
41
|
- Delete **only** the active design's artifacts — un-started designs (from a split) stay in `docs/plans/`.
|
|
77
|
-
- ADRs are
|
|
78
|
-
- Bump the package version if this is a published change (major
|
|
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).
|
|
@@ -5,7 +5,7 @@ description: "Show all active pipeline topics and their phase/progress. Use when
|
|
|
5
5
|
|
|
6
6
|
# Status
|
|
7
7
|
|
|
8
|
-
Report on all in-flight pipelines (split designs may run in parallel across worktrees). Read-only.
|
|
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
9
|
|
|
10
10
|
## Process
|
|
11
11
|
|
|
@@ -7,22 +7,24 @@ description: "Turn a design doc's requirements into a behavioral spec — accept
|
|
|
7
7
|
|
|
8
8
|
Turn the design doc's requirements into a **behavioral spec** the executor implements against.
|
|
9
9
|
|
|
10
|
-
One design doc = one plan = one PR. The plan lists **all** the design's requirements; the executor builds them one at a time
|
|
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.
|
|
11
11
|
|
|
12
|
-
|
|
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.
|
|
13
13
|
|
|
14
14
|
## Process
|
|
15
15
|
|
|
16
|
-
1. **Find the design doc** —
|
|
17
|
-
2. **Create the feature branch
|
|
18
|
-
3. **Read the
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- **
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- **Production-risk notes**
|
|
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.
|
|
26
28
|
|
|
27
29
|
Save to `docs/plans/YYYY-MM-DD-<topic>-implementation.md`:
|
|
28
30
|
|
|
@@ -42,41 +44,35 @@ You may only create or edit files under `docs/plans/`. Do not modify source code
|
|
|
42
44
|
- `should <behavior>` — asserts <observable outcome>
|
|
43
45
|
- `should <error case>` — asserts <failure outcome>
|
|
44
46
|
|
|
47
|
+
### Checkpoints: full | spec | none
|
|
48
|
+
### Review: parallel | inline | skip
|
|
49
|
+
|
|
45
50
|
### Production-risk notes
|
|
46
51
|
- <from the design's Production-risk areas, if any>
|
|
47
52
|
|
|
48
53
|
## Requirement 2: <name>
|
|
49
54
|
…
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**If the design has `## Production-risk areas`** that flag schema migrations, new dependencies, external API integrations, or seed data, emit a `## Setup` section between `## Overview` and `## Requirement 1`:
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- **Dependencies:** what to install (and how)
|
|
58
|
-
- **Migrations:** each migration with a brief description
|
|
59
|
-
- **Seed / test data:** what data to prepare
|
|
60
|
-
- **Verify:** how to confirm setup worked (e.g. `npm test` still passes)
|
|
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>.
|
|
61
59
|
```
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
- Every requirement has acceptance criteria **and** matching integration tests.
|
|
65
|
-
- Acceptance criteria are observable behaviors, not implementation steps.
|
|
66
|
-
- Edge/error cases are covered.
|
|
67
|
-
- Production-risk areas from the design are reflected.
|
|
68
|
-
Fix gaps before presenting.
|
|
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.)
|
|
69
62
|
|
|
70
|
-
|
|
71
|
-
7. **Present the plan** — show the complete plan and wait for approval. On approval, hand off to `/skill:pwk-executing-tasks` — running it is what transitions out of the gated plan phase (the guard unlocks on the skill, not on the word "approve").
|
|
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).
|
|
72
64
|
|
|
73
|
-
|
|
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).
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
- **Not micro-tasks** — one coarse block per requirement. The executor decides how to structure and slice the implementation.
|
|
77
|
-
- **Not the tests themselves** — the plan specifies *what* the tests prove (names + assertions); `pwk-executing-tasks` writes the actual test files first (red), then implements to green.
|
|
73
|
+
## What belongs in the plan — and what stays out
|
|
78
74
|
|
|
79
|
-
The
|
|
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.
|
|
80
76
|
|
|
81
77
|
## After the plan
|
|
82
78
|
|