# implement-patch

implement-patch — a Claude Code skill for fixing confirmed bugs at the invariant level. Enforces variant searches, upfront regression tests, and isolated patch records.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 677 installs · ★ 8341 repo stars
- Author: trailofbits
- License: CC-BY-SA-4.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/trailofbits/skills/tree/HEAD/plugins/patching-bugs/skills/implement-patch/SKILL.md
- Updated: 2026-10-24
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/implement-patch

## What it does

The skill guides an agent through a disciplined bug-fixing protocol once an issue is confirmed. It verifies the repair scope before editing using a `uv run` validation gate, then locates every matching invariant breach across the boundary. Writing a failing regression test against the project baseline is mandatory before touching production code.

Changes stay scoped to the smallest reviewable fix. The procedure requires exactly one local git commit and forbids pushing branches or opening pull requests. All outputs are exported to separate `fix.patch` and `tests.patch` files, alongside a structured `patch.json` capturing commit hashes and test suite counts.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill implement-patch -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/implement-patch/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/implement-patch/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill implement-patch -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/implement-patch/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill implement-patch -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/implement-patch/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install trailofbits/skills plugins/patching-bugs/skills/implement-patch
```

2. **Manually: put the files in place**
- File: `.github/skills/implement-patch/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill implement-patch -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/trailofbits/skills --path plugins/patching-bugs/skills/implement-patch
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/implement-patch/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add trailofbits/skills --skill implement-patch -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/trailofbits/skills/tree/HEAD/plugins/patching-bugs/skills/implement-patch/SKILL.md

## When to use it
- resolve confirmed bugs by repairing violated invariants
- discover related flaw variants across the codebase
- capture a failing regression test before patching
- export isolated diff files alongside patch.json metadata

## Example prompts
- Apply an invariant fix for the confirmed parser bug using implement-patch
- Search for all variants of the state desync issue and record patch.json
- Produce a single local commit and regression test for the session leak

## Similar
- [mantis-patch](https://affpapa.org/en/nevibecode/skills/mantis-patch.md) — skill · 1600 installs
- [threat-patch](https://affpapa.org/en/nevibecode/skills/threat-patch.md) — skill · 232 installs
- [surgical-patch](https://affpapa.org/en/nevibecode/skills/surgical-patch.md) — skill · 128900 installs
- [patch-verifier](https://affpapa.org/en/nevibecode/agents/patch-verifier.md) — subagent · ★ 47914 repo stars
- [issue-tracer](https://affpapa.org/en/nevibecode/skills/issue-tracer.md) — skill · ★ 539 repo stars
- [implement](https://affpapa.org/en/nevibecode/skills/boshu2-implement.md) — skill · 1500 installs

From the same set: [trailofbits/skills](https://affpapa.org/en/nevibecode/by/trailofbits/skills.md) — 95 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
