lsp-safe-edit

lsp-safe-edit is a skill for Claude Code from blackwell-systems/agent-lsp. It costs 59 tokens per session (2,509 once invoked), scanned A, original, MIT.

A code-editing workflow that compares programming-language diagnostics before and after a proposed change.

In plain words
What is it for?
Use it for single- or multi-file edits, previewing changes, applying them when the error change is acceptable, and reviewing available quick fixes.
Why use it?
It helps catch new errors caused by an edit and distinguishes them from problems that already existed.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it for single- or multi-file edits, previewing changes, applying them when the error change is acceptable, and reviewing available quick fixes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/blackwell-systems/agent-lsp/lsp-safe-edit
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 blackwell-systems/agent-lsp --skill lsp-safe-edit
Clone the repo
git clone --depth 1 https://github.com/blackwell-systems/agent-lsp

Made for: Claude Code.

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 lsp-safe-edit

README.md
[![agentmods](https://agentmods.dev/badge/skills/blackwell-systems/agent-lsp/lsp-safe-edit/github.svg)](https://agentmods.dev/skills/blackwell-systems/agent-lsp/lsp-safe-edit)
Your own site
<a href="https://agentmods.dev/skills/blackwell-systems/agent-lsp/lsp-safe-edit"><img src="https://agentmods.dev/badge/skills/blackwell-systems/agent-lsp/lsp-safe-edit/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 lsp-safe-edit

Your own site · 80×15
<a href="https://agentmods.dev/skills/blackwell-systems/agent-lsp/lsp-safe-edit"><img src="https://agentmods.dev/badge/skills/blackwell-systems/agent-lsp/lsp-safe-edit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,509 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00059 $0.02509
Opus 5 $0.00030 $0.01255
Sonnet 5 $0.00012 $0.00502
Haiku 4.5 $0.00006 $0.00251

Measured 9d ago against content hash 6af294acfa96, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

lsp-safe-edit 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 9d 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/lsp-safe-edit/SKILL.md · 315 lines

How it starts

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

Requires the agent-lsp MCP server.

lsp-safe-edit

Wrap any code edit with a before/after diagnostic comparison. Speculatively previews the change in-memory before touching disk, then diffs errors introduced vs. resolved after applying. If errors appear, surfaces code actions to fix them.

Prerequisites

LSP must be running for the target workspace. If not yet initialized, call mcp__lsp__start_lsp with the workspace root before proceeding.

Auto-init note: agent-lsp supports workspace auto-inference from file paths. Explicit start_lsp is only needed when switching workspace roots.

Input

  • target file(s): One or more files to be edited (absolute paths).
  • description of change: What you intend to edit and why.

Workflow

Step 1 — Open target file(s)

Call mcp__lsp__open_document for each file that will be edited:

mcp__lsp__open_document(file_path: "/abs/path/to/file.go", language_id: "go")

Step 2 — Capture baseline diagnostics (BEFORE)

Call mcp__lsp__get_diagnostics for each target file. Store as BEFORE. For multi-file edits, collect diagnostics for all files involved.

BEFORE = mcp__lsp__get_diagnostics(file_path: "/abs/path/to/file.go")

If the server returns an empty list immediately after open, wait briefly and retry — LSP analysis is async.

Step 3 — Speculative preview (preview_edit)

Before touching disk, call mcp__lsp__preview_edit to preview the error delta of the intended change:

mcp__lsp__preview_edit(
  file_path: "/abs/path/to/file.go",
  start_line: <N>,
  start_column: <col>,
  end_line: <N>,
  end_column: <col>,
  new_text: "<replacement text>"
)

Returns net_delta (new errors introduced minus errors resolved) without writing to disk.

Decision:

net_delta Action
≤ 0 Proceed — edit improves or does not worsen error state
> 0 Pause. Report introduced errors to user and ask: "Proceed anyway? [y/n]"

If net_delta > 0 and user says "n", stop. Do not apply the edit.

Read the full file on GitHub · 315 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 9d ago First seen · 315 lines · 59 tokens per session scan A 6af294acfa96

Subscribe to this mod's changes

lsp-safe-edit is a skill published in the GitHub repository blackwell-systems/agent-lsp (123 stars, last pushed today), licensed MIT. It adds 59 tokens to every session and 2,509 once invoked, about $0.0003 per session on Opus 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-30.

Related

Other skills, from other repositories

trace-mcp

Use trace-mcp tools for code navigation, impact analysis, and framework-aware queries instead of Read/Grep/Glob/Bash. Activate whenever the agent needs to explore, understand, or modify a codebase that has trace-mcp indexed.

nikolai-vysotskyi/trace-mcp · 52 tokens

dead-code-cleanup

Use when the user asks about cleanup, removing unused code, refactoring, reducing bundle size, or identifying dead code in a Repowise-indexed codebase (.repowise/ directory exists). Also activates when discussing technical debt, code hygiene, or repository maintenance.

repowise-dev/repowise · 59 tokens

authoring-smell-rules

Add a findsmells rule to mache — a SQL query over the projected code graph that surfaces a code smell (duplication, complexity, dead code, drift). Use when adding or debugging a SmellRule in cmd/smellrules.go or an external $MACHESMELLRULESDIR rule. Covers the SmellRule struct, the standalone-vs-ast table capability…

agentic-research/mache · 102 tokens

m1nd-first

Use when investigating a repository, searching for implementation, reviewing changes, working from specs/docs, or preparing a risky code change in an environment where m1nd is available. This doctrine makes m1nd the first investigative layer before grep, glob, or manual file reads, except when the task is pure…

maxkle1nz/m1nd · 78 tokens

Sverklo Code Intelligence

Gives you deep codebase understanding — semantic search, blast-radius analysis, PR review, and health audits.

sverklo/sverklo · 27 tokens

analyze-usage

Use when asked to analyze codescout tool usage, check for error patterns, audit tool health, generate a usage report, spot anti-patterns, or clear usage statistics to start fresh.

mareurs/codescout · 42 tokens