@kl-c/matrixos 0.3.40 → 0.3.41

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 (49) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/cli/skills/api-and-interface-design/SKILL.md +298 -0
  3. package/dist/cli/skills/browser-testing-with-devtools/SKILL.md +321 -0
  4. package/dist/cli/skills/ci-cd-and-automation/SKILL.md +394 -0
  5. package/dist/cli/skills/context-engineering/SKILL.md +293 -0
  6. package/dist/cli/skills/deprecation-and-migration/SKILL.md +251 -0
  7. package/dist/cli/skills/documentation-and-adrs/SKILL.md +292 -0
  8. package/dist/cli/skills/doubt-driven-development/SKILL.md +247 -0
  9. package/dist/cli/skills/incremental-implementation/SKILL.md +253 -0
  10. package/dist/cli/skills/interview-me/SKILL.md +229 -0
  11. package/dist/cli/skills/observability-and-instrumentation/SKILL.md +207 -0
  12. package/dist/cli/skills/performance-optimization/SKILL.md +354 -0
  13. package/dist/cli/skills/security-and-hardening/SKILL.md +471 -0
  14. package/dist/cli/skills/shipping-and-launch/SKILL.md +314 -0
  15. package/dist/cli/skills/source-driven-development/SKILL.md +198 -0
  16. package/dist/cli/skills/test-driven-development/SKILL.md +402 -0
  17. package/dist/cli-node/index.js +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/skills/api-and-interface-design/SKILL.md +298 -0
  20. package/dist/skills/browser-testing-with-devtools/SKILL.md +321 -0
  21. package/dist/skills/ci-cd-and-automation/SKILL.md +394 -0
  22. package/dist/skills/context-engineering/SKILL.md +293 -0
  23. package/dist/skills/deprecation-and-migration/SKILL.md +251 -0
  24. package/dist/skills/documentation-and-adrs/SKILL.md +292 -0
  25. package/dist/skills/doubt-driven-development/SKILL.md +247 -0
  26. package/dist/skills/incremental-implementation/SKILL.md +253 -0
  27. package/dist/skills/interview-me/SKILL.md +229 -0
  28. package/dist/skills/observability-and-instrumentation/SKILL.md +207 -0
  29. package/dist/skills/performance-optimization/SKILL.md +354 -0
  30. package/dist/skills/security-and-hardening/SKILL.md +471 -0
  31. package/dist/skills/shipping-and-launch/SKILL.md +314 -0
  32. package/dist/skills/source-driven-development/SKILL.md +198 -0
  33. package/dist/skills/test-driven-development/SKILL.md +402 -0
  34. package/package.json +1 -1
  35. package/packages/shared-skills/skills/api-and-interface-design/SKILL.md +298 -0
  36. package/packages/shared-skills/skills/browser-testing-with-devtools/SKILL.md +321 -0
  37. package/packages/shared-skills/skills/ci-cd-and-automation/SKILL.md +394 -0
  38. package/packages/shared-skills/skills/context-engineering/SKILL.md +293 -0
  39. package/packages/shared-skills/skills/deprecation-and-migration/SKILL.md +251 -0
  40. package/packages/shared-skills/skills/documentation-and-adrs/SKILL.md +292 -0
  41. package/packages/shared-skills/skills/doubt-driven-development/SKILL.md +247 -0
  42. package/packages/shared-skills/skills/incremental-implementation/SKILL.md +253 -0
  43. package/packages/shared-skills/skills/interview-me/SKILL.md +229 -0
  44. package/packages/shared-skills/skills/observability-and-instrumentation/SKILL.md +207 -0
  45. package/packages/shared-skills/skills/performance-optimization/SKILL.md +354 -0
  46. package/packages/shared-skills/skills/security-and-hardening/SKILL.md +471 -0
  47. package/packages/shared-skills/skills/shipping-and-launch/SKILL.md +314 -0
  48. package/packages/shared-skills/skills/source-driven-development/SKILL.md +198 -0
  49. package/packages/shared-skills/skills/test-driven-development/SKILL.md +402 -0
@@ -0,0 +1,247 @@
1
+ ---
2
+ name: doubt-driven-development
3
+ description: Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production, security-sensitive logic, irreversible operations), or any time a confident output would be cheaper to verify now than to debug later.
4
+ source: addyosmani/agent-skills (MIT)
5
+ ---
6
+
7
+ # Doubt-Driven Development
8
+
9
+ ## Overview
10
+
11
+ A confident answer is not a correct one. Long sessions accumulate context that quietly turns assumptions into "facts" without anyone noticing. Doubt-driven development is the discipline of materializing a fresh-context reviewer — biased to **disprove**, not approve — before any non-trivial output stands.
12
+
13
+ This is not `/review`. `/review` is a verdict on a finished artifact. This is an in-flight posture: non-trivial decisions get cross-examined while course-correction is still cheap.
14
+
15
+ ## When to Use
16
+
17
+ A decision is **non-trivial** when at least one of these is true:
18
+
19
+ - It introduces or modifies branching logic
20
+ - It crosses a module or service boundary
21
+ - It asserts a property the type system or compiler cannot verify (thread safety, idempotence, ordering, invariants)
22
+ - Its correctness depends on context the future reader cannot see
23
+ - Its blast radius is irreversible (production deploy, data migration, public API change)
24
+
25
+ Apply the skill when:
26
+
27
+ - About to make an architectural decision under uncertainty
28
+ - About to commit non-trivial code
29
+ - About to claim a non-obvious fact ("this is safe", "this scales", "this matches the spec")
30
+ - Working in code you don't fully understand
31
+
32
+ **When NOT to use:**
33
+
34
+ - Mechanical operations (renaming, formatting, file moves)
35
+ - Following a clear, unambiguous user instruction
36
+ - Reading or summarizing existing code
37
+ - One-line changes with obvious correctness
38
+ - Pure tooling operations (running tests, listing files)
39
+ - The user has explicitly asked for speed over verification
40
+
41
+ If you doubt every keystroke, you ship nothing. The skill applies only to non-trivial decisions as defined above.
42
+
43
+ ## Loading Constraints
44
+
45
+ This skill is designed for the **main-session orchestrator**, where Step 3 (DOUBT, detailed below) can spawn a fresh-context reviewer.
46
+
47
+ - **Do NOT add this skill to a persona's `skills:` frontmatter.** A persona that follows Step 3 would spawn another persona — the orchestration anti-pattern explicitly forbidden by `references/orchestration-patterns.md` ("personas do not invoke other personas").
48
+ - **If you find yourself applying this skill from inside a subagent context** (where Claude Code prevents nested subagent spawn): the preferred path is to surface to the user that doubt-driven cannot run nested and let the main session handle it. As a last resort only, a degraded self-questioning fallback exists — rewrite ARTIFACT + CONTRACT as a fresh self-prompt with a hard mental separator from your prior reasoning, and walk Steps 1–5. This is **not fresh-context review** (you carry your own context with you), so flag the result as degraded and prefer escalation whenever the user is reachable.
49
+
50
+ ## The Process
51
+
52
+ Copy this checklist when applying the skill:
53
+
54
+ ```
55
+ Doubt cycle:
56
+ - [ ] Step 1: CLAIM — wrote the claim + why-it-matters
57
+ - [ ] Step 2: EXTRACT — isolated artifact + contract, stripped reasoning
58
+ - [ ] Step 3: DOUBT — invoked fresh-context reviewer with adversarial prompt
59
+ - [ ] Step 4: RECONCILE — classified every finding against the artifact text
60
+ - [ ] Step 5: STOP — met stop condition (trivial findings, 3 cycles, or user override)
61
+ ```
62
+
63
+ ### Step 1: CLAIM — Surface what stands
64
+
65
+ Name the decision in two or three lines:
66
+
67
+ ```
68
+ CLAIM: "The new caching layer is thread-safe under the
69
+ read-heavy workload described in the spec."
70
+ WHY THIS MATTERS: a race here corrupts user data and is
71
+ hard to detect in QA.
72
+ ```
73
+
74
+ If you can't write the claim that compactly, you have a vibe, not a decision. Surface it before scrutinizing it.
75
+
76
+ ### Step 2: EXTRACT — Smallest reviewable unit
77
+
78
+ A fresh-context reviewer needs the **artifact** and the **contract**, not the journey.
79
+
80
+ - Code: the diff or the function — not the whole file
81
+ - Decision: the proposal in 3–5 sentences plus the constraints it has to satisfy
82
+ - Assertion: the claim plus the evidence that supposedly supports it (kept distinct from the Step 1 CLAIM block, which is the orchestrator's hypothesis under scrutiny)
83
+
84
+ Strip your reasoning. If you hand over conclusions, you'll get back validation of your conclusions. The unit must be small enough that a reviewer can hold it in mind in one read — if it's a 500-line PR, decompose first.
85
+
86
+ ### Step 3: DOUBT — Invoke the fresh-context reviewer
87
+
88
+ The reviewer's prompt **must be adversarial**. Framing decides the answer.
89
+
90
+ ```
91
+ Adversarial review. Find what is wrong with this artifact.
92
+ Assume the author is overconfident. Look for:
93
+ - Unstated assumptions
94
+ - Edge cases not handled
95
+ - Hidden coupling or shared state
96
+ - Ways the contract could be violated
97
+ - Existing conventions this might break
98
+ - Failure modes under unexpected input
99
+
100
+ Do NOT validate. Do NOT summarize. Find issues, or state
101
+ explicitly that you cannot find any after thorough examination.
102
+
103
+ ARTIFACT: <paste artifact>
104
+ CONTRACT: <paste contract>
105
+ ```
106
+
107
+ **Pass ARTIFACT + CONTRACT only. Do NOT pass the CLAIM.** Handing the reviewer your conclusion biases it toward agreement. The reviewer must independently determine whether the artifact satisfies the contract.
108
+
109
+ In Claude Code, the role-based reviewers in `agents/` start with isolated context by design and are usable here — see `agents/` for the roster and per-domain match.
110
+
111
+ **The adversarial prompt above takes precedence over the persona's default response shape.** Personas like `code-reviewer` are written to produce balanced verdicts with both strengths and weaknesses; doubt-driven needs issues-only output. Paste the adversarial prompt verbatim into the invocation so it overrides the persona's default. If a persona's response shape can't be overridden cleanly, fall back to a generic subagent with the adversarial prompt.
112
+
113
+ #### Cross-model escalation
114
+
115
+ A single-model reviewer shares blind spots with the original author — a colder, different-architecture model catches them. Doubt-driven is already opt-in for non-trivial decisions, so within that scope offering cross-model is part of the skill's value, not optional friction.
116
+
117
+ **Interactive sessions: always offer. Never silently skip.**
118
+
119
+ **Step 1: Ask the user**
120
+
121
+ After the single-model review in Step 3 above, but before RECONCILE, pause and ask:
122
+
123
+ > *"Single-model review complete. Want a cross-model second opinion? Options: Gemini CLI, Codex CLI, manual external review (you paste it elsewhere), or skip."*
124
+
125
+ This question is mandatory in every interactive doubt cycle — even on artifacts that feel low-stakes. The user — not the agent — decides whether the cost is worth it. The agent's job is to surface the choice.
126
+
127
+ **Step 2: If the user picks a CLI — verify, then invoke**
128
+
129
+ 1. Check the tool is in PATH (`which gemini`, `which codex`).
130
+ 2. Test it works (`gemini --version` or equivalent) before passing the full prompt — a stale or broken binary may pass `which` but fail on real input.
131
+ 3. Confirm the exact invocation with the user, including required flags, auth, and env vars (e.g., API keys). Implementations vary; never assume.
132
+ 4. Pass ARTIFACT + CONTRACT + the adversarial prompt **only**. No session context, no CLAIM.
133
+ 5. Mind shell escaping. If the artifact contains quotes, `$(...)`, or backticks, prefer stdin (`echo … | gemini`) or a heredoc over inline `-p "…"`. When in doubt, ask the user to confirm the invocation before running it.
134
+ 6. Take the output into Step 4 (RECONCILE).
135
+
136
+ **Never interpolate the artifact into a shell-quoted argument.** Code, markdown, and review prompts routinely contain backticks, `$(...)`, and quote characters that will either truncate the prompt or execute embedded shell. Write the full prompt to a file and pipe it through stdin.
137
+
138
+ Example shapes (verify flags against your installed tool — syntax differs across implementations and versions):
139
+
140
+ ```bash
141
+ # Write the adversarial prompt + ARTIFACT + CONTRACT to a temp file first.
142
+ # Then pipe via stdin so shell metacharacters in the artifact stay inert.
143
+
144
+ # Codex (read-only sandbox keeps the CLI from writing to your workspace):
145
+ codex exec --sandbox read-only -C <repo-path> - < /tmp/doubt-prompt.md
146
+
147
+ # Gemini ('--approval-mode plan' is read-only; '-p ""' triggers non-interactive
148
+ # mode and the prompt is read from stdin):
149
+ gemini --approval-mode plan -p "" < /tmp/doubt-prompt.md
150
+ ```
151
+
152
+ A read-only sandbox is the load-bearing detail: a doubt artifact may itself contain instructions (intentional or accidental prompt injection) that the cross-model CLI would otherwise execute against your workspace.
153
+
154
+ **Step 3: If the CLI is unavailable or fails**
155
+
156
+ Surface the failure explicitly. Offer: run it manually, try a different tool, or skip. Do not silently fall back to single-model — the user should know cross-model didn't happen.
157
+
158
+ **Step 4: If the user skips**
159
+
160
+ Acknowledge the skip in the output (*"Proceeding with single-model findings only"*) and continue to RECONCILE. Skipping is fine; silent skipping is not.
161
+
162
+ **Non-interactive contexts** (CI, `/loop`, autonomous-loop, scheduled runs):
163
+
164
+ - Cross-model is **skipped**, and the skip must be **announced** in the output: *"Cross-model skipped: non-interactive context."*
165
+ - **Never invoke an external CLI without explicit user authorization** — this is a load-bearing safety property.
166
+
167
+ Cross-model adds cost, latency, and tool fragility. The agent surfaces the choice every cycle; the user decides whether this artifact warrants it.
168
+
169
+ ### Step 4: RECONCILE — Fold findings back
170
+
171
+ The reviewer's output is data, not verdict. **You are still the orchestrator.** Re-read the artifact text against each finding before classifying — rubber-stamping the reviewer is the same failure mode as ignoring it.
172
+
173
+ For each finding, classify in this **precedence order** (first matching class wins):
174
+
175
+ 1. **Contract misread** — reviewer flagged something specifically because the CONTRACT you provided was unclear or incomplete. Fix the contract first, re-classify on the next cycle.
176
+ 2. **Valid + actionable** — real issue requiring a change to the artifact. Change it, re-loop.
177
+ 3. **Valid trade-off** — issue is real but cost of fixing exceeds cost of accepting. Document the trade-off explicitly so the user sees it.
178
+ 4. **Noise** — reviewer flagged something that's actually correct under context the reviewer didn't have. Note it, move on, and ask: would adding that context to the contract have prevented the false flag?
179
+
180
+ A fresh reviewer can be wrong because it lacks context. Don't defer just because it's "fresh."
181
+
182
+ ### Step 5: STOP — Bounded loop, not recursion
183
+
184
+ Stop when:
185
+
186
+ - Next iteration returns only trivial or already-considered findings, **or**
187
+ - 3 cycles completed (escalate to user, don't grind a fourth alone), **or**
188
+ - User explicitly says "ship it"
189
+
190
+ If after 3 cycles the reviewer still surfaces substantive issues, the artifact may not be ready. Surface this to the user — three unresolved cycles is information about the artifact, not a reason to keep looping.
191
+
192
+ If 3 cycles is "obviously insufficient" because the artifact is large: the artifact is too big — return to Step 2 and decompose. Do not lift the bound.
193
+
194
+ ## Common Rationalizations
195
+
196
+ | Rationalization | Reality |
197
+ |---|---|
198
+ | "I'm confident, skip the doubt step" | Confidence correlates poorly with correctness on novel problems. Moments of certainty are exactly when blind spots hide. |
199
+ | "Spawning a reviewer is expensive" | Debugging a wrong commit in production is more expensive. The check is bounded; the bug isn't. |
200
+ | "The reviewer will just nitpick" | Only if unscoped. Constrain the prompt to "issues that would make this fail under the contract." |
201
+ | "I'll do doubt at the end with `/review`" | `/review` is a final gate. Doubt-driven catches wrong directions early when course-correction is cheap. By PR time it's too late. |
202
+ | "If I doubt every step I'll never ship" | The skill applies to non-trivial decisions, not every keystroke. Re-read "When NOT to Use." |
203
+ | "Two opinions are always better than one" | Not when the second has less context and produces noise. Reconcile, don't defer. |
204
+ | "The reviewer disagreed so I was wrong" | The reviewer lacks your context — disagreement is information, not verdict. Re-read the artifact, classify, then decide. |
205
+ | "Cross-model is always better" | Cross-model catches blind spots a single model shares with itself, but it adds cost and tool fragility. Offer it every interactive doubt cycle — the user decides whether the artifact warrants it. The agent's job is to surface the choice, not to gate it. |
206
+ | "User said yes once, so I can keep invoking the CLI" | Each invocation is its own authorization. The artifact, the prompt, and the flags change between calls — re-confirm the exact command with the user before every run. |
207
+
208
+ ## Red Flags
209
+
210
+ - Spawning a fresh-context reviewer for a one-line rename or formatting change
211
+ - Treating reviewer output as authoritative without re-reading the artifact text
212
+ - Looping >3 cycles without escalating to the user
213
+ - Prompting the reviewer with "is this good?" instead of "find issues"
214
+ - Skipping doubt under time pressure on a high-stakes decision
215
+ - Re-spawning fresh-context on an unchanged artifact (you'll get the same findings; you're stalling)
216
+ - **Doubt theater (checkable signal)**: across 2 or more cycles where the reviewer surfaced substantive findings, zero findings were classified as actionable. You are validating, not doubting. Stop and escalate.
217
+ - Doubting only after committing — that's `/review`, not doubt-driven development
218
+ - Hardcoding an external CLI invocation without confirming with the user that the tool exists, is configured, and accepts that exact syntax
219
+ - **Silently skipping cross-model in an interactive doubt cycle.** Even when not recommending it, the offer must be visible. Skipping is fine; silent skipping is not.
220
+ - Falling back silently when an external CLI errors or is missing — surface the failure and let the user redirect
221
+ - Stripping the contract from the reviewer's input
222
+ - Passing the CLAIM to the reviewer (biases toward agreement)
223
+
224
+ ## Interaction with Other Skills
225
+
226
+ - **`code-review-and-quality` / `/review`**: complementary. `/review` is post-hoc PR verdict; doubt-driven is in-flight per-decision. Use both.
227
+ - **`source-driven-development`**: SDD verifies *facts about frameworks* against official docs. Doubt-driven verifies *your reasoning about the artifact*. SDD checks the API exists; doubt-driven checks you used it correctly under the contract.
228
+ - **`test-driven-development`**: TDD's RED step is doubt made concrete — a failing test is a disproof attempt. When TDD applies, that failing test *is* the doubt step for behavioral claims.
229
+ - **`debugging-and-error-recovery`**: when the reviewer surfaces a real failure mode, drop into the debugging skill to localize and fix.
230
+ - **Repo orchestration rules** (`references/orchestration-patterns.md`): this skill orchestrates from the main session. A persona calling another persona is anti-pattern B — see Loading Constraints above.
231
+
232
+ ## Verification
233
+
234
+ After applying doubt-driven development:
235
+
236
+ - [ ] Every non-trivial decision (per the definition above) was named explicitly as a CLAIM before standing
237
+ - [ ] At least one fresh-context review per non-trivial artifact (a failing test produced by TDD's RED step satisfies this for behavioral claims, per Interaction with Other Skills)
238
+ - [ ] The reviewer received ARTIFACT + CONTRACT — NOT the CLAIM, NOT your reasoning
239
+ - [ ] The reviewer's prompt was adversarial ("find issues"), not validating ("is it good")
240
+ - [ ] Findings were classified against the artifact text (not rubber-stamped) using the precedence: contract misread / actionable / trade-off / noise
241
+ - [ ] A stop condition was met (trivial findings, 3 cycles, or user override)
242
+ - [ ] In interactive mode, cross-model was **explicitly offered** to the user (regardless of artifact stakes) and the response was acknowledged in the output
243
+ - [ ] In non-interactive mode, cross-model was skipped and the skip was announced
244
+ - [ ] Any external CLI invocation was preceded by a PATH check, a working-binary test, syntax confirmation with the user, and explicit authorization to run
245
+
246
+ ---
247
+ *Source: addyosmani/agent-skills (MIT). Ported into MaTrixOS shared-skills bundle.*
@@ -0,0 +1,253 @@
1
+ ---
2
+ name: incremental-implementation
3
+ description: Delivers changes incrementally. Use when implementing any feature or change that touches more than one file. Use 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
+ source: addyosmani/agent-skills (MIT)
5
+ ---
6
+
7
+ # Incremental Implementation
8
+
9
+ ## Overview
10
+
11
+ 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.
12
+
13
+ ## When to Use
14
+
15
+ - Implementing any multi-file change
16
+ - Building a new feature from a task breakdown
17
+ - Refactoring existing code
18
+ - Any time you're tempted to write more than ~100 lines before testing
19
+
20
+ **When NOT to use:** Single-file, single-function changes where the scope is already minimal.
21
+
22
+ ## The Increment Cycle
23
+
24
+ ```
25
+ ┌──────────────────────────────────────┐
26
+ │ │
27
+ │ Implement ──→ Test ──→ Verify ──┐ │
28
+ │ ▲ │ │
29
+ │ └───── Commit ◄─────────────┘ │
30
+ │ │ │
31
+ │ ▼ │
32
+ │ Next slice │
33
+ │ │
34
+ └──────────────────────────────────────┘
35
+ ```
36
+
37
+ For each slice:
38
+
39
+ 1. **Implement** the smallest complete piece of functionality
40
+ 2. **Test** — run the test suite (or write a test if none exists)
41
+ 3. **Verify** — confirm the slice works as expected (tests pass, build succeeds, manual check)
42
+ 4. **Commit** -- save your progress with a descriptive message (see `git-workflow-and-versioning` for atomic commit guidance)
43
+ 5. **Move to the next slice** — carry forward, don't restart
44
+
45
+ ## Slicing Strategies
46
+
47
+ ### Vertical Slices (Preferred)
48
+
49
+ Build one complete path through the stack:
50
+
51
+ ```
52
+ Slice 1: Create a task (DB + API + basic UI)
53
+ → Tests pass, user can create a task via the UI
54
+
55
+ Slice 2: List tasks (query + API + UI)
56
+ → Tests pass, user can see their tasks
57
+
58
+ Slice 3: Edit a task (update + API + UI)
59
+ → Tests pass, user can modify tasks
60
+
61
+ Slice 4: Delete a task (delete + API + UI + confirmation)
62
+ → Tests pass, full CRUD complete
63
+ ```
64
+
65
+ Each slice delivers working end-to-end functionality.
66
+
67
+ ### Contract-First Slicing
68
+
69
+ When backend and frontend need to develop in parallel:
70
+
71
+ ```
72
+ Slice 0: Define the API contract (types, interfaces, OpenAPI spec)
73
+ Slice 1a: Implement backend against the contract + API tests
74
+ Slice 1b: Implement frontend against mock data matching the contract
75
+ Slice 2: Integrate and test end-to-end
76
+ ```
77
+
78
+ ### Risk-First Slicing
79
+
80
+ Tackle the riskiest or most uncertain piece first:
81
+
82
+ ```
83
+ Slice 1: Prove the WebSocket connection works (highest risk)
84
+ Slice 2: Build real-time task updates on the proven connection
85
+ Slice 3: Add offline support and reconnection
86
+ ```
87
+
88
+ If Slice 1 fails, you discover it before investing in Slices 2 and 3.
89
+
90
+ ## Implementation Rules
91
+
92
+ ### Rule 0: Simplicity First
93
+
94
+ Before writing any code, ask: "What is the simplest thing that could work?"
95
+
96
+ After writing code, review it against these checks:
97
+ - Can this be done in fewer lines?
98
+ - Are these abstractions earning their complexity?
99
+ - Would a staff engineer look at this and say "why didn't you just..."?
100
+ - Am I building for hypothetical future requirements, or the current task?
101
+
102
+ ```
103
+ SIMPLICITY CHECK:
104
+ ✗ Generic EventBus with middleware pipeline for one notification
105
+ ✓ Simple function call
106
+
107
+ ✗ Abstract factory pattern for two similar components
108
+ ✓ Two straightforward components with shared utilities
109
+
110
+ ✗ Config-driven form builder for three forms
111
+ ✓ Three form components
112
+ ```
113
+
114
+ 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.
115
+
116
+ ### Rule 0.5: Scope Discipline
117
+
118
+ Touch only what the task requires.
119
+
120
+ Do NOT:
121
+ - "Clean up" code adjacent to your change
122
+ - Refactor imports in files you're not modifying
123
+ - Remove comments you don't fully understand
124
+ - Add features not in the spec because they "seem useful"
125
+ - Modernize syntax in files you're only reading
126
+
127
+ If you notice something worth improving outside your task scope, note it — don't fix it:
128
+
129
+ ```
130
+ NOTICED BUT NOT TOUCHING:
131
+ - src/utils/format.ts has an unused import (unrelated to this task)
132
+ - The auth middleware could use better error messages (separate task)
133
+ → Want me to create tasks for these?
134
+ ```
135
+
136
+ ### Rule 1: One Thing at a Time
137
+
138
+ Each increment changes one logical thing. Don't mix concerns:
139
+
140
+ **Bad:** One commit that adds a new component, refactors an existing one, and updates the build config.
141
+
142
+ **Good:** Three separate commits — one for each change.
143
+
144
+ ### Rule 2: Keep It Compilable
145
+
146
+ After each increment, the project must build and existing tests must pass. Don't leave the codebase in a broken state between slices.
147
+
148
+ ### Rule 3: Feature Flags for Incomplete Features
149
+
150
+ If a feature isn't ready for users but you need to merge increments:
151
+
152
+ ```typescript
153
+ // Feature flag for work-in-progress
154
+ const ENABLE_TASK_SHARING = process.env.FEATURE_TASK_SHARING === 'true';
155
+
156
+ if (ENABLE_TASK_SHARING) {
157
+ // New sharing UI
158
+ }
159
+ ```
160
+
161
+ This lets you merge small increments to the main branch without exposing incomplete work.
162
+
163
+ ### Rule 4: Safe Defaults
164
+
165
+ New code should default to safe, conservative behavior:
166
+
167
+ ```typescript
168
+ // Safe: disabled by default, opt-in
169
+ export function createTask(data: TaskInput, options?: { notify?: boolean }) {
170
+ const shouldNotify = options?.notify ?? false;
171
+ // ...
172
+ }
173
+ ```
174
+
175
+ ### Rule 5: Rollback-Friendly
176
+
177
+ Each increment should be independently revertable:
178
+
179
+ - Additive changes (new files, new functions) are easy to revert
180
+ - Modifications to existing code should be minimal and focused
181
+ - Database migrations should have corresponding rollback migrations
182
+ - Avoid deleting something in one commit and replacing it in the same commit — separate them
183
+
184
+ ## Working with Agents
185
+
186
+ When directing an agent to implement incrementally:
187
+
188
+ ```
189
+ "Let's implement Task 3 from the plan.
190
+
191
+ Start with just the database schema change and the API endpoint.
192
+ Don't touch the UI yet — we'll do that in the next increment.
193
+
194
+ After implementing, run `npm test` and `npm run build` to verify
195
+ nothing is broken."
196
+ ```
197
+
198
+ Be explicit about what's in scope and what's NOT in scope for each increment.
199
+
200
+ ## Increment Checklist
201
+
202
+ After each increment, verify:
203
+
204
+ - [ ] The change does one thing and does it completely
205
+ - [ ] All existing tests still pass (`npm test`)
206
+ - [ ] The build succeeds (`npm run build`)
207
+ - [ ] Type checking passes (`npx tsc --noEmit`)
208
+ - [ ] Linting passes (`npm run lint`)
209
+ - [ ] The new functionality works as expected
210
+ - [ ] The change is committed with a descriptive message
211
+
212
+ **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.
213
+
214
+ ## Common Rationalizations
215
+
216
+ | Rationalization | Reality |
217
+ |---|---|
218
+ | "I'll test it all at the end" | Bugs compound. A bug in Slice 1 makes Slices 2-5 wrong. Test each slice. |
219
+ | "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. |
220
+ | "These changes are too small to commit separately" | Small commits are free. Large commits hide bugs and make rollbacks painful. |
221
+ | "I'll add the feature flag later" | If the feature isn't complete, it shouldn't be user-visible. Add the flag now. |
222
+ | "This refactor is small enough to include" | Refactors mixed with features make both harder to review and debug. Separate them. |
223
+ | "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. |
224
+
225
+ ## Red Flags
226
+
227
+ - More than 100 lines of code written without running tests
228
+ - Multiple unrelated changes in a single increment
229
+ - "Let me just quickly add this too" scope expansion
230
+ - Skipping the test/verify step to move faster
231
+ - Build or tests broken between increments
232
+ - Large uncommitted changes accumulating
233
+ - Building abstractions before the third use case demands it
234
+ - Touching files outside the task scope "while I'm here"
235
+ - Creating new utility files for one-time operations
236
+ - Running the same build/test command twice in a row without any intervening code change
237
+
238
+ ## Verification
239
+
240
+ After completing all increments for a task:
241
+
242
+ - [ ] Each increment was individually tested and committed
243
+ - [ ] The full test suite passes
244
+ - [ ] The build is clean
245
+ - [ ] The feature works end-to-end as specified
246
+ - [ ] No uncommitted changes remain
247
+
248
+ ## See Also
249
+
250
+ 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 `references/definition-of-done.md`.
251
+
252
+ ---
253
+ *Source: addyosmani/agent-skills (MIT). Ported into MaTrixOS shared-skills bundle.*