eng-skills 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -46,10 +46,16 @@ docs/
46
46
  guard.mjs # PreToolUse(Bash): denies rm -rf, force push, .env exfil, …
47
47
  commands/
48
48
  onboard.md # /onboard — Claude researches YOUR codebase, fills CLAUDE.md
49
- feature.md # /featureresearch planimplement verify document
49
+ kickoff.md # /kickoffnew project: interviewlandscape researchspec
50
+ feature.md # /feature — clarify → research → plan → implement → verify → document
50
51
  fix.md # /fix — reproduce → root-cause → fix → prove → document
51
52
  decide.md # /decide — record an ADR
52
53
  phase.md # /phase — honest progress review, phase-gate closeout
54
+ skills/
55
+ brainstorming/ # asks clarifying questions + researches what others do BEFORE building
56
+ root-cause/ # systematic RCA discipline — no symptom-patching
57
+ frontend-verify/ # screenshot/console/network verification via chrome-devtools MCP
58
+ .mcp.json # chrome-devtools MCP server (offered for frontend projects — asks first)
53
59
  ```
54
60
 
55
61
  Everything is dependency-free Node (~150 lines of hooks total). No runtime, no daemon,
@@ -89,20 +95,51 @@ architecture as ADRs — so the knowledge base starts warm, not empty.
89
95
 
90
96
  ## The daily workflow
91
97
 
98
+ You don't have to remember the slash commands. CLAUDE.md contains an
99
+ **intent-routing table**: a plain "add a dark mode toggle" triggers the same
100
+ clarify → research → plan → implement → verify → document workflow as typing
101
+ `/feature` — casual phrasing doesn't skip steps. The commands are just explicit
102
+ shortcuts:
103
+
92
104
  | Command | What it does |
93
105
  |---|---|
94
- | `/feature <desc>` | Researches the codebase (and web when useful) *before* writing code, writes a checkbox plan to `docs/plans/`, implements with TDD, verifies end-to-end, documents in `docs/features/`. |
106
+ | `/kickoff <idea>` | From-scratch projects: interviews you (mandatory questions), researches the competitive landscape ("what are others doing"), locks stack decisions as ADRs, writes the spec and phase roadmap *then* scaffolds. |
107
+ | `/feature <desc>` | Asks clarifying questions first, researches the codebase (and web when useful) *before* writing code, writes a checkbox plan to `docs/plans/`, implements with TDD, verifies end-to-end, documents in `docs/features/`. |
95
108
  | `/fix <bug>` | Reproduce first, root-cause (not symptom-patch), failing test → fix, document Symptom/Root cause/Fix/Verification/Prevention in `docs/fixes/`. |
96
109
  | `/decide <choice>` | Numbered ADR with context, options, decision, consequences. Supersede — never delete — old decisions. |
97
110
  | `/phase status` | Cross-checks the current phase checklist against reality (do claimed tests actually pass?). |
98
111
  | `/phase next <name>` | Phase-gate closeout: verify acceptance criteria, get operator sign-off, open the next phase. |
99
112
 
113
+ ## Skills
114
+
115
+ Three skills install to `.claude/skills/` and trigger automatically:
116
+
117
+ - **brainstorming** — before any non-trivial build: interviews the user
118
+ (batched clarifying questions are *mandatory*, not optional), researches the
119
+ codebase *and* the landscape (what libraries/products already solve this),
120
+ presents real options with trade-offs, and locks the user's choices into a
121
+ design spec in `docs/specs/`.
122
+ - **root-cause** — debugging discipline: reproduce before touching code, trace
123
+ real data instead of theorizing, five-whys to the actual root cause, prove the
124
+ fix with evidence, add prevention. Explicit anti-pattern list (no retry-loops,
125
+ no sleep-fixes, no speculative change-stacking).
126
+ - **frontend-verify** — after any UI change: run the app, navigate with the
127
+ chrome-devtools MCP, screenshot and *look*, check console messages and network
128
+ requests, exercise the interaction, iterate 2–3×. "The code looks right" is
129
+ not verification.
130
+
131
+ For frontend projects (React/Vue/Svelte/Next/… detected in package.json), `init`
132
+ offers to add the [chrome-devtools MCP](https://www.npmjs.com/package/chrome-devtools-mcp)
133
+ to `.mcp.json` — it asks first, merges with existing servers, and never overrides.
134
+
100
135
  ## CLI reference
101
136
 
102
137
  ```bash
103
138
  npx eng-skills init [dir] # scaffold (default: current directory)
104
139
  --force # overwrite existing files
105
140
  --dry-run # print what would happen, write nothing
141
+ --yes # accept recommendations without prompting (CI/scripts)
142
+ --no-mcp # never offer the chrome-devtools MCP config
106
143
  ```
107
144
 
108
145
  ## Design principles (and their sources)
package/bin/cli.mjs CHANGED
@@ -13,6 +13,8 @@ const positional = argv.filter((a) => !a.startsWith('--'));
13
13
  const command = positional[0] || 'init';
14
14
  const FORCE = flags.has('--force');
15
15
  const DRY = flags.has('--dry-run');
16
+ const YES = flags.has('--yes');
17
+ const NO_MCP = flags.has('--no-mcp');
16
18
 
17
19
  if (flags.has('--help') || command === 'help') {
18
20
  console.log(`
@@ -24,14 +26,18 @@ Usage:
24
26
  Options:
25
27
  --force overwrite files that already exist (default: skip them)
26
28
  --dry-run show what would be written without writing anything
29
+ --yes accept all recommendations without prompting (for CI/scripts)
30
+ --no-mcp never offer the chrome-devtools MCP config
27
31
  --help this message
28
32
 
29
33
  What it sets up:
30
34
  CLAUDE.md protocol + TODO(onboard) markers Claude fills in
31
35
  docs/ features/ fixes/ decisions/ phases/ plans/ specs/ + templates
32
36
  .claude/hooks/ pre-edit reminder, post-edit changelog, stop-gate, bash guard
33
- .claude/commands/ /onboard /feature /fix /decide /phase
37
+ .claude/commands/ /onboard /kickoff /feature /fix /decide /phase
38
+ .claude/skills/ brainstorming, root-cause, frontend-verify
34
39
  .claude/settings.json hook wiring (merged into an existing file safely)
40
+ .mcp.json chrome-devtools MCP for frontend projects (asks first)
35
41
 
36
42
  After installing, open Claude Code in the repo and run /onboard.
37
43
  `);
@@ -143,6 +149,71 @@ function installClaudeMd() {
143
149
  if (!DRY) fs.writeFileSync(dest, existing.trimEnd() + '\n\n' + section + '\n');
144
150
  }
145
151
 
152
+ const FRONTEND_DEPS = [
153
+ 'react', 'react-dom', 'next', 'vue', 'nuxt', 'svelte', '@sveltejs/kit',
154
+ '@angular/core', 'solid-js', 'astro', 'vite', 'preact', 'remix', '@remix-run/react',
155
+ ];
156
+
157
+ function detectFrontend() {
158
+ try {
159
+ const pkg = JSON.parse(fs.readFileSync(path.join(target, 'package.json'), 'utf8'));
160
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
161
+ return FRONTEND_DEPS.filter((d) => deps[d]);
162
+ } catch {
163
+ return [];
164
+ }
165
+ }
166
+
167
+ async function confirm(question) {
168
+ if (YES) return true;
169
+ if (!process.stdin.isTTY) return false; // non-interactive: never assume yes
170
+ const { createInterface } = await import('node:readline/promises');
171
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
172
+ const answer = (await rl.question(`${question} [Y/n] `)).trim().toLowerCase();
173
+ rl.close();
174
+ return answer === '' || answer === 'y' || answer === 'yes';
175
+ }
176
+
177
+ /** Offer to add the chrome-devtools MCP server for frontend projects. */
178
+ async function offerMcp() {
179
+ if (NO_MCP) return;
180
+ const found = detectFrontend();
181
+ if (!found.length) return;
182
+
183
+ const rel = '.mcp.json';
184
+ const dest = path.join(target, rel);
185
+ const ours = JSON.parse(fs.readFileSync(path.join(TEMPLATES, 'mcp.json'), 'utf8'));
186
+
187
+ let existing = null;
188
+ if (fs.existsSync(dest)) {
189
+ try {
190
+ existing = JSON.parse(fs.readFileSync(dest, 'utf8'));
191
+ } catch {
192
+ console.log(` ! ${rel} exists but is not valid JSON — skipping MCP setup.`);
193
+ return;
194
+ }
195
+ if (existing.mcpServers?.['chrome-devtools']) {
196
+ skipped.push(rel + ' (chrome-devtools already configured)');
197
+ return;
198
+ }
199
+ }
200
+
201
+ console.log(`\nFrontend project detected (${found.slice(0, 3).join(', ')}).`);
202
+ console.log('The chrome-devtools MCP lets Claude open your app in a browser,');
203
+ console.log('take screenshots, and check console/network — the frontend-verify');
204
+ console.log('skill uses it to visually verify every UI change.');
205
+ const ok = await confirm(existing ? `Add chrome-devtools server to your existing ${rel}?` : `Create ${rel} with the chrome-devtools server?`);
206
+ if (!ok) {
207
+ console.log(` = ${rel} skipped by choice (re-run with --yes, or add it later)`);
208
+ return;
209
+ }
210
+ const next = existing ?? { mcpServers: {} };
211
+ next.mcpServers ||= {};
212
+ next.mcpServers['chrome-devtools'] = ours.mcpServers['chrome-devtools'];
213
+ (existing ? merged : written).push(rel + (existing ? ' (+ chrome-devtools server)' : ''));
214
+ if (!DRY) fs.writeFileSync(dest, JSON.stringify(next, null, 2) + '\n');
215
+ }
216
+
146
217
  function ensureGitignore() {
147
218
  const dest = path.join(target, '.gitignore');
148
219
  const line = '.claude/.docs-state/';
@@ -158,9 +229,12 @@ console.log(`\neng-skills init → ${target}${DRY ? ' (dry run)' : ''}\n`);
158
229
  for (const f of ['lib.mjs', 'pre-edit.mjs', 'post-edit.mjs', 'stop-gate.mjs', 'guard.mjs']) {
159
230
  copyTemplate(path.join('claude', 'hooks', f), path.join('.claude', 'hooks', f));
160
231
  }
161
- for (const f of ['onboard.md', 'feature.md', 'fix.md', 'decide.md', 'phase.md']) {
232
+ for (const f of ['onboard.md', 'kickoff.md', 'feature.md', 'fix.md', 'decide.md', 'phase.md']) {
162
233
  copyTemplate(path.join('claude', 'commands', f), path.join('.claude', 'commands', f));
163
234
  }
235
+ for (const s of ['brainstorming', 'root-cause', 'frontend-verify']) {
236
+ copyTemplate(path.join('claude', 'skills', s, 'SKILL.md'), path.join('.claude', 'skills', s, 'SKILL.md'));
237
+ }
164
238
  mergeSettings();
165
239
 
166
240
  // Knowledge base
@@ -177,6 +251,7 @@ for (const d of ['features', 'fixes', 'plans', 'specs']) {
177
251
 
178
252
  installClaudeMd();
179
253
  ensureGitignore();
254
+ await offerMcp();
180
255
 
181
256
  for (const f of written) console.log(` + ${f}`);
182
257
  for (const f of merged) console.log(` ~ ${f}`);
@@ -185,8 +260,11 @@ for (const f of skipped) console.log(` = ${f} (exists, skipped)`);
185
260
  console.log(`
186
261
  Done. Next steps:
187
262
  1. cd ${path.relative(process.cwd(), target) || '.'} && claude
188
- 2. Run /onboard — Claude researches this codebase and fills in CLAUDE.md.
189
- 3. Build things with /feature, fix things with /fix, record choices with /decide.
263
+ 2. Existing codebase: run /onboard — Claude researches it and fills in CLAUDE.md.
264
+ Brand-new project: run /kickoff <what you want to build>.
265
+ 3. Build with /feature, fix with /fix, record choices with /decide.
266
+ Skills installed: brainstorming (asks before building), root-cause
267
+ (debugging discipline), frontend-verify (browser screenshots via MCP).
190
268
 
191
269
  The stop-gate hook now blocks any turn that changes code without updating docs/.
192
270
  Verify hooks are active with /hooks inside Claude Code.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eng-skills",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Scaffold battle-tested Claude Code engineering conventions into any repo: enforced docs protocol (features/fixes/decisions/phases), pre/post/stop hooks, research-first slash commands, and a CLAUDE.md that Claude fills in by reading your codebase.",
5
5
  "keywords": [
6
6
  "claude",
@@ -44,6 +44,25 @@ Notes:
44
44
  - If the Stop hook blocks you, it's working as designed: write the missing doc, then finish.
45
45
  - If hooks don't fire at all, the workspace may be untrusted — verify with `/hooks`.
46
46
 
47
+ ## 🧭 Intent routing (applies WITHOUT slash commands)
48
+
49
+ The workflows below are how work is done in this repo — **whether or not the user
50
+ types the slash command**. When a plain-language request matches an intent, read
51
+ the corresponding command file and follow its workflow:
52
+
53
+ | The user asks to… | Follow the workflow in |
54
+ |---|---|
55
+ | build/add/implement anything non-trivial | `.claude/commands/feature.md` (clarify → research → plan → implement → verify → document) |
56
+ | fix a bug, investigate an error or wrong behavior | `.claude/commands/fix.md` + the `root-cause` skill |
57
+ | choose between approaches / anything with a real trade-off | `.claude/commands/decide.md` (record the ADR) |
58
+ | start a new project or major subsystem | `.claude/commands/kickoff.md` |
59
+ | "where are we" / review progress | `.claude/commands/phase.md` |
60
+
61
+ Do not skip steps because the user phrased the request casually. "Can you quickly
62
+ add X" still gets clarifying questions if the design is ambiguous, still gets
63
+ verified, and still gets documented. Only genuinely trivial changes (typo, rename,
64
+ one-line tweak) may skip the plan — never the verification or the docs.
65
+
47
66
  ## Phase roadmap
48
67
 
49
68
  <!-- TODO(onboard): bullet list of phases, one marked `← CURRENT`, each pointing
@@ -5,6 +5,14 @@ argument-hint: <feature description>
5
5
 
6
6
  Build the following feature using the research-first workflow: **$ARGUMENTS**
7
7
 
8
+ ## 0. Clarify (MANDATORY for non-trivial features)
9
+
10
+ If any requirement is ambiguous in a way that changes the design — scope, edge
11
+ cases, UX, performance expectations — ask the user now (AskUserQuestion when
12
+ available, batched, max 4). For genuinely trivial changes, state your
13
+ assumptions in one line and proceed. For anything larger, use the
14
+ **brainstorming** skill first: interview → landscape research → spec.
15
+
8
16
  ## 1. Research (before any code)
9
17
 
10
18
  - Search the codebase for everything the feature touches: existing modules to reuse, conventions to follow, contracts (API schemas, types, DB models) to extend.
@@ -22,7 +30,7 @@ Work through the plan's checkboxes, ticking them as you go. TDD for logic. Follo
22
30
 
23
31
  ## 4. Verify
24
32
 
25
- Run the project's tests and build/typecheck. For user-facing behavior, exercise the feature end-to-end (run the app, hit the endpoint, drive the UI) — not just tests. Paste real output as evidence.
33
+ Run the project's tests and build/typecheck. For user-facing behavior, exercise the feature end-to-end (run the app, hit the endpoint, drive the UI) — not just tests. For UI changes, use the **frontend-verify** skill: screenshot the running app via the chrome-devtools MCP, check console and network, iterate until it actually looks right. Paste real output as evidence.
26
34
 
27
35
  ## 5. Document (required — the Stop hook enforces this)
28
36
 
@@ -7,7 +7,7 @@ Fix the following bug: **$ARGUMENTS**
7
7
 
8
8
  ## 1. Reproduce & root-cause
9
9
 
10
- Reproduce the bug first (failing test, curl, script). Then find the *root cause* trace the actual failure, don't patch the symptom. Check `docs/fixes/` for related past fixes before starting; the same class of bug may have history.
10
+ Use the **root-cause** skill: reproduce the bug first (failing test, curl, script for frontend bugs, the chrome-devtools MCP: console, network, screenshots), then trace the actual failure to its root cause. Don't patch the symptom. Check `docs/fixes/` for related past fixes before starting; the same class of bug may have history.
11
11
 
12
12
  ## 2. Fix
13
13
 
@@ -0,0 +1,48 @@
1
+ ---
2
+ description: Start a brand-new project — interview the user, research the landscape, lock the stack, write the spec and phase roadmap
3
+ argument-hint: <what you want to build>
4
+ ---
5
+
6
+ Kick off a new project: **$ARGUMENTS**
7
+
8
+ This is the from-scratch counterpart to `/onboard`. Use the **brainstorming**
9
+ skill's discipline throughout: questions first, research second, code last.
10
+
11
+ ## 1. Interview (MANDATORY)
12
+
13
+ Ask the user, in 1–2 batched rounds (AskUserQuestion when available):
14
+ - Who is this for, and what single problem must v1 solve?
15
+ - What is explicitly out of scope for v1?
16
+ - Constraints: platform, budget, deadline, must-use / must-avoid tech?
17
+ - Any stack preference, or should you recommend one?
18
+ - How will they demo success ("the demo sentence")?
19
+
20
+ ## 2. Landscape research
21
+
22
+ Web-search what already exists: competing products, closest open-source
23
+ projects, the standard stack choices for this kind of app in the current year.
24
+ Deliver a short landscape summary: what exists, what's table-stakes, where this
25
+ project differentiates. If something off-the-shelf already solves the problem,
26
+ say so honestly before building anything.
27
+
28
+ ## 3. Lock decisions
29
+
30
+ Present 2–3 stack/architecture options with trade-offs, recommend one, let the
31
+ user choose. Record the chosen stack and each major trade-off as ADRs in
32
+ `docs/decisions/` (`/decide`).
33
+
34
+ ## 4. Spec + roadmap
35
+
36
+ - Write `docs/specs/YYYY-MM-DD-<name>-design.md`: goal, out-of-scope, locked
37
+ decisions table, architecture sketch, landscape notes.
38
+ - Break the build into 3–6 phases with review gates; create
39
+ `docs/phases/phase-1-<name>.md` from the template and update the Phase roadmap
40
+ in `CLAUDE.md` (Phase 0 = this kickoff; mark phase 1 `← CURRENT`).
41
+ - Fill in CLAUDE.md's mission, stack, and commands sections for the chosen stack.
42
+
43
+ ## 5. Scaffold
44
+
45
+ Only after the user approves the spec: generate the project skeleton, verify it
46
+ boots/builds, and document it as the first feature doc. If it's a frontend
47
+ project, confirm `.mcp.json` has the chrome-devtools server and use the
48
+ **frontend-verify** skill for every UI milestone from day one.
@@ -30,6 +30,16 @@ with researched, accurate content — not guesses.
30
30
 
31
31
  4. **Verify.** Run the test/build command you documented in Commands to confirm it actually works. If it fails, document the real state honestly rather than an aspirational one.
32
32
 
33
- 5. **Report.** Summarize what you filled in and anything you were unsure about so the human can correct it.
33
+ 5. **Ask, don't assume.** Where the codebase is ambiguous about things only the
34
+ human knows — current priorities, what's deprecated vs. active, invariants that
35
+ aren't visible in code — ask the user (AskUserQuestion when available) instead
36
+ of guessing. Their answers go into CLAUDE.md and the phase roadmap.
37
+
38
+ 6. **Recommend the toolkit.** Based on what you found, tell the user which of the
39
+ installed skills matter most here (e.g. frontend project → **frontend-verify**
40
+ + the chrome-devtools MCP in `.mcp.json`; complex domain → **brainstorming**
41
+ before every feature), and flag any recommended setup that's missing.
42
+
43
+ 7. **Report.** Summarize what you filled in and anything you were unsure about so the human can correct it.
34
44
 
35
45
  Do NOT modify source code during onboarding — this is a documentation-only pass.
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: brainstorming
3
+ description: Use BEFORE building any non-trivial feature or starting a new project — interviews the user with clarifying questions, researches the codebase and what others have built, presents options with trade-offs, and locks decisions into a design spec. Trigger on "build", "create", "add a feature", "new app", or any request where requirements are not fully specified.
4
+ ---
5
+
6
+ # Brainstorming — question first, research second, code last
7
+
8
+ Never jump from a one-line request to implementation. The cost of a wrong
9
+ assumption compounds through every file you touch.
10
+
11
+ ## 1. Interview the user (MANDATORY — do not skip)
12
+
13
+ Ask clarifying questions before proposing anything. Use the AskUserQuestion tool
14
+ when available (give 2–4 concrete options per question), otherwise ask in plain
15
+ text. Cover at least:
16
+
17
+ - **Who/why**: who uses this and what problem does it solve for them?
18
+ - **Scope**: what is explicitly OUT of scope for this iteration?
19
+ - **Constraints**: performance, compatibility, budget, deadline, stack preferences?
20
+ - **Success**: how will we know it works — what would the user demo?
21
+
22
+ Skip only questions whose answers are already unambiguous from the request or the
23
+ repo. One round of good questions is mandatory; a second round is fine if answers
24
+ open new forks. Don't interrogate — batch questions, max 4 per round.
25
+
26
+ ## 2. Research (both directions)
27
+
28
+ - **Inward**: search the codebase for what already exists — modules to reuse,
29
+ conventions to follow, prior art in `docs/features/`, constraints in
30
+ `docs/decisions/`. Never design something the repo already has.
31
+ - **Outward**: search the web for how others solve this — established libraries,
32
+ competing products' approaches, known pitfalls. For anything involving an
33
+ external API, verify current docs; do not trust memory. Summarize the landscape
34
+ in 3–5 bullets: what exists, what's standard, where we differ and why.
35
+
36
+ ## 3. Present options, drive a decision
37
+
38
+ Present 2–3 genuinely different approaches with honest trade-offs (not one real
39
+ option padded with strawmen). Recommend one and say why. Let the user choose —
40
+ their choice becomes a **locked decision**.
41
+
42
+ ## 4. Write the spec
43
+
44
+ Write `docs/specs/YYYY-MM-DD-<name>-design.md`:
45
+
46
+ - Goal (one paragraph), out-of-scope list
47
+ - **Locked decisions table** (D1, D2, … — decision + why + who decided)
48
+ - Architecture sketch, file/module layout
49
+ - Landscape notes (what others do, sources)
50
+ - Open questions that can wait
51
+
52
+ Significant trade-offs also get an ADR in `docs/decisions/` so they survive
53
+ beyond this feature. Then hand off to planning/implementation (`/feature`).
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: frontend-verify
3
+ description: Visually verify frontend/UI changes in a real browser using the Chrome DevTools MCP — screenshot, console, and network checks against the locally running app. Use after ANY change that affects rendered UI, and when debugging frontend issues.
4
+ ---
5
+
6
+ # Frontend verification — see it before you ship it
7
+
8
+ "The code looks right" is not verification for UI work. Render it, look at it,
9
+ check the console. Claude's UI output improves dramatically over 2–3
10
+ screenshot-and-fix iterations.
11
+
12
+ ## Setup (once)
13
+
14
+ This skill uses the Chrome DevTools MCP server. If its tools (take_screenshot,
15
+ navigate_page, list_console_messages, …) are not available in this session, it
16
+ isn't connected — check that `.mcp.json` in the repo root contains:
17
+
18
+ ```json
19
+ {
20
+ "mcpServers": {
21
+ "chrome-devtools": {
22
+ "command": "npx",
23
+ "args": ["-y", "chrome-devtools-mcp@latest"]
24
+ }
25
+ }
26
+ }
27
+ ```
28
+
29
+ (`npx eng-skills init` offers to add this for frontend projects.) The user must
30
+ restart Claude Code after adding it and approve the server on first use.
31
+
32
+ ## The verification loop
33
+
34
+ 1. **Run the app locally** (dev server from CLAUDE.md's Commands section). Wait
35
+ until it's actually serving — curl the URL or watch the output.
36
+ 2. **Navigate** to the affected page/state with the chrome-devtools MCP.
37
+ 3. **Screenshot** and actually look at it: layout, spacing, overflow, dark/light
38
+ mode if the app supports it, mobile viewport if relevant (resize_page).
39
+ 4. **Check the console** (list_console_messages) — a rendering change that logs
40
+ errors/warnings is not done.
41
+ 5. **Check network** (list_network_requests) for failed or duplicate requests
42
+ the change may have introduced.
43
+ 6. **Exercise the interaction**, not just the render: click, fill forms, submit
44
+ (click/fill/fill_form tools). Verify the resulting state.
45
+ 7. **Compare and iterate.** If a design mock was provided, compare screenshot to
46
+ mock, list every difference, fix, and re-screenshot. 2–3 iterations is
47
+ normal — don't stop at the first "close enough".
48
+
49
+ ## Evidence
50
+
51
+ Attach/describe the final screenshot in your report and paste console/network
52
+ findings. The feature/fix doc's Verification section should say what was
53
+ visually confirmed, in which viewport(s).
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: root-cause
3
+ description: Systematic root-cause analysis for bugs and unexpected behavior. Use whenever debugging anything — an error, a failing test, wrong output, a flaky behavior — BEFORE proposing a fix. Prevents symptom-patching.
4
+ ---
5
+
6
+ # Root-cause debugging — evidence over hypothesis
7
+
8
+ A fix that doesn't address the root cause is a second bug with better PR.
9
+
10
+ ## The loop
11
+
12
+ 1. **Reproduce first.** Turn the report into a deterministic reproduction: a
13
+ failing test, a curl command, a script, or a browser flow. If you cannot
14
+ reproduce it, you are not debugging — you are guessing. Say so and gather
15
+ more evidence instead.
16
+
17
+ 2. **Trace, don't theorize.** Follow the actual data through the actual code:
18
+ log/inspect at the boundaries (input → transform → output) until you find the
19
+ first place where reality diverges from expectation. For frontend issues, use
20
+ the chrome-devtools MCP (console messages, network requests, DOM state) — see
21
+ the `frontend-verify` skill. For backend, read real logs and add targeted
22
+ temporary instrumentation; remove it after.
23
+
24
+ 3. **Ask "why" until it stops being interesting.** The failing line is rarely
25
+ the cause. Five-whys until you reach a decision, assumption, or missing
26
+ guarantee (e.g. "the API can return null here and we assumed it couldn't").
27
+ Check `docs/fixes/` — if the same class of bug happened before, the previous
28
+ Prevention section failed and that itself is a finding.
29
+
30
+ 4. **Fix at the root, prove it.** Write the failing test that captures the root
31
+ cause (not just the symptom), make it pass with the smallest correct change,
32
+ then re-run the original reproduction AND the surrounding test suite. Paste
33
+ real output as evidence — "should work now" is not verification.
34
+
35
+ 5. **Prevent + document.** What guard, test, or type makes this class of bug
36
+ impossible? Write `docs/fixes/YYYY-MM-DD-<slug>.md` (template in
37
+ `docs/_templates/fix.md`) with Symptom / Root cause / Fix / Verification /
38
+ Prevention.
39
+
40
+ ## Anti-patterns (stop yourself)
41
+
42
+ - Changing code before reproducing.
43
+ - "Fixed" by retrying / adding a sleep / widening a try-catch.
44
+ - Fixing the test instead of the code without proving the test was wrong.
45
+ - Stacking multiple speculative changes at once — change one variable per experiment.
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "chrome-devtools": {
4
+ "command": "npx",
5
+ "args": ["-y", "chrome-devtools-mcp@latest"]
6
+ }
7
+ }
8
+ }