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.
Files changed (67) hide show
  1. package/AGENTS.md +106 -0
  2. package/LICENSE +21 -0
  3. package/README.md +67 -0
  4. package/agents/build.md +22 -0
  5. package/agents/coder.md +19 -0
  6. package/agents/documenter.md +28 -0
  7. package/agents/explore.md +20 -0
  8. package/agents/general.md +21 -0
  9. package/agents/keeper.md +22 -0
  10. package/agents/master.md +68 -0
  11. package/agents/plan.md +32 -0
  12. package/agents/researcher.md +21 -0
  13. package/agents/reviewer.md +27 -0
  14. package/agents/security-auditor.md +20 -0
  15. package/agents/test-engineer.md +20 -0
  16. package/agents/vault.md +64 -0
  17. package/agents/web-performance-auditor.md +19 -0
  18. package/bin/cli.js +641 -0
  19. package/commands/build.md +13 -0
  20. package/commands/checkpoint.md +5 -0
  21. package/commands/code-simplify.md +13 -0
  22. package/commands/council.md +24 -0
  23. package/commands/doctor.md +18 -0
  24. package/commands/handoff.md +5 -0
  25. package/commands/keeper.md +7 -0
  26. package/commands/plan.md +18 -0
  27. package/commands/ponytail-audit.md +7 -0
  28. package/commands/ponytail-debt.md +14 -0
  29. package/commands/review.md +7 -0
  30. package/commands/ship.md +31 -0
  31. package/commands/spec.md +15 -0
  32. package/commands/test.md +14 -0
  33. package/opencode.jsonc +427 -0
  34. package/package.json +45 -0
  35. package/reference/README.md +18 -0
  36. package/reference/model-keeper.md +26 -0
  37. package/reference/model-test.md +171 -0
  38. package/reference/models.md.example +21 -0
  39. package/scripts/harness-doctor.ps1 +964 -0
  40. package/scripts/panic/panic.ts +240 -0
  41. package/skills/_shared/SOURCES.md +26 -0
  42. package/skills/_shared/references/accessibility-checklist.md +160 -0
  43. package/skills/_shared/references/definition-of-done.md +67 -0
  44. package/skills/_shared/references/observability-checklist.md +92 -0
  45. package/skills/_shared/references/orchestration-patterns.md +156 -0
  46. package/skills/_shared/references/performance-checklist.md +236 -0
  47. package/skills/_shared/references/security-checklist.md +245 -0
  48. package/skills/_shared/references/testing-patterns.md +235 -0
  49. package/skills/api-and-interface-design/SKILL.md +367 -0
  50. package/skills/code-review-and-quality/SKILL.md +396 -0
  51. package/skills/code-simplification/SKILL.md +371 -0
  52. package/skills/creative-writing/SKILL.md +96 -0
  53. package/skills/debugging-and-error-recovery/SKILL.md +316 -0
  54. package/skills/frontend-ui-engineering/SKILL.md +328 -0
  55. package/skills/git-ceremony/SKILL.md +329 -0
  56. package/skills/grilling/SKILL.md +38 -0
  57. package/skills/incremental-implementation/SKILL.md +249 -0
  58. package/skills/observability-and-instrumentation/SKILL.md +238 -0
  59. package/skills/performance-optimization/SKILL.md +496 -0
  60. package/skills/planning-and-task-breakdown/SKILL.md +257 -0
  61. package/skills/security-and-hardening/SKILL.md +499 -0
  62. package/skills/source-driven-development/SKILL.md +216 -0
  63. package/skills/spec-driven-development/SKILL.md +245 -0
  64. package/skills/swarm-orchestration/SKILL.md +54 -0
  65. package/skills/test-driven-development/SKILL.md +398 -0
  66. package/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
  67. package/skills/writing-for-agents/SKILL.md +83 -0
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * panic — stop rogue subagent sessions, now.
4
+ *
5
+ * The host exposes two things that make this exact rather than a guess:
6
+ *
7
+ * GET /api/session/active a live map of what is running
8
+ * POST /api/session/{id}/interrupt stop a session's current turn
9
+ * DELETE /api/session/{id} remove the session entirely
10
+ *
11
+ * Order matters, and it is counter-intuitive: **interrupt first, and only
12
+ * restart the service as a last resort.** A child session that is suspended can
13
+ * be *resumed* by a service restart, so restarting a live rogue agent can bring
14
+ * it back rather than kill it. Interrupt sticks; restart can resurrect.
15
+ *
16
+ * Default targets are running sessions that have a parent — subagents. A root
17
+ * session (yours) is never touched unless you name it with --session.
18
+ *
19
+ * panic interrupt every running subagent, verify, report
20
+ * panic -n dry run: list what would be killed, change nothing
21
+ * panic -s <session-id> target one session exactly (may be a root)
22
+ * panic --remove if an interrupt does not stick, delete the session
23
+ * panic --restart last resort: restart the background service
24
+ *
25
+ * Exit codes: 0 all targets stopped, 1 something survived, 2 usage/call error.
26
+ */
27
+
28
+ const TIMEOUT_DEFAULT = 20;
29
+
30
+ interface Options {
31
+ readonly dryRun: boolean;
32
+ readonly sessions: readonly string[];
33
+ readonly timeout: number;
34
+ readonly remove: boolean;
35
+ readonly restart: boolean;
36
+ readonly json: boolean;
37
+ }
38
+
39
+ interface SessionInfo {
40
+ readonly id?: string;
41
+ readonly parentID?: string;
42
+ readonly agent?: string;
43
+ readonly title?: string;
44
+ }
45
+
46
+ const argv = process.argv.slice(2);
47
+
48
+ function usage(message: string): never {
49
+ process.stderr.write(`panic: ${message}\n\n`);
50
+ process.stderr.write(
51
+ "usage: panic [--dry-run] [--session <id>]... [--timeout <s>] [--remove] [--restart] [--json]\n",
52
+ );
53
+ process.exit(2);
54
+ }
55
+
56
+ function parse(argv: readonly string[]): Options {
57
+ const options = { dryRun: false, sessions: [] as string[], timeout: TIMEOUT_DEFAULT, remove: false, restart: false, json: false };
58
+ for (let index = 0; index < argv.length; index += 1) {
59
+ const arg = argv[index]!;
60
+ const next = (): string => {
61
+ const value = argv[index + 1];
62
+ if (value === undefined) usage(`${arg} needs a value`);
63
+ index += 1;
64
+ return value;
65
+ };
66
+ if (arg === "-n" || arg === "--dry-run") options.dryRun = true;
67
+ else if (arg === "-s" || arg === "--session") options.sessions.push(next());
68
+ else if (arg === "--timeout") options.timeout = Number(next());
69
+ else if (arg === "--remove") options.remove = true;
70
+ else if (arg === "--restart") options.restart = true;
71
+ else if (arg === "--json") options.json = true;
72
+ else if (arg === "-h" || arg === "--help") usage("stop rogue subagent sessions");
73
+ else usage(`unknown option ${arg}`);
74
+ }
75
+ if (!Number.isFinite(options.timeout) || options.timeout < 0) usage("--timeout must be a number of seconds");
76
+ return options;
77
+ }
78
+
79
+ const options = parse(argv);
80
+
81
+ // ---------------------------------------------------------------------------
82
+ // Talking to the host
83
+ // ---------------------------------------------------------------------------
84
+
85
+ const bin = Bun.which("opencode") ?? "opencode";
86
+
87
+ /** Returns parsed JSON, or undefined when the call failed. Never throws. */
88
+ function api(method: string, path: string, body?: unknown): unknown {
89
+ const args = body === undefined ? [method, path] : ["--data", JSON.stringify(body), method, path];
90
+ try {
91
+ const proc = Bun.spawnSync([bin, "api", ...args], { stdout: "pipe", stderr: "pipe" });
92
+ const text = proc.stdout.toString().trim();
93
+ if (text.length === 0) return undefined;
94
+ return JSON.parse(text);
95
+ } catch {
96
+ return undefined;
97
+ }
98
+ }
99
+
100
+ /** The host's own view of what is running. */
101
+ function active(): Record<string, { type?: string }> | undefined {
102
+ const response = api("get", "/api/session/active") as { data?: Record<string, { type?: string }> } | undefined;
103
+ return response?.data;
104
+ }
105
+
106
+ function sessionOf(id: string): SessionInfo | undefined {
107
+ const response = api("get", `/api/session/${encodeURIComponent(id)}`) as { data?: SessionInfo } | SessionInfo | undefined;
108
+ if (response === undefined) return undefined;
109
+ const wrapped = response as { data?: SessionInfo };
110
+ return wrapped.data ?? (response as SessionInfo);
111
+ }
112
+
113
+ function interrupt(id: string): boolean {
114
+ const response = api("post", `/api/session/${encodeURIComponent(id)}/interrupt`, { continue: false }) as
115
+ | { interrupted?: boolean }
116
+ | undefined;
117
+ return response?.interrupted === true;
118
+ }
119
+
120
+ function remove(id: string): boolean {
121
+ // DELETE returns 204 with an empty body, so "no throw" is the success signal.
122
+ return api("delete", `/api/session/${encodeURIComponent(id)}`) !== undefined || true;
123
+ }
124
+
125
+ const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
126
+
127
+ // ---------------------------------------------------------------------------
128
+ // Choosing targets
129
+ // ---------------------------------------------------------------------------
130
+
131
+ interface Target {
132
+ readonly id: string;
133
+ readonly agent: string;
134
+ readonly title: string;
135
+ readonly root: boolean;
136
+ }
137
+
138
+ function targets(): Target[] {
139
+ const running = active();
140
+ if (running === undefined) {
141
+ process.stderr.write("panic: the host did not answer /api/session/active\n");
142
+ process.exit(2);
143
+ }
144
+
145
+ const ids = options.sessions.length > 0 ? options.sessions : Object.keys(running);
146
+ const chosen: Target[] = [];
147
+ for (const id of ids) {
148
+ if (options.sessions.length === 0 && running[id] === undefined) continue;
149
+ const info = sessionOf(id);
150
+ // Default scope is subagents: a session with no parent is somebody's root
151
+ // session, and killing that unasked would be its own kind of rogue.
152
+ if (options.sessions.length === 0 && info?.parentID === undefined) continue;
153
+ chosen.push({
154
+ id,
155
+ agent: info?.agent ?? running[id]?.type ?? "unknown",
156
+ title: info?.title ?? "(untitled)",
157
+ root: info?.parentID === undefined,
158
+ });
159
+ }
160
+ return chosen;
161
+ }
162
+
163
+ const list = targets();
164
+
165
+ if (options.json) {
166
+ process.stdout.write(`${JSON.stringify({ targets: list, dryRun: options.dryRun }, null, 2)}\n`);
167
+ } else {
168
+ if (list.length === 0) {
169
+ process.stdout.write("panic: nothing running that matches. No action taken.\n");
170
+ } else {
171
+ process.stdout.write(`${options.dryRun ? "would stop" : "stopping"} ${list.length} session(s):\n`);
172
+ for (const target of list) {
173
+ process.stdout.write(` ${target.id} ${target.agent.padEnd(18)} ${target.root ? "(root!) " : ""}${target.title}\n`);
174
+ }
175
+ }
176
+ }
177
+
178
+ if (list.length === 0) process.exit(0);
179
+ if (options.dryRun) process.exit(0);
180
+
181
+ // ---------------------------------------------------------------------------
182
+ // Kill, verify, escalate
183
+ // ---------------------------------------------------------------------------
184
+
185
+ async function survivors(): Promise<string[]> {
186
+ const deadline = Date.now() + options.timeout * 1_000;
187
+ let remaining = list.map((target) => target.id);
188
+ while (Date.now() < deadline) {
189
+ const running = active() ?? {};
190
+ remaining = remaining.filter((id) => running[id] !== undefined);
191
+ if (remaining.length === 0) return [];
192
+ await sleep(1_000);
193
+ }
194
+ return remaining;
195
+ }
196
+
197
+ process.stdout.write("\ninterrupting...\n");
198
+ for (const target of list) {
199
+ const stopped = interrupt(target.id);
200
+ process.stdout.write(` ${stopped ? "interrupted" : "already stopped"} ${target.id}\n`);
201
+ }
202
+
203
+ let remaining = await survivors();
204
+ process.stdout.write(remaining.length === 0 ? `\nstopped. verified against /api/session/active.\n` : `\nstill running: ${remaining.join(", ")}\n`);
205
+
206
+ // One more interrupt before anything heavier: a session can pick up work between
207
+ // the first interrupt and the check.
208
+ if (remaining.length > 0) {
209
+ process.stdout.write("\nsecond interrupt pass...\n");
210
+ for (const id of remaining) interrupt(id);
211
+ remaining = await survivors();
212
+ }
213
+
214
+ if (remaining.length > 0 && options.remove) {
215
+ process.stdout.write("\nremoving (destructive)...\n");
216
+ for (const id of remaining) {
217
+ remove(id);
218
+ process.stdout.write(` removed ${id}\n`);
219
+ }
220
+ remaining = await survivors();
221
+ }
222
+
223
+ // Restart is last, never first: it can RESUME a suspended child session.
224
+ if (remaining.length > 0 && options.restart) {
225
+ process.stdout.write("\nrestarting the background service (last resort)...\n");
226
+ Bun.spawnSync([bin, "service", "restart"], { stdout: "pipe", stderr: "pipe" });
227
+ await sleep(3_000);
228
+ remaining = await survivors();
229
+ }
230
+
231
+ if (remaining.length === 0) {
232
+ process.stdout.write("\nOK — all targets stopped.\n");
233
+ process.exit(0);
234
+ }
235
+
236
+ process.stderr.write(`\nSURVIVED: ${remaining.join(", ")}\n`);
237
+ process.stderr.write("Try, in this order:\n");
238
+ process.stderr.write(` panic -s ${remaining[0]} --remove delete the session (irreversible)\n`);
239
+ process.stderr.write(" panic --restart restart the service (may revive suspended sessions)\n");
240
+ process.exit(1);
@@ -0,0 +1,26 @@
1
+ # Local Skill Layer — Sources
2
+
3
+ This directory is the local, self-contained skill layer. Upstream material was inspected, adapted to this harness, and is owned locally; runtime does not depend on external checkouts.
4
+
5
+ | Source | Revision inspected (pinned) | Used for |
6
+ |--------|------------------------------|----------|
7
+ | `DietrichGebert/ponytail` (v4.9.0) | `356918eba965ee1eac64bd3a7f0dd02108350de5` | `code-simplification` (report-only review/audit modes); the lean ladder is integrated into `AGENTS.md` |
8
+ | `addyosmani/agent-skills` | `6ca0cd7db39b41b1c37e26d335c507ee92382c6d` | Active local workflow skills listed below |
9
+ | `mattpocock/skills` | `3cca18b368ae95cdbdebbff572ccafa662551015` | `grilling`, `writing-for-agents`, and `creative-writing` (modes from `writing-fragments` / `writing-beats` / `writing-shape`) |
10
+
11
+ `_shared/references/` mirrors the upstream `references/` checklists from the same addyosmani/agent-skills revision; all skills link to them via `../_shared/references/...` instead of the upstream `../../references/...` paths.
12
+
13
+ Transformations applied:
14
+
15
+ - Frontmatter normalized to OpenCode V2 (`name`, `description`, optional `metadata`). Low-frequency / collision-prone skills are marked `metadata.opencode.autoinvoke: false` (explicit-only).
16
+ - All `../../references/...` links rewritten to `../_shared/references/...`.
17
+ - Harness adaptations: `$ARGUMENTS` references are command-template aware; upstream scripts, adapters, plugins, hooks, and repo-specific policy files are not runtime dependencies.
18
+ - Ponytail adaptations: no plugin hooks, mode tracker, MCP/server code, adapter manifests, config/env default-mode machinery, or benchmark scoreboard. The always-on ladder lives in `AGENTS.md`; only report-only complexity workflows are active here.
19
+ - `swarm-orchestration` is local work, not upstream-derived; left unchanged. `git-ceremony` is likewise local/adapted work: it is the harness's own fixed git ritual, adopted without a recorded upstream and owned locally, not tracked to a pinned revision. Its worktree section absorbed the former standalone `worktree` skill on <DATE>.
20
+ - Mattpocock adaptations: ported as model-invoked local skills; upstream `disable-model-invocation` mapped to the harness explicit-only marker `metadata: {"opencode/autoinvoke": false}`; `grilling` invoked directly as a model-invoked skill (its former `/grill` wrapper command was retired <DATE>); `CLAUDE.md` references normalized to `AGENTS.md`; generic sub-agent references mapped to harness helpers (`explore`, lead-spawned children). Upstream OpenAI agent adapters and plugin packaging are not adopted. The `SKILL-MECHANICS.md` sibling reference is retained as disclosed reference.
21
+
22
+ Active Addy-derived IDs: `api-and-interface-design`, `code-review-and-quality`, `code-simplification`, `debugging-and-error-recovery`, `frontend-ui-engineering`, `incremental-implementation`, `observability-and-instrumentation`, `performance-optimization`, `planning-and-task-breakdown`, `security-and-hardening`, `source-driven-development`, `spec-driven-development`, and `test-driven-development`.
23
+
24
+ Active Mattpocock-derived IDs: `grilling`, `writing-for-agents`, and `creative-writing`. Local/adapted without a pinned upstream: `git-ceremony` (absorbed the former `worktree` skill <DATE>).
25
+
26
+ Runtime boundary: the OpenCode config uses a wildcard skill deny followed by exact allows for the active local IDs. Compatibility skill directories are not part of the local layer and are not required for any command or agent.
@@ -0,0 +1,160 @@
1
+ # Accessibility Checklist
2
+
3
+ Quick reference for WCAG 2.1 AA compliance. Use alongside the `frontend-ui-engineering` skill.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Essential Checks](#essential-checks)
8
+ - [Common HTML Patterns](#common-html-patterns)
9
+ - [Testing Tools](#testing-tools)
10
+ - [Quick Reference: ARIA Live Regions](#quick-reference-aria-live-regions)
11
+ - [Common Anti-Patterns](#common-anti-patterns)
12
+
13
+ ## Essential Checks
14
+
15
+ ### Keyboard Navigation
16
+ - [ ] All interactive elements focusable via Tab key
17
+ - [ ] Focus order follows visual/logical order
18
+ - [ ] Focus is visible (outline/ring on focused elements)
19
+ - [ ] Custom widgets have keyboard support (Enter to activate, Escape to close)
20
+ - [ ] No keyboard traps (user can always Tab away from a component)
21
+ - [ ] Skip-to-content link at top of page - visible (at least) on keyboard focus
22
+ - [ ] Modals trap focus while open, return focus on close
23
+
24
+ ### Screen Readers
25
+ - [ ] All images have `alt` text (or `alt=""` for decorative images)
26
+ - [ ] All form inputs have associated labels (`<label>` or `aria-label`)
27
+ - [ ] Buttons and links have descriptive text (not "Click here")
28
+ - [ ] Icon-only buttons have `aria-label`
29
+ - [ ] Page has one `<h1>` and headings don't skip levels
30
+ - [ ] Dynamic content changes announced (`aria-live` regions)
31
+ - [ ] Tables have `<th>` headers with scope
32
+
33
+ ### Visual
34
+ - [ ] Text contrast ≥ 4.5:1 (normal text) or ≥ 3:1 (large text, 18px+)
35
+ - [ ] UI components contrast ≥ 3:1 against background
36
+ - [ ] Color is not the only way to convey information
37
+ - [ ] Text resizable to 200% without breaking layout
38
+ - [ ] No content that flashes more than 3 times per second
39
+
40
+ ### Forms
41
+ - [ ] Every input has a visible label
42
+ - [ ] Required fields indicated (not by color alone)
43
+ - [ ] Error messages specific and associated with the field
44
+ - [ ] Error state visible by more than color (icon, text, border)
45
+ - [ ] Form submission errors summarized and focusable
46
+ - [ ] Known fields use autocomplete (for example `type="email" autocomplete="email"`)
47
+
48
+ ### Content
49
+ - [ ] Language declared (`<html lang="en">`)
50
+ - [ ] Page has a descriptive `<title>`
51
+ - [ ] Links distinguish from surrounding text (not by color alone)
52
+ - [ ] Touch targets ≥ 44x44px on mobile
53
+ - [ ] Meaningful empty states (not blank screens)
54
+
55
+ ## Common HTML Patterns
56
+
57
+ ### Buttons vs. Links
58
+
59
+ ```html
60
+ <!-- Use <button> for actions -->
61
+ <button onClick={handleDelete}>Delete Task</button>
62
+
63
+ <!-- Use <a> for navigation -->
64
+ <a href="/tasks/123">View Task</a>
65
+
66
+ <!-- NEVER use div/span as buttons -->
67
+ <div onClick={handleDelete}>Delete</div> <!-- BAD -->
68
+ ```
69
+
70
+ ### Form Labels
71
+
72
+ ```html
73
+ <!-- Explicit label association -->
74
+ <label htmlFor="email">Email address</label>
75
+ <input id="email" type="email" required />
76
+
77
+ <!-- Implicit wrapping -->
78
+ <label>
79
+ Email address
80
+ <input type="email" required />
81
+ </label>
82
+
83
+ <!-- Hidden label (visible label preferred) -->
84
+ <input type="search" aria-label="Search tasks" />
85
+ ```
86
+
87
+ ### ARIA Roles
88
+
89
+ ```html
90
+ <!-- Navigation -->
91
+ <nav aria-label="Main navigation">...</nav>
92
+ <nav aria-label="Footer links">...</nav>
93
+
94
+ <!-- Status messages -->
95
+ <div role="status" aria-live="polite">Task saved</div>
96
+
97
+ <!-- Alert messages -->
98
+ <div role="alert">Error: Title is required</div>
99
+
100
+ <!-- Modal dialogs -->
101
+ <dialog aria-modal="true" aria-labelledby="dialog-title">
102
+ <h2 id="dialog-title">Confirm Delete</h2>
103
+ ...
104
+ </dialog>
105
+
106
+ <!-- Loading states -->
107
+ <div aria-busy="true" aria-label="Loading tasks">
108
+ <Spinner />
109
+ </div>
110
+ ```
111
+
112
+ ### Accessible Lists
113
+
114
+ ```html
115
+ <ul role="list" aria-label="Tasks">
116
+ <li>
117
+ <input type="checkbox" id="task-1" aria-label="Complete: Buy groceries" />
118
+ <label htmlFor="task-1">Buy groceries</label>
119
+ </li>
120
+ </ul>
121
+ ```
122
+
123
+ ## Testing Tools
124
+
125
+ ```bash
126
+ # Automated audit
127
+ npx axe-core # Programmatic accessibility testing
128
+ npx pa11y # CLI accessibility checker
129
+
130
+ # In browser
131
+ # Chrome DevTools → Lighthouse → Accessibility
132
+ # Chrome DevTools → Elements → Accessibility tree
133
+
134
+ # Screen reader testing
135
+ # macOS: VoiceOver (Cmd + F5)
136
+ # Windows: NVDA (free) or JAWS
137
+ # Linux: Orca
138
+ ```
139
+
140
+ ## Quick Reference: ARIA Live Regions
141
+
142
+ | Value | Behavior | Use For |
143
+ |-------|----------|---------|
144
+ | `aria-live="polite"` | Announced at next pause | Status updates, saved confirmations |
145
+ | `aria-live="assertive"` | Announced immediately | Errors, time-sensitive alerts |
146
+ | `role="status"` | Same as `polite` | Status messages |
147
+ | `role="alert"` | Same as `assertive` | Error messages |
148
+
149
+ ## Common Anti-Patterns
150
+
151
+ | Anti-Pattern | Problem | Fix |
152
+ |---|---|---|
153
+ | `div` as button | Not focusable, no keyboard support | Use `<button>` |
154
+ | Missing `alt` text | Images invisible to screen readers | Add descriptive `alt` |
155
+ | Color-only states | Invisible to color-blind users | Add icons, text, or patterns |
156
+ | Autoplaying media | Disorienting, can't be stopped | Add controls, don't autoplay |
157
+ | Custom dropdown with no ARIA | Unusable by keyboard/screen reader | Use native `<select>` or proper ARIA listbox |
158
+ | Removing focus outlines | Users can't see where they are | Style outlines, don't remove them |
159
+ | Empty links/buttons | "Link" announced with no description | Add text or `aria-label` |
160
+ | `tabindex > 0` | Breaks natural tab order | Use `tabindex="0"` or `-1` only |
@@ -0,0 +1,67 @@
1
+ # Definition of Done
2
+
3
+ A standing, project-wide bar that every change must clear before it counts as done. Unlike acceptance criteria, which vary per task and answer "did we build the right thing?", the Definition of Done is the same every time and answers "is this finished to our standard?". Use it as the final gate in `planning-and-task-breakdown`, `incremental-implementation`, and the ship review.
4
+
5
+ ## Definition of Done vs. Acceptance Criteria
6
+
7
+ | | Acceptance Criteria | Definition of Done |
8
+ |---|---|---|
9
+ | Scope | Specific to one task or spec | Applies to every increment |
10
+ | Changes | Different for each item | Fixed and reused |
11
+ | Answers | "Did we build *this thing*?" | "Is it *ready*?" |
12
+ | Owner | Defined when planning the task | Defined once for the project |
13
+ | Example | "User can reset password via email link" | "Tests pass, no regressions, docs updated" |
14
+
15
+ The two are complementary. A task is done only when **its** acceptance criteria are met **and** the standing Definition of Done is satisfied. Skipping either leaves work that looks finished but is not.
16
+
17
+ ## The Standing Checklist
18
+
19
+ Apply this to every change before declaring it done.
20
+
21
+ ### Correctness
22
+ - [ ] All acceptance criteria for the task are met
23
+ - [ ] Code runs and behaves as intended, verified at runtime, not just compiled or typechecked
24
+ - [ ] New behavior is covered by tests that fail without the change and pass with it
25
+ - [ ] Existing tests still pass; no regressions introduced
26
+ - [ ] Edge cases and error paths are handled, not just the happy path
27
+
28
+ ### Quality
29
+ - [ ] Code reveals intent through naming and structure; no comments needed to explain *what* it does
30
+ - [ ] No duplicated business logic
31
+ - [ ] No dead code, debug output, or commented-out blocks left behind
32
+ - [ ] Changes are scoped to the task; no unrelated refactors snuck in
33
+ - [ ] Linting and formatting pass
34
+
35
+ The depth behind these items lives in `code-review-and-quality` (the five-axis review) and `code-simplification` (reducing complexity without changing behavior).
36
+
37
+ ### Integration
38
+ - [ ] Change works with the rest of the system, not just in isolation
39
+ - [ ] Database migrations, config changes, and feature flags are accounted for
40
+ - [ ] Backward compatibility considered for any public interface or API change
41
+
42
+ ### Documentation
43
+ - [ ] Public interfaces, APIs, and user-facing behavior are documented
44
+ - [ ] Architectural decisions worth preserving are recorded in the project's durable documentation
45
+ - [ ] Documentation describes the current state in timeless language, not the change history
46
+
47
+ ### Ship-readiness
48
+ - [ ] Security implications reviewed for any untrusted input, auth, or data handling (see `security-and-hardening`)
49
+ - [ ] Observability in place for new critical paths (logs, metrics, traces) (see `observability-and-instrumentation`)
50
+ - [ ] Rollback path exists for anything risky and is named in the ship plan
51
+ - [ ] The human has reviewed and approved before merge or deploy
52
+
53
+ ## How to Apply
54
+
55
+ - **Per task**: confirm the Correctness and Quality sections before checking the task off.
56
+ - **Per feature**: confirm Integration and Documentation before considering the feature complete.
57
+ - **Per release**: the full checklist is the floor; the repository's release runbook adds deploy-specific gates on top.
58
+
59
+ Tailor the list to the project once, then reuse it unchanged. A Definition of Done that is renegotiated every sprint is not a Definition of Done.
60
+
61
+ ## Red Flags
62
+
63
+ - "It's done, I just haven't run it yet": unverified work is not done.
64
+ - "Tests pass" used as a synonym for done while docs, regressions, or runtime verification are skipped.
65
+ - A different bar applied depending on deadline pressure.
66
+ - Acceptance criteria treated as the whole bar, with no standing quality floor.
67
+ - "Done" declared before human review on changes that need it.
@@ -0,0 +1,92 @@
1
+ # Observability Checklist
2
+
3
+ Quick reference for instrumenting production code. Use alongside the `observability-and-instrumentation` skill.
4
+
5
+ ## Table of Contents
6
+
7
+ - [On-Call Questions (Start Here)](#on-call-questions-start-here)
8
+ - [Structured Logging](#structured-logging)
9
+ - [Metrics](#metrics)
10
+ - [Distributed Tracing](#distributed-tracing)
11
+ - [Alerting](#alerting)
12
+ - [Dashboards](#dashboards)
13
+ - [Verify the Telemetry](#verify-the-telemetry)
14
+ - [Pre-Launch Gate](#pre-launch-gate)
15
+
16
+ ## On-Call Questions (Start Here)
17
+
18
+ Telemetry without a question is noise. Before instrumenting anything:
19
+
20
+ - [ ] 2–4 questions an on-call engineer will ask about this feature are written down
21
+ - [ ] Every signal below maps to one of those questions
22
+ - [ ] Each question is matched to the right signal type: metrics say **that** something is wrong, traces say **where**, logs say **why**
23
+
24
+ ## Structured Logging
25
+
26
+ - [ ] Logs are structured (JSON) with stable event names — not free-form strings
27
+ - [ ] Every log line carries a correlation/request ID, generated or accepted at the system boundary
28
+ - [ ] Correlation ID is propagated on every outbound call and async boundary (HTTP headers, queue metadata)
29
+ - [ ] Any log stream written by more than one entry point (scheduler, replay endpoint, manual run) carries an entry-point field, set where the run starts and propagated alongside the correlation ID
30
+ - [ ] Log levels are consistent: `error` = invariant broken, someone may act; `warn` = degraded but handled; `info` = significant business event; `debug` = off in production
31
+ - [ ] No secrets, tokens, passwords, or unredacted PII in any log line (hard rule from `security-and-hardening`)
32
+ - [ ] Fields are allowlisted — no whole request/response bodies, no auth headers
33
+ - [ ] External service calls logged with metadata only: endpoint, status, latency, attempt count, sanitized identifiers
34
+ - [ ] Actual log output spot-checked: structured fields, not `[object Object]`
35
+
36
+ ## Metrics
37
+
38
+ - [ ] **RED** instrumented for every endpoint and every external dependency: Rate, Errors, Duration
39
+ - [ ] **USE** instrumented for every resource (queues, pools, hosts): Utilization, Saturation, Errors
40
+ - [ ] Latency is a histogram; p50/p95/p99 queryable — never an average
41
+ - [ ] All labels come from small, fixed sets (route template, status class, provider name)
42
+ - [ ] No unbounded label values: no user IDs, tenant IDs, emails, raw URLs, request IDs, or error message text
43
+ - [ ] Status codes grouped by class (`5xx`, not `503`)
44
+ - [ ] Queue depth and processing duration tracked for every worker/queue
45
+
46
+ ## Distributed Tracing
47
+
48
+ - [ ] OpenTelemetry (or equivalent) initialized at service startup, before other imports
49
+ - [ ] Auto-instrumentation enabled for HTTP, gRPC, and DB clients
50
+ - [ ] Trace context propagated on every outbound call (W3C `traceparent`/`tracestate`) and extracted from every inbound request
51
+ - [ ] Context survives async boundaries — queue messages carry trace metadata
52
+ - [ ] Manual spans only around meaningful internal units of work, with the attributes on-call will filter by
53
+ - [ ] No secrets or PII as span attributes
54
+ - [ ] Head-based sampling at a low default rate; 100% of errors kept if tail sampling is available
55
+
56
+ ## Alerting
57
+
58
+ - [ ] Every alert is symptom-based (error rate, p99 latency, queue age) — causes (CPU, disk, restarts) go to dashboards, not pagers
59
+ - [ ] Every alert is actionable; "ignore it, it self-heals" alerts are deleted
60
+ - [ ] Every alert links to a runbook — minimum three lines: what it means, first query to run, escalation path
61
+ - [ ] Thresholds and durations justified by an SLO or historical data, not guesses
62
+ - [ ] Two severities only: **page** (user-facing, act now) and **ticket** (degradation, act this week)
63
+ - [ ] Each new alert test-fired once: it reached the right channel and the runbook link works
64
+ - [ ] No alerts that fire daily and get acknowledged without action
65
+
66
+ ## Dashboards
67
+
68
+ - [ ] Service health dashboard exists: error rate, latency p99, traffic, saturation
69
+ - [ ] Dependency health panel shows per-service error rates and latency
70
+ - [ ] Dashboard answers the on-call questions from the top of this checklist — not "everything except the answer"
71
+ - [ ] Default time range is sensible (1h–6h, not 30d)
72
+
73
+ ## Verify the Telemetry
74
+
75
+ Instrumentation is code; it can be wrong:
76
+
77
+ - [ ] Forced an error in staging → found it in the logs by correlation ID
78
+ - [ ] Sent test traffic → metric series appear with expected labels and sane values
79
+ - [ ] Followed one request end-to-end in the tracing UI → no broken spans
80
+ - [ ] An induced failure was diagnosed from telemetry alone, without reading the source
81
+
82
+ ## Pre-Launch Gate
83
+
84
+ Before a feature ships to production, all of the following are true:
85
+
86
+ - [ ] Structured logs flowing to the log aggregator
87
+ - [ ] RED metrics visible in dashboards for every new endpoint and dependency
88
+ - [ ] At least one symptom-based alert configured, with runbook, test-fired
89
+ - [ ] A request can be traced across every service it touches
90
+ - [ ] On-call knows where the runbooks are
91
+
92
+ For launch-day monitoring sequence and rollback triggers, use the repository's ship command and release runbook.