edit-file-usage

edit-file-usage is a skill for Claude Code, Codex from sharpninja/McpServer. It costs 44 tokens per session (1,238 once invoked), scanned A, original, Apache-2.0.

A tool for changing a specific part of an existing repository file by replacing an exact piece of text.

In plain words
What is it for?
It helps update one function, setting, or named piece of code while leaving the rest of the file unchanged.
Why use it?
It avoids rewriting the whole file when only a small, known change is needed, while checking that the edit stays within allowed paths and can be rolled back.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps update one function, setting, or named piece of code while leaving the rest of the file unchanged.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sharpninja/mcpserver/edit-file-usage
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 sharpninja/McpServer --skill edit-file-usage
Clone the repo
git clone --depth 1 https://github.com/sharpninja/McpServer

Made for: Claude Code, Codex.

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 edit-file-usage

README.md
[![agentmods](https://agentmods.dev/badge/skills/sharpninja/mcpserver/edit-file-usage/github.svg)](https://agentmods.dev/skills/sharpninja/mcpserver/edit-file-usage)
Your own site
<a href="https://agentmods.dev/skills/sharpninja/mcpserver/edit-file-usage"><img src="https://agentmods.dev/badge/skills/sharpninja/mcpserver/edit-file-usage/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for edit-file-usage

Your own site · 80×15
<a href="https://agentmods.dev/skills/sharpninja/mcpserver/edit-file-usage"><img src="https://agentmods.dev/badge/skills/sharpninja/mcpserver/edit-file-usage.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,238 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.00044 $0.01238
Opus 5.5 $0.00018 $0.00495
Sonnet 5.5 $0.00009 $0.00248
Haiku 4.5 $0.00004 $0.00124

Measured 4d ago against content hash 8cc3a39175fa, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

edit-file-usage 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 4d 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/edit-file-usage/SKILL.md · 90 lines

How it starts

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

edit_file Usage

The QBAgent edit_file tool performs a surgical, in-place change to a single file by replacing an exact oldString with a newString. Edits are not raw filesystem writes: they route through the QBrain.AI RepoFileService (interface IRepoFileService, src/QBrainAi.Services/Services/RepoFileService.cs) and are wrapped by TransactionGatedRepoFileService (src/QBrainAi.Support.Mcp/Services/TransactionGatedRepoFileService.cs), which enforces the path allowlist (FR-SUPPORT-010, TR-PLANNED-CORE-013) and transactional rollback compensation via IRepoFileCompensation (TR-MCP-TXN-001).

When to Use

  • Changing a known region of an existing file: one function, one config key, a few lines.
  • Renaming or retargeting a symbol where you can pin a unique surrounding context.
  • Any edit where most of the file should stay byte-for-byte unchanged.

When Not to Use

  • Creating a brand new file, or replacing essentially all of a file's content: use write_file (backed by RepoFileService.WriteAsync) instead.
  • The target path is outside the workspace allowlist: the write will be rejected.
  • You cannot read the file first to obtain an exact oldString. Never guess at content.

Inputs

  • filePath (or relativePath): path to the existing file, relative to the repo root.
  • oldString: exact text to find, including original indentation and line breaks.
  • newString: replacement text. Must differ from oldString.
  • replaceAll (optional, default false): replace every occurrence instead of one.
  • expectedOccurrences (optional): assert the number of matches before applying; the edit fails if the actual count differs. Use this as a guard when replaceAll is true.

Critical Rules

  • Read the file first. oldString must match the on-disk bytes exactly, including leading whitespace. Strip any line-number or cat -n prefixes before matching.
  • oldString must be unique within the file unless replaceAll is set. A non-unique oldString without replaceAll is an error; widen the surrounding context to a unique span rather than forcing it.
  • oldString and newString must differ. A no-op edit is an error.
  • Prefer edit_file over write_file for partial changes. Rewriting a whole file discards unrelated content, defeats the diff, and risks clobbering concurrent edits.
  • Edits are transactional. On a failed turn transaction, IRepoFileCompensation restores the prior file state, so a rejected edit leaves the file unchanged. Do not add your own manual rollback logic.
  • Do not chase path-safety or rollback yourself: the server owns both. Treat a rejected edit as a signal to fix the path or the oldString, not to retry blindly.

Read the full file on GitHub · 90 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. 4d ago Changed 8cc3a39175fa
  2. 1mo ago First seen · 90 lines · 44 tokens per session scan A ce0aac1cdfa5

Subscribe to this mod's changes

edit-file-usage is a skill published in the GitHub repository sharpninja/McpServer (4 stars, last pushed today), licensed Apache-2.0. It adds 44 tokens to every session and 1,238 once invoked, about $0.0002 per session on Opus 5.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.

Related

Other skills, from other repositories

omh-code-review

This is an OMH code-review workflow skill, projected for Agent Skills hosts (Claude Code, Codex, Cursor, opencode, OpenClaw, pi).

rlaope/oh-my-hermes · 48 tokens

omh-rust

This is an OMH rust workflow skill, projected for Agent Skills hosts (Claude Code, Codex, Cursor, opencode, OpenClaw, pi).

rlaope/oh-my-hermes · 74 tokens

redteam-web-detail-pack

Routing and boundary guidance for authorized general web application security testing. Use as a web testing router when the attack surface should be dispatched to more specific web vulnerability skills.

Netw0rkNoob/VulnClaw · 38 tokens

android-pentest

A guide for authorized security testing of Android apps, covering APK inspection, runtime testing, traffic capture, code review, and function hooking. An APK is the installable package used by an Android app.

Netw0rkNoob/VulnClaw · 32 tokens

manage-schemas

Creates, views, edits, deletes, and validates note schemas for the MCP Task Orchestrator in .taskorchestrator/config.yaml — the templates that define which notes agents must fill at each workflow phase. Also recommends schema designs from a library of workflow patterns (autonomous coding loops, spec-driven teams…

jpicklyk/task-orchestrator · 212 tokens

lighting-report-extract

Check reported lighting quantities and results in supplied simulation PDFs without adding repeated calculation surfaces. Use for scoped luminaire inventories and illuminance results; not simulation or compliance.

AlpacaLabsLLC/skills-for-architects · 37 tokens