structured-edit

Locate code elements via LSP and apply read-verify-edit modifications.

1|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/Kuass/kiro-gateway-plus --skill structured-edit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: structured-edit
Source: https://github.com/Kuass/kiro-gateway-plus/tree/main/.opencode/skill/structured-edit
Command: npx skills add https://github.com/Kuass/kiro-gateway-plus --skill structured-edit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the common and frustrating failures in LLM code editing caused by subtle differences in file content, such as whitespace, encoding, or concurrent modifications, by implementing a robust read-verify-edit pattern.

Core Features & Use Cases

  • LSP Integration: Leverages Language Server Protocol (LSP) for precise code element location (definitions, references, symbols).
  • Read-Verify-Edit Pattern: Ensures content is read fresh, verified against expectations, and then edited with unique context, drastically reducing "string not found" errors.
  • Use Case: When an LLM needs to modify a specific function in a large codebase, this Skill ensures it accurately locates the function using LSP, reads its current state, confirms it's the expected code, and then applies the modification using surrounding lines as unique identifiers, preventing common edit failures.

Quick Start

Use the structured-edit skill to locate the definition of the 'calculate_total' function in the file 'utils.py' and then edit it to return the sum of its arguments.

Frequently Asked Questions about structured-edit

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

FAQPage Schema
Why do LLM code edits fail with str_replace and how to prevent string not found errors?

LLM code edits fail due to subtle whitespace, encoding, or stale context differences. Prevent str_replace errors by using a read-verify-edit-confirm workflow that reads fresh content, verifies expectations, and applies modifications using unique surrounding lines as identifiers.

How do I use LSP to locate and modify functions for reliable LLM code editing?

Use LSP integration to precisely locate code elements like definitions and symbols. For reliable LLM code editing, locate the target function via LSP, read its current state, confirm it matches expectations, and then apply modifications using surrounding lines as unique context identifiers.

What is the read-verify-edit pattern for LLM coding and when is it needed?

The read-verify-edit pattern is a structured editing protocol ensuring LLMs read fresh file content, verify it against expectations, and edit with unique context. It is needed when modifying large codebases to mitigate failures from whitespace, encoding, or concurrent file changes.

How to prevent LLM code refactoring issues caused by concurrent file modifications?

Prevent LLM code refactoring issues from concurrent modifications by implementing a structured editing protocol. This approach reads fresh content, verifies it against expectations, and confirms edits using unique surrounding context, drastically reducing failures caused by stale context or concurrent changes.

Does structured editing work without external dependencies for LLM debugging?

Yes, structured editing works without external dependencies for LLM debugging. It relies on LSP integration and a read-verify-edit-confirm workflow to accurately locate and modify code, ensuring reliable edits by mitigating issues related to whitespace, encoding, and concurrent file changes.

What are the limitations of using str_replace for code editing compared to a structured editing protocol?

The limitation of str_replace is its vulnerability to whitespace, encoding, and stale context differences causing string not found errors. A structured editing protocol overcomes this by combining LSP for precise location with a read-verify-edit-confirm workflow to ensure reliable modifications.