minimal-bug-fix
Skill0 starsChanged 2 months agoMITView on GitHub
Applies the smallest necessary code edit that resolves a confirmed bug without refactoring unrelated code.
In this repository49 other files it gives its agents.
- bug-reproducerSkill
- claim-checkerSkill
- command-failure-diagnoserSkill
- config-risk-reviewerSkill
- csv-validatorSkill
- deployment-checklist-makerSkill
- diff-reviewerSkill
- factual-summarizerSkill
- field-extractorSkill
- api-contract-testerSkill
- database-migration-helperSkill
- security-vulnerability-fixerSkill
- git-commit-stagerSkill
- git-conflict-resolverSkill
- github-actions-debuggerSkill
- github-issue-triagerSkill
- github-pr-creatorSkill
- github-pr-reviewerSkill
- go-code-qualitySkill
- go-lint-and-vetSkill
- go-testingSkill
- json-schema-converterSkill
- lint-and-typecheckSkill
- meaning-preserving-editorSkill
- meeting-notes-to-actionsSkill
- option-comparatorSkill
- py-code-qualitySkill
- py-lint-and-typecheckSkill
- py-testingSkill
- readme-writerSkill
- regression-test-writerSkill
- release-notes-drafterSkill
- repo-inspectorSkill
- research-briefSkill
- reversible-cleanup-plannerSkill
- rust-clippy-checkSkill
- rust-code-qualitySkill
- rust-testingSkill
- small-refactorSkill
- status-updateSkill
- step-by-step-tutorialSkill
- step-decomposerSkill
- tabular-analyzerSkill
- task-briefSkill
- test-runner-debuggerSkill
- ts-code-qualitySkill
- ts-lint-and-typecheckSkill
- ts-testingSkill
- skill-templateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 10 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use this skill when:
- Very specific: line 20
Do not use to restructure or modernize code style.
- Very specific: line 21
Do not use before proving the bug exists.
- Very specific: line 22
Do not use to write brand new features.
- Very specific: line 30
If no reproduction command is available: stop and run bug-reproducer first.
- Very specific: line 31
If root_cause is uncertain: isolate cause by inspecting git blame or local logs before editing.
- Distinctive: line 32
Never touch lines outside the affected function.
- Distinctive: line 35
Follow these numbered actions:
- Distinctive: line 37
Run the reproduction command.
- Distinctive: line 44
Run the reproduction command.
- Distinctive: line 46
Ensure no regressions were introduced.
- Distinctive: line 51
If the diff exceeds 15 lines: stop and check whether a simpler fix exists.
- Distinctive: line 52
If existing tests break after the edit: revert the edit immediately and re-analyze the root cause.
- Distinctive: line 53
Never reformat or change quote styles in untouched lines.
- Distinctive: line 92
Stop and escalate when:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Minimal Bug Fix
Applies the smallest possible surgical code modification that cures a verified bug. Strictly avoids incidental formatting, refactoring, or scope creep.
1. Purpose
Fix a defect with minimal diff footprint. A "Minimal Bug Fix" changes only the offending logic lines and leaves all adjacent code, style, and formatting untouched.
2. When to Use
Use this skill when:
- A bug has been reproduced via
bug-reproducer. - Patching production defects where small diffs reduce review risk.
- Fixing regression test failures.
3. When Not to Use
- Do not use to restructure or modernize code style; use
small-refactor. - Do not use before proving the bug exists; use
bug-reproducer. - Do not use to write brand new features; use
task-brief.
4. Required Inputs
reproduction_command: The command that proves the bug exists (fails before fix).target_file: The specific file containing the defect.root_cause: The reason for the bug (e.g., missing null check, off-by-one loop).
5. Missing-Input Behavior
- If no reproduction command is available: stop and run
bug-reproducerfirst. - If
root_causeis uncertain: isolate cause by inspecting git blame or local logs before editing. - Never touch lines outside the affected function.
6. Procedure
Follow these numbered actions:
- Action 1: Verify Pre-Fix Failure
- Run the reproduction command. Confirm it fails.
- Action 2: Draft Minimal Edit
- Identify the exact 1 to 5 lines causing the failure.
- Guard against edge cases (null, undefined, 0, negative values).
- Action 3: Apply the Patch
- Modify only the necessary lines.
- Action 4: Verify Post-Fix Success
- Run the reproduction command. Confirm it now passes.
- Action 5: Run Entire Test Suite
- Ensure no regressions were introduced.
- Action 6: Emit Fix Summary
- Format using Section 8.
7. Decision Rules
- If the diff exceeds 15 lines: stop and check whether a simpler fix exists.
- If existing tests break after the edit: revert the edit immediately and re-analyze the root cause.
- Never reformat or change quote styles in untouched lines.
8. Output Format
Emit the fix summary using this template:
### Minimal Bug Fix: [Bug Title]
- **File Modified**: `[relative file path]`
- **Lines Changed**: [Count]
- **Verification**: [PASS | FAIL]
#### Patch Summary
[1-2 sentences explaining what was changed and why.]
#### Diff
```diff
- [Old code]
+ [New code]Verification Evidence
- Pre-fix command output:
[Failing error summary] - Post-fix command output:
[Passing result] - Test suite output:
[All tests passing]
## 9. Verification Checklist
- [ ] Reproduction command failed before the fix.
- [ ] Reproduction command succeeded after the fix.
- [ ] Full test suite (`npm test`, `pytest`) passed without regressions.
- [ ] Diff is strictly minimal with zero gratuitous whitespace/style edits.
## 10. Common Failures and Recovery
| Failure Symptom | Cause | Recovery Action |
| :--- | :--- | :--- |
| Incidental refactoring | "Fixing" other code while in file | Revert unrelated edits using git diff check. |
| Off-by-one recurrence | Incomplete edge check | Add explicit boundary test for <= vs <. |
## 11. Stop or Escalation Conditions
Stop and escalate when:
- Fixing the bug requires an architectural redesign or database schema migration.
## 12. Examples
### Example 1: Successful Execution
**Input:**
```text
Target: src/math.js
Repro: node -e "require('./src/math').divide(10, 0)"
Bug: Returns Infinity instead of throwing Error.Output:
### Minimal Bug Fix: Prevent Zero Division in divide()
- **File Modified**: `src/math.js`
- **Lines Changed**: 3
- **Verification**: PASS
#### Patch Summary
Added an explicit check for `divisor === 0` to throw an `Error("Division by zero")`.
#### Diff
```diff
function divide(a, b) {
+ if (b === 0) {
+ throw new Error("Division by zero");
+ }
return a / b;
}Verification Evidence
- Pre-fix: Returned
Infinity - Post-fix: Throws
Error: Division by zero - Test suite:
npm test-> 28 passed, 0 failed
### Example 2: Ambiguous or Missing Input
**Input:**
```text
Fix the frontend bugs.Output:
### Minimal Bug Fix: Halted - No Target or Reproduction
- **Status**: Halted
Cannot apply a minimal fix without:
1. Target file path.
2. Concrete reproduction steps or test command.
Please run `bug-reproducer` or specify the failing file.Example 3: Expected Final Output
Output:
### Minimal Bug Fix: Guard Null Token in Auth Header
- **File Modified**: `src/auth.ts`
- **Lines Changed**: 1
- **Verification**: PASS
#### Patch Summary
Used optional chaining on `authHeader` before calling `.split(' ')` to prevent null pointer exceptions on unauthenticated requests.
#### Diff
```diff
- const token = authHeader.split(' ')[1];
+ const token = authHeader?.split(' ')[1] ?? null;Verification Evidence
- Pre-fix:
TypeError: Cannot read properties of undefined (reading 'split') - Post-fix: Returns
nulltoken and 401 response - Test suite:
npm test tests/auth.test.tspassed
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

