Validate fix

From danielvm-git/bigpowers · View interactive version

Validate fix is an AI agent skill from the GitHub repository danielvm-git/bigpowers. Prove a fix works before declaring done — re-run the failing test, run the full suite, typecheck, lint, and harden against recurrence. Use after implementing a bug fix, when user says \"is this fixed?\", or before closing an investigation.

How to use this skill

Skill file

Validate Fix

HARD GATE — Fix must not regress. Run full test suite and manual UAT before declaring success.

Prove the fix works. "I think it works" is not evidence. Run the suite, show the output, then harden against recurrence.

Two-commit red/green policy (e45s08) — Bug fixes follow the same two-commit discipline as develop-tdd: first commit adds/adjusts the failing test (test(<scope>): …), second commit applies the fix (fix(<scope>): …). Do not squash RED and GREEN before review.

Checklist

1. Re-run the originally failing test

# Run the specific test that captured the bug
<test command for the failing test>

2. Run the full test suite

# Run all tests — no filtering
<full test command from CLAUDE.md>

3. Type check

<typecheck command>

4. Lint

<lint command>

5. Harden against recurrence

For every bug fixed, add at least one prevention layer:

| Mechanism | When to use |

|-----------|-------------|

| Type guard | Input could be the wrong shape |

| Schema validation (Zod, Pydantic, etc.) | External data crossing a boundary |

| Invariant assertion | Internal state that must always hold |

| Lint rule | Pattern that's easy to repeat by mistake |

| Environment check at startup | Missing config causes silent failure |

5b. Generalize-fix (HARD GATE — e80s04 / GH #98)

Sweep the defect class across the codebase after local hardening — see REFERENCE-generalize-fix.md.

6. Update the bug file and registry.yaml

Find the most recent specs/bugs/BUG-*.md file and append the resolution:

## Resolution

**Fixed:** [date]
**Root cause confirmed:** [one sentence]
**Fix applied:** [what was changed]
**Hardening added:** [type guard / schema / assertion / lint rule]
**Evidence:** all tests pass (`<verify command>`)
**Commit:** `fix(<scope>): <description>`

Also update the corresponding row in specs/bugs/registry.yaml: set status to fixed, fill in files_changed, approach, risk_level, commit_message, and any other resolution fields.

7. Behavioral Proof (HARD GATE)

Mechanical verification (tests passing) is only half the fix. You must prove behavioral correctness.

Rules

Suggest next skill: audit-code → commit-message.

Verify

→ verify: grep -q 'generalize-fix' skills/validate-fix/SKILL.md && test -x scripts/verify-generalize-sweep.sh && bash scripts/verify-generalize-sweep.sh --self-test && echo OK


Generalize-fix (e80s04 / GH #98)

After local hardening in validate-fix, sweep the defect class across the codebase.

Steps

  1. Classify — name the pattern (e.g. unscoped org query, fail-open verify, hardcoded package manager).
  2. Sweep — grep for sibling instances; record match_count and grep_pattern.
  3. Resolve — patch all matches in this PR or file one tracking issue listing every remaining instance.
  4. Artifact — write sweep evidence before declaring done:
cat > specs/verifications/generalize-sweep-BUG-YYYY-MM-DD-slug.json <<EOF
{
  "defect_class": "fail-open-verify",
  "grep_pattern": "\\\\|\\\\| echo",
  "match_count": 0,
  "sweep_scope": "skills/*/SKILL.md",
  "patched_in_pr": [],
  "tracked_issues": []
}
EOF
bash scripts/verify-generalize-sweep.sh specs/verifications/generalize-sweep-*.json

Security classes

When the defect class is security- or gate-relevant:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.