MCP HubMCP Hub
스킬 목록으로 돌아가기

lsp-simulate

blackwell-systems
업데이트됨 5 days ago
53
2
53
GitHub에서 보기
개발general

정보

lsp-simulate 스킬은 개발자가 디스크에 적용하기 전에 메모리에서 안전하게 코드 변경 사항을 테스트하고 탐색할 수 있도록 합니다. 이 스킬은 LSP 서버 오버레이를 사용하여 다중 파일 편집을 시뮬레이션하고, 진단을 실행하며, 실제 파일을 건드리지 않고 안전성을 검증합니다. 이는 위험한 리팩터링을 계획하거나 작업 공간 전체에 걸친 복잡한 변경 사항을 검증하는 데 이상적입니다.

빠른 설치

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-simulate

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Requires the agent-lsp MCP server.

lsp-simulate

Simulate code edits in memory before writing to disk. The LSP server applies your changes to an in-memory overlay, runs diagnostics, and reports whether the edit is safe — without touching any files.

Prerequisites

LSP must be running for the target workspace. If not yet initialized, call start_lsp before any simulation tool.

mcp__lsp__start_lsp(root_dir: "/your/workspace")

Auto-init note: agent-lsp supports workspace auto-inference from file paths. Explicit start_lsp is only needed when switching workspace roots.

Quick Start (single edit)

For a single what-if check, use preview_edit — it creates a session, applies the edit, evaluates, and destroys the session in one call:

mcp__lsp__preview_edit(
  workspace_root: "/your/workspace",
  language: "go",
  file_path: "/abs/path/to/file.go",
  start_line: 42, start_column: 1,
  end_line: 42, end_column: 20,
  new_text: "replacement text"
)

Result:

{ net_delta: 0 }   -- safe to apply
{ net_delta: 2 }   -- 2 new errors introduced; do NOT apply

net_delta: 0 means no new errors were introduced. Positive values mean errors were introduced — inspect errors_introduced before deciding.

Full Session Workflow (multiple edits)

Use a full session when applying several edits that build on each other, or when you want to inspect the patch before deciding whether to write to disk.

Step 1 — Create a simulation session

mcp__lsp__create_simulation_session(
  workspace_root: "/your/workspace",
  language: "go"
)
→ { session_id: "abc123" }

Step 2 — Apply edits in-memory

Call simulate_edit one or more times. All edits are in-memory only. Positions are 1-indexed (matching editor line numbers and cat -n output).

mcp__lsp__simulate_edit(
  session_id: "abc123",
  file_path: "/abs/path/to/file.go",
  start_line: 10, start_column: 1,
  end_line: 10, end_column: 30,
  new_text: "func NewClient(cfg Config) *Client {"
)
→ { session_id: "abc123", edit_applied: true, version_after: 1 }

Repeat for additional edits as needed.

Step 3 — Evaluate the session

mcp__lsp__evaluate_session(
  session_id: "abc123",
  scope: "file"
)
→ {
    net_delta: 0,
    confidence: "high",
    errors_introduced: [],
    errors_resolved: [],
    edit_risk_score: 0.0,
    affected_symbols: []
  }

scope: "file" (default) is faster and returns confidence: "high". scope: "workspace" catches cross-file type errors but returns confidence: "eventual" (results may not be fully settled).

Step 4 — Decision gate

If net_delta == 0, proceed to commit. Otherwise, discard:

mcp__lsp__discard_session(session_id: "abc123")

Step 5 — Commit the session

-- Preview patch only (no disk write):
mcp__lsp__commit_session(session_id: "abc123", apply: false)

-- Write to disk:
mcp__lsp__commit_session(session_id: "abc123", apply: true)

Step 6 — Destroy the session (always)

mcp__lsp__destroy_session(session_id: "abc123")

Always call destroy_session after commit or discard to release server resources. See Cleanup Rule below.

Chained Mutations (simulate_chain)

Use simulate_chain when you have a sequence of edits and want to find how far through the sequence is safe to apply. Unlike multiple simulate_edit calls, simulate_chain evaluates diagnostics after each step.

mcp__lsp__simulate_chain(
  session_id: "abc123",
  edits: [
    { file_path: "/abs/file.go", start_line: 5, start_column: 1,
      end_line: 5, end_column: 40, new_text: "type Foo struct { Bar int }" },
    { file_path: "/abs/file.go", start_line: 20, start_column: 1,
      end_line: 20, end_column: 10, new_text: "f.Bar" },
    { file_path: "/abs/other.go", start_line: 8, start_column: 1,
      end_line: 8, end_column: 10, new_text: "x.Bar" }
  ]
)
→ {
    steps: [
      { step: 1, net_delta: 0, errors_introduced: [] },
      { step: 2, net_delta: 0, errors_introduced: [] },
      { step: 3, net_delta: 1, errors_introduced: [...] }
    ],
    safe_to_apply_through_step: 2,
    cumulative_delta: 1
  }

safe_to_apply_through_step: 2 means steps 1 and 2 are safe; step 3 introduced errors. Commit the session after reviewing to apply steps 1–2, or discard to cancel everything.

Decision Guide

net_deltaconfidenceAction
0highSafe. Commit or apply.
0eventualLikely safe. Workspace scope — re-evaluate if risk matters.
> 0anyDo NOT apply. Inspect errors_introduced. Discard session.
> 0partialTimeout. Results incomplete. Discard and retry with smaller scope.

Session States

StateMeaningNext step
createdSession initialized, no edits yetsimulate_edit
mutatedOne or more edits applied in-memoryevaluate_session
evaluatedDiagnostics collectedcommit or discard
committedPatch returned (and optionally written to disk)destroy_session
discardedIn-memory edits reverted, no disk writedestroy_session
dirtyRevert failed or version mismatch; session is inconsistentdestroy_session only

A session in dirty state cannot be recovered — call destroy_session immediately.

Cleanup Rule

Always call destroy_session after finishing a session, even on error paths:

-- After commit:
mcp__lsp__commit_session(session_id: "abc123", apply: true)
mcp__lsp__destroy_session(session_id: "abc123")

-- After discard:
mcp__lsp__discard_session(session_id: "abc123")
mcp__lsp__destroy_session(session_id: "abc123")

MCP server restart: Sessions are ephemeral — they live in server memory only. If the MCP server restarts, all session IDs become invalid. To preserve work across a restart, call commit_session(apply: false) first to get a portable patch, then re-apply it after the server restarts.

See references/patterns.md for detailed field descriptions and confidence interpretation.

GitHub 저장소

blackwell-systems/agent-lsp
경로: skills/lsp-simulate
0
agentskillsai-agentsai-toolingclaudeclaude-codecode-intelligence

연관 스킬

qmd

개발

qmd는 BM25, 벡터 임베딩, 재순위화를 결합한 하이브리드 검색을 통해 로컬 파일을 색인화하고 검색할 수 있는 로컬 검색 및 색인화 CLI 도구입니다. 명령줄 사용과 Claude 통합을 위한 MCP(Model Context Protocol) 모드를 모두 지원합니다. 이 도구는 임베딩에 Ollama를 사용하고 색인을 로컬에 저장하여 터미널에서 직접 문서나 코드베이스를 검색하는 데 이상적입니다.

스킬 보기

subagent-driven-development

개발

이 스킬은 각 독립적인 작업마다 새로운 하위 에이전트를 배치하고 작업 사이에 코드 리뷰를 진행하여 구현 계획을 실행합니다. 이 리뷰 프로세스를 통해 품질 게이트를 유지하면서 빠른 반복 작업을 가능하게 합니다. 동일한 세션 내에서 대부분 독립적인 작업을 진행할 때 내장된 품질 검증과 함께 지속적인 진행을 보장하기 위해 사용하세요.

스킬 보기

mcporter

개발

mcporter 스킬은 개발자가 Claude에서 직접 Model Context Protocol(MCP) 서버를 관리하고 호출할 수 있도록 합니다. 이 스킬은 사용 가능한 서버를 나열하고, 인수를 사용해 해당 서버의 도구를 호출하며, 인증 및 데몬 생명주기를 처리하는 명령어를 제공합니다. 개발 워크플로우에서 MCP 서버 기능을 통합하고 테스트할 때 이 스킬을 사용하세요.

스킬 보기

adk-deployment-specialist

개발

이 스킬은 A2A 프로토콜을 사용하여 Vertex AI ADK 에이전트를 배포하고 오케스트레이션하며, AgentCard 검색, 작업 제출, 코드 실행 샌드박스 및 메모리 뱅크와 같은 지원 도구를 관리합니다. Python, Java 또는 Go 언어로 순차, 병렬 또는 루프 오케스트레이션 패턴을 갖춘 다중 에이전트 시스템 구축을 가능하게 합니다. Google Cloud에서 ADK 에이전트 배포 또는 에이전트 워크플로우 오케스트레이션을 요청받았을 때 사용하세요.

스킬 보기