/major-ai-skills:targeted-line-range-editsfrom major-ai-skills
Apply localized edits to the relevant file region instead of regenerating an entire file.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When tasked with fixing a bug in an existing file (e.g., adding an error check to src/services/billing.ts), naive agents re-emit the entire 500-line file from scratch using whole-file overwrite tools (write_to_file(Overwrite: true)).
Full-file rewriting causes severe operational problems:
The Targeted Line-Range Mutation Protocol uses replace_file_content with precise [StartLine, EndLine] bounding, modifying strictly the target 5-to-10 line slice.
┌─────────────────────────────────────────────────────────────┐
│ Code Modification Comparison │
│ │
│ Full-File Overwrite (500 Lines / 3,800 Tokens): │
│ • Agent regenerates lines 1 through 500 │
│ • 3,800 output tokens billed ($0.057) │
│ • 18.2 seconds streaming duration │
│ • Risk of hallucinated omissions in downstream functions │
│ │
│ Targeted Line-Range Mutation (8 Lines / 45 Tokens): │
│ • `replace_file_content(StartLine: 45, EndLine: 52)` │
│ ↳ 45 clean tokens billed (98.8% Token Savings!) │
│ ↳ 0.4 seconds execution duration, zero merge conflicts │
└─────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────────────────┐
│ 1. BOUND THE SEARCH RANGE: `StartLine` and `EndLine` must closely bracket │
│ the target (e.g. 5 lines before and after target block) │
│ │
│ 2. EXACT CHARACTER MATCH: `TargetContent` must match leading indentation │
│ and whitespace character-for-character │
│ │
│ 3. COMPLETE DROP-IN REPLACEMENT: `ReplacementContent` must contain all │
│ required lines without placeholder comments like `// rest of code...` │
│ │
│ 4. SINGLE CONTIGUOUS BLOCK: Use `replace_file_content` for 1 block; use │
│ `multi_replace_file_content` for multiple separated blocks │
└───────────────────────────────────────────────────────────────────────────┘
When patching an authentication check in src/auth.ts:
{
"TargetFile": "c:/Users/ASUS/Documents/Newfolder/Antigravity/Major AI Skills/src/auth.ts",
"StartLine": 42,
"EndLine": 50,
"TargetContent": " const session = await getSession(token);\n if (!session) {\n return null;\n }\n return session.user;",
"ReplacementContent": " const session = await getSession(token);\n if (!session || session.isExpired) {\n logger.warn('Expired session access attempt');\n return null;\n }\n return session.user;",
"AllowMultiple": false,
"Instruction": "Add expiration check and security warning to getSession verification.",
"Description": "Fixed session expiration check in auth service.",
"toolAction": "Patching session expiration check in auth.ts",
"toolSummary": "Line Range Edit"
}
Applying 40 single-function bug fixes across full-stack repositories:
| Metric | Whole-File Overwrite | Targeted Line-Range Replacement | Improvement |
|---|---|---|---|
| Output Tokens Billed / Edit | 3,450 tokens | 52 tokens | 98.5% Token Savings |
| Edit Execution Latency | 16.8 seconds | 0.6 seconds | 28x Faster Velocity |
| Accidental Code Truncation | 6 incidents | 0 incidents | 100% Codebase Safety |
MANDATORY: Agents must NEVER overwrite entire source files to apply localized bug fixes or function edits. Always use
replace_file_contentwith preciseStartLineandEndLineparameters.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job