Coding & Refactoringlow risk

systematic-test-fix

Fix a failing function by reproducing the failure, localizing the smallest wrong expression, making the minimal change, and re-verifying — for small bug-fix tasks with a known expected behaviour.

sdsrss/super-skill·evals/test-fix-family/handwritten/SKILL.md
32/ 100推荐值

导入这个 Skill

选择你的 coding agent,复制项目级或个人级安装命令。

固定到平台收录的 commit
导入当前项目.agents/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a codex -y
导入个人环境~/.agents/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a codex -g -y
手动放置目录.agents/skills/handwrittenOfficial docs ↗
导入当前项目.claude/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a claude-code -y
导入个人环境~/.claude/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a claude-code -g -y
手动放置目录.claude/skills/handwrittenOfficial docs ↗
导入当前项目.agents/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a github-copilot -y
导入个人环境~/.copilot/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a github-copilot -g -y
手动放置目录.agents/skills/handwrittenOfficial docs ↗
导入当前项目.agents/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a cursor -y
导入个人环境~/.cursor/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a cursor -g -y
手动放置目录.agents/skills/handwrittenOfficial docs ↗
导入当前项目.agents/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a gemini-cli -y
导入个人环境~/.gemini/skills/handwritten
npx skills add https://github.com/sdsrss/super-skill/tree/e13a5b1da1235030e9da480071f2a7e5eb518bbe/evals/test-fix-family/handwritten -a gemini-cli -g -y
Native Gemini CLIgemini skills install https://github.com/sdsrss/super-skill.git --scope workspace --path evals/test-fix-family/handwritten
手动放置目录.agents/skills/handwrittenOfficial docs ↗
⚠ 安装命令使用开源 skills CLI。执行前请检查来源、脚本和权限。
# Systematic test-fix

A discipline for fixing a function whose behaviour is wrong, when you know what
it should do. Optimises for the smallest correct change, not a rewrite.

## When to use

A single function returns wrong results for some inputs and you have concrete
expected input/output pairs (from a description or a failing check).

## Steps

1. **Restate the contract.** Write down the expected output for 2–3 inputs,
   including the boundaries and the empty/degenerate case. These are your oracle.
2. **Reproduce.** Trace the current code by hand on the input that looks most
   likely to break (a boundary, an empty input, a negative number). Confirm the
   wrong output before changing anything — do not fix by guessing.
3. **Localize.** Find the single expression responsible: an off-by-one in a
   slice or index, a `>` that should be `>=`, an accumulator initialised to `0`
   instead of the first element or negative infinity, a wrong base case.
4. **Minimal fix.** Change only that expression. Keep the signature. Resist
   refactoring unrelated code in the same edit.
5. **Re-verify against the oracle** from step 1, especially the boundary and the
   degenerate case, since those are where these bugs hide. If any still fails,
   return to step 3 — the localization was wrong, not the fix.

## Common shapes

- Slice/index endpoints (`len(x) - n` vs `len(x) - n + 1`).
- Boundary comparisons (inclusive vs exclusive).
- Accumulator seeds (`0` breaks all-negative inputs; seed with the first element
  or `float("-inf")`).
- Missing empty-input handling.