Use when a confirmed local bug needs an invariant-level fix, variant search, tests, and one local commit.
Capabilities
When NOT to Use
Do not use for speculative bug hunting, proof of a completed patch, or a change that
Procedure
Use the declared scope as the repair brief
Getting started
Full instructionsInstall the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.
Instructions: SKILL.mdv1.0.0
Implement Patch
When to Use
Use after independent validation confirms one claim. Read the
record contract.
Before target commands, follow its project guidance.
When NOT to Use
Do not use for speculative bug hunting, proof of a completed patch, or a change that
cannot be exercised by the local compiler or runtime.
Procedure
-
Before editing, run
uv run --no-project <script> check --before-repair <run-dir>
with the record validator. If this check fails,
stop and return its errors for an INCONCLUSIVE report. The gate requires
finding.repair_scopewith a usable case plan and a consistent attempt count.
Use the declared scope as the repair brief. Identify the broken
invariant and search within its boundary for every instance of the
same violation. Read the threat model only to preserve intended behavior; it is
not a gate. -
Run the project's existing suite and record its results. Write a regression test
that fails on the baseline for the named bug and any fixed variant. Observe the
failure. Fix the invariant within the repair brief with the smallest reviewable change. -
Run the regression test and full existing suite again. Compare before and after
failures. Fix new failures or explain a pre-existing one from receipts. -
Record every variant as
fixedornot_fixedwith a reason. Produce exactly one
local commit. Never push or open a PR. From the baseline, writefix.patchfor
production changes andtests.patchfor test changes inpatch/attempt-N/. -
Write
patch.jsonwith the two commit SHAs, changed-file and line counts,
variants, suite results, and your agent identity. If the attempt produced no commit,
recordpatch_commit: nulland return it as failed. Manifest the entire attempt
directory, including both patch files and the record, using
uv run --no-project <script> manifest <patch-attempt-dir>. Check it with the
record validator.Patch record schema:
{
"schema_version": 1,
"attempt": 1,
"baseline_commit": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"patch_commit": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"files_changed": 2,
"lines_added": 3,
"lines_removed": 1,
"variants": [],
"suite_before": {"command": "pytest", "passed": 9, "failed": 1, "skipped": 0},
"suite_after": {"command": "pytest", "passed": 10, "failed": 0, "skipped": 0},
"agent": "patcher-1"
}
Rationalizations to Reject
| Shortcut | Required action |
|---|---|
| Only the reported line matters. | Search for the same invariant violation. |
| Minimal means the fewest lines. | Make the smallest reviewable invariant-level fix. |
| Tests pass after the patch. | Show the regression test failed before it. |
Explore more skills
Browse all- Variant AnalysisHunts for the other instances of a bug already found — the variants of one root cause across a codebase. Use…
- Modern CppGuides C++ code toward modern idioms (C++20/23/26). Use when writing new C++ code, modernizing legacy patterns, or…
- codeqlScans a codebase for security vulnerabilities using CodeQL's interprocedural data flow and taint tracking analysis.…
- Firebase Apk ScannerScans Android APKs for Firebase security misconfigurations including open databases, storage buckets, authentication…
- Code ImproverRuns an autonomous review-and-fix improvement loop over any code target — a skill, plugin, module, or directory — using…
- Dimensional AnalysisAudits code for unit and decimal-scaling bugs and annotates it with dimensional comments recording the units of each…
Security
Signing
SignedSLSA L2- Signed by
- skills-hub.ai distributor
- Method
- Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
- Key
- skills-hub-ed25519-2026-11
- Signed
Reviews (0)
More from Trail of Bits
View source →Frequently asked questions about implement-patch
What does the implement-patch skill do?
Use when a confirmed local bug needs an invariant-level fix, variant search, tests, and one local commit. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the implement-patch skill?
Run `npx @skills-hub-ai/cli install trail-of-bits-implement-patch` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/trail-of-bits-implement-patch/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does implement-patch work with?
implement-patch runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the implement-patch skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use implement-patch after installing it?
In Claude Code, type `/trail-of-bits-implement-patch` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the implement-patch skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.
Badge for your README
Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.
[](https://skills-hub.ai/skills/trail-of-bits-implement-patch)<a href="https://skills-hub.ai/skills/trail-of-bits-implement-patch"><img src="https://skills-hub.ai/api/badges/skill/trail-of-bits-implement-patch" alt="Install on Skills Hub"></a>More options in the badge docs.