spec-to-code-compliance
Checks blockchain codebases against specifications to ensure logical alignment and security compliance.
Install
mkdir -p .claude/skills/spec-to-code-compliance && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3785" && unzip -o skill.zip -d .claude/skills/spec-to-code-compliance && rm skill.zipInstalls to .claude/skills/spec-to-code-compliance
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Verifies code implements exactly what documentation specifies for blockchain audits. Use when comparing code against whitepapers, finding gaps between specs and implementation, or performing compliance checks for protocol implementations.Key capabilities
- →Maps specification docs to codebase
- →Identifies unimplemented requirements
- →Verifies code logic against invariants
- →Cites evidence for compliance gaps
How it works
Performs a deterministic, manual-style audit by cross-referencing specific text within documentation against exact file and line references.
Inputs & outputs
When to use spec-to-code-compliance
- →Auditing smart contracts against whitepapers
- →Identifying unimplemented spec requirements
- →Verifying security invariants
- →Compliance checking for blockchain protocols
About this skill
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 checks first.undecidable, and anydocumentProblem, are findings about the documentation. A requirement too vague to check is one the client cannot hold anyone to.stronger-than-specis an undocumented constraint. It works today, and nothing tells the next person changing that code that anything depended on it.
The report also carries the reverse direction — behavior the code has that no document mentions — which the per-requirement pass cannot find by construction, since it is driven by the documents.
Read notChecked, unverified, and unreadableDocuments before treating the report as complete. Requirements
below the fan-out cut were never checked, and a divergence whose refutation agents both failed is unverified
rather than confirmed.
Judgment the workflow does not make for you
Severity is consequence, not distance from the text: DIVERGENCE_RUBRIC.md. A rounding step that bleeds a pool outranks a MUST satisfied by different means than the document describes, and documentation drift with no behavioral consequence is a docs ticket.
The verdict is not the finding. absent on a mandatory requirement is a finding; absent on a sentence
describing a roadmap item is not. Deciding which is which is what this skill is for, and the workflow hands you
the evidence to decide it with.
The target does not have to be a contract
The question is the same everywhere — what does this requirement demand, where would it be enforced, is it enforced on every path — but what counts as a specification and where enforcement hides both change. DOMAIN_NOTES.md maps that across contracts, C and C++, services, and decompiled firmware, and covers the case where the specification is an RFC or a standard rather than a project document. Read it when the target is not a contract, and when scoping a check against a large standard.
Reference
- ANALYSIS_FORMAT.md — the on-disk format for a per-requirement analysis. Read when extending this plugin or judging whether a record is trustworthy.
- WORKED_EXAMPLE.md — three requirements chased to a verdict, one per verdict that is easy to get wrong: arithmetic that satisfies a requirement it does not resemble, an absence whose searches are the finding, and enforcement present on every path but the one nobody tested.
- DOMAIN_NOTES.md — per-domain mapping of specifications and enforcement.
- DIVERGENCE_RUBRIC.md — severity, and the two directions of a gap.
When not to use it
- →General software debugging
- →Projects lacking formal documentation
Prerequisites
Limitations
- →High dependency on spec document quality
- →Binary pass/fail outcomes for logic gaps
How it compares
It is an evidence-based audit tool that prohibits internal knowledge usage, ensuring strict adherence to provided source materials.
Compared to similar skills
spec-to-code-compliance side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| spec-to-code-compliance (this skill) | 2 | 2mo | No flags | Advanced |
| solidity-security | 15 | 2mo | No flags | Intermediate |
| supabase-rls-policy-generator | 11 | 9mo | No flags | Advanced |
| backend-security-coder | 24 | 4mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by trailofbits
View all by trailofbits →You might also like
solidity-security
wshobson
Master smart contract security best practices to prevent common vulnerabilities and implement secure Solidity patterns. Use when writing smart contracts, auditing existing contracts, or implementing security measures for blockchain applications.
supabase-rls-policy-generator
hopeoverture
This skill should be used when the user requests to generate, create, or add Row-Level Security (RLS) policies for Supabase databases in multi-tenant or role-based applications. It generates comprehensive RLS policies using auth.uid(), auth.jwt() claims, and role-based access patterns. Trigger terms include RLS, row level security, supabase security, generate policies, auth policies, multi-tenant security, role-based access, database security policies, supabase permissions, tenant isolation.
backend-security-coder
sickn33
Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.
sqlmap-database-penetration-testing
davila7
This skill should be used when the user asks to "automate SQL injection testing," "enumerate database structure," "extract database credentials using sqlmap," "dump tables and columns from a vulnerable database," or "perform automated database penetration testing." It provides comprehensive guidance for using SQLMap to detect and exploit SQL injection vulnerabilities.
agent-security-manager
ruvnet
Agent skill for security-manager - invoke with $agent-security-manager
secure-workflow-guide
trailofbits
Guides through Trail of Bits' 5-step secure development workflow. Runs Slither scans, checks special features (upgradeability/ERC conformance/token integration), generates visual security diagrams, helps document security properties for fuzzing/verification, and reviews manual security areas.