Minimal-Diff Bug Fixes and Scoped Code Changes

Bug fixes and code changes with a checkable success condition, root-cause trace, minimal diff, and a line-by-line scope audit.

Development / Engineeringminimal-diffbug-fixing
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Refactor our authentication layer from basic sessions to JWTs.”
Beforegeneric AI agent
Okay, so you need to move to JWTs. That makes sense. JWTs are pretty popular for modern auth systems. I think the approach would be to create new JWT-issuing endpoints, update your middleware to accept tokens, handle the payload parsing, add refresh-token logic, maybe set up expiration. You'd probably want to update your frontend to store tokens in localStorage or sessionStorage. There are also security considerations—you'll want HTTPS, secure cookies for refresh tokens, that kind of thing. I could help you think through the whole flow. Do you have any existing token infrastructure? What framework are you using?
Afterwith Minimal-Diff Bug Fixes and Scoped Code Changes
PHASE ZERO: DEFINE SUCCESS BEFORE TOUCHING CODE
✓ What will 'done' look like? Token strategy accepted by security review. Client/server tests passing. Legacy sessions coexisting 2 weeks. Rollback plan documented.
✓ What will break? Old mobile clients, server-side session validation, existing middleware assumptions.
✓ Simplest path? Dual-auth (accept both JWT and session) during transition. No parallel infrastructure. No refresh-token dance until v2.

PHASE ONE: SURGICAL SCOPE
→ Commit: JWT issue endpoint + middleware validation. DO NOT touch: password reset, 2FA, role checks yet. Those stay in session.
→ Change only: auth.ts (add JWT issuer), middleware.ts (add JWT parser), 2 test files.
→ Avoid trap: shaving the entire auth yak. Keep sessions working.

PHASE TWO: TEST THEN PATCH
→ Reproduce: POST /auth/token with valid creds → expect JWT. Parse token in middleware.
→ Isolate: Does payload round-trip? Is exp honored? Does malformed token reject cleanly?
→ Hypothesis: Legacy refresh-token expiry logic will collide (delete it in phase 2).
→ Patch only: the identified collision. Nothing more.

About this skill

You asked for a one-line fix and got a 300-line diff. Your imports got reordered, variables got renamed, and a new helper class appeared. The actual bug was patched where it crashed, not where it started. This skill makes Claude decide what "done" means before it edits, change only what that requires, and show you which goal each changed line serves.

What it does

  • Writes a checkable success condition and a "must not change" line before any edit
  • Traces the bad value back to where it starts, and fixes it there instead of scattering guards at the crash site
  • Ranks candidate fixes from smallest to largest and needs a stated reason to pick a bigger one
  • Sets a size budget up front and stops to re-plan if the change runs far past it
  • Checks every hunk of the diff against the goal and moves drive-by changes to an "out of scope" list
  • Says plainly whether a fix was actually run, and gives the test or command that confirms it

What you get

A short answer for each change: the goal, the cause with a confidence level, a minimal diff, why the fix belongs there, how to verify it, and a list of things it noticed but deliberately left alone.

Best for

Developers working in existing codebases with Claude Code or Claude who are tired of scope creep, symptom patches, and "this should work" claims. Also useful for anyone reviewing AI-generated diffs before merging.

SKILL.md preview

SKILL.md
---
name: minimal-diff-bug-fixes-scoped-changes
description: Makes code changes that are scoped, root-caused, and verifiable. It states a checkable success condition before editing, traces the bug to where the bad state starts, picks the smallest change that meets the condition, touches only the responsible lines, then checks each hunk of the diff against the goal. Use when the user says "just fix this bug", "make the smallest possible change", "don't touch anything else", "Claude keeps rewriting my whole file", "it refactored stuff I didn't ask for", "this fix broke something unrelated", "why is the diff 400 lines for a one-line bug".
---

# Minimal-Diff Bug Fixes and Scoped Code Changes

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →