一键导入
fix-first-then-test
Land every code fix before running the test harness. Use grep + read to debug; the harness is a verifier, not a debugger.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Land every code fix before running the test harness. Use grep + read to debug; the harness is a verifier, not a debugger.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Pass model explicitly when dispatching sub-agents. Parent-default inheritance bypasses cost considerations; reserve stronger models for tasks that genuinely need them.
When a commit changes a component's public API, the same commit must update every test asserting the removed surface — split commits leave CI broken even when each commit is internally consistent.
When a class of bug keeps slipping through tests, run a coverage-matrix audit first, then fan out fix agents per gap — don't whack-a-mole individual failures.
Before pushing to CI, validate that your local test run is representative — three predictable axes diverge (gitignored fixtures, dev-only ports, dev-only env vars) and each has a deterministic fix.
Tests that mock the layer where the bug lives cannot catch bugs at that layer. Write tests that drive the same code path the user drives, ending at something the user can see.
When verifying or fixing a multi-layer change, dispatch each test layer and each independent fix as a parallel sub-agent rather than running serially in the main context.
| name | fix-first-then-test |
| description | Land every code fix before running the test harness. Use grep + read to debug; the harness is a verifier, not a debugger. |
| metadata | {"tags":["process","testing","debugging","discipline"]} |
Reproduce in your head from the code. Read the relevant files. Use grep to trace the call path. Identify the exact line(s) responsible. Do NOT start the harness before completing this step.
Fix all known bugs for a logical unit. If three bugs share a root cause, fix all three together. If three bugs are independent, dispatch three fix agents in parallel (see [[parallel-fanout-verification]]). Each fix gets one atomic commit with a why-first message.
Run the harness after all in-flight fixes are committed. Fan out: pytest + vitest + Playwright + live integration, all in parallel sub-agents. Never run them one-by-one.
Act on harness reports. A new failure = GOTO step 1, not "let's see if another run clears it."
| Goal | Tool |
|---|---|
| Find where a variable is set | grep -r "varname" src/ |
| Trace a call path | Read the call site, then the callee, then its deps |
| Confirm a hypothesis about state | Read the relevant state store / hook |
| Understand a component's render conditions | Read the component's return, not the test |
When a harness run reports failures:
The test harness is optimized for breadth: it runs every case, produces complete output, and terminates. It is not optimized for locality: the failure message points at what broke, not why. Using the harness as the first step of debugging forces you to read failure output, form a hypothesis, and THEN read the code — which is the same work you would have done by reading the code first, but with thousands of lines of noise in between. Reading the code first is faster and preserves context.