surgical-patch

Fix bugs by changing the narrowest responsible code layer with regression proof.

Updated Aug 20, 2026
One-click install
npx skills add https://github.com/bittlinkm/claude-setup --skill surgical-patch-bittlinkm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: surgical-patch
Source: https://github.com/bittlinkm/claude-setup/tree/main/skills/surgical-patch
Command: npx skills add https://github.com/bittlinkm/claude-setup --skill surgical-patch-bittlinkm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Bug fixes often balloon into unrelated refactors, renames, and cleanups that introduce new regressions and make reviews painful. This Skill enforces a disciplined patching workflow that isolates the root cause, changes only the layer that owns the incorrect behavior, and proves the fix with focused tests. ## Core Features & Use Cases - Root-cause tracing: Reproduce the failure first when economical, or capture the strongest available evidence, then trace the symptom to the responsible mechanism. - Minimal-change discipline: Modify only the narrowest layer that owns the bug while preserving unrelated behavior and existing user changes. - Regression proof: Add only task-relevant regression tests, then run the focused proof plus the nearest affected gate before stopping. - Use Case: A user reports that date parsing breaks on leap years. Instead of refactoring the date module, the Skill reproduces the failure, patches the single function responsible, adds one regression test for February 29, and runs the nearest test suite. ## Quick Start Use the surgical-patch skill to fix this bug with a narrow verified change and a regression test.

Frequently Asked Questions about surgical-patch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a bug without breaking unrelated code?

Trace the symptom to the mechanism that owns the incorrect behavior, then change only that narrowest responsible layer. Avoid cleanup, renaming, and abstraction outside the fix, and add a regression test that proves the specific failure is resolved.

What is a surgical patch approach to bug fixing?

A surgical patch reproduces the failure first, isolates the root cause, and changes only the code layer responsible for the defect. It preserves surrounding behavior and user changes, then validates the fix with focused regression proof plus the nearest affected test gate.

When should I reproduce a bug before fixing it?

Reproduce the failure first whenever it is economical to do so, since a reproduction confirms the root cause and becomes the basis of regression proof. When reproduction is too costly, capture the strongest available evidence such as logs or failing test output instead.

When is a minimal patch the wrong approach?

A minimal patch is wrong when the defect stems from a systemic design flaw affecting many layers, where a narrow fix would only mask symptoms. In those cases a broader refactor or redesign is more appropriate than a localized change.

How many tests should a bug fix include?

Add only regression proof relevant to the task, typically one focused test that fails before the fix and passes after. Then run the nearest affected test gate to confirm surrounding behavior remains intact.