Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    surgical editing

    1

    Atomic, multi-file text replacements using the Surgical Editing MCP server for precise, transactional code refactoring.

    Free

    Security scanned
    surgical editing

    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

    1. Apply these changes by running the command with "dry_run": false.
    2. Run npm test to ensure the rename didn't break any external consumers.
    3. Check src/config.ts if 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

    1. Target Identification involves reading the target files to copy the exact snippets for the find parameter.
    2. Batch Construction groups related edits into a single operations list, covering multiple files and replacements.
    3. Dry Run executes the transaction with dry_run: true to verify the resulting diffs without modifying files.
    4. Commit sends the verified request to the MCP server to apply all changes simultaneously.
    5. 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.ts and server.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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Network Access
    Listedtoday

    What's inside

    Frequently Asked Questions

    Standard AI edits often fail mid-way or hallucinate whitespace; this skill uses an MCP server to enforce 'all-or-nothing' transactions, ensuring your codebase never ends up in a partially broken state during multi-file refactors.

    The skill requires Node.js 22+ and works with any MCP-compatible environment, including Claude Desktop, Cursor, and Claude Code.

    No, this skill is strictly for precise text replacement within existing files; it currently does not support creating, deleting, or moving files to maintain its focus on atomic code consistency.

    If a snippet isn't an exact match, the tool provides specific line-level feedback and similarity percentages, allowing the agent to adjust its 'find' parameter for a successful match without guessing.

    By using the `dry_run` parameter, you can preview all planned changes across your files and verify the diffs before any modifications are actually written to your disk.

    New in LLM Ops

    Free