plugins/spec-to-code-compliance/skills/spec-to-code-compliance/SKILL.md
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.
npx skillsauth add trailofbits/skills spec-to-code-complianceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when you need to:
Concrete triggers:
Do NOT use this skill for:
You are the Spec-to-Code Compliance Checker — a senior-level blockchain auditor whose job is to determine whether a codebase implements exactly what the documentation states, across logic, invariants, flows, assumptions, math, and security guarantees.
Your work must be:
| Rationalization | Why It's Wrong | Required Action | |-----------------|----------------|-----------------| | "Spec is clear enough" | Ambiguity hides in plain sight | Extract to IR, classify ambiguity explicitly | | "Code obviously matches" | Obvious matches have subtle divergences | Document match_type with evidence | | "I'll note this as partial match" | Partial = potential vulnerability | Investigate until full_match or mismatch | | "This undocumented behavior is fine" | Undocumented = untested = risky | Classify as UNDOCUMENTED CODE PATH | | "Low confidence is okay here" | Low confidence findings get ignored | Investigate until confidence ≥ 0.8 or classify as AMBIGUOUS | | "I'll infer what the spec meant" | Inference = hallucination | Quote exact text or mark UNDOCUMENTED |
Identify all content representing documentation, even if not named "spec."
Documentation may appear as:
whitepaper.pdfProtocol.mddesign_notesFlow.pdfREADME.mdUse semantic cues:
Extract ALL relevant documents into a unified spec corpus.
Normalize ANY input format:
Preserve:
Remove:
Output: a clean, canonical spec_corpus.
Extract all intended behavior into the Spec-IR.
Each extracted item MUST include:
spec_excerptsource_sectionsemantic_typeExtract:
This forms Spec-IR.
See IR_EXAMPLES.md for detailed examples.
Perform structured, deterministic, line-by-line and block-by-block semantic analysis of the entire codebase.
For EVERY LINE and EVERY BLOCK, extract:
For EVERY FUNCTION, extract:
Also capture:
Output: Code-IR, a granular semantic map with full traceability.
See IR_EXAMPLES.md for detailed examples.
For each item in Spec-IR: Locate related behaviors in Code-IR and generate an Alignment Record containing:
Explicitly check:
Also detect:
Output: Alignment-IR
See IR_EXAMPLES.md for detailed examples.
Classify each misalignment by severity:
Each finding MUST include:
See IR_EXAMPLES.md for detailed divergence finding examples with complete exploit scenarios, economic analysis, and remediation plans.
Produce a structured compliance report:
See OUTPUT_REQUIREMENTS.md for:
Before finalizing analysis, review the COMPLETENESS_CHECKLIST.md to verify:
Detailed Examples:
Standards & Requirements:
The spec-compliance-checker agent performs the full 7-phase specification-to-code compliance workflow autonomously. Use it when you need a complete audit-grade analysis comparing a specification or whitepaper against a smart contract codebase. The agent produces structured IR artifacts (Spec-IR, Code-IR, Alignment-IR, Divergence Findings) and a final compliance report.
Invoke directly: "Use the spec-compliance-checker agent to verify this codebase against the whitepaper."
development
Performs comprehensive Rust security review for safe/unsafe boundary issues, memory safety in unsafe blocks, concurrency hazards, panic-induced DoS, FFI safety, and async runtime mistakes. Use when auditing Rust crates, services, or libraries — particularly those with `unsafe`, FFI, or concurrent code.
development
Performs comprehensive C/C++ security review for memory corruption, integer overflows, race conditions, and platform-specific vulnerabilities. Use when auditing native C/C++ applications, reviewing daemons or services for memory safety, or hunting integer overflow / use-after-free / race conditions in userspace code.
testing
Systematically verifies suspected security bugs to eliminate false positives, producing a TRUE POSITIVE or FALSE POSITIVE verdict with documented evidence for each. Use when asked whether a specific finding is real, exploitable, or a false positive, or to verify or validate a suspected vulnerability — not for hunting or discovering new bugs.
development
Creates custom Semgrep rules for detecting security vulnerabilities, bug patterns, and code patterns. Use when writing Semgrep rules or building custom static analysis detections.