surgical-edit

surgical-edit is a skill for Claude Code from lantisprime/claude-sdlc. It costs 115 tokens per session (755 once invoked), scanned A, original, MIT.

A rule set for making the smallest possible code change. It limits edits to the files and functions already approved in the work plan.

In plain words
What is it for?
Use it whenever you edit or write code and need a narrowly focused diff with unrelated issues recorded for later.
Why use it?
It prevents unrelated cleanup, accidental refactoring, and changes to nearby code that was not part of the task.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the sdlc-plugin plugin — 18 skills, 16 commands, 10 agents, 4 hooks shipped together

Good fit Use it whenever you edit or write code and need a narrowly focused diff with unrelated issues recorded for later.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lantisprime/claude-sdlc/surgical-edit
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add lantisprime/claude-sdlc --skill surgical-edit
Clone the repo
git clone --depth 1 https://github.com/lantisprime/claude-sdlc

Made for: Claude Code.

Or install sdlc-plugin, the plugin that ships this one along with the rest of its 18 skills, 16 commands, 10 agents, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for surgical-edit

README.md
[![agentmods](https://agentmods.dev/badge/skills/lantisprime/claude-sdlc/surgical-edit.svg)](https://agentmods.dev/skills/lantisprime/claude-sdlc/surgical-edit)
Your own site
<a href="https://agentmods.dev/skills/lantisprime/claude-sdlc/surgical-edit"><img src="https://agentmods.dev/badge/skills/lantisprime/claude-sdlc/surgical-edit.svg" alt="Measured on agentmods" height="20"></a>
Per session 115 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 755 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00115 $0.00755
Opus 5 $0.00057 $0.00378
Sonnet 5 $0.00023 $0.00151
Haiku 4.5 $0.00012 $0.00076

Measured 8d ago against content hash d96252b8027b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

surgical-edit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/surgical-edit/SKILL.md · 57 lines

How it starts

The opening of the file, as written. The whole thing — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Surgical Edit

Make the smallest possible diff that satisfies the approved plan.

The rules

  1. In-scope files only. Before any Edit/Write, read the plan's In-scope files list. If the target file isn't listed, stop and ask: "This file isn't in the plan. Extend scope, or is this the wrong file?"

  2. In-scope functions only. Before editing within a file, read the plan's In-scope functions list. Only modify functions on that list. Adjacent functions — even if they look wrong — must not be changed.

  3. No ambient cleanup. Do not reformat, rename, reorder imports, or tidy unrelated code. Even whitespace changes in unrelated regions pollute the diff.

  4. No speculative refactors. "This would be cleaner if…" belongs in a separate task. Write the idea to .claude/sdlc/followups/<task-slug>.md and move on.

  5. Unrelated bugs → follow-ups. Noticing a bug while working on something else is valuable. Fixing it in this change is not. Log it.

  6. Prefer edit over create. New files require justification: a new module, a new test file for a new function, a new template referenced by the plan. Otherwise, extend existing files.

  7. Match surrounding style. Indentation, naming, quote style, import order — mirror what's already there. This is not the place to introduce "better" conventions.

The scope-extension protocol

When you legitimately need a file or function not in the plan (you discovered something during implementation):

  1. Stop editing.
  2. Propose the extension: "The change requires modifying auth.py::refresh_token because validate_token depends on it. Extend scope?"
  3. Wait for human approval.
  4. Update the plan's in-scope list with the approved additions and a one-line reason.
  5. Resume.

This preserves discipline without blocking honest discovery.

Hooks that enforce this

  • hooks/diff-scope-check.sh — after each Edit/Write, runs git diff --name-only and flags any files not in the plan's in-scope list.
  • hooks/adjacent-function-detector.sh — after each Edit/Write, parses the diff's function-level hunks (via git diff function context or tree-sitter per config/tools.json) and flags any functions not in the plan's in-scope list.

Read the full file on GitHub · 57 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 57 lines · 115 tokens per session scan A d96252b8027b

Subscribe to this mod's changes

surgical-edit is a skill published in the GitHub repository lantisprime/claude-sdlc (3 stars, last pushed 4mo ago), licensed MIT. It adds 115 tokens to every session and 755 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.