lsp-safe-edit

Validate code edits against diagnostics before applying them.

102|5|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/blackwell-systems/agent-lsp --skill lsp-safe-edit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lsp-safe-edit
Source: https://github.com/blackwell-systems/agent-lsp/tree/main/skills/lsp-safe-edit
Command: npx skills add https://github.com/blackwell-systems/agent-lsp --skill lsp-safe-edit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Wraps code edits with a before/after diagnostic comparison to catch regressions before touching disk. Speculatively previews the change (simulate_edit_atomic), then surfaces code actions for quick fixes if post-edit diagnostics reveal issues.

Core Features & Use Cases

  • Speculative edit previews that measure the error delta before applying.
  • Supports single-file and multi-file edits (simulate_chain) with coordinated apply.
  • Post-edit diagnostics, quick fixes via code actions, and optional formatting checks to ensure a clean result.

Quick Start

Open the target file(s), preview the change with simulate_edit_atomic, and apply the edit only if the diagnostic delta is acceptable.

Frequently Asked Questions about lsp-safe-edit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate code edits against live diagnostics before applying them?

Validating code edits against live diagnostics requires speculatively previewing the change to measure the error delta before writing to disk. This before/after diagnostic comparison catches regressions early by surfacing post-edit issues without modifying files.

Can I preview multi-file refactors for diagnostic regressions before committing changes?

Multi-file refactors can be previewed for diagnostic regressions using speculative chain simulations. This coordinates edits across the workspace, measuring the diagnostic delta before applying changes to ensure no new errors are introduced.

What is a speculative edit preview in LSP code refactoring?

A speculative edit preview in LSP refactoring simulates an atomic code change to measure the diagnostic error delta before touching disk. It wraps edits with before/after diagnostic comparisons to catch regressions and surfaces code actions for quick fixes.

Do I need an active agent-lsp server to check code diagnostics for refactoring?

Checking code diagnostics for refactoring requires an active agent-lsp server along with LSP tools for opening documents and retrieving diagnostics. These dependencies are necessary to validate edits, generate speculative previews, and apply formatting checks.

How do code actions help fix post-edit diagnostics during a workspace refactor?

Code actions help fix post-edit diagnostics by surfacing quick fixes after a speculative edit preview reveals issues. When the diagnostic delta shows new errors, code actions provide automated resolutions to ensure a clean refactoring result before applying.

What is the best way to safely apply incremental bug fixes without introducing regressions?

Safely applying incremental bug fixes without regressions is best done by simulating the edit atomically, checking the diagnostic delta, and applying only if the error count is acceptable. Post-edit formatting checks and code actions ensure a clean result.