Works with the AI Agents you already use
surgical editing
Atomic, multi-file text replacements using the Surgical Editing MCP server for precise, transactional code refactoring.
Free
surgical editing
Example session with this skill installed
Rename the apiKey field to serviceToken in src/auth.ts and src/client.ts as a single transaction. Make sure both update or neither does.
- Read your context and instructions
- Compiled the surgical editing
I have prepared the atomic transaction to rename apiKey to serviceToken across your authentication and client modules. I will perform a dry run first to verify the replacements.
Surgical Edit: Rename apiKey to serviceToken
{
"operations": [
{
"file_path": "src/auth.ts",
"replacements": [
{
"find": " private apiKey: string;",
"replace": " private serviceToken: string;"
},
{
"find": " this.apiKey = config.key;",
"replace": " this.serviceToken = config.key;"
}
]
},
{
"file_path": "src/client.ts",
"replacements": [
{
"find": "headers: { 'Authorization': `Bearer ${this.apiKey}` }",
"replace": "headers: { 'Authorization': `Bearer ${this.serviceToken}` }"
}
]
}
],
"dry_run": true
}
Dry run results:
src/auth.ts: 2 replacements successful.src/client.ts: 1 replacement successful.
The diff looks correct and maintains consistency between the class definition and the API caller.
Next steps
- Apply these changes by running the command with
"dry_run": false. - Run
npm testto ensure the rename didn't break any external consumers. - Check
src/config.tsif the configuration object also needs a corresponding field rename.
Connects securely to your tools. The creator never sees your data.
About this skill
Applying broad code changes across multiple files often leads to partial failures or "broken states" where one file updates but another fails. This skill manages atomic, transaction-based edits using the surgical_replace MCP tool to ensure your codebase stays consistent.
What it does
- Atomic transactions ensures that either every change in a multi-file batch succeeds or none are applied.
- Precision matching uses exact snippet replacement rather than fuzzy guessing to prevent accidental overwrites.
- Dry-run validation allows you to preview diffs across several files before committing changes to disk.
- Smart error recovery provides specific line-level feedback and similarity percentages when a match fails.
- Conflict detection identifies concurrent modifications or path changes that happen during a transaction.
How it works
- Target Identification involves reading the target files to copy the exact snippets for the
findparameter. - Batch Construction groups related edits into a single
operationslist, covering multiple files and replacements. - Dry Run executes the transaction with
dry_run: trueto verify the resulting diffs without modifying files. - Commit sends the verified request to the MCP server to apply all changes simultaneously.
- Verification uses the tool's contextual line output to confirm success without needing to re-read entire files.
Frameworks & tools
This skill requires the Surgical Editing MCP server running on Node.js 22 or later. It integrates with Claude Code, Cursor, Claude Desktop, and other MCP-compatible clients.
Why this beats prompting it yourself
Standard LLM file edits often hallucinate whitespace or fail when a project-wide rename hits a single locked file. This skill enforces strict transactionality and exact-match logic, preventing the "half-finished refactor" problem that breaks builds.
Use cases
- Multi-file refactoring like renaming a shared interface property across five different components.
- Coordinated config updates such as changing a port number in both
config.tsandserver.ts. - Atomic bug fixes where an import and its usage must be updated simultaneously to pass linting.
- Version bumps across multiple manifest or configuration files in a monorepo.
Known limitations
Does not support creating, deleting, or moving files. Refuses binary files, non-UTF-8 text, and files larger than configured server limits.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.
Cannot create, delete, or move files. Refuses binary files and non-UTF-8 text. Requires Node.js 22+ for the MCP server. Path traversal outside project root is blocked by default.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed today
- Free with an Agensi account
- Software
Node.js