Skip to content

Surgical Patch

Fixes bugs with the smallest responsible change, plus targeted regression tests.

Stars
116,835
Licence
Apache-2.0
Files
2 files

What it does

When installed, this skill tells the AI agent to approach bug fixes and small behavior changes in a disciplined way. It asks the agent to reproduce the failure first if practical, trace the problem to the code that actually causes it, change only the narrowest layer responsible, and leave unrelated behavior and the user's own edits alone. It also discourages unnecessary cleanup or renaming and asks for only the tests needed to prove the fix works.

Great for

  • Developers who want small, focused bug fixes instead of sweeping refactors
  • Teams that value regression tests tied to the specific change
  • Maintainers reviewing AI-generated patches who want minimal diffs

Skip it if

  • Large feature work or architectural redesigns, where broader changes are expected (the skill intentionally limits scope)
  • Projects with no test suite or build commands, since the skill relies on running existing checks and the agent may not know how to run them

Try asking

  • “Fix the off-by-one error in the pagination helper and add a regression test for it”
  • “The discount is applied twice on checkout when a coupon is used; find the cause and patch it narrowly”
  • “Change the default timeout for the payment client without touching other HTTP behavior”
Step-by-step guide: how to use Surgical PatchInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 2 original files, the Apache-2.0 licence and an attribution note.

    surgical-patch.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip surgical-patch.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip surgical-patch.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Describe the symptom and, if you have one, the failing input or error message so the agent can reproduce it
  • Point the agent to the test command for your project so it can run the focused proof and nearest gate
  • Review the diff afterward, since the agent still decides what counts as the responsible layer

What's inside

  • agents/openai.yaml
  • SKILL.md

Redistributed unmodified from JuliusBrussee/caveman under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.