oc-harness-setup 0.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/AGENTS.md +106 -0
- package/LICENSE +21 -0
- package/README.md +67 -0
- package/agents/build.md +22 -0
- package/agents/coder.md +19 -0
- package/agents/documenter.md +28 -0
- package/agents/explore.md +20 -0
- package/agents/general.md +21 -0
- package/agents/keeper.md +22 -0
- package/agents/master.md +68 -0
- package/agents/plan.md +32 -0
- package/agents/researcher.md +21 -0
- package/agents/reviewer.md +27 -0
- package/agents/security-auditor.md +20 -0
- package/agents/test-engineer.md +20 -0
- package/agents/vault.md +64 -0
- package/agents/web-performance-auditor.md +19 -0
- package/bin/cli.js +641 -0
- package/commands/build.md +13 -0
- package/commands/checkpoint.md +5 -0
- package/commands/code-simplify.md +13 -0
- package/commands/council.md +24 -0
- package/commands/doctor.md +18 -0
- package/commands/handoff.md +5 -0
- package/commands/keeper.md +7 -0
- package/commands/plan.md +18 -0
- package/commands/ponytail-audit.md +7 -0
- package/commands/ponytail-debt.md +14 -0
- package/commands/review.md +7 -0
- package/commands/ship.md +31 -0
- package/commands/spec.md +15 -0
- package/commands/test.md +14 -0
- package/opencode.jsonc +427 -0
- package/package.json +45 -0
- package/reference/README.md +18 -0
- package/reference/model-keeper.md +26 -0
- package/reference/model-test.md +171 -0
- package/reference/models.md.example +21 -0
- package/scripts/harness-doctor.ps1 +964 -0
- package/scripts/panic/panic.ts +240 -0
- package/skills/_shared/SOURCES.md +26 -0
- package/skills/_shared/references/accessibility-checklist.md +160 -0
- package/skills/_shared/references/definition-of-done.md +67 -0
- package/skills/_shared/references/observability-checklist.md +92 -0
- package/skills/_shared/references/orchestration-patterns.md +156 -0
- package/skills/_shared/references/performance-checklist.md +236 -0
- package/skills/_shared/references/security-checklist.md +245 -0
- package/skills/_shared/references/testing-patterns.md +235 -0
- package/skills/api-and-interface-design/SKILL.md +367 -0
- package/skills/code-review-and-quality/SKILL.md +396 -0
- package/skills/code-simplification/SKILL.md +371 -0
- package/skills/creative-writing/SKILL.md +96 -0
- package/skills/debugging-and-error-recovery/SKILL.md +316 -0
- package/skills/frontend-ui-engineering/SKILL.md +328 -0
- package/skills/git-ceremony/SKILL.md +329 -0
- package/skills/grilling/SKILL.md +38 -0
- package/skills/incremental-implementation/SKILL.md +249 -0
- package/skills/observability-and-instrumentation/SKILL.md +238 -0
- package/skills/performance-optimization/SKILL.md +496 -0
- package/skills/planning-and-task-breakdown/SKILL.md +257 -0
- package/skills/security-and-hardening/SKILL.md +499 -0
- package/skills/source-driven-development/SKILL.md +216 -0
- package/skills/spec-driven-development/SKILL.md +245 -0
- package/skills/swarm-orchestration/SKILL.md +54 -0
- package/skills/test-driven-development/SKILL.md +398 -0
- package/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/skills/writing-for-agents/SKILL.md +83 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-ceremony
|
|
3
|
+
description: "The fixed git ritual for our repos — pull, branch, commit, PR, merge, tags, versioning, releases, and isolated worktrees. Use for any git work in a repository we own: creating or naming a branch, writing a commit message or PR body, merging, tagging, bumping a version, updating a release, or setting up an isolated workspace. A repo's own documented convention takes precedence when one exists."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Git Ceremony
|
|
7
|
+
|
|
8
|
+
One fixed git ritual for every repo we own. Short, standard, ours.
|
|
9
|
+
**The repo's own rules win. Ours is the fallback.**
|
|
10
|
+
|
|
11
|
+
## 0. Precedence — read the repo before you touch it
|
|
12
|
+
|
|
13
|
+
Before branching, check whether the target repo already dictates how it wants work done.
|
|
14
|
+
If it does, that is the ceremony for that repo.
|
|
15
|
+
|
|
16
|
+
Look for: `CONTRIBUTING*`, `.github/` (PR template, workflows, CODEOWNERS), `.gitlab/`,
|
|
17
|
+
commit-lint / husky configs, branch protection, a versioning or release process, sign-off
|
|
18
|
+
or DCO requirements.
|
|
19
|
+
|
|
20
|
+
- Repo has rules → follow them exactly.
|
|
21
|
+
- Repo is silent → follow this document.
|
|
22
|
+
|
|
23
|
+
Ours never overrides a repo's documented convention.
|
|
24
|
+
|
|
25
|
+
## 1. Pull — start from truth
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
git switch <default-branch> # main, master, trunk — whichever the repo uses
|
|
29
|
+
git pull --ff-only
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Detect the default branch from the repo (§0). Never assume `main`.
|
|
33
|
+
- Fast-forward only. If it fails, stop — do not manufacture a merge on the default branch.
|
|
34
|
+
- Never branch from a stale default branch.
|
|
35
|
+
|
|
36
|
+
## 2. Branch — create and name
|
|
37
|
+
|
|
38
|
+
One branch per unit of work. Never work on main. Never reuse a merged branch.
|
|
39
|
+
|
|
40
|
+
**Format:** `<type>/<slug>`
|
|
41
|
+
|
|
42
|
+
| type | for |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `feat` | new capability |
|
|
45
|
+
| `fix` | broken behavior |
|
|
46
|
+
| `chore` | tooling, deps, config |
|
|
47
|
+
| `docs` | documentation only |
|
|
48
|
+
| `refactor` | no behavior change |
|
|
49
|
+
| `test` | tests only |
|
|
50
|
+
| `perf` | speed/size |
|
|
51
|
+
| `hotfix` | urgent production fix |
|
|
52
|
+
| `wt` | isolated worktree work (§10) |
|
|
53
|
+
|
|
54
|
+
- `slug`: kebab-case, 2–5 words, describes the change — not the author, not the date.
|
|
55
|
+
- Issue suffix only when the repo tracks issues: `fix/login-timeout-4821`.
|
|
56
|
+
- Examples: `feat/token-refresh`, `docs/git-ceremony`, `hotfix/null-cart`.
|
|
57
|
+
|
|
58
|
+
## 3. Commit — message format
|
|
59
|
+
|
|
60
|
+
**Subject:** `type: imperative summary`, ≤ 72 chars, no trailing period. An optional `(scope)` may follow the type — `fix(api): cap retry backoff`.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
fix: cap retry backoff at 30s
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Body:** only when the reason isn't obvious. Up to three plain bullets — no padding,
|
|
67
|
+
no "this commit…", no emoji unless the repo uses them.
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
fix: cap retry backoff at 30s
|
|
71
|
+
|
|
72
|
+
- unbounded backoff stalled the queue ~9 min
|
|
73
|
+
- 30s ceiling keeps retries under the request timeout
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- One logical change per commit. If the subject needs "and", split it.
|
|
77
|
+
- No WIP commits on a branch headed for review — squash first.
|
|
78
|
+
- Issue refs (`#123`, `ABC-123`) go in the body, never the subject.
|
|
79
|
+
- No AI-attribution or sign-off trailers unless the repo requires them.
|
|
80
|
+
- A version bump is its own commit — never buried in a feature commit (§8).
|
|
81
|
+
|
|
82
|
+
**Review the staged diff before every commit:** `git diff --staged`. It is the last gate
|
|
83
|
+
against a secret, a stray artifact, or a debug print.
|
|
84
|
+
|
|
85
|
+
**Line endings.** Never commit a whole-file line-ending change — it buries the real diff.
|
|
86
|
+
On our repos, keep a `.gitattributes` with `* text=auto eol=lf`. On a repo we don't own,
|
|
87
|
+
if a change shows whole-file churn, stop and fix the checkout config instead of committing
|
|
88
|
+
the noise.
|
|
89
|
+
|
|
90
|
+
## 4. Push and PR
|
|
91
|
+
|
|
92
|
+
Open the PR against the repo's default branch. Title = the commit subject.
|
|
93
|
+
|
|
94
|
+
**PR body — exactly this, nothing more:**
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
What: <one line>
|
|
98
|
+
Why: <one line, omit if obvious>
|
|
99
|
+
Check: <the single command that proves it, or "n/a">
|
|
100
|
+
Risk: <one line, or "low">
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- Draft PR while in progress; ready only when the check passes.
|
|
104
|
+
- Small diffs. If it's large, split it.
|
|
105
|
+
- Screenshots only for visual changes.
|
|
106
|
+
|
|
107
|
+
## 5. Comments and review — format
|
|
108
|
+
|
|
109
|
+
- One point per comment. Short, direct. No greetings, no praise padding.
|
|
110
|
+
- Prefix intent when useful: `nit:` · `q:` · `blocker:` · `suggest:`.
|
|
111
|
+
- Reply once — resolve or answer. Take real disagreements offline.
|
|
112
|
+
- Review at the same standard: tight, specific, no essay.
|
|
113
|
+
|
|
114
|
+
## 6. Merge
|
|
115
|
+
|
|
116
|
+
- **main stays green.** A PR merges only after its check passes — never merge red.
|
|
117
|
+
- Default to **squash merge** — one commit per PR, linear history. Honor the repo otherwise.
|
|
118
|
+
- **Conflicts:** if main moved, rebase your branch on it and resolve there — never on main.
|
|
119
|
+
Never leave conflict markers, and never resolve by discarding the other side wholesale.
|
|
120
|
+
Re-run the check after resolving.
|
|
121
|
+
- Delete the branch after merge, local and remote. `git fetch --prune` when stale refs pile up.
|
|
122
|
+
- Force-push only your own PR branch, and only with `--force-with-lease`. Plain `--force` is
|
|
123
|
+
reserved for the single `latest` tag (§9).
|
|
124
|
+
- **Never** force-push main or any shared branch.
|
|
125
|
+
|
|
126
|
+
## 7. Tags — default OFF
|
|
127
|
+
|
|
128
|
+
> Off unless proven necessary.
|
|
129
|
+
|
|
130
|
+
- Do not create tags as part of normal work. Not per commit, not per PR.
|
|
131
|
+
- Turn tags on only when the repo requires them (publish/deploy tooling), or you ask.
|
|
132
|
+
- The single exception is the moving release pointer in §9 — that is a pointer, not a version tag.
|
|
133
|
+
|
|
134
|
+
## 8. Versioning — strict
|
|
135
|
+
|
|
136
|
+
**Format: detect, never invent.**
|
|
137
|
+
|
|
138
|
+
1. The repo declares a versioning format → use it exactly.
|
|
139
|
+
2. The repo declares nothing → our default: `MAJOR.MINOR.PATCH`.
|
|
140
|
+
|
|
141
|
+
Shapes we follow as-is: `0.0.0`, `0.0.0.0`, `0.0.0-beta.1`, CalVer `YYYY.MM.DD`,
|
|
142
|
+
a bare build number — whatever the repo uses.
|
|
143
|
+
|
|
144
|
+
**One source of truth.** The version lives in exactly one place — the manifest its
|
|
145
|
+
ecosystem reads (`package.json`, `pyproject.toml`, `Cargo.toml`, a `VERSION` file).
|
|
146
|
+
Everything else derives from it — the release body in §9 only *renders* it. Never hardcode the number in two places.
|
|
147
|
+
|
|
148
|
+
**Bump table (default 3-part):**
|
|
149
|
+
|
|
150
|
+
| Change | Bump |
|
|
151
|
+
|---|---|
|
|
152
|
+
| Breaking API or behavior change | MAJOR |
|
|
153
|
+
| New capability, backward compatible | MINOR |
|
|
154
|
+
| Bug fix, no new surface | PATCH |
|
|
155
|
+
|
|
156
|
+
- MAJOR resets MINOR and PATCH to 0. MINOR resets PATCH to 0.
|
|
157
|
+
- At `0.y.z` the project is unstable: a `y` bump may include breaking changes. State the
|
|
158
|
+
break so it isn't a surprise.
|
|
159
|
+
- Four-part `MAJOR.MINOR.PATCH.BUILD`: the first three follow the table; `BUILD` increments
|
|
160
|
+
per build and carries no API meaning. It never absorbs a breaking change.
|
|
161
|
+
|
|
162
|
+
**No bump for:** docs, tests, CI, formatting, or refactors that don't change shipped behavior.
|
|
163
|
+
|
|
164
|
+
**The bump is its own commit** — `chore(release): <old> -> <new>` — never buried inside a
|
|
165
|
+
feature commit.
|
|
166
|
+
|
|
167
|
+
**Every bump is justified — an unjustified bump is invalid.** The reason is one line, and it
|
|
168
|
+
appears twice: in the bump commit and in the release body.
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
chore(release): 1.4.2 -> 1.5.0
|
|
172
|
+
|
|
173
|
+
- minor: adds token refresh endpoint (backward compatible)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
bump 1.4.2 -> 1.5.0 · minor · new: token refresh endpoint
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The justification states *what kind of change* forced *which digit*. A `1.4.2 -> 1.4.3` with no
|
|
181
|
+
line explaining the fix is not allowed.
|
|
182
|
+
|
|
183
|
+
**Never:** reuse a version · bump downward · bump without justification · keep two sources of
|
|
184
|
+
truth · bury a bump inside an unrelated feature commit.
|
|
185
|
+
|
|
186
|
+
## 9. Releases — exactly one, forever
|
|
187
|
+
|
|
188
|
+
A repo has **at most one release entry, permanently**. Never a growing list. Each release is
|
|
189
|
+
the same entry, rewritten to describe the project as it stands now.
|
|
190
|
+
|
|
191
|
+
**Mechanism — one moving tag, one release:**
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
git tag -f latest <head-sha> # move the single pointer
|
|
195
|
+
git push --force origin latest # deliberate: the tag is a pointer, not a version
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Then edit the one release object to point at `latest` and rewrite its body.
|
|
199
|
+
|
|
200
|
+
**Body format:**
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
Version: <rendered from the manifest — never hand-edited>
|
|
204
|
+
Now: <what the project is right now, 1–3 bullets>
|
|
205
|
+
Changed: <bump + reason since the last update, 1–3 bullets>
|
|
206
|
+
Use: <one line to install/run>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
- One release entry. Ever. Never create a second.
|
|
210
|
+
- Never accumulate per-version tags or releases.
|
|
211
|
+
- If the repo has its own release process → **theirs wins**; do not collapse or delete it.
|
|
212
|
+
- Some repos forbid force-moving tags → repo rule wins; fall back to their process.
|
|
213
|
+
|
|
214
|
+
**How this squares with strict versioning:** the release entry is a current-state snapshot, not
|
|
215
|
+
a changelog. Version *history* lives in the bump commits — each justified, each permanent. The
|
|
216
|
+
entry only reports the version the project is at now, and overwrites cleanly every time.
|
|
217
|
+
Nothing is lost, because the commits are the record.
|
|
218
|
+
|
|
219
|
+
## 10. Worktrees — isolate when the work earns it
|
|
220
|
+
|
|
221
|
+
Multiple working trees from one repo, each on its own branch, sharing one `.git`. Use one when
|
|
222
|
+
the main checkout must stay clean, or when two things are in flight at once.
|
|
223
|
+
|
|
224
|
+
**Use when:** risky or large change · two or more features in flight · isolated review or merge ·
|
|
225
|
+
multi-branch test runs.
|
|
226
|
+
|
|
227
|
+
**Don't use when:** single-branch linear work (pure ceremony) · you just need to park uncommitted
|
|
228
|
+
changes (`git stash` is the smaller tool) · the same file would be open in two places (a conflict
|
|
229
|
+
factory, not parallelism).
|
|
230
|
+
|
|
231
|
+
### 10.1 Detect first — never create what already exists
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
git rev-parse --git-dir
|
|
235
|
+
git rev-parse --git-common-dir
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Different paths means you are already in a linked worktree — stop, do not nest another.
|
|
239
|
+
|
|
240
|
+
**Submodule guard:** that difference is also true inside a submodule. Confirm with
|
|
241
|
+
`git rev-parse --show-superproject-working-tree` — a path back means submodule, treat it as a
|
|
242
|
+
normal repo.
|
|
243
|
+
|
|
244
|
+
Only when the two paths match are you in a normal checkout.
|
|
245
|
+
|
|
246
|
+
### 10.2 Directory — pick, then prove it's ignored
|
|
247
|
+
|
|
248
|
+
Priority: explicit instruction › existing `.worktrees/` › existing `worktrees/` › default
|
|
249
|
+
`.worktrees/`.
|
|
250
|
+
|
|
251
|
+
**Before creating, verify the directory is ignored.** An unignored worktree dir commits the
|
|
252
|
+
entire tree into the repo:
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
git check-ignore -q .worktrees || {
|
|
256
|
+
echo ".worktrees/" >> .gitignore
|
|
257
|
+
git add .gitignore
|
|
258
|
+
git commit -m "chore: ignore worktrees dir"
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
If the worktree must live outside the repo, use a sibling instead: `<repo-root>-wt-<slug>`.
|
|
263
|
+
|
|
264
|
+
### 10.3 Create, then start from a clean baseline
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
git worktree add -b wt/<slug> <repo-root>/.worktrees/<slug> <main | commit | tag>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
1. **Set up deps** — detect and run the project's own installer (`npm install`, `cargo build`,
|
|
271
|
+
`pip install -r requirements.txt`, `poetry install`, `go mod download`).
|
|
272
|
+
2. **Run the test suite before writing code.** A dirty baseline makes every later failure
|
|
273
|
+
ambiguous. If tests already fail, report and ask — do not build on sand.
|
|
274
|
+
3. Report: worktree path, baseline result, ready.
|
|
275
|
+
|
|
276
|
+
**Sandbox fallback:** if `git worktree add` is blocked by permissions, say so and work in place.
|
|
277
|
+
|
|
278
|
+
### 10.4 Work, merge, remove
|
|
279
|
+
|
|
280
|
+
```pwsh
|
|
281
|
+
# pin every command to the worktree — the shell cwd is NOT the worktree
|
|
282
|
+
git -C <path> status
|
|
283
|
+
git -C <path> add -A; git -C <path> commit -m "..."
|
|
284
|
+
|
|
285
|
+
# merge into the base with a merge commit (keeps history readable)
|
|
286
|
+
git -C <repo-root> merge --no-ff wt/<slug>
|
|
287
|
+
|
|
288
|
+
# after merge, remove and sweep stale bookkeeping
|
|
289
|
+
git -C <repo-root> worktree remove <path>
|
|
290
|
+
git -C <repo-root> worktree prune
|
|
291
|
+
git -C <repo-root> worktree list
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
The `--no-ff` merge here is a local integration step. The PR itself still squashes per §6.
|
|
295
|
+
|
|
296
|
+
### 10.5 Rails
|
|
297
|
+
|
|
298
|
+
- **One writer per worktree.** One tree = one agent or session at a time; concurrent edits
|
|
299
|
+
corrupt review state.
|
|
300
|
+
- **Always pin with `git -C <path>`.** Never assume the shell is inside the worktree.
|
|
301
|
+
- **No `git clean` or `git reset --hard`** in a shared worktree.
|
|
302
|
+
- **Uncommitted work stays put.** Never carry edits between worktrees — commit, then merge.
|
|
303
|
+
- **`git worktree remove` refusing a dirty tree is the safety, not an error to route around.**
|
|
304
|
+
- **Adopting a worktree as the session's working directory is a session move:** call
|
|
305
|
+
`tools.opencode.session_move` rather than relying on shell cwd.
|
|
306
|
+
|
|
307
|
+
## 11. Never
|
|
308
|
+
|
|
309
|
+
- Never work directly on main.
|
|
310
|
+
- Never merge red — main stays green.
|
|
311
|
+
- Never commit secrets, `.env`, or credentials.
|
|
312
|
+
- Never commit debug prints or commented-out code.
|
|
313
|
+
- Never commit generated artifacts unless the repo expects them.
|
|
314
|
+
- Never force-push a shared branch.
|
|
315
|
+
- Never create a second release entry or a per-version tag.
|
|
316
|
+
- Never bump a version without a stated justification.
|
|
317
|
+
- Never tag by default.
|
|
318
|
+
|
|
319
|
+
## Quick card
|
|
320
|
+
|
|
321
|
+
```
|
|
322
|
+
detect repo rules → pull --ff-only → branch type/slug → commit type: summary →
|
|
323
|
+
push → PR (What/Why/Check/Risk) → squash → delete branch
|
|
324
|
+
version: repo's format first, else MAJOR.MINOR.PATCH — every bump justified, own commit
|
|
325
|
+
tags: off release: one, moved via `latest`, body rewritten
|
|
326
|
+
worktree: detect first · .worktrees/ ignored · clean baseline · one writer · git -C
|
|
327
|
+
main stays green · force-push only with --force-with-lease
|
|
328
|
+
repo rules always win
|
|
329
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grilling
|
|
3
|
+
description: Interview the user to a shared understanding before building. Use when a request, plan, or design is ambiguous, expensive, or has unresolved decisions; use before spec-driven-development when a wrong build would be costly. Triggered by "grill me" and by any decision tree with open branches.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Grilling
|
|
7
|
+
|
|
8
|
+
Interview the user relentlessly until you reach a shared understanding. Map the topic as a **design tree**: every decision branches into the decisions that hang off it.
|
|
9
|
+
|
|
10
|
+
Reach for this before `spec-driven-development` when a wrong build would be expensive. The spec records settled decisions; grilling settles them.
|
|
11
|
+
|
|
12
|
+
## Rounds and the frontier
|
|
13
|
+
|
|
14
|
+
Work the tree in **rounds**. The **frontier** is every decision whose prerequisites are already settled — the questions you can ask _now_ without guessing at answers you have not heard. Ask the whole frontier in one round, numbered, each with your recommended answer. Then wait for the user's answers before the next round.
|
|
15
|
+
|
|
16
|
+
Format a round like so:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
❓ **Q1** - **<question title>**: <question body, including the choices>
|
|
20
|
+
|
|
21
|
+
➡️ <your recommended answer>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
❓ **Q2** - **<question title>**: <question body>
|
|
26
|
+
|
|
27
|
+
➡️ <your recommended answer>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Each round reshapes the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute the frontier and ask the next round. A question whose answer depends on another question still open in this round belongs to a _later_ round, not this one.
|
|
31
|
+
|
|
32
|
+
## Facts are yours; decisions are theirs
|
|
33
|
+
|
|
34
|
+
Find facts yourself — never ask the user for something the environment can answer. Dispatch `explore` for filesystem, code, or docs facts; don't block on it. A running exploration is an unsettled prerequisite, so only the questions downstream of it wait for the report; ask the rest of the frontier now. Put every decision to the user and wait.
|
|
35
|
+
|
|
36
|
+
## Done
|
|
37
|
+
|
|
38
|
+
The session is done when the frontier is empty: every branch of the design tree visited, nothing left silently assumed. Do not act on it until the user confirms you have reached a shared understanding; then hand the settled decisions to `spec-driven-development` or straight to the build.
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: incremental-implementation
|
|
3
|
+
description: Delivers changes incrementally in thin, verifiable slices. Use when implementing any feature or change that touches more than one file, or when picking up the next task from a plan. Use when rolling a change out behind a feature flag, when you're about to write a large amount of code at once, or when a task feels too big to land in one step.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Incremental Implementation
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Build in thin vertical slices — implement one piece, test it, verify it, then expand. Avoid implementing an entire feature in one pass. Each increment should leave the system in a working, testable state. This is the execution discipline that makes large features manageable.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Implementing any multi-file change
|
|
15
|
+
- Building a new feature from a task breakdown
|
|
16
|
+
- Refactoring existing code
|
|
17
|
+
- Any time you're tempted to write more than ~100 lines before testing
|
|
18
|
+
|
|
19
|
+
**When NOT to use:** Single-file, single-function changes where the scope is already minimal.
|
|
20
|
+
|
|
21
|
+
## The Increment Cycle
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
┌──────────────────────────────────────┐
|
|
25
|
+
│ │
|
|
26
|
+
│ Implement ──→ Test ──→ Verify ──┐ │
|
|
27
|
+
│ ▲ │ │
|
|
28
|
+
│ └───── Commit ◄─────────────┘ │
|
|
29
|
+
│ │ │
|
|
30
|
+
│ ▼ │
|
|
31
|
+
│ Next slice │
|
|
32
|
+
│ │
|
|
33
|
+
└──────────────────────────────────────┘
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
For each slice:
|
|
37
|
+
|
|
38
|
+
1. **Implement** the smallest complete piece of functionality
|
|
39
|
+
2. **Test** — run the test suite (or write a test if none exists)
|
|
40
|
+
3. **Verify** — confirm the slice works as expected (tests pass, build succeeds, manual check)
|
|
41
|
+
4. **Commit** -- save your progress with a descriptive, atomic commit message (one slice = one commit)
|
|
42
|
+
5. **Move to the next slice** — carry forward, don't restart
|
|
43
|
+
|
|
44
|
+
## Slicing Strategies
|
|
45
|
+
|
|
46
|
+
### Vertical Slices (Preferred)
|
|
47
|
+
|
|
48
|
+
Build one complete path through the stack:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Slice 1: Create a task (DB + API + basic UI)
|
|
52
|
+
→ Tests pass, user can create a task via the UI
|
|
53
|
+
|
|
54
|
+
Slice 2: List tasks (query + API + UI)
|
|
55
|
+
→ Tests pass, user can see their tasks
|
|
56
|
+
|
|
57
|
+
Slice 3: Edit a task (update + API + UI)
|
|
58
|
+
→ Tests pass, user can modify tasks
|
|
59
|
+
|
|
60
|
+
Slice 4: Delete a task (delete + API + UI + confirmation)
|
|
61
|
+
→ Tests pass, full CRUD complete
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Each slice delivers working end-to-end functionality.
|
|
65
|
+
|
|
66
|
+
### Contract-First Slicing
|
|
67
|
+
|
|
68
|
+
When backend and frontend need to develop in parallel:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Slice 0: Define the API contract (types, interfaces, OpenAPI spec)
|
|
72
|
+
Slice 1a: Implement backend against the contract + API tests
|
|
73
|
+
Slice 1b: Implement frontend against mock data matching the contract
|
|
74
|
+
Slice 2: Integrate and test end-to-end
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Risk-First Slicing
|
|
78
|
+
|
|
79
|
+
Tackle the riskiest or most uncertain piece first:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Slice 1: Prove the WebSocket connection works (highest risk)
|
|
83
|
+
Slice 2: Build real-time task updates on the proven connection
|
|
84
|
+
Slice 3: Add offline support and reconnection
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If Slice 1 fails, you discover it before investing in Slices 2 and 3.
|
|
88
|
+
|
|
89
|
+
## Implementation Rules
|
|
90
|
+
|
|
91
|
+
### Rule 0: Simplicity First
|
|
92
|
+
|
|
93
|
+
Before writing any code, ask: "What is the simplest thing that could work?"
|
|
94
|
+
|
|
95
|
+
After writing code, review it against these checks:
|
|
96
|
+
- Can this be done in fewer lines?
|
|
97
|
+
- Are these abstractions earning their complexity?
|
|
98
|
+
- Would a staff engineer look at this and say "why didn't you just..."?
|
|
99
|
+
- Am I building for hypothetical future requirements, or the current task?
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
SIMPLICITY CHECK:
|
|
103
|
+
✗ Generic EventBus with middleware pipeline for one notification
|
|
104
|
+
✓ Simple function call
|
|
105
|
+
|
|
106
|
+
✗ Abstract factory pattern for two similar components
|
|
107
|
+
✓ Two straightforward components with shared utilities
|
|
108
|
+
|
|
109
|
+
✗ Config-driven form builder for three forms
|
|
110
|
+
✓ Three form components
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Three similar lines of code is better than a premature abstraction. Implement the naive, obviously-correct version first. Optimize only after correctness is proven with tests.
|
|
114
|
+
|
|
115
|
+
### Rule 0.5: Scope Discipline
|
|
116
|
+
|
|
117
|
+
Touch only what the task requires.
|
|
118
|
+
|
|
119
|
+
Do NOT:
|
|
120
|
+
- "Clean up" code adjacent to your change
|
|
121
|
+
- Refactor imports in files you're not modifying
|
|
122
|
+
- Remove comments you don't fully understand
|
|
123
|
+
- Add features not in the spec because they "seem useful"
|
|
124
|
+
- Modernize syntax in files you're only reading
|
|
125
|
+
|
|
126
|
+
If you notice something worth improving outside your task scope, note it — don't fix it:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
NOTICED BUT NOT TOUCHING:
|
|
130
|
+
- src/utils/format.ts has an unused import (unrelated to this task)
|
|
131
|
+
- The auth middleware could use better error messages (separate task)
|
|
132
|
+
→ Want me to create tasks for these?
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Rule 1: One Thing at a Time
|
|
136
|
+
|
|
137
|
+
Each increment changes one logical thing. Don't mix concerns:
|
|
138
|
+
|
|
139
|
+
**Bad:** One commit that adds a new component, refactors an existing one, and updates the build config.
|
|
140
|
+
|
|
141
|
+
**Good:** Three separate commits — one for each change.
|
|
142
|
+
|
|
143
|
+
### Rule 2: Keep It Compilable
|
|
144
|
+
|
|
145
|
+
After each increment, the project must build and existing tests must pass. Don't leave the codebase in a broken state between slices.
|
|
146
|
+
|
|
147
|
+
### Rule 3: Feature Flags for Incomplete Features
|
|
148
|
+
|
|
149
|
+
If a feature isn't ready for users but you need to merge increments:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// Feature flag for work-in-progress
|
|
153
|
+
const ENABLE_TASK_SHARING = process.env.FEATURE_TASK_SHARING === 'true';
|
|
154
|
+
|
|
155
|
+
if (ENABLE_TASK_SHARING) {
|
|
156
|
+
// New sharing UI
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
This lets you merge small increments to the main branch without exposing incomplete work.
|
|
161
|
+
|
|
162
|
+
### Rule 4: Safe Defaults
|
|
163
|
+
|
|
164
|
+
New code should default to safe, conservative behavior:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
// Safe: disabled by default, opt-in
|
|
168
|
+
export function createTask(data: TaskInput, options?: { notify?: boolean }) {
|
|
169
|
+
const shouldNotify = options?.notify ?? false;
|
|
170
|
+
// ...
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Rule 5: Rollback-Friendly
|
|
175
|
+
|
|
176
|
+
Each increment should be independently revertable:
|
|
177
|
+
|
|
178
|
+
- Additive changes (new files, new functions) are easy to revert
|
|
179
|
+
- Modifications to existing code should be minimal and focused
|
|
180
|
+
- Database migrations should have corresponding rollback migrations
|
|
181
|
+
- Avoid deleting something in one commit and replacing it in the same commit — separate them
|
|
182
|
+
|
|
183
|
+
## Working with Agents
|
|
184
|
+
|
|
185
|
+
When directing an agent to implement incrementally:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
"Let's implement Task 3 from the plan.
|
|
189
|
+
|
|
190
|
+
Start with just the database schema change and the API endpoint.
|
|
191
|
+
Don't touch the UI yet — we'll do that in the next increment.
|
|
192
|
+
|
|
193
|
+
After implementing, run the repository's test and build commands to
|
|
194
|
+
verify nothing is broken."
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Be explicit about what's in scope and what's NOT in scope for each increment.
|
|
198
|
+
|
|
199
|
+
## Increment Checklist
|
|
200
|
+
|
|
201
|
+
After each increment, verify with the repository's own commands (see the test-driven-development skill's Discover the Stack First section):
|
|
202
|
+
|
|
203
|
+
- [ ] The change does one thing and does it completely
|
|
204
|
+
- [ ] All existing tests still pass (the repository's test command: `npm test`, `./gradlew test`, `pytest`, ...)
|
|
205
|
+
- [ ] The build succeeds (the repository's build command)
|
|
206
|
+
- [ ] Type checking passes, where the stack has one (`npx tsc --noEmit`, `mypy`, ...)
|
|
207
|
+
- [ ] Linting passes (the repository's lint command)
|
|
208
|
+
- [ ] The new functionality works as expected
|
|
209
|
+
- [ ] The change is committed with a descriptive message
|
|
210
|
+
|
|
211
|
+
**Note:** Run each verification command after a change that could affect it. After a successful run, don't repeat the same command unless the code has changed since — re-running on unchanged code adds no information.
|
|
212
|
+
|
|
213
|
+
## Common Rationalizations
|
|
214
|
+
|
|
215
|
+
| Rationalization | Reality |
|
|
216
|
+
|---|---|
|
|
217
|
+
| "I'll test it all at the end" | Bugs compound. A bug in Slice 1 makes Slices 2-5 wrong. Test each slice. |
|
|
218
|
+
| "It's faster to do it all at once" | It *feels* faster until something breaks and you can't find which of 500 changed lines caused it. |
|
|
219
|
+
| "These changes are too small to commit separately" | Small commits are free. Large commits hide bugs and make rollbacks painful. |
|
|
220
|
+
| "I'll add the feature flag later" | If the feature isn't complete, it shouldn't be user-visible. Add the flag now. |
|
|
221
|
+
| "This refactor is small enough to include" | Refactors mixed with features make both harder to review and debug. Separate them. |
|
|
222
|
+
| "Let me run the build command again just to be sure" | After a successful run, repeating the same command adds nothing unless the code has changed since. Run it again after subsequent edits, not as reassurance. |
|
|
223
|
+
|
|
224
|
+
## Red Flags
|
|
225
|
+
|
|
226
|
+
- More than 100 lines of code written without running tests
|
|
227
|
+
- Multiple unrelated changes in a single increment
|
|
228
|
+
- "Let me just quickly add this too" scope expansion
|
|
229
|
+
- Skipping the test/verify step to move faster
|
|
230
|
+
- Build or tests broken between increments
|
|
231
|
+
- Large uncommitted changes accumulating
|
|
232
|
+
- Building abstractions before the third use case demands it
|
|
233
|
+
- Touching files outside the task scope "while I'm here"
|
|
234
|
+
- Creating new utility files for one-time operations
|
|
235
|
+
- Running the same build/test command twice in a row without any intervening code change
|
|
236
|
+
|
|
237
|
+
## Verification
|
|
238
|
+
|
|
239
|
+
After completing all increments for a task:
|
|
240
|
+
|
|
241
|
+
- [ ] Each increment was individually tested and committed
|
|
242
|
+
- [ ] The full test suite passes
|
|
243
|
+
- [ ] The build is clean
|
|
244
|
+
- [ ] The feature works end-to-end as specified
|
|
245
|
+
- [ ] No uncommitted changes remain
|
|
246
|
+
|
|
247
|
+
## See Also
|
|
248
|
+
|
|
249
|
+
Per-increment verification is the local check. Before declaring a task done, apply the project-wide Definition of Done as the final gate, the standing bar every increment clears regardless of the task. See `../_shared/references/definition-of-done.md`.
|