@martinffx/atelier 3.0.1 → 3.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 (31) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +19 -1
  3. package/dist/atelier.js +237 -44
  4. package/package.json +1 -1
  5. package/skills/atelier-orchestrator/SKILL.md +16 -3
  6. package/skills/atelier-setup/SKILL.md +43 -20
  7. package/skills/atelier-setup/references/domain.md +22 -0
  8. package/skills/atelier-setup/references/issue-tracker.md +35 -0
  9. package/skills/code-commit/SKILL.md +4 -3
  10. package/skills/code-pull-request/references/common.md +4 -4
  11. package/skills/code-pull-request/references/create-pr.md +15 -15
  12. package/skills/code-pull-request/references/merge-pr.md +3 -3
  13. package/skills/code-pull-request/references/read-comments.md +2 -2
  14. package/skills/code-review/SKILL.md +27 -8
  15. package/skills/code-review/references/output.md +52 -0
  16. package/skills/code-review/references/reviewers.md +113 -13
  17. package/skills/code-review/references/rq.md +195 -53
  18. package/skills/code-review/references/rs.md +41 -5
  19. package/skills/code-subagents/SKILL.md +4 -2
  20. package/skills/code-subagents/references/batch-reviewer-prompt.md +9 -0
  21. package/skills/code-subagents/references/implementor-prompt.md +7 -0
  22. package/skills/oracle-debug/SKILL.md +17 -10
  23. package/skills/oracle-debug/references/techniques.md +41 -137
  24. package/skills/oracle-domain-modelling/SKILL.md +5 -2
  25. package/skills/oracle-grill-me/SKILL.md +4 -1
  26. package/skills/spec-brainstorm/SKILL.md +34 -9
  27. package/skills/spec-finish/SKILL.md +40 -36
  28. package/skills/spec-implement/SKILL.md +38 -47
  29. package/skills/spec-plan/SKILL.md +64 -32
  30. package/skills/spec-plan/references/plan_template.md +15 -2
  31. package/skills/oracle-debug/references/language-tools.md +0 -139
@@ -4,7 +4,9 @@
4
4
 
5
5
  Interactive interview mode to resolve code review findings. No subagents.
6
6
 
7
- The agent interviews the user one question at a time, multiple choice, until it has enough context to resolve all issues raised by the review.
7
+ The agent interviews the user one question at a time, multiple choice, until each finding has
8
+ a resolution. Fixes change the code. Intentional non-fix resolutions are recorded beside the
9
+ relevant code so later reviews can honor the decision without restating the full finding.
8
10
 
9
11
  ## Prompt
10
12
 
@@ -17,9 +19,40 @@ Ask me questions 1 by 1, multiple choice.
17
19
 
18
20
  1. Load the review findings from the current conversation context
19
21
  2. Begin interviewing the user — one question at a time, always multiple choice
20
- 3. Use answers to build understanding of how to resolve each finding
21
- 4. Once all context is gathered, apply the fixes
22
- 5. **Always ask user before applying fixes**
22
+ 3. Classify each finding as fix, intentional/accepted risk, false positive, or deferred
23
+ 4. Capture the rationale and reconsideration condition for every non-fix resolution
24
+ 5. Present one plan containing the exact fixes and proposed decision comments
25
+ 6. **Always ask the user before applying fixes or adding, changing, or removing comments**
26
+
27
+ ## Resolution Rules
28
+
29
+ | Resolution | Action |
30
+ |------------|--------|
31
+ | Fix | Change the code; do not add a decision comment for a concern the change removes |
32
+ | Intentional / accepted risk | Add or update a decision comment with the reason the behavior is intentional and when to reconsider it |
33
+ | False positive | Add or update a decision comment that states the invariant or context that makes the concern inapplicable |
34
+ | Deferred | Add a decision comment only when the user supplies a concrete reconsideration condition or tracking reference; otherwise leave the finding active |
35
+
36
+ ## Decision Comment Contract
37
+
38
+ Use the language's native comment syntax and this tagged prose format:
39
+
40
+ ```text
41
+ review-decision: <concern> — <rationale>. Reconsider if <condition>.
42
+ ```
43
+
44
+ For example:
45
+
46
+ ```typescript
47
+ // review-decision: retry count is intentionally unbounded — the caller enforces a deadline. Reconsider if this function becomes part of the public API.
48
+ ```
49
+
50
+ - Put the comment at the closest stable code location that owns the relevant behavior or invariant.
51
+ - Explain the code and its constraints, not the review conversation or the reviewer.
52
+ - Keep the concern, rationale, and reconsideration condition specific enough to validate later.
53
+ - Update an existing matching comment instead of adding a duplicate.
54
+ - Remove or revise a comment when its concern is fixed or its assumptions no longer hold.
55
+ - Do not create IDs, a registry entry, or duplicate comments across every affected call site.
23
56
 
24
57
  ## Guidelines
25
58
 
@@ -27,4 +60,7 @@ Ask me questions 1 by 1, multiple choice.
27
60
  - Always provide multiple choice answers (a, b, c, d...)
28
61
  - Start with the most ambiguous findings first
29
62
  - Skip findings that are clearly actionable without input
30
- - After all questions are answered, summarize the plan and confirm before making changes
63
+ - For a non-fix choice, ask for the rationale or reconsideration condition only when the
64
+ conversation and repository do not already provide it
65
+ - After all questions are answered, show exact proposed comments with the fix plan and confirm
66
+ before making changes
@@ -55,8 +55,9 @@ For shared-tree parallel work:
55
55
 
56
56
  1. Assign each task an exclusive file list before dispatch
57
57
  2. Do not let implementers stage or commit changes
58
- 3. Capture a path-scoped `git diff` for each task when it reports completion
59
- 4. Run tasks sequentially if their file ownership overlaps or cannot be isolated
58
+ 3. Capture full `git status`, including untracked files, before and after each task
59
+ 4. Capture the task's path-scoped patch and reject changes outside its assigned paths
60
+ 5. Run tasks sequentially if their file ownership overlaps or cannot be isolated
60
61
 
61
62
  ---
62
63
 
@@ -97,6 +98,7 @@ Give one fresh reviewer:
97
98
  - The complete requirements for work items in the batch
98
99
  - The relevant constraints
99
100
  - The path-scoped patch captured for each task
101
+ - The full changed-file inventory, including untracked files
100
102
  - The implementers' reports and validation results
101
103
 
102
104
  The reviewer checks both requirements compliance and code quality:
@@ -7,6 +7,11 @@ captured task patches, not a commit range.
7
7
 
8
8
  ```
9
9
  You are reviewing one completed implementation batch for requirements compliance and code quality.
10
+ You are read-only: do not modify files, stage changes, or create commits.
11
+
12
+ ## Working Directory
13
+
14
+ {WORKING_DIRECTORY}
10
15
 
11
16
  ## Batch Requirements
12
17
 
@@ -20,6 +25,10 @@ You are reviewing one completed implementation batch for requirements compliance
20
25
 
21
26
  {BATCH_PATCHES}
22
27
 
28
+ ## Complete Changed-File Inventory
29
+
30
+ {CHANGED_FILES}
31
+
23
32
  ## Implementer Reports and Validation
24
33
 
25
34
  {IMPLEMENTER_REPORTS}
@@ -17,6 +17,13 @@ You are implementing {WORK_ITEM_NAME}
17
17
  {Scene-setting: where this fits in the work, what was built before it, constraints, and
18
18
  existing patterns to follow}
19
19
 
20
+ ## File Ownership
21
+
22
+ - **Owned files:** {OWNED_FILES}
23
+ - **Forbidden files:** {FORBIDDEN_FILES}
24
+
25
+ Do not modify files outside the owned list. Report immediately if the work requires one.
26
+
20
27
  ## Before You Begin
21
28
 
22
29
  If you have questions about:
@@ -3,7 +3,7 @@ name: oracle-debug
3
3
  description: >
4
4
  Disciplined debugging methodology. Triggers on bug reports, test failures, "debug this",
5
5
  "diagnose this", unexpected behavior, build failures, integration issues, or performance
6
- regressions. Always find root cause before attempting any fix.
6
+ regressions. Find root cause before a permanent corrective fix; contain urgent harm safely first.
7
7
  user-invocable: true
8
8
  ---
9
9
 
@@ -11,7 +11,8 @@ user-invocable: true
11
11
 
12
12
  Random fixes waste time and create new bugs. Quick patches mask underlying issues.
13
13
 
14
- **Core principle:** find root cause before attempting any fix. Symptom fixes are failure.
14
+ **Core principle:** find root cause before a permanent corrective fix. Temporary containment is
15
+ appropriate when needed to limit security, production, or data-loss impact.
15
16
 
16
17
  **Violating the letter of this process is violating the spirit of debugging.**
17
18
 
@@ -72,11 +73,13 @@ relevant modules before tracing.
72
73
 
73
74
  Iterate on the loop: make it faster, sharper, and more deterministic. A 30-second flaky loop is barely better than no loop.
74
75
 
75
- 3. **Reproduce the bug.** Run the loop. Confirm the failure matches what the user described, is reproducible across runs, and the exact symptom is captured.
76
+ 3. **Reproduce the bug.** Run the loop when safe. Confirm the failure matches what the user
77
+ described and capture the exact symptom. When reproduction is unsafe or impossible, use
78
+ historical artifacts, static evidence, or targeted telemetry instead.
76
79
  4. **Check recent changes.** `git diff`, recent commits, new dependencies, config changes, environment differences.
77
80
  5. **Trace data flow.** In multi-component systems, add diagnostic instrumentation at each boundary:
78
- - Log what data enters each component
79
- - Log what data exits each component
81
+ - Record only the minimum fields needed at each component boundary
82
+ - Redact credentials, authorization data, session identifiers, personal data, and payloads
80
83
  - Verify environment/config propagation
81
84
  - Check state at each layer
82
85
 
@@ -85,7 +88,10 @@ relevant modules before tracing.
85
88
 
86
89
  ### Non-deterministic bugs
87
90
 
88
- The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelize, add stress, narrow timing windows, inject sleeps. A 50% flake is debuggable; 1% is not — keep raising the rate until it is.
91
+ The goal is not a clean repro but a **higher reproduction rate**. Narrow timing windows and vary
92
+ one condition at a time. Treat added delay or load as a perturbation, not proof. Do not replay
93
+ state-changing traffic, stress production, or collect sensitive artifacts without explicit
94
+ authorization and a safe operational plan.
89
95
 
90
96
  ### When you genuinely cannot build a loop
91
97
 
@@ -95,7 +101,8 @@ Stop and say so explicitly. Ask the user for:
95
101
  - A captured artifact (HAR, log dump, core dump, screen recording)
96
102
  - Permission to add temporary production instrumentation
97
103
 
98
- **Do not proceed to Phase 2 without a loop you believe in.**
104
+ **Do not claim root cause without evidence you can explain.** A safe loop is preferred, but
105
+ artifact-based investigation is valid when a loop is unavailable.
99
106
 
100
107
  ---
101
108
 
@@ -123,7 +130,8 @@ Use the scientific method.
123
130
 
124
131
  **Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup becomes a single grep.
125
132
 
126
- 4. **Performance regressions.** Logs are usually wrong. Establish a baseline measurement (timing harness, profiler, query plan), then bisect. Measure first, fix second.
133
+ 4. **Performance regressions.** Establish a baseline measurement using the least intrusive
134
+ evidence available, then bisect. Measure first, fix second.
127
135
 
128
136
  5. **When you don't know, say so.** Don't pretend. Ask for help or research more.
129
137
 
@@ -211,8 +219,7 @@ After each session, summarize:
211
219
 
212
220
  ## References
213
221
 
214
- - **Language-specific tools** → `references/language-tools.md`
215
222
  - **Common bug patterns** → `references/bug-patterns.md`
216
- - **Logging & techniques** → `references/techniques.md`
223
+ - **Techniques and safety practices** → `references/techniques.md`
217
224
 
218
225
  Structure inspired by [obra/superpowers systematic-debugging](https://github.com/obra/superpowers).
@@ -1,157 +1,61 @@
1
1
  # Debugging Techniques
2
2
 
3
- ## Print Debugging
3
+ ## Println Debugging
4
4
 
5
- ### When to Use
6
- - Quick checks in development
7
- - When debugger isn't available
8
- - Understanding flow in unfamiliar code
9
- - Minimal reproducible cases
5
+ Start with temporary, labeled output or the project's structured logger to establish execution
6
+ order and inspect the values relevant to the current hypothesis. Print only the fields needed,
7
+ include a unique session tag, and avoid tight loops. Move to tracing, profiling, or other heavier
8
+ instrumentation only when focused logs cannot establish the evidence.
10
9
 
11
- ### Best Practices
10
+ Do not print credentials, authorization data, session identifiers, personal data, private
11
+ payloads, or environment values. Remove temporary output once the investigation is complete.
12
12
 
13
- **Do:**
14
- - Print at function entry/exit to trace execution
15
- - Print variable values at key decision points
16
- - Use descriptive labels: `console.log('userId:', userId)`
17
- - Print full objects for inspection: `console.log(JSON.stringify(data, null, 2))`
13
+ ## Further Instrumentation
18
14
 
19
- **Don't:**
20
- - Leave print statements in production code
21
- - Print sensitive data (passwords, tokens)
22
- - Over-print (noise obscures signal)
23
- - Print in tight loops (use breakpoints instead)
15
+ Instrument the smallest useful boundary. Record event order, identifiers, state transitions, and
16
+ timing rather than entire payloads. Use a unique session tag for temporary instrumentation and
17
+ remove only the instrumentation introduced for that session.
24
18
 
25
- ### Tagged Debug Logs
19
+ Never record credentials, authorization data, session identifiers, personal data, private
20
+ payloads, or environment values. Treat captures, traces, and dumps as sensitive artifacts.
26
21
 
27
- When instrumenting during a debugging session, tag every temporary log with a
28
- unique prefix so cleanup is trivial:
22
+ ## Bisection
29
23
 
30
- ```javascript
31
- console.log('[DEBUG-a4f2] userId:', userId);
32
- console.log('[DEBUG-a4f2] payload:', payload);
33
- ```
24
+ Narrow the failing path by disabling coherent branches, reducing inputs, or comparing a known-good
25
+ revision with a known-bad revision. Keep the system valid while narrowing; arbitrary code removal
26
+ can change the behavior being investigated.
34
27
 
35
- Cleanup: `grep -r '\[DEBUG-' .` → delete all matches.
28
+ Before revision bisection, preserve unrelated work and record the starting revision. Reset to the
29
+ starting state after the investigation.
36
30
 
37
- Untagged logs survive; tagged logs die.
31
+ ## Non-Deterministic Failures
38
32
 
39
- ---
33
+ Record the conditions of every attempt: input, environment, timing, concurrency, seed, and result.
34
+ Vary one condition at a time. Use delays and load only to perturb scheduling, never as proof of the
35
+ cause. Prefer deterministic scheduling, fault injection, or recorded traces when available.
40
36
 
41
- ## Structured Logging
37
+ ## Performance Investigation
42
38
 
43
- Better than `console.log` for production:
39
+ Establish a representative baseline before changing code. Use measurements, profiling, tracing, or
40
+ query plans that fit the suspected bottleneck. Avoid high-volume logging on the hot path because it
41
+ can alter timing.
44
42
 
45
- ```javascript
46
- const logger = {
47
- debug: (msg, meta) => console.debug(JSON.stringify({ level: 'debug', msg, ...meta })),
48
- info: (msg, meta) => console.info(JSON.stringify({ level: 'info', msg, ...meta })),
49
- warn: (msg, meta) => console.warn(JSON.stringify({ level: 'warn', msg, ...meta })),
50
- error: (msg, meta) => console.error(JSON.stringify({ level: 'error', msg, ...meta })),
51
- };
52
- ```
43
+ Some analysis tools execute the operation they inspect. Confirm whether a command is read-only and
44
+ whether it can create load, acquire locks, or repeat side effects before using it outside an
45
+ isolated environment.
53
46
 
54
- ### Console Methods
47
+ ## Production Safety
55
48
 
56
- | Method | Use |
57
- |--------|-----|
58
- | console.log | General output |
59
- | console.debug | Debug info |
60
- | console.info | Informational |
61
- | console.warn | Warnings |
62
- | console.error | Errors |
63
- | console.table | Arrays/objects in table format |
64
- | console.trace | Stack trace |
65
- | console.time/timeEnd | Timing |
49
+ Default to development, staging, or an isolated replica. Before production instrumentation,
50
+ replay, or load generation, obtain explicit authorization and define scope, rate limits, rollback,
51
+ and a stop condition. Replay only idempotent or dry-run operations unless the user explicitly
52
+ accepts the side effects.
66
53
 
67
- ---
54
+ ## Cleanup
68
55
 
69
- ## Binary Search Debugging
56
+ Before closing the investigation:
70
57
 
71
- ### Code Binary Search
72
-
73
- Comment out half the code to find where the bug is.
74
-
75
- ### Git Bisect
76
-
77
- For regression bugs:
78
-
79
- ```bash
80
- git bisect start
81
- git bisect bad
82
- git bisect good v1.2.3
83
- # Run your test, mark good/bad
84
- git bisect reset
85
- ```
86
-
87
- ---
88
-
89
- ## Rubber Ducking
90
-
91
- ### The Process
92
-
93
- 1. Describe the problem in detail
94
- 2. Explain expected behavior
95
- 3. Explain actual behavior
96
- 4. Walk through the code line by line
97
-
98
- ---
99
-
100
- ## Logging Strategies
101
-
102
- ### What to Log
103
-
104
- | Log This | Don't Log This |
105
- |----------|----------------|
106
- | Request/response with IDs | Full request bodies |
107
- | Key decisions in code | Every loop iteration |
108
- | Error details with context | Stack traces |
109
- | Performance timing | Large data dumps |
110
- | User actions | Sensitive data (PII, passwords) |
111
-
112
- ### Context to Include
113
-
114
- ```javascript
115
- logger.error('Request failed', {
116
- endpoint: '/api/users',
117
- method: 'POST',
118
- statusCode: 500,
119
- userId: user?.id,
120
- requestId: req.headers['x-request-id'],
121
- duration: Date.now() - startTime,
122
- errorMessage: error.message
123
- });
124
- ```
125
-
126
- ### Log Levels
127
-
128
- | Level | When |
129
- |-------|------|
130
- | DEBUG | Detailed debugging info |
131
- | INFO | Normal operation events |
132
- | WARN | Something unexpected, but handled |
133
- | ERROR | Operation failed |
134
-
135
- ---
136
-
137
- ## Performance Regression Techniques
138
-
139
- ### The Perf Branch
140
-
141
- For performance regressions, logs are usually wrong. Instead:
142
-
143
- 1. **Establish a baseline measurement** using one of:
144
- - Timing harness around the suspect code path
145
- - `performance.now()` in browser / `process.hrtime()` in Node
146
- - CPU profiler (Chrome DevTools, `node --prof`, py-spy, etc.)
147
- - Database query planner (`EXPLAIN ANALYZE`)
148
-
149
- 2. **Bisect** — narrow down which commit / change introduced the regression.
150
-
151
- 3. **Measure first, fix second.** Do not optimise without data.
152
-
153
- ### Hot Path Identification
154
-
155
- - Profile before guessing
156
- - Look for O(n²) algorithms, unnecessary renders, blocking operations
157
- - Check for N+1 queries, unbounded caches, recursive without memoisation
58
+ - Remove temporary instrumentation and throwaway harnesses.
59
+ - Preserve only sanitized evidence needed to explain the conclusion.
60
+ - Re-run the original verification signal.
61
+ - Record the confirmed cause, fix, and prevention measure.
@@ -41,13 +41,16 @@ If a `CONTEXT-MAP.md` exists at the root, the repo has multiple contexts. The ma
41
41
  │ └── docs/adr/
42
42
  ```
43
43
 
44
- Create files lazily — only when you have something to write. If no `CONTEXT.md` exists, create one when the first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
44
+ Read `docs/agents/domain.md` when it exists to locate the configured domain documents. Create files
45
+ lazily — only when you have something to write. If no `CONTEXT.md` exists, create one when the
46
+ first term is resolved. If no `docs/adr/` exists, create it when the first ADR is needed.
45
47
 
46
48
  ## During the session
47
49
 
48
50
  ### Challenge against the glossary
49
51
 
50
- When the user uses a term that conflicts with the existing language in `CONTEXT.md`, call it out immediately:
52
+ When the user uses a term that conflicts with the existing language in the relevant `CONTEXT.md`,
53
+ call it out immediately. Resolve `CONTEXT-MAP.md` first when present:
51
54
 
52
55
  > "Your glossary defines 'cancellation' as X, but you seem to mean Y — which is it?"
53
56
 
@@ -15,6 +15,9 @@ Ask the questions one at a time, waiting for feedback on each question before co
15
15
 
16
16
  If a *fact* can be found by exploring the environment (filesystem, tools, etc.), look it up rather than asking me. The *decisions*, though, are mine — put each one to me and wait for my answer.
17
17
 
18
- Do not act on it until I confirm we have reached a shared understanding.
18
+ Do not implement the proposed plan or decision until I confirm we have reached a shared
19
+ understanding. Update domain documentation as terminology and decisions are resolved; when this
20
+ session is nested in spec-brainstorm, return changed assumptions to that workflow for any required
21
+ design update.
19
22
 
20
23
  Run this session using the `oracle-domain-modelling` skill.
@@ -53,7 +53,8 @@ explain a unit's job in one sentence, it's doing too much.
53
53
 
54
54
  Explore the current structure first. Follow existing patterns. Targeted improvements only.
55
55
  No unrelated refactoring. Understand why things are the way they are before proposing
56
- changes.
56
+ changes. Treat loaded skills as relevant guidance, not as a requirement to apply every pattern
57
+ they contain.
57
58
 
58
59
  ### Decomposition
59
60
 
@@ -62,12 +63,18 @@ into sub-projects before diving into details. Each substantial sub-project gets
62
63
  and plan; bounded sub-projects can use Inline Plans. A spec that tries to cover three
63
64
  subsystems helps no one.
64
65
 
66
+ Keep migrations separate from authorization, product behavior, infrastructure, schema, and
67
+ test-platform projects. Do not use a migration as permission to redesign adjacent systems.
68
+
65
69
  ### YAGNI ruthlessly
66
70
 
67
71
  Remove unnecessary features from all designs. If a capability isn't needed for the first
68
72
  user story, it doesn't go in the spec. Every feature is a cost — to build, to test,
69
73
  to maintain, to understand later. Push back on scope creep during discovery.
70
74
 
75
+ Future consumers do not justify shared infrastructure. A "reusable foundation" may describe
76
+ an architectural quality, but it is not a user story or a current requirement.
77
+
71
78
  ---
72
79
 
73
80
  ## Step 1: Orient
@@ -154,7 +161,18 @@ Read the relevant codebase deeply. Not signatures — implementations, edge case
154
161
  handling, data flows. Trace callers and callees. Read tests to understand expected
155
162
  behaviour.
156
163
 
157
- Write findings directly into the spec as the foundation.
164
+ Collect research findings for the spec as the foundation. Do not write `design.md` until the
165
+ approved design sections are assembled in Step 4c.
166
+
167
+ The research section must map each relevant concern to the code that already handles it and
168
+ the current requirement that drives the decision:
169
+
170
+ | Concern | Existing solution | Decision | Current requirement |
171
+ |---------|-------------------|----------|---------------------|
172
+ | IDs | Shared parser and ID type | reuse | Parse route parameters |
173
+
174
+ Use only `reuse`, `modify`, `delete`, or `new` in the Decision column. Every `new` concept must
175
+ map to a present requirement; a future or hypothetical consumer does not qualify.
158
176
 
159
177
  **Tell the human:** "I've written the research section of the spec. Ready for you to
160
178
  review before I continue with the design."
@@ -172,6 +190,9 @@ then write the spec file.
172
190
 
173
191
  Before settling on a design, present **2-3 approaches** with trade-offs.
174
192
 
193
+ The first approach must keep the existing architecture and make the smallest correct change.
194
+ Present broader approaches only when a current requirement makes their extra cost relevant.
195
+
175
196
  For each approach, address:
176
197
 
177
198
  1. **What it looks like** — Brief architecture sketch
@@ -181,6 +202,9 @@ For each approach, address:
181
202
 
182
203
  Lead with your recommended option and explain why it wins.
183
204
 
205
+ Before asking the human to approve an approach or design batch, remove anything justified only
206
+ by completeness, consistency, or hypothetical reuse.
207
+
184
208
  **Example:**
185
209
 
186
210
  > **Approach A: Single table with JSON columns**
@@ -323,6 +347,8 @@ After writing the file, check it with fresh eyes:
323
347
  decomposed in Step 2. If it's still too broad, flag it now.
324
348
  4. **Ambiguity check** — Could any requirement be interpreted two ways? If so,
325
349
  pick one interpretation, state it explicitly, and let the human correct you.
350
+ 5. **Necessity check** — Delete concepts justified only by completeness, consistency, or
351
+ hypothetical reuse. Confirm every remaining new concept maps to a current requirement.
326
352
 
327
353
  **Substance rule:** if a fix changes the substance of an approved section,
328
354
  re-present that section for approval. Wording and consistency fixes go inline —
@@ -334,14 +360,13 @@ note them at handoff.
334
360
 
335
361
  **Tell the human:**
336
362
 
337
- > "Spec written to `docs/specs/<path>`. Every section was approved during our
338
- > conversation - review it if you'd like, or we can go straight to the
339
- > Spec-backed Plan. Ready for spec-plan?"
363
+ > "Spec written to `docs/specs/<path>`. Please confirm this assembled document before we move to
364
+ > the Spec-backed Plan."
340
365
 
341
- If the human requests changes — in conversation or by annotating the file —
342
- address every note, update the spec, and re-run the self-review. If a change
343
- alters the substance of an approved section, re-present that section for
344
- approval before continuing.
366
+ If the human requests changes — in conversation or by annotating the file — address every note,
367
+ update the spec, and re-run the self-review. If a change alters the substance of an approved
368
+ section, re-present that section for approval before continuing. Resolve questions that affect
369
+ scope, architecture, contracts, data, security, or task ordering before handoff.
345
370
 
346
371
  The next step is **spec-plan** in Spec-backed mode. Do not start planning without the
347
372
  human's go-ahead. Do not write code.
@@ -10,20 +10,42 @@ user-invocable: true
10
10
 
11
11
  # Spec Finish
12
12
 
13
- Post-implementation workflow: validate → review → stack commits → prepare PR.
13
+ Post-implementation workflow: simplify → synchronize docs → validate → review → prepare PR.
14
14
 
15
15
  ## Prerequisites
16
16
 
17
17
  Before starting, verify:
18
18
  1. All Spec-backed Plan tasks are complete
19
- 2. Working directory is clean (committed or staged)
19
+ 2. Working directory has no unresolved staged or unstaged changes
20
20
  3. Tests pass
21
21
 
22
22
  If not complete, go back to `spec-implement`.
23
23
 
24
24
  ---
25
25
 
26
- ## Step 1: Validate
26
+ ## Step 1: Compare Scope and Simplify
27
+
28
+ Compare the implementation with the original behavior and user goal before documentation or
29
+ validation. Remove unrequested scope, duplicate concepts, one-consumer abstractions, and custom
30
+ machinery that replaces sufficient platform behavior.
31
+
32
+ If the implementation faithfully follows an unnecessarily large design, stop and return to
33
+ `spec-plan`. Get approval for the smaller plan before continuing.
34
+
35
+ Update the finished SDD to describe the smaller result. Replace rejected architecture in the
36
+ normative design and plan instead of preserving it as precedent; mention it only as a rejected
37
+ alternative when that history remains useful.
38
+
39
+ ---
40
+
41
+ ## Step 2: Update Documentation
42
+
43
+ Check whether README, API documentation, or changelog updates are needed. Make and commit any
44
+ necessary documentation changes through **code-commit** before final validation.
45
+
46
+ ---
47
+
48
+ ## Step 3: Validate
27
49
 
28
50
  Run validation checks.
29
51
 
@@ -67,12 +89,13 @@ go build ./...
67
89
 
68
90
  ---
69
91
 
70
- ## Step 2: Review
92
+ ## Step 4: Review
71
93
 
72
- Use the Skill tool to invoke code-review skill for comprehensive code review.
94
+ Invoke the installed **code-review** skill through the harness's skill mechanism for one
95
+ comprehensive review of the final change.
73
96
 
74
97
  ### What to Review
75
- - All changed files since feature branch
98
+ - All changed files since the intended base branch's merge base
76
99
  - Test coverage
77
100
  - Documentation updates
78
101
  - No debug code left
@@ -83,41 +106,21 @@ Use the Skill tool to invoke code-review skill for comprehensive code review.
83
106
 
84
107
  ---
85
108
 
86
- ## Step 3: Stack Commits
87
-
88
- ### Workflow
89
- 1. Review current commits: `git log --oneline`
90
- 2. Ensure commits are organized logically
91
- 3. Rebase if needed: `git rebase -i <base-branch>`
92
- 4. Ensure each commit is clean and functional
93
-
94
- ### Commit Guidelines
95
- - Each commit should pass tests
96
- - Use conventional commit format
97
- - Meaningful commit messages
98
-
99
- ---
100
-
101
- ## Step 4: Update Documentation
102
-
103
- ### Check for Updates
104
- - README changes needed?
105
- - API documentation updated?
106
- - Changelog updated?
109
+ ## Step 5: Prepare Commits
107
110
 
108
- ### If documentation needed
109
- - Update relevant docs
110
- - Commit with docs
111
+ Review current commits with `git log --oneline`. Use **code-commit** for any uncommitted work.
112
+ Do not rewrite history by default. If a rebase would materially improve an unpublished stack,
113
+ show the affected range and ask for separate approval before rebasing.
111
114
 
112
115
  ---
113
116
 
114
- ## Step 5: Open the PR
117
+ ## Step 6: Prepare the PR
115
118
 
116
- Steps 1-4 (validate, review, stack commits, update docs) must all be complete
119
+ Steps 1-5 (simplification, documentation, validation, review, commits) must all be complete
117
120
  before proceeding. **If code-review found blocking or scope-changing issues, stop and return
118
- to spec-implement to fix them. Do not proceed to Step 5b.**
121
+ to spec-implement to fix them. Do not proceed to Step 6b.**
119
122
 
120
- ### Step 5a: Present Completion Summary
123
+ ### Step 6a: Present Completion Summary
121
124
 
122
125
  Before creating the PR, present a summary to the human:
123
126
 
@@ -133,7 +136,7 @@ Before creating the PR, present a summary to the human:
133
136
  **Ready for PR:** [yes/no]
134
137
  ```
135
138
 
136
- ### Step 5b: Invoke code-pull-request
139
+ ### Step 6b: Invoke code-pull-request
137
140
 
138
141
  Only when the summary shows **Ready for PR: yes**, invoke the
139
142
  [code-pull-request](../code-pull-request/SKILL.md) skill to create the PR. It
@@ -142,7 +145,7 @@ template, generates the body from commits, and opens the PR via `gh` or `glab`.
142
145
 
143
146
  ### Handoff
144
147
 
145
- > "Implementation complete. [N] commits stacked. Opening PR now."
148
+ > "Implementation complete. [N] commits are ready. PR package ready for approval."
146
149
 
147
150
  ---
148
151
 
@@ -160,3 +163,4 @@ This skill orchestrates other skills:
160
163
  - If implementation is still in progress, use spec-implement
161
164
  - If tests are failing, go back to spec-implement
162
165
  - If review found blocking or scope-changing issues, go back to spec-implement
166
+ - If the implementation follows an unnecessarily large design, go back to spec-plan