Install the "lsp-extract-function" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-extract-function into .claude/skills/lsp-extract-function/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-extract-function", 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.
Type 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.
skills CLI
$ npx skills add blackwell-systems/agent-lsp --skill lsp-extract-function -a codex
Project install goes to .agents/skills/; add -g for ~/.codex/skills/.
Install the "lsp-extract-function" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-extract-function into .agents/skills/lsp-extract-function/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-extract-function", 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.
skills CLI
$ npx skills add blackwell-systems/agent-lsp --skill lsp-extract-function -a cursor
Project install goes to .agents/skills/; add -g for ~/.cursor/skills/.
Install the "lsp-extract-function" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-extract-function into .cursor/skills/lsp-extract-function/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-extract-function", 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.
--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
skills CLI
$ npx skills add blackwell-systems/agent-lsp --skill lsp-extract-function -a gemini-cli
Project install goes to .agents/skills/; add -g for ~/.gemini/skills/.
Install the "lsp-extract-function" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-extract-function into .gemini/skills/lsp-extract-function/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-extract-function", 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.
Installs 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).
skills CLI
$ npx skills add blackwell-systems/agent-lsp --skill lsp-extract-function -a github-copilot
Project install goes to .agents/skills/; add -g for ~/.copilot/skills/.
Install the "lsp-extract-function" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-extract-function into .github/skills/lsp-extract-function/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-extract-function", 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.
skills CLI
$ npx skills add blackwell-systems/agent-lsp --skill lsp-extract-function -a opencode
OpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
Install the "lsp-extract-function" agent skill from https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-extract-function into .opencode/skills/lsp-extract-function/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "lsp-extract-function", 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.
Facts
Skill name
lsp-extract-function
GitHub stars
157
Token cost
~2k tokens
SKILL.md length
713 words
Files
2 (incl. references)
Skills in repo
24
Repo updated
First seen
Licence
MIT
At a glance
Extract a selected code block into a named function. An agent skill from blackwell-systems/agent-lsp.
Works in 5 steps: Get context (document symbols) → Check server capabilities → Primary path: LSP code action → …
Agent Workflows work in your project
SKILL.md covers Prerequisites, Step 1 — Get context (document…, Step 2 — Check server… and Step 3 — Primary path: LSP…, plus 4 more sections
Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
What it does
Lsp Extract Function is an agent skill from blackwell-systems/agent-lsp. Extract a selected code block into a named function. Primary path uses the language server's extract-function code action; falls back to manual extraction when no code action is available. Validates captured variables, scope shadowing, and compilation after extraction.
Its SKILL.md is about 2k 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 Agent Workflows. 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.
When your agent uses it
Agent Workflows work in your project
Example prompts
“/lsp-extract-function”
Requirements
Python 3
Compatibility (from SKILL.md): Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)
Read from SKILL.md and the folder at commit 09ea99e. It shows what the files ask for, not the result of running them.
Tool permissions
Pre-approves these tools, so the agent can use them without asking each time:
mcp__lsp__list_symbols
mcp__lsp__suggest_fixes
mcp__lsp__execute_command
mcp__lsp__apply_edit
mcp__lsp__get_diagnostics
mcp__lsp__open_document
mcp__lsp__format_document
mcp__lsp__get_server_capabilities
From allowed-tools in the SKILL.md frontmatter.
Runs code
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.
Network
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Credentials
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Compatibility
Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)
From compatibility in the SKILL.md frontmatter.
Context cost
Lsp Extract Function loads about 2k tokens when it runs, and up to ~2.5k if it reads all its reference files. Until then it costs about 73 tokens; SKILL.md has 713 words of instructions outside code blocks.
Always· name and description, kept in context so the agent knows when to use it
~73
When it runs· the whole SKILL.md, loaded when a task matches
~2k
With references· SKILL.md plus every file in references/, read only if the agent opens them
~2.5k
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.
Safety
Auto-check passed
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.
Download SKILL.mdSave it as .claude/skills/lsp-extract-function/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
lsp-extract-function
description
Extract a selected code block into a named function. Primary path uses the language server's extract-function code action; falls back to manual extraction when no code action is available. Validates captured variables, scope shadowing, and compilation after extraction.
lsp-extract-function: Extract Code Block into a Named Function
This skill RESTRUCTURES existing code — it takes code that already exists
and moves it into a new function. This is distinct from /lsp-generate, which
creates NEW code that does not yet exist (stubs, mocks, interface implementations).
Use this skill when the code is already written; use /lsp-generate when you
need to generate code from scratch.
Invocation: User provides file_path (absolute path), start_line and
end_line (1-indexed range), and new_function_name (desired name for the
extracted function).
Prerequisites
If LSP is not yet initialized, call mcp__lsp__start_lsp with the workspace
root first. Auto-inference applies when file paths are provided, but an explicit
start is required when switching workspaces.
Step 1 — Get context (document symbols)
Call mcp__lsp__open_document to open the file, then call
mcp__lsp__list_symbols to understand the containing function and scope:
Whether new_function_name already exists in the file (name collision check)
Mandatory name collision check: If new_function_name already exists as a
symbol in the document symbols list, report the conflict and stop immediately:
Cannot extract: function new_function_name already exists in this file.
Choose a different name and retry.
Step 2 — Check server capabilities
Call mcp__lsp__get_server_capabilities to understand what the language server
supports:
mcp__lsp__get_server_capabilities({})
Check for codeActionProvider in the response. Note whether execute_command
is listed in executeCommandProvider.commands. This determines whether the
primary path (Step 3) is available.
Step 3 — Primary path: LSP code action
Call mcp__lsp__suggest_fixes with the selection range:
mcp__lsp__suggest_fixes({
"file_path": "<file_path>",
"start_line": N,
"start_column": 1,
"end_line": M,
"end_column": 999
})
Filter the returned actions for extract-function actions: include any action
whose kind contains "refactor.extract" OR whose title contains both
"Extract" and "function" (case-insensitive).
If an extract-function action is found:
Display the action title to the user
If the action proposes a different name than new_function_name, ask for
confirmation before proceeding
Execute via mcp__lsp__execute_command if the action has a command field:
Apply call-site replacement first, then insert the new function. This order
preserves line numbers during editing: replacing call site does not shift the
insertion point for the new function definition.
Follow with the Diagnostic Summary if any errors changed (format in
references/patterns.md).
Language-Specific Notes
Go: gopls may offer "Extract function" in code actions for selection ranges.
Check code actions first; gopls support varies by version.
TypeScript/JavaScript: typescript-language-server may offer "Extract to function in global scope"
or "Extract to inner function" — filter for these titles in Step 3.
Python: pylsp and pyright-langserver typically do NOT offer extract-function
code actions. Manual fallback (Step 4) is required for Python files.
Lsp Extract Function 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.
Lsp Extract Function compared with similar skills
Skill
Stars
Used in
Tokens
Auto-check
Licence
Repo updated
Lsp Extract Function this skillblackwell-systems/agent-lsp
Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.
Explains how to bundle Model Context Protocol servers in a Claude Code plugin, covering config files, stdio, SSE, HTTP and WebSocket server types, and authentication.
Mines project files and conversation exports into a local, searchable memory palace and recalls past work by semantic search through the mempalace CLI.
Explains how to configure the Crush coding agent with crushrc or crush.json, covering providers, models, LSPs, MCP servers, hooks, permissions and config precedence.
Extract a selected code block into a named function. An agent skill from blackwell-systems/agent-lsp. Lsp Extract Function is an agent skill from blackwell-systems/agent-lsp. Extract a selected code block into a named function.
When should I use Lsp Extract Function?
Lsp Extract Function fits situations like: agent Workflows work in your project.
How do I install Lsp Extract Function in Claude Code?
Run `npx skills add blackwell-systems/agent-lsp --skill lsp-extract-function -a claude-code`. Or copy the skill folder (skills/lsp-extract-function in blackwell-systems/agent-lsp) into .claude/skills/lsp-extract-function in your project. Claude Code loads it when a task matches its description.
How do I install Lsp Extract Function in Codex?
Run `npx skills add blackwell-systems/agent-lsp --skill lsp-extract-function -a codex`. Or copy the skill folder (skills/lsp-extract-function in blackwell-systems/agent-lsp) into .agents/skills/lsp-extract-function in your project. Codex loads it when a task matches its description.
Can I use Lsp Extract Function in Cursor, Gemini CLI or GitHub Copilot?
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-extract-function -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-extract-function, .gemini/skills/lsp-extract-function, .github/skills/lsp-extract-function and .opencode/skills/lsp-extract-function in your project.
What does Lsp Extract Function need to run?
SKILL.md names no scripts, command-line tools or credentials: Lsp Extract Function is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: mcp__lsp__list_symbols, mcp__lsp__suggest_fixes, mcp__lsp__execute_command, mcp__lsp__apply_edit, mcp__lsp__get_diagnostics, mcp__lsp__open_document, mcp__lsp__format_document, mcp__lsp__get_server_capabilities. Compatibility (from SKILL.md): Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp).
Does Lsp Extract Function access the network?
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.
Is Lsp Extract Function safe to install?
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.
What licence does Lsp Extract Function use?
Lsp Extract Function is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
How many tokens does Lsp Extract Function use?
About 2k tokens (SKILL.md is roughly 7.9k 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.
What are the alternatives to Lsp Extract Function?
Skills that share tags, products or a category with Lsp Extract Function: MCP Server Builder (anthropics/skills, 180k stars), MCP Server Builder (shareAI-lab/learn-claude-code, 78k stars), MCP Integration for Plugins (anthropics/claude-plugins-official, 37k stars) and Fastmcp Client CLI (PrefectHQ/fastmcp, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
Who maintains Lsp Extract Function?
blackwell-systems (a GitHub user) maintains it in blackwell-systems/agent-lsp, which has 157 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.