spec-to-code-compliance
Fungsinya
Skill ini memeriksa apakah kode benar-benar melakukan apa yang tertulis dalam spesifikasi atau whitepaper-nya. Skill ini untuk auditor dan engineer yang harus membuktikan bahwa implementasi sesuai dengan dokumen yang dipublikasikan atau diberikan klien.
Kapan dipakai
- โSaat klien atau auditor menginginkan bukti bahwa kode sesuai dengan spesifikasi tertulis.
- โSaat Anda punya dokumen protokol dan implementasi dan ingin tahu di mana keduanya tidak sepakat.
- โSaat Anda membutuhkan daftar perilaku tak terdokumentasi dalam kode yang tidak disebut dalam catatan desain.
Link skill
https://github.com/trailofbits/skills/blob/main/plugins/spec-to-code-compliance/skills/spec-to-code-compliance/SKILL.mdSalin 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
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
โSaya ingin membandingkan spesifikasi protokol ini dengan kode saya dan menemukan persyaratan mana yang tidak diikuti kode.โ
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agen membaca dokumen dan kode berdampingan, mencantumkan setiap persyaratan, dan memeriksa apakah kode memenuhinya, melanggarnya, atau tidak menyebutkannya. Setiap celah ditandai sebagai bug kode atau kesalahan dokumentasi.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Spec-to-Code Compliance
Two artifacts disagree, and the job is to find where. The documentation says what the system does; the code decides what it actually does. Every gap between them is either a bug or a documentation fix, and which one it is is the finding.
When to Use
You have both documentation describing intended behavior and the code that should implement it. A whitepaper against a protocol, a design note against a service, a README's stated guarantees against the functions behind them.
Most useful when the document is authoritative โ something a client wrote, published, or is audited against โ because then a divergence is a defect rather than stale prose.
When NOT to Use
Not for code with no documentation of intended behavior. There is nothing to check against, and a requirement
inferred from the code is checked against itself. Build the system model first with audit-context-building.
Not for finding bugs in general. This finds one class: where the code and the document disagree. A bug both artifacts are silent about is out of scope, and a bug the document endorses is a finding against the document.
Not for writing or improving documentation, though it produces the list of what needs fixing.
Do not check requirements in this context
Run /spec-to-code-compliance:spec-compliance <path>. The slash command takes a path; to name the
specification directly or widen the fan-out, ask for the run with those values โ "run spec-compliance on
./contracts against SPEC.md, checking 20 requirements" โ and they reach the script as {path, spec, limit}.
Typing the object literally after the slash command does not work; it arrives as a string and becomes the path.
It finds the documents, splits them into individually checkable requirements, gives each requirement its own
agent to hunt the code with, has independent agents try to refute every divergence before it is reported, and
writes spec-compliance/REPORT.md plus one file per requirement under spec-compliance/requirements/. Only
compact records come back here.
For a single requirement, dispatch the spec-to-code-compliance:spec-compliance-checker agent at it.
This is not a preference about where output lands. The check does not fit in one context window if it is done honestly: judging one requirement means reading the enforcement, its callees, and its callers, and doing that for thirty requirements means holding thirty call chains at once. Attempted inline, the first few get a real check and the rest get a plausible one โ and the transcript looks the same either way, because a verdict resting on a promising function name reads exactly like one resting on having read the function. Per requirement, in its own context, is what makes that difference visible.
Two properties come from the script rather than from instructions, and cannot be had here:
- A refutation the finding's author did not perform. Claude favors findings it produced when asked to check them. The workflow sends each divergence to agents that did not produce it โ one reading the code again, one re-reading the document โ and drops what either knocks down.
- Records that cannot be prose. A subagent bound to a return schema has to name the lines it read and the
searches it ran. An
absentverdict arrives with the patterns tried and their results attached, which is the only thing separating a real absence from a search that stopped early.
Measured on the routes-not-inline eval: with this plugin installed the work is dispatched every run, without
it never โ ฮ +1.00. Deleting this section while leaving the workflow in place changes nothing, because the
workflow is a real command that gets found and dispatched on its own. Read that as the mechanism carrying the
behavior rather than this text: the section is here so a human knows what runs and why, not because the routing
depends on it.
What comes back, and how to read it
Every requirement gets one of six verdicts: implemented, partial, contradicted, stronger-than-spec,
absent, or undecidable. The interesting ones are the middle four.
partialis usually the most serious thing in the report. The requirement holds on the paths anyone would test and fails on one nobody did, which is how it survived long enough to be found.absentrests entirely on itssearchedrecord. Read it. Enforcement often lives somewhere the search did not go โ a modifier, a base class, a caller that chec
Pertanyaan umum
Apakah perlu dokumen?
Ya. Skill ini untuk kode yang punya deskripsi tertulis tentang perilaku yang dimaksud. Kode tanpa dokumen tidak punya acuan untuk diperiksa.
Apakah skill ini menemukan semua bug?
Tidak. Skill ini hanya menemukan kasus ketika kode dan dokumen tidak sepakat.
Bagaimana cara memulainya?
Arahkan skill ke berkas spesifikasi yang ingin Anda periksa terhadap kode.
Detail
Deskripsi asli dari pembuat
Check code against the documentation that specifies it - which requirements hold, which the code contradicts, which are absent, and what the code does that no document mentions. Use when comparing an implementation against a whitepaper, protocol spec, or design document.
repo: trailofbits/skills
Popularitas
- Bintang GitHub
- 8.0k
- Peringkat
- #12706
- Lisensi
- CC-BY-SA-4.0
- Diperbarui
- 2/11/2026
Komentar
- โฆ
Skill lain dari repositori ini
audit-context-building
8.0kMembantu agent Anda mempelajari basis kode yang belum dikenal sebelum tinjauan keamanan, dengan memetakan apa yang diasumsikan, dijamin, dan bergantung pada setiap fungsi.
algorand-vulnerability-scanner
8.0kMembantu agent Anda memindai smart contract Algorand, yang ditulis dalam TEAL atau PyTeal, untuk 11 masalah keamanan umum seperti serangan rekeying dan biaya yang tidak diperiksa.
audit-prep-assistant
8.0kMembantu agent Anda menyiapkan basis kode untuk tinjauan keamanan dari luar, dengan analisis statis, cakupan tes, pembersihan kode mati, dan dokumentasi yang jelas.
cairo-vulnerability-scanner
8.0kMembantu agent Anda memindai smart contract Cairo di StarkNet untuk 6 masalah serius, termasuk overflow aritmetika, pesan lintas lapisan yang berisiko, dan replay tanda tangan.
Skill serupa
test-driven-development
311kMengajari agent Anda menulis tes yang gagal dulu, melihatnya gagal, lalu menulis kode terkecil yang lulus, sebelum membangun fitur atau perbaikan apa pun.
verification-before-completion
311kMengajari agent Anda menjalankan pemeriksaan nyata dan membaca keluarannya sebelum menyatakan tugas, perbaikan, atau build sudah selesai atau lulus.
migrate-to-shoehorn
310kMengganti type cast berisiko di file tes Anda dengan pustaka shoehorn, sehingga tes bisa memakai data parsial dan tetap lulus pemeriksaan tipe.