test-and-fix
Run the test suite, categorize every failure (regression / flake / environment), fix regressions, and never silently skip. Use whenever tests fail or before opening a PR.
SKILL.md.claude/skills/test-and-fix/SKILL.md
GitHubtest-and-fix
Procedure
- Run
go test ./...(thenmake checkfor the full gate). - Categorize every failure:
- Regression — the code under test is wrong, or the change broke a real contract. Fix the code (or, if the test encoded a wrong expectation, fix the test and say so in the PR).
- Flake — passes on rerun, timing/ordering dependent. Rerun with
-count=5 -raceto confirm. Don't just rerun-until-green: file an issue for the flake with the failure output, and fix it if the fix is small (deterministic clock, channel sync, t.TempDir). - Environment — missing tool, sandbox limits, network. Note it in the PR; make the test skip explicitly and loudly (
t.Skipfwith reason) only if the dependency is genuinely optional.
- Fix regressions in the current branch if in scope for the issue; otherwise file a blocking issue and stop.
- Re-run the full suite after fixes.
Never
- Delete or
t.Skipa failing test to get green without flagging it prominently in the PR description (CLAUDE.md rule 6). - Mark a regression as a flake because it passed once on rerun.
- Ship with the approval-path E2E test failing — that is always a blocker (rule 3).