lsp-refactor

lsp-refactor is a skill for Claude Code from OKHP3/skillz. It costs 57 tokens per session (2,881 once invoked), scanned A, a copy of lsp-refactor, MIT.

A coordinated workflow for safely refactoring code: first examining affected code, then applying an edit, checking the build, and running related tests. Refactoring changes code structure without intending to change its behaviour.

In plain words
What is it for?
Use it for planned symbol or file refactors when you want impact analysis, a controlled edit, build verification, and focused test execution.
Why use it?
It reduces the risk of hidden breakage when renaming symbols or changing their parameters. The workflow checks the likely impact, diagnostics, compilation, and affected tests.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it for planned symbol or file refactors when you want impact analysis, a controlled edit, build verification, and focused test execution.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/okhp3/skillz/lsp-refactor
View source ↗ OKHP3/skillz
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 OKHP3/skillz --skill lsp-refactor
Clone the repo
git clone --depth 1 https://github.com/OKHP3/skillz

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/okhp3/skillz/lsp-refactor.svg)](https://agentmods.dev/skills/okhp3/skillz/lsp-refactor)
Your own site
<a href="https://agentmods.dev/skills/okhp3/skillz/lsp-refactor"><img src="https://agentmods.dev/badge/skills/okhp3/skillz/lsp-refactor.svg" alt="Measured on agentmods" 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.
Origin 100% copy Near-identical to another mod 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 $0.00028 $0.01440
Sonnet 5 $0.00011 $0.00576
Haiku 4.5 $0.00006 $0.00288

Measured 4d ago against content hash b734df40fcc6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 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.

Origin

This is a copy

100% identical to lsp-refactor — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

community/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. 4d 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 OKHP3/skillz (3 stars, last pushed today), licensed MIT. It adds 57 tokens to every session and 2,881 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to lsp-refactor, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

verify

Verify Elixir/Phoenix changes — compile, format, and test in one loop. Use after implementation, before PRs, or after fixing bugs.

oliver-kriska/claude-elixir-phoenix · 33 tokens

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

jamditis/claude-skills-journalism · 21 tokens

test-first-bugs

Enforces a test-driven bug-fixing workflow. Use when a user reports a bug, failing code, an error, or asks to fix something.

jamditis/claude-skills-journalism · 35 tokens

java-code-review

Review Java code for bugs, duplicate code, correctness risks, maintainability improvements, and missing tests. By default review files modified in git; when the user explicitly names files, classes, packages, or a diff, review that scope instead. Generate a detailed review.md report with actionable comments and fixes.

sivaprasadreddy/sivalabs-agent-skills · 64 tokens

regression-root-cause-analyzer

Locate root causes of failing regression tests by analyzing code changes, error messages, and test dependencies. Use when regression tests start failing after code changes, investigating test failures in CI/CD, debugging flaky tests, or understanding why previously passing tests now fail. Analyzes git diffs, stack…

ArabelaTso/Skills-4-SE · 109 tokens

symbolic-execution-assistant

Performs symbolic execution to detect potential errors by exploring execution paths, solving path constraints, and generating test inputs. Use when you need to analyze code for bugs like null dereferences, division by zero, buffer overflows, or assertion violations. Also use to generate test inputs that exercise…

ArabelaTso/Skills-4-SE · 111 tokens