К основному содержанию
скилл CX Codex

lsp-fix-all — скилл для Claude Code: массовые quick-fix через LSP

Прогоняет все диагностики в файле и применяет доступные quick-fix от языкового сервера. Пригодится, когда в файле накопились ошибки и предупреждения перед новой работой.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add blackwell-systems/agent-lsp --skill lsp-fix-all -a claude-code
Открыть на GitHub

Что делает lsp-fix-all

Скилл открывает файл в языковом сервере, забирает список диагностик и по каждой спрашивает доступные code actions. Применяет только quick-fix и source.organizeImports. Рефакторинги и структурные правки пропускает — это не его работа.

Главная особенность — по одной правке за итерацию. После каждого apply_edit номера строк сдвигаются, поэтому диагностики собираются заново перед следующей правкой. Цикл останавливается, когда диагностик не осталось, когда ни у одной нет подходящего quick-fix или когда счётчик дошёл до 50 — защита от случая, когда правка порождает новую исправимую ошибку. Если apply_edit вернул ошибку, цикл встаёт сразу, остаток работы не доделывается.

Нужен запущенный MCP-сервер agent-lsp и активный LSP для рабочей области. Требуется capability codeActionProvider, форматирование документа — по желанию. Для файла без диагностик скилл просто сообщит, что чисто, и остановится. Если вы только что что-то правили и хотите починить свежие ошибки, это другой скилл — /lsp-safe-edit.

Какие задачи решает

  • разобрать накопившиеся ошибки и предупреждения в файле без ручной правки каждой
  • привести файл в порядок перед началом новой задачи
  • применить все доступные quick-fix от языкового сервера разом
  • отсортировать импорты через source.organizeImports
  • получить отчёт: что исправлено, что осталось без автофикса

Примеры запросов агенту

  • Прогони lsp-fix-all по файлу src/server/handler.go и покажи, что осталось
  • Почисти internal/api/routes.ts — примени все quick-fix, которые может дать языковой сервер
  • Запусти /lsp-fix-all на pkg/store/cache.py и отформатируй файл в конце

Как установить lsp-fix-all

1Через Skills CLI (Vercel)

npx skills add blackwell-systems/agent-lsp --skill lsp-fix-all -a claude-code

2Вручную: положить файлы

~/.claude/skills/lsp-fix-all/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/lsp-fix-all/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о lsp-fix-all

Как установить lsp-fix-all в Claude Code?

Выполните npx skills add blackwell-systems/agent-lsp --skill lsp-fix-all -a claude-code. Скилл встанет в ~/.claude/skills/lsp-fix-all/SKILL.md.

Что делает lsp-fix-all?

Собирает диагностики файла и применяет к ним доступные quick-fix от языкового сервера — по одной правке за раз, с повторным сбором диагностик между ними, потому что номера строк сдвигаются.

Чем lsp-fix-all отличается от /lsp-safe-edit?

Этот скилл чинит ошибки, которые уже были в файле до начала работы. /lsp-safe-edit на шаге 7 разбирается с ошибками, которые появились из-за конкретной вашей правки.

Исходный текст

SKILL.md · MIT
---
name: lsp-fix-all
description: Apply available quick-fix code actions for all current diagnostics in a file, one at a time with re-collection between each fix. Use to bulk-resolve errors and warnings the language server can fix automatically.
argument-hint: "[file-path]"
user-invocable: true
allowed-tools: mcp__lsp__get_diagnostics mcp__lsp__suggest_fixes mcp__lsp__apply_edit mcp__lsp__open_document mcp__lsp__format_document
license: MIT
compatibility: Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)
metadata:
  required-capabilities: codeActionProvider
  optional-capabilities: documentFormattingProvider
---

> 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 kind | Apply? |
|---|---|
| `quickfix` | YES |
| `quickfix.*` | YES |
| `refactor` | NO — structural change |
| `refactor.extract` | NO — structural change |
| `refactor.inline` | NO — structural change |
| `source.organizeImports` | YES — 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_command` — `apply_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.

© blackwell-systems · MIT · blackwell-systems/agent-lsp

Похожие скиллы

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →
setup-matt-pocock-skills Matt Pocock Скилл настраивает репозиторий для инженерных скиллов Matt Pocock: задаёт трекер задач, метки триажа и расположение доменной документации. Запустите его перед первым использованием остальных скиллов. 1 052 851установок ask-matt Matt Pocock Помогает выбрать подходящий скилл или рабочий поток из набора Matt Pocock. Пригодится, когда непонятно, с чего начать задачу: от идеи до разбора бага. 766 587установок to-tickets Matt Pocock Разбивает план, спецификацию или переписку на небольшие сквозные задачи и отмечает, какие из них блокируют остальные. Пригодится, когда нужно согласовать порядок работы до публикации задач в трекере. 711 230установок writing-plans Jesse Vincent Скилл превращает требования к многошаговой задаче в подробный план реализации до начала работы с кодом. Пригодится, когда исполнителю нужно зафиксировать файлы, интерфейсы и проверки. CX Codex 282 859установок caveman-review JuliusBrussee Пишет замечания к коду одной строкой: место, проблема, исправление. Пригодится, когда ревью диффа или PR надо пройти быстро и без воды. CX Codex +1 411 800установок caveman-compress JuliusBrussee Сжимает CLAUDE.md, списки задач и другие текстовые файлы в краткий формат, сохраняя читаемую резервную копию. CX Codex +1 411 500установок

Из того же набора9

lsp-test-correlation Находит тесты, которые покрывают изменённый файл, и запускает только их. Пригодится, когда правишь один файл и не хочешь гонять весь набор. CX Codex +1 ★ 164звёзд репо lsp-rename Переименовывает функции, методы, переменные и типы по всему проекту в два этапа: сначала показывает все затронутые места, потом меняет их после подтверждения. CX Codex +1 ★ 164звёзд репо lsp-local-symbols Показывает, какие функции и типы объявлены в файле, где используется переменная и какой у неё тип. Пригодится перед правкой одного файла. CX Codex +1 ★ 164звёзд репо lsp-impact Показывает всех вызывающих, супертипы и подтипы, число ссылок на символ или файл до того, как вы что-то поменяете. Пригодится при рефакторинге и удалении кода. CX Codex +1 ★ 164звёзд репо lsp-edit-symbol Меняет функцию, тип или переменную по имени, когда точный файл и позиция неизвестны. Работает через MCP-сервер agent-lsp. CX Codex +1 ★ 164звёзд репо lsp-dead-code Скилл перечисляет экспортируемые символы файла и проверяет каждый на ссылки по всему проекту. Помогает понять, какие экспорты можно удалять. CX Codex +1 ★ 164звёзд репо lsp-architecture Собирает структурный обзор кодовой базы: языки, пакеты, точки входа, зависимости и горячие файлы. Один вызов вместо ручного обхода репозитория. CX Codex +1 ★ 164звёзд репо agent-lsp Координирует языковые серверы и предоставляет агенту 65 инструментов для работы с кодом на 32 языках без постоянного повторного сканирования. CX Codex +1 ★ 164звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой