external/trailofbits-security/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 seikaikyo/dash-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."
tools
Conduct comprehensive GDPR compliance assessments by evaluating data processing activities against EU Regulation 2016/679, including Article 30 records of processing, lawful basis validation, data subject rights implementation, Data Protection Impact Assessments (DPIAs) under Article 35, breach notification procedures, international transfer safeguards (SCCs, adequacy decisions), and technical/organizational measures under Article 32. Use when processing personal data of EU residents, preparing for supervisory authority audits, implementing privacy-by-design for new systems, scoping compliance gaps for M&A due diligence, assessing third-party processors, or responding to data subject access requests at scale. Incorporates 2026 guidance from ICO, EDPB, and post-Data (Use and Access) Act 2025 UK-GDPR considerations. Do not use for implementing specific Article 32 controls — use implementing-gdpr-data-protection-controls; or for DSAR automation — use implementing-gdpr-data-subject-access-request.
tools
Parse Windows forensic artifacts—$MFT/$J (MFTECmd), Prefetch (PECmd), registry hives (RECmd), shellbags, and Amcache—into normalized CSV/JSON with Eric Zimmerman's EZ Tools, then load results into Timeline Explorer for analysis. Use during DFIR/incident-response investigations, after triage collection (e.g. with KAPE), to establish program execution, file/folder access, and persistence evidence from acquired forensic images.
development
Build automated multi-turn adversarial attacks against conversational LLM targets using Microsoft PyRIT's RedTeamingOrchestrator, CrescendoOrchestrator (gradual escalation), and TreeOfAttacksWithPruningOrchestrator (adaptive branching), with scorer feedback loops and persisted conversation memory. Use when single-shot LLM scanning is insufficient and you need multi-turn, scorer-driven AI red-team campaigns against a chatbot or agent.
testing
Stand up MISP, enable and cache curated threat feeds (CIRCL, abuse.ch, Feodo Tracker), apply warninglists to suppress false positives, query indicators with PyMISP, and export attributes as auto-generated Suricata/Sigma/Wazuh detection rules. Use when maturing a MISP instance to actively drive detection, curating threat feeds with quality controls, or automating IOC-to-detection pipelines for the SIEM/IDS.