agentleFS
fbsmna-coderfbsmna-coder/karpathy-pro-max/skills/surgical-edits/SKILL.md

surgical-edits

Skill0 starsChanged 8 months agoMITView on GitHub

Touch only what the request requires. Use when editing existing code to prevent scope creep, accidental refactors, formatting drift, and changes to code you do not understand.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you cannot point at the request and say "this line exists because of *that*," delete the change before committing.

    line 15
  2. Distinctive:

    Import order, even if it's "wrong."

    line 20
  3. Distinctive:

    When your changes orphan something, clean up:

    line 28
  4. Very specific:

    If the file uses snake_case and you add camelCase, you have made the codebase worse, not better — even if camelCase is "correct" in some …

    line 39
  5. Distinctive:

    If you notice something that should be changed but is outside scope:

    line 43
  6. Distinctive:

    Do not change it.

    line 45
  7. Distinctive:

    Do not file an issue for it unless asked.

    line 46

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Surgical Edits

LLMs drift. While editing one function, they "improve" the import order, reformat a nearby block, rename a variable that bothered them, and change a comment they didn't fully understand. Each of these is a separate change the user did not ask for, and each one is a place a regression can hide.

The rule

Every changed line must trace directly to the user's request.

If you cannot point at the request and say "this line exists because of that," delete the change before committing.

What to NOT touch

  • Formatting / whitespace in code you didn't need to modify.
  • Import order, even if it's "wrong."
  • Variable names in adjacent functions, even if they're inconsistent.
  • Comments you did not author, even if they look stale — you may not have the context to know if they're stale.
  • Dead code. Mention it. Do not delete it unless asked.
  • Style choices (single vs double quotes, trailing commas, etc.) that disagree with your preference but match the surrounding code.

What you SHOULD clean up

When your changes orphan something, clean up:

  • Imports that became unused because of YOUR changes.
  • Variables / parameters / functions that became unreferenced because of YOUR changes.
  • Tests that test removed behavior.

The distinction: pre-existing mess is not yours to fix. Mess you created is.

Style matching

Match the surrounding style even if you would do it differently. The codebase has one voice; do not introduce a second.

If the file uses snake_case and you add camelCase, you have made the codebase worse, not better — even if camelCase is "correct" in some abstract sense.

When to surface, not silently fix

If you notice something that should be changed but is outside scope:

  • Mention it in your end-of-task report.
  • Do not change it.
  • Do not file an issue for it unless asked.

Example

Bad:

User: "Fix the off-by-one in process_batch." Agent: fixes the off-by-one, also reformats 30 lines, renames i to index, adds 4 type hints, removes a comment that "looked stale," updates an unrelated import order.

Good:

User: "Fix the off-by-one in process_batch." Agent: changes one line. Reports: "Fixed. Note: noticed process_batch has no test for the empty-input case — leaving as-is per scope, flagging in case you want it added."

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.