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

lsp-fix-all

blackwell-systems
업데이트됨 5 days ago
53
2
53
GitHub에서 보기
디자인aiautomationdesign

정보

lsp-fix-all 스킬은 파일 내 진단 정보에 대해 사용 가능한 모든 빠른 수정 코드 액션을 자동으로 적용하며, 줄 번호 이동을 고려하기 위해 수정 사이에 진단 정보를 재수집하면서 순차적으로 처리합니다. 이 스킬은 언어 서버가 자동으로 수정할 수 있는 오류와 경고를 대량 해결하도록 설계되어, 편집 기반 스킬과 차별화됩니다. 이를 위해서는 codeActionProvider 기능을 갖춘 agent-lsp MCP 서버가 필요합니다.

빠른 설치

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-fix-all

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

문서

Requires the agent-lsp MCP server.

lsp-fix-all

Apply available quick-fix code actions for all current diagnostics in a file, one at a time, re-collecting diagnostics between each fix because line numbers shift after each application.

Important distinction from /lsp-safe-edit: This skill fixes pre-existing diagnostics in a file — errors and warnings that already exist before any edit session begins. /lsp-safe-edit has a code-action step (Step 7) for fixing errors introduced by a specific edit you just made. Use this skill for systematic bulk-fixing of existing issues, independent of any edit session.

When to use / not use

Use this skill when:

  • A file has accumulated errors or warnings you want to resolve automatically
  • You want to clean up a file before starting new work
  • You want to apply all available language-server quick-fixes in bulk

Do NOT use this skill when:

  • You just made an edit and want to fix newly introduced errors — use /lsp-safe-edit
  • You want to apply structural refactors — this skill applies quick-fixes only (see filtering below)
  • The file has zero diagnostics (the skill will report clean and stop)

Input

  • file_path: Absolute path to the file to fix.

Workflow

Step 1 — Open and collect initial diagnostics

Call mcp__lsp__open_document with the target file path to ensure it is loaded in the language server. Then call mcp__lsp__get_diagnostics to retrieve all current diagnostics.

If zero diagnostics are returned: report "No diagnostics found — file is clean." and stop. No further steps are needed.

Record the initial count of errors and warnings for the summary output.

Step 2 — Classify and filter code actions

For EACH diagnostic (process one at a time, not in batch):

  1. Call mcp__lsp__suggest_fixes at the diagnostic's position/range.
  2. Filter the returned actions to quick-fix kind only.
  3. Skip any diagnostic for which no applicable quick-fix exists — note it in the summary.

Decision gate — which code actions to apply:

Action kindApply?
quickfixYES
quickfix.*YES
refactorNO — structural change
refactor.extractNO — structural change
refactor.inlineNO — structural change
source.organizeImportsYES — safe formatting
source.* (others)NO — skip unless organizeImports
(no kind / empty)NO — unknown, skip

A code action qualifies if: kind == "quickfix", OR kind starts with "quickfix.", OR kind == "source.organizeImports".

Reject actions whose kind is "refactor", starts with "refactor.", or has no kind field at all.

Step 3 — Apply one fix and re-collect (the core loop)

This is the critical correctness constraint: never apply more than one fix per iteration. After each apply_edit call, line numbers in the file shift. Always re-call get_diagnostics before processing the next diagnostic.

Loop:

iteration = 0
max_iterations = 50

while iteration < max_iterations:
    diagnostics = mcp__lsp__get_diagnostics(file_path)
    if diagnostics is empty: break

    for each diagnostic in diagnostics:
        actions = mcp__lsp__suggest_fixes(diagnostic.range)
        applicable = filter to quickfix / source.organizeImports kinds (see Step 2)
        if applicable is not empty:
            apply the first applicable action via mcp__lsp__apply_edit
            record: (line, message, action title) in "Fixed" list
            iteration += 1
            break  # restart the outer loop — line numbers have shifted

    if no diagnostic in this pass had an applicable quick-fix:
        break  # no progress possible — exit loop

Exit the loop when:

  • The diagnostics list is empty, OR
  • No remaining diagnostic has an applicable quick-fix action, OR
  • The iteration counter reaches 50 (safety guard against edge cases where a fix introduces a new fixable diagnostic, preventing infinite loops)

If apply_edit returns an error: stop the loop immediately and report the failure in the summary. Do not attempt further fixes.

Step 4 — Verify and format

After the loop exits:

  1. Call mcp__lsp__get_diagnostics one final time to capture the post-fix state.
  2. For any remaining diagnostics that had no applicable quick-fix, list them in the "Skipped" section with explanation.
  3. Call mcp__lsp__format_document to clean up any indentation drift introduced by the applied edits.

Output format

## lsp-fix-all Summary

File: /path/to/file.go
Initial diagnostics: N errors, M warnings
Fixes applied: K
Remaining (no auto-fix available): J

### Fixed
- line X: <message> → applied: <action title>

### Skipped (no quick-fix available)
- line Y: <message>

If apply_edit failed mid-loop, append:

### Loop stopped
- apply_edit returned error on line Z: <error message>
- Fixes applied before failure: K

Safety rules

  • Never apply more than one code action per loop iteration
  • Always re-collect diagnostics after each apply_edit before the next fix
  • Never apply refactor or structural code actions — quick-fix and source.organizeImports only
  • If apply_edit returns an error, stop the loop and report the failure; do not continue
  • Maximum iterations: 50 (safety guard against infinite loops in edge cases where a fix introduces a new fixable diagnostic)
  • Do not use execute_commandapply_edit is sufficient for all quick-fixes

Prerequisites

LSP must be running for the target workspace. If not yet initialized, call mcp__lsp__start_lsp with the workspace root before proceeding.

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

GitHub 저장소

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

연관 스킬

executing-plans

디자인

executing-plans 스킬은 검토 체크포인트가 포함된 통제된 배치로 실행할 완전한 구현 계획이 있을 때 사용합니다. 이 스킬은 계획을 불러와 비판적으로 검토한 후, 소규모 배치(기본값 3개 작업)로 작업을 실행하면서 각 배치 사이에 진행 상황을 아키텍트 검토를 위해 보고합니다. 이를 통해 내재된 품질 관리 체크포인트를 갖춘 체계적인 구현이 보장됩니다.

스킬 보기

requesting-code-review

디자인

이 스킬은 코드 변경 사항을 요구 사항에 따라 분석하기 위해 코드 리뷰어 하위 에이전트를 호출합니다. 작업 완료 후, 주요 기능 구현 후, 또는 메인 브랜치에 병합하기 전에 사용해야 합니다. 이 리뷰는 현재 구현체와 원래 계획을 비교하여 문제를 조기에 발견하는 데 도움이 됩니다.

스킬 보기

connect-mcp-server

디자인

이 스킬은 개발자들이 HTTP, stdio 또는 SSE 전송 방식을 통해 MCP 서버를 Claude Code에 연결하는 포괄적인 가이드를 제공합니다. GitHub, Notion 및 사용자 정의 API와 같은 외부 서비스를 통합하기 위한 설치, 구성, 인증 및 보안을 다룹니다. MCP 통합 설정, 외부 도구 구성 또는 Claude의 모델 컨텍스트 프로토콜 작업 시 활용하세요.

스킬 보기

web-cli-teleport

디자인

이 스킬은 작업 분석을 기반으로 개발자가 Claude Code 웹 인터페이스와 CLI 인터페이스 중 선택할 수 있도록 돕고, 두 환경 간 원활한 세션 텔레포트를 가능하게 합니다. 웹, CLI 또는 모바일 환경 전환 시 세션 상태와 컨텍스트를 관리하여 워크플로를 최적화합니다. 다양한 단계에서 서로 다른 도구가 필요한 복잡한 프로젝트에 사용하세요.

스킬 보기