lsp-refactor

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

A complete workflow for changing code safely: it studies affected code, previews the edit, applies it, checks the build, and runs related tests.

In plain words
What is it for?
Use it for planned changes to a symbol or file, such as renaming code or adding a function parameter. It requires an LSP server.
Why use it?
It shows the likely impact of a refactor and verifies that the change did not introduce build or test failures.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it for planned changes to a symbol or file, such as renaming code or adding a function parameter. It requires an LSP server.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/blackwell-systems/agent-lsp/lsp-refactor
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-refactor
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-refactor

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/blackwell-systems/agent-lsp/lsp-refactor"><img src="https://agentmods.dev/badge/skills/blackwell-systems/agent-lsp/lsp-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,881 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.00057 $0.02881
Opus 5.5 $0.00023 $0.01152
Sonnet 5.5 $0.00011 $0.00576
Haiku 4.5 $0.00006 $0.00288

Measured 1mo ago against content hash b734df40fcc6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

lsp-refactor 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 1mo 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/lsp-refactor/SKILL.md · 368 lines

How it starts

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

Requires the agent-lsp MCP server.

lsp-refactor

End-to-end safe refactor workflow. Sequences blast-radius analysis, speculative preview, disk apply, build verification, and targeted test execution in one coordinated pass.

This skill does NOT replace lsp-safe-edit or lsp-impact.

  • lsp-safe-edit wraps a single edit with before/after diagnostic comparison — use it when you need to make one targeted change with careful error diffing.
  • lsp-impact is read-only blast-radius analysis — use it when you want to understand scope before deciding whether to proceed.
  • lsp-refactor sequences ALL four workflows (lsp-impact → lsp-safe-edit → lsp-verify → lsp-test-correlation) in order. Use it when you know your target and intent up front and want the complete workflow without switching skills.

Input

  • target: symbol name in dot notation (e.g. "codec.Encode", "Buffer.Reset") OR file path (e.g. "internal/lsp/client.go")
  • intent: description of the change to make (e.g. "rename to ParseConfigV2", "add a second parameter timeout time.Duration")
  • workspace_root: absolute path to the workspace root

Phase 1 — Blast-Radius Analysis (inlined from lsp-impact)

This phase is mandatory. Do not skip it, even for "small" refactors.

Call mcp__lsp__blast_radius with changed_files set to the file containing the target symbol. If the user provided a file path directly, use it. If the user provided a symbol name, resolve the file first (e.g. via mcp__lsp__go_to_symbol).

mcp__lsp__blast_radius({
  "changed_files": ["/abs/path/to/file"],
  "include_transitive": false
})

Returns:

  • affected_symbols — exported symbols with reference counts
  • test_callers — test files and enclosing test function names
  • non_test_callers — production call sites

Display:

  • Affected symbol count
  • Test callers (each with enclosing test function name)
  • Non-test callers (each with file:line)
  • Total reference count

High blast-radius gate: If the total reference count exceeds 20, STOP and ask the user to confirm before continuing:

Read the full file on GitHub · 368 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. 1mo ago First seen · 368 lines · 57 tokens per session scan A b734df40fcc6

Subscribe to this mod's changes

lsp-refactor is a skill published in the GitHub repository blackwell-systems/agent-lsp (164 stars, last pushed today), licensed MIT. It adds 57 tokens to every session and 2,881 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-30.

Related

Other skills, from other repositories