New to Claude Skills? Learn how to install them →

Pnexu-io on GitHub

Patch Edit

Free

Make localized code changes with clear audit trails.

Get this skill

Free · Opens the source repo

What Patch Edit does

Patch Edit is designed for developers who need to apply code changes in a granular, reviewable manner. Instead of rewriting entire files for localized changes, this skill applies one rewrite-plan step at a time, ensuring that each modification is small and easily auditable. This approach is particularly useful in collaborative environments where code reviews are critical, as it allows reviewers to focus on specific changes without the noise of unrelated modifications.

The skill operates by taking a structured rewrite plan, which consists of individual steps that outline the intended changes. It requires inputs such as the current state of the plan and the relevant files in the project. Each time a step is executed, Patch Edit mutates the files accordingly and generates a receipt that documents the change, including a summary of the diff and the rationale behind the modification. This meticulous record-keeping fosters transparency and accountability in the development process.

Patch Edit is particularly advantageous when working on large codebases or in teams where multiple developers contribute to the same files. By enforcing a policy of localized edits, it minimizes the risk of introducing errors and simplifies the review process. Additionally, the skill is designed to prevent common anti-patterns, such as making unnecessary changes to unrelated files or skipping steps without proper documentation, thus maintaining the integrity of the codebase.

In summary, Patch Edit is a valuable tool for developers looking to enhance their code review process and ensure that every change is justified and traceable. It streamlines the workflow by allowing for focused, incremental updates that can be easily reviewed and approved, making it an essential addition to any development toolkit.

When to use it

Use Patch Edit when you need to apply small, specific changes to code and require clear documentation for each modification.

When not to use it

Avoid using this skill for large-scale rewrites or when changes are not localized, as it is designed for incremental updates only.

What you can build with it

Incremental Code Refactoring

Use Patch Edit to refactor code in small increments, ensuring each change is clear and reviewable.

Collaborative Development

In team environments, Patch Edit helps maintain a clear audit trail for code changes, facilitating better collaboration.

Code Migration Projects

When migrating code, use Patch Edit to apply changes step-by-step, reducing the risk of introducing errors.

How to install Patch Edit

View source

1. Install with the skills CLI

npx skills add nexu-io/open-design/patch-edit --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by nexu-io

Patch edit

Spec §20.3 / §21.3.2: code-migration / tune-collab cannot ship a trustworthy diff when the agent rewrites whole files in one pass — the reviewer can't audit the change. This atom enforces "one step per turn, smallest possible localised edit".

Inputs

  • plan/steps.json from rewrite-plan.
  • The current value of iterations (the daemon's per-stage counter).
  • code/index.json for the file's known imports + neighbours.

Output

The atom mutates files inside the project cwd via the file-edit tool. After every iteration, it writes a per-step receipt:

project-cwd/
└── plan/
    ├── steps.json (status updated: 'pending' → 'completed' | 'skipped')
    └── receipts/
        └── step-<id>.json    # { files: ['...'], diffSummary, rationale, completedAt }

Convergence

The atom completes when every step in plan/steps.json is in a terminal state (completed / skipped) OR iterations >= OD_MAX_DEVLOOP_ITERATIONS. Use:

{
  "id": "patch-edit-loop",
  "atoms": ["patch-edit"],
  "repeat": true,
  "until": "plan.steps.terminal === plan.steps.total || iterations >= 8"
}

Anti-patterns the prompt fragment forbids

  • Rewriting an entire file when the rewrite-plan step is localised.
  • Touching a file outside the step's files[].
  • Touching a shell-tier file when the step's risk is not 'high' or the user hasn't confirmed.
  • Skipping a step without a receipt + a rationale string.

Status

Implemented by the daemon runner in apps/daemon/src/plugins/atoms/patch-edit.ts. It validates step ownership and risk, applies unified diffs with atomic writes, and records receipts and progress.

Frequently asked questions about Patch Edit

Similar skills