返回技能列表

lsp-edit-symbol

blackwell-systems
更新于 6 days ago
53
2
53
在 GitHub 上查看
其他general

关于

This Claude Skill enables editing code symbols (functions, types, variables) by name alone, without needing their file paths or exact positions. It automatically resolves the symbol's definition, retrieves its full range, and applies your edit. Use it when you want to change a symbol's body or signature but only know its name.

快速安装

Claude Code

推荐
主要方式
npx skills add blackwell-systems/agent-lsp -a claude-code
插件命令备选方式
/plugin add https://github.com/blackwell-systems/agent-lsp
Git 克隆备选方式
git clone https://github.com/blackwell-systems/agent-lsp.git ~/.claude/skills/lsp-edit-symbol

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

lsp-edit-symbol

Edit a named symbol (function, type, variable) without needing its exact file path or line/column. Primary path uses replace_symbol_body for direct symbol replacement. Falls back to find_symbol + list_symbols + apply_edit when the server does not support document symbols well.

Workflow

Step 1 — Locate the file

{ "tool": "find_symbol", "query": "MyFunc" }

Returns a list of matching symbols with file URI and position. Pick the definition (not a test file, not a stub). If multiple matches, use the container name or file path to disambiguate.

Step 2 — Replace the symbol body (primary path)

Use replace_symbol_body to replace the entire function/method/type body by name:

{
  "tool": "replace_symbol_body",
  "file_path": "/path/to/file.go",
  "symbol_path": "MyFunc",
  "new_body": "func MyFunc() error {\n\treturn nil\n}"
}

For methods, use dot notation: "MyStruct.Method".

This resolves the symbol by name within the file, finds its full range, and replaces it atomically. No position math required.

If replace_symbol_body fails (e.g., the server cannot resolve document symbols for this file), fall back to the manual path below.

Fallback — Manual resolution via document symbols

Step 2b — Get the full range:

{
  "tool": "list_symbols",
  "file_path": "/path/to/file.go",
  "language_id": "go"
}

Find MyFunc in the returned tree. The range field covers the entire symbol including its body; selectionRange covers only the name.

Step 3b — Apply the edit:

Option A (text-match, recommended when you have the old text):

{
  "tool": "apply_edit",
  "file_path": "/path/to/file.go",
  "old_text": "func MyFunc() {",
  "new_text": "func MyFunc() error {"
}

Option B (positional, when you have the exact range):

{
  "tool": "apply_edit",
  "workspace_edit": {
    "changes": {
      "file:///path/to/file.go": [{
        "range": { "start": {"line": 12, "character": 0}, "end": {"line": 18, "character": 1} },
        "newText": "func MyFunc() error {\n\treturn nil\n}"
      }]
    }
  }
}

Decision guide

SituationApproach
Replacing full bodyreplace_symbol_body (primary path)
Changing signature onlyStep 1 + apply_edit with one-line old_text
Symbol name ambiguousUse find_symbol query + container name filter
Server lacks document symbolsFallback path (Step 2b + 3b)
After editRun get_diagnostics to verify no errors introduced

Notes

  • replace_symbol_body is the preferred path for full-body replacements. It handles symbol resolution and range calculation internally.
  • find_symbol returns declaration sites, not all references. The first non-test result is usually the definition.
  • Positions in list_symbols are 1-based (shifted from LSP convention). apply_edit workspace_edit expects 0-based; subtract 1 when using positional mode (Option B). Text-match mode (Option A) requires no position math.
  • For renames (not edits), use /lsp-rename instead; it updates all call sites.

GitHub 仓库

blackwell-systems/agent-lsp
路径: skills/lsp-edit-symbol
0
agentskillsai-agentsai-toolingclaudeclaude-codecode-intelligence

相关推荐技能

llamaguard

其他

LlamaGuard是Meta推出的7-8B参数内容审核模型,专门用于过滤LLM的输入和输出内容。它能检测六大安全风险类别(暴力/仇恨、性内容、武器、违禁品、自残、犯罪计划),准确率达94-95%。开发者可通过HuggingFace、vLLM或Sagemaker快速部署,并能与NeMo Guardrails集成实现自动化安全防护。

查看技能

cost-optimization

其他

这个Claude Skill帮助开发者优化云成本,通过资源调整、标记策略和预留实例来降低AWS、Azure和GCP的开支。它适用于减少云支出、分析基础设施成本或实施成本治理策略的场景。关键功能包括提供成本可视化、资源规模调整指导和定价模型优化建议。

查看技能

quantizing-models-bitsandbytes

其他

这个Skill使用bitsandbytes库量化大语言模型,能在GPU内存有限时通过8位或4位量化减少50-75%内存占用,同时保持精度损失最小。它支持INT8、NF4、FP4等多种量化格式,可与HuggingFace Transformers无缝集成,适用于需要部署更大模型或加速推理的场景。还提供QLoRA训练和8位优化器支持,让开发者能轻松实现高效模型压缩。

查看技能

dispatching-parallel-agents

其他

该Skill用于并行处理3个以上无依赖关系的独立故障,可为每个问题域分派专属Claude代理同时执行调查修复。它通过并发处理多个独立问题显著提升故障排查效率,特别适用于测试文件、子系统等无共享状态的场景。

查看技能