ast-grep Structural Search
code-yeongyu/oh-my-openagent
Searches and rewrites code by syntax-tree shape across 25 languages with ast-grep, for codemods, structural queries and YAML lint rules, using a Python wrapper script.
End-to-end safe refactor workflow — blast-radius analysis, speculative preview, apply to disk, verify build, run affected tests.
$ npx skills add blackwell-systems/agent-lsp --skill lsp-refactor -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install blackwell-systems/agent-lsp lsp-refactor --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/blackwell-systems/agent-lsp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/lsp-refactor .claude/skills/lsp-refactor && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "lsp-refactor" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-refactor into .claude/skills/lsp-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-refactor", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-refactorType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add blackwell-systems/agent-lsp --skill lsp-refactor -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install blackwell-systems/agent-lsp lsp-refactor --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/blackwell-systems/agent-lsp.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/lsp-refactor .agents/skills/lsp-refactor && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "lsp-refactor" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-refactor into .agents/skills/lsp-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-refactor", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add blackwell-systems/agent-lsp --skill lsp-refactor -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install blackwell-systems/agent-lsp lsp-refactor --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/blackwell-systems/agent-lsp.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/lsp-refactor .cursor/skills/lsp-refactor && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "lsp-refactor" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-refactor into .cursor/skills/lsp-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-refactor", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/blackwell-systems/agent-lsp.git --path skills/lsp-refactor--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add blackwell-systems/agent-lsp --skill lsp-refactor -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install blackwell-systems/agent-lsp lsp-refactor --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/blackwell-systems/agent-lsp.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/lsp-refactor .gemini/skills/lsp-refactor && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "lsp-refactor" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-refactor into .gemini/skills/lsp-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-refactor", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install blackwell-systems/agent-lsp lsp-refactorInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add blackwell-systems/agent-lsp --skill lsp-refactor -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/blackwell-systems/agent-lsp.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/lsp-refactor .github/skills/lsp-refactor && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "lsp-refactor" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-refactor into .github/skills/lsp-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-refactor", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add blackwell-systems/agent-lsp --skill lsp-refactor -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install blackwell-systems/agent-lsp lsp-refactor --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/blackwell-systems/agent-lsp.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/lsp-refactor .opencode/skills/lsp-refactor && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "lsp-refactor" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-refactor into .opencode/skills/lsp-refactor/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-refactor", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
lsp-refactorEnd-to-end safe refactor workflow — blast-radius analysis, speculative preview, apply to disk, verify build, run affected tests.
Lsp Refactor is an agent skill from blackwell-systems/agent-lsp. End-to-end safe refactor workflow — blast-radius analysis, speculative preview, apply to disk, verify build, run affected tests. Inlines lsp-impact + lsp-safe-edit + lsp-verify + lsp-test-correlation into one coordinated sequence.
Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/patterns.md`). Compatibility notes: Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)
It sits in Development, covering Refactoring. It works with Model Context Protocol. The repository describes itself as: MCP server that orchestrates language servers into agent-native workflows. 65 tools, 30 CI-verified languages. The licence is MIT.
5 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 6fa5faf. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
mcp__lsp__blast_radiusmcp__lsp__preview_editmcp__lsp__simulate_chainmcp__lsp__get_diagnosticsmcp__lsp__run_buildmcp__lsp__run_testsmcp__lsp__get_tests_for_filemcp__lsp__apply_editmcp__lsp__replace_symbol_bodymcp__lsp__open_document…and 3 more on the same allowed-tools line.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)
From compatibility in the SKILL.md frontmatter.
Lsp Refactor loads about 2.8k tokens when it runs, and up to ~3.3k if it reads all its reference files. Until then it costs about 61 tokens; SKILL.md has 707 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from blackwell-systems/agent-lsp at commit 6fa5faf, republished under its MIT licence (© blackwell-systems). 707 words, ~2,756 tokens.
.claude/skills/lsp-refactor/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.Requires the agent-lsp MCP server.
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."codec.Encode", "Buffer.Reset")
OR file path (e.g. "internal/lsp/client.go")timeout time.Duration")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 countstest_callers — test files and enclosing test function namesnon_test_callers — production call sitesDisplay:
High blast-radius gate: If the total reference count exceeds 20, STOP and ask the user to confirm before continuing:
High blast radius: N callers found. Proceed with refactor? [y/n]If the user answers "n", abort. Do not proceed to Phase 2.
Only reached if Phase 1 blast radius is acceptable (≤ 20 callers, or user confirmed).
mcp__lsp__open_document({ "file_path": "/abs/path/to/file", "language_id": "go" })
mcp__lsp__get_diagnostics({ "file_path": "/abs/path/to/file" })Store baseline diagnostics as BEFORE.
For a single-file change: use preview_edit:
mcp__lsp__preview_edit({
"file_path": "/abs/path/to/file",
"start_line": <N>,
"start_column": <col>,
"end_line": <N>,
"end_column": <col>,
"new_text": "<replacement text>"
})For a multi-file change (e.g. rename + call site updates): use simulate_chain:
mcp__lsp__simulate_chain({
"workspace_root": "/abs/path/to/workspace",
"language": "go",
"edits": [
{
"file_path": "/abs/path/to/file.go",
"start_line": <N>, "start_column": <col>,
"end_line": <N>, "end_column": <col>,
"new_text": "<replacement>"
}
// additional dependent edits ...
]
})Display the speculative result using the Diagnostic Diff Output Format from references/patterns.md.
Decision:
net_delta | Action |
|---|---|
| ≤ 0 | Safe. Proceed to Phase 3. |
| > 0 | Abort. Report introduced errors. Do NOT apply to disk. |
If net_delta > 0, stop and show the full list of errors the simulation
introduced. Do not proceed to Phase 3.
Only reached if Phase 2 net_delta <= 0.
Apply the change using the Edit or Write tool. When the edit targets a complete
function or method body, mcp__lsp__replace_symbol_body is an alternative that
resolves the symbol by name and replaces its full range without position math:
mcp__lsp__replace_symbol_body({
"file_path": "/abs/path/to/file",
"symbol_path": "Package.Function",
"new_body": "func Function() error {\n\treturn nil\n}"
})For edits computed by simulation, mcp__lsp__apply_edit may be used directly if
the simulation returned an edit object:
Edit(file_path: "/abs/path/to/file", old_string: "...", new_string: "...")For multi-file changes, apply each file's edits before moving to Phase 4. If any individual apply fails, stop and report before applying remaining files.
After applying, format the changed file(s):
mcp__lsp__format_document({ "file_path": "/abs/path/to/file" })Apply the returned TextEdit[] via mcp__lsp__apply_edit if non-empty.
Run in this order — LSP diagnostics first, then the compiler build:
mcp__lsp__get_diagnostics({ "file_path": "/abs/path/to/file" })
mcp__lsp__run_build({ "workspace_root": "/abs/path/to/workspace" })Decision:
| Result | Action |
|---|---|
| Diagnostics clean, build passes | Proceed to Phase 5. |
| Diagnostics show new errors | Display errors and stop. Do not proceed to Phase 5. |
| Build fails | Display build output and stop. Do not proceed to Phase 5. |
If build fails, report the full build error output and stop. Test execution is skipped until build passes.
For each file changed in Phase 3, find correlated test files:
mcp__lsp__get_tests_for_file({ "file_path": "/abs/path/to/changed/file" })Deduplicate the resulting test files if multiple source files were changed. Run only the correlated test files:
mcp__lsp__run_tests({ "workspace_root": "/abs/path/to/workspace", "test_files": [...] })If no correlated test files are found: note "No test correlation found —
run full suite manually to confirm." Do not attempt to run ./... automatically.
The following conditions abort the workflow immediately. Each abort displays the relevant output before stopping.
net_delta > 0 (simulation introduced errors) → abort, show errorsAfter completing all phases, produce this structured report:
## lsp-refactor Complete
### Phase 1 — Blast Radius
Affected symbols: N
Test callers: M (list each with enclosing test function)
Non-test callers: K
### Phase 2 — Speculative Preview
[Diagnostic Diff Output Format from patterns.md]
net_delta: 0 → safe to apply
### Phase 3 — Applied
Files changed: [list]
### Phase 4 — Build Verification
Diagnostics: N errors (0 new)
Build: PASS
### Phase 5 — Test Results
Test files run: [list]
Result: PASS / FAILIf the workflow aborted at a phase, report only the phases completed and the abort reason:
## lsp-refactor Aborted at Phase 2
### Phase 1 — Blast Radius
...
### Phase 2 — Speculative Preview
ABORTED: net_delta: +2 (errors introduced)
Errors:
- file.go:34 — undefined: NewType
- file.go:51 — cannot use int as stringGoal: rename exported function ParseConfig → ParseConfigV2 in pkg/config
Phase 1 — Blast Radius
blast_radius(changed_files=["pkg/config/parser.go"])
→ affected_symbols: 1 (ParseConfig)
→ non_test_callers: 3 (cmd/main.go, internal/app.go, internal/loader.go)
→ test_callers: 1 (pkg/config/parser_test.go — TestParseConfig)
→ total references: 4 — within threshold, proceeding
Phase 2 — Speculative Preview
open_document(file_path="pkg/config/parser.go")
get_diagnostics → BEFORE: 0 errors
simulate_chain(edits: [parser.go rename + 3 call-site updates])
→ cumulative_delta: 0 → safe to apply
Phase 3 — Applied
Edit parser.go: func ParseConfig → func ParseConfigV2
Edit cmd/main.go, internal/app.go, internal/loader.go: update call sites
format_document(parser.go)
Phase 4 — Build Verification
get_diagnostics → 0 errors
run_build → success
Phase 5 — Test Results
get_tests_for_file(parser.go) → pkg/config/parser_test.go
run_tests(test_files=["pkg/config/parser_test.go"]) → PASS
## lsp-refactor Complete
...© blackwell-systems, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 1 other file (references) in skills/lsp-refactor of blackwell-systems/agent-lsp.
Open the folder on GitHubat commit 6fa5faf
Lsp Refactor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Lsp Refactor this skillblackwell-systems/agent-lsp | 159 | — | ~2.8k | Automated safety check: Pass | MIT | |
| ast-grep Structural Searchcode-yeongyu/oh-my-openagent | 70k | — | ~3.3k | Automated safety check: Pass | MIT | |
| Graph-Guided Safe Refactoringtirth8205/code-review-graph | 32k | 1 repos | ~332 | Automated safety check: Pass | MIT | |
| Code Review Graph Navigatorhandsontable/handsontable | 22k | — | ~939 | Automated safety check: Pass | Custom licence | |
| Architecturektnyt/cclsp | 675 | — | ~1.6k | Automated safety check: Pass | MIT | |
| Typed Dependencies with fp-go EffectIBM/fp-go | 2k | — | ~4.3k | Automated safety check: Pass | Apache-2.0 |
code-yeongyu/oh-my-openagent
Searches and rewrites code by syntax-tree shape across 25 languages with ast-grep, for codemods, structural queries and YAML lint rules, using a Python wrapper script.
tirth8205/code-review-graph
Plans a refactor from a code dependency graph, previews renames before applying them and checks that the final impact matches the plan.
handsontable/handsontable
Queries a pre-built, Tree-sitter-based code graph of the whole monorepo instead of grepping call chains, for exploring, debugging, refactoring or reviewing code.
ktnyt/cclsp
Guides the design of safely disposable code through contracts (traits/interfaces) and dependency inversion.
IBM/fp-go
Teaches an agent to write fp-go v2 services with the Effect type, carrying dependencies in its type parameter instead of in context.Context or parameters.
admica/FileScopeMCP
Codebase intelligence via FileScopeMCP — symbol lookup, dependency mapping, importance ranking, and semantic search.
blackwell-systems/agent-lsp
Enumerate exported symbols in a file and surface those with zero references across the workspace.
blackwell-systems/agent-lsp
Safe workflow for editing exported symbols or public APIs. An agent skill from blackwell-systems/agent-lsp.
blackwell-systems/agent-lsp
Apply available quick-fix code actions for all current diagnostics in a file, one at a time with re-collection between each fix.
blackwell-systems/agent-lsp
Trigger language server code generation — implement interface stubs, generate test skeletons, add missing methods, generate mock types.
blackwell-systems/agent-lsp
Blast-radius analysis for a symbol or file — shows all callers, type supertypes/subtypes, and reference count before you change it.
blackwell-systems/agent-lsp
Two-phase safe rename across the entire workspace. An agent skill from blackwell-systems/agent-lsp.
Works with
Categories
End-to-end safe refactor workflow — blast-radius analysis, speculative preview, apply to disk, verify build, run affected tests. Lsp Refactor is an agent skill from blackwell-systems/agent-lsp. End-to-end safe refactor workflow — blast-radius analysis, speculative preview, apply to disk, verify build, run affected tests.
Lsp Refactor fits situations like: tasks that involve Refactoring.
Run `npx skills add blackwell-systems/agent-lsp --skill lsp-refactor -a claude-code`. Or copy the skill folder (skills/lsp-refactor in blackwell-systems/agent-lsp) into .claude/skills/lsp-refactor in your project. Claude Code loads it when a task matches its description.
Run `npx skills add blackwell-systems/agent-lsp --skill lsp-refactor -a codex`. Or copy the skill folder (skills/lsp-refactor in blackwell-systems/agent-lsp) into .agents/skills/lsp-refactor in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add blackwell-systems/agent-lsp --skill lsp-refactor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/lsp-refactor, .gemini/skills/lsp-refactor, .github/skills/lsp-refactor and .opencode/skills/lsp-refactor in your project.
SKILL.md names no scripts, command-line tools or credentials: Lsp Refactor is instructions for the agent only. Its frontmatter pre-approves these tools: mcp__lsp__blast_radius, mcp__lsp__preview_edit, mcp__lsp__simulate_chain, mcp__lsp__get_diagnostics, mcp__lsp__run_build, mcp__lsp__run_tests, mcp__lsp__get_tests_for_file, mcp__lsp__apply_edit, mcp__lsp__replace_symbol_body, mcp__lsp__open_document, mcp__lsp__format_document, Edit, Write. Compatibility (from SKILL.md): Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp).
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Lsp Refactor is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 499 tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Lsp Refactor: ast-grep Structural Search (code-yeongyu/oh-my-openagent, 70k stars), Graph-Guided Safe Refactoring (tirth8205/code-review-graph, 32k stars), Code Review Graph Navigator (handsontable/handsontable, 22k stars) and Architecture (ktnyt/cclsp, 675 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
blackwell-systems (a GitHub user) maintains it in blackwell-systems/agent-lsp, which has 159 GitHub stars. The repository holds 24 skills in this directory. The repository was last updated on October 7, 2026.
Source: blackwell-systems/agent-lsp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.