Langsung ke konten
Skillpedia
Keamanan7.7k Β· #13103

patch

Fungsinya

Skill ini mengubah daftar temuan keamanan yang sudah diperiksa menjadi usulan perubahan kode. Skill ini tidak pernah menerapkannya ke proyek Anda. Skill ini ditujukan untuk pengembang yang menginginkan saran perbaikan untuk ditinjau.

Kapan dipakai

  • βœ“Saat Anda memiliki daftar temuan keamanan yang sudah diverifikasi dan ingin draf perbaikan.
  • βœ“Saat Anda ingin membatasi perbaikan pada temuan yang paling serius.
  • βœ“Saat Anda ingin usulan perbaikan disimpan untuk ditinjau manusia, bukan diterapkan secara otomatis.

Link skill

https://github.com/anthropics/defending-code-reference-harness/blob/main/.claude/skills/patch/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/anthropics/defending-code-reference-harness/blob/main/.claude/skills/patch/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBisakah Anda membuat draf perbaikan untuk masalah keamanan paling serius di daftar triase saya dan menyimpannya agar bisa saya tinjau?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Untuk setiap temuan, agent menulis perubahan yang diusulkan dan meminta peninjau kedua memeriksanya. Hasilnya disimpan sebagai diff teks yang dapat diterapkan seseorang setelah membacanya.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

patch

Third leg of the static pipeline (/vuln-scan β†’ /triage β†’ /patch). Turns a ranked list of verified findings into candidate diffs.

The skill never applies a diff to the target repo. Output is inert text in ./PATCHES/ for a human to review and apply out-of-band β€” see docs/patching.md#reviewing-generated-patches. There is no --apply or --approve flag by design: the capability isn't present, so it can't be prompt-injected into use.

Invoke with /patch <findings-path> [--repo PATH] [--top N] [--id fNNN] [--model M] [--fresh].

Arguments (parse from $ARGUMENTS):

  • findings path (first positional, required): TRIAGE.json, VULN-FINDINGS.json, a pipeline results/<target>/<ts>/ directory, or any JSON the /triage ingest table recognizes.
  • --repo PATH: target codebase, read-only (default cwd). Required for static mode; the skill stops if cited files don't resolve under it.
  • --top N: patch only the N highest-severity true positives (static mode).
  • --id fNNN: patch only the finding with this id.
  • --model M: passed through to vuln-pipeline patch in execution-verified mode. Ignored in static mode (subagents inherit the orchestrator's model).
  • --fresh: ignore ./.patch-state/ checkpoint and start over.

Tools. Prefer Read, Glob, Grep, Write, Task. Some sessions do not provision Glob or Grep; allowed-tools is a permission filter, not a loader. When they are unavailable, fall back to the read-only Bash commands whitelisted above: rg/grep for search, ls for enumeration, head/file/wc for sniffing, jq for JSON ingest. Bash is otherwise permitted only for python3 .claude/skills/_lib/checkpoint.py (state I/O) and vuln-pipeline patch (execution-verified delegate). find is NOT permitted.

Write scope. The Write tool may target ONLY paths under ./PATCHES/ and ./.patch-state/. Never write into --repo, never git apply, never patch, never edit target source. If a step seems to require it, the step is wrong.


Checkpointing (runs before Phase 0 and after every phase)

State persists to ./.patch-state/ so a fresh /patch session resumes without re-spawning patch or reviewer subagents. All checkpoint I/O goes through python3 .claude/skills/_lib/checkpoint.py (atomic, JSON-validated). The Write→--from pattern keeps repo-derived bytes out of Bash argv; never pass payload via heredoc or stdin.

State files: progress.json (single source of truth: {"status": "running"|"complete", "phase_done": N, "shards_done": [...]}), phaseN.json, _chunk.tmp.

Start of run. Bash: python3 .claude/skills/_lib/checkpoint.py load ./.patch-state

  • status == "absent" OR "complete", OR --fresh in $ARGUMENTS β†’ fresh start. Bash: python3 .claude/skills/_lib/checkpoint.py reset ./.patch-state, proceed to Phase 0.
  • status == "running" with phase_done == N β†’ resume. Read phase0.json..phaseN.json in order (and any shard_*.json listed in shards_done), merge into working state, print Resuming from checkpoint: Phase N complete, skip to Phase N+1. Do not re-spawn any subagent whose output is already checkpointed.

End of every phase N. Write tool β†’ ./.patch-state/_chunk.tmp with the phase's JSON, then Bash: python3 .claude/skills/_lib/checkpoint.py save ./.patch-state <N> <name> --from ./.patch-state/_chunk.tmp

End of run. After writing PATCHES.md and PATCHES.json, Bash: python3 .claude/skills/_lib/checkpoint.py done ./.patch-state 4


Phase 0: Parse arguments and detect mode

0a. Parse $ARGUMENTS

Extract findings path (first positional), --repo (default .), --top, --id, --model, --fresh. If no findings path, stop and ask.

0b. Detect mode

Inspect the findings path:

  • execution-verified mode when the path is a directory containing reports/manifest.jsonl OR found_bugs.jsonl OR run_*/result.json (pipeline output) β€” unless an INCIDENTS.json is present anywhere in it: D&R run dirs also contain run_*/result.json, and their incidents route static. The findings have PoC bytes + ASAN traces + reproduction commands; the pipeline's verification ladder applies.
  • static mode otherwise: TRIAGE.json, VULN-FINDINGS.json, INCIDENTS.json (the /dnr-* output), generic finding JSON, or markdown. No PoC; the oracle is a fresh-context reviewer.

Record mode in working state. The two modes share Phase 1 ingest then fork at Phase 2.

**Checkpoi

Pertanyaan umum

Apakah ini mengubah kode saya?

Tidak. Keluarannya hanya file teks untuk Anda tinjau dan terapkan sendiri.

Bisakah saya memilih temuan mana yang akan diperbaiki?

Bisa. Anda dapat membatasi pekerjaan pada temuan teratas atau satu temuan berdasarkan ID-nya.

File apa yang dibaca?

Skill ini membaca file triase, file temuan, file insiden, atau folder hasil pipeline.

Detail

Deskripsi asli dari pembuat

Generate candidate fixes for verified security findings. Consumes TRIAGE.json (preferred), VULN-FINDINGS.json, INCIDENTS.json, or a vuln-pipeline results directory. Pipeline input is delegated to the execution-verified `vuln-pipeline patch` ladder; static-analysis input gets a per-finding patch subagent + independent reviewer and is written as inert diffs for human review. Writes PATCHES/bug_NN/{patch.diff,patch_result.json}, PATCHES.md, and PATCHES.json. Use when asked to "fix the findings", "patch these vulns", "generate fixes", or "close the loop on triage".

repo: anthropics/defending-code-reference-harness

Popularitas

Bintang GitHub
7.7k
Peringkat
#13103
Lisensi
β€”
Diperbarui
6/8/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa