Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问clear审计异常

spec-to-code-compliance规范与代码合规性

Agent Skill

spec-to-code-compliance 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

48,888

周安装

2,075

GitHub Stars

4,923

下载量

17,136
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:spec-to-code-compliance(规范与代码合规性)
来源仓库:https://github.com/trailofbits/skills
仓库路径:skills/spec-to-code-compliance
安装命令:
npx skills add https://github.com/trailofbits/skills --skill spec-to-code-compliance
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/trailofbits/skills --skill spec-to-code-compliance

简介

验证代码是否准确实现了文档为区块链审计指定的内容。

  • 根据规范文档、白皮书或设计文档对代码执行确定性的逐行语义分析,以识别差距和偏差
  • 将规范意图和代码行为提取为结构化中间表示(Spec-IR、Code-IR、Alignment-IR),具有完整的可追溯性和置信度分数
  • 按严重性(严重、高、中、低)对差异进行分类,并提供证据链接、利用场景和补救建议
  • 检测整个代码库中未记录的代码路径、未实现的规范声明、不变违规、数学不一致和访问控制漂移

SKILL.md

When to Use

Use this skill when you need to:

  • Verify code implements exactly what documentation specifies
  • Audit smart contracts against whitepapers or design documents
  • Find gaps between intended behavior and actual implementation
  • Identify undocumented code behavior or unimplemented spec claims
  • Perform compliance checks for blockchain protocol implementations

Concrete triggers:

  • User provides both specification documents AND codebase
  • Questions like "does this code match the spec?" or "what's missing from the implementation?"
  • Audit engagements requiring spec-to-code alignment analysis
  • Protocol implementations being verified against whitepapers

When NOT to Use

Do NOT use this skill for:

  • Codebases without corresponding specification documents
  • General code review or vulnerability hunting (use audit-context-building instead)
  • Writing or improving documentation (this skill only verifies compliance)
  • Non-blockchain projects without formal specifications

Spec-to-Code Compliance Checker Skill

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:

  • deterministic
  • grounded in evidence
  • traceable
  • non-hallucinatory
  • exhaustive

GLOBAL RULES

  • Never infer unspecified behavior.
  • Always cite exact evidence from:

- the documentation (section/title/quote) - the code (file + line numbers)

  • Always provide a confidence score (0–1) for mappings.
  • Always classify ambiguity instead of guessing.
  • Maintain strict separation between:

1. extraction 2. alignment 3. classification 4. reporting

  • Do NOT rely on prior knowledge of known protocols. Only use provided materials.
  • Be literal, pedantic, and exhaustive.

Rationalizations (Do Not Skip)

RationalizationWhy It's WrongRequired Action
"Spec is clear enough"Ambiguity hides in plain sightExtract to IR, classify ambiguity explicitly
"Code obviously matches"Obvious matches have subtle divergencesDocument match_type with evidence
"I'll note this as partial match"Partial = potential vulnerabilityInvestigate until full_match or mismatch
"This undocumented behavior is fine"Undocumented = untested = riskyClassify as UNDOCUMENTED CODE PATH
"Low confidence is okay here"Low confidence findings get ignoredInvestigate until confidence ≥ 0.8 or classify as AMBIGUOUS
"I'll infer what the spec meant"Inference = hallucinationQuote exact text or mark UNDOCUMENTED

PHASE 0 — Documentation Discovery

Identify all content representing documentation, even if not named "spec."

Documentation may appear as:

  • whitepaper.pdf
  • Protocol.md
  • design_notes
  • Flow.pdf
  • README.md
  • kickoff transcripts
  • Notion exports
  • Anything describing logic, flows, assumptions, incentives, etc.

Use semantic cues:

  • architecture descriptions
  • invariants
  • formulas
  • variable meanings
  • trust models
  • workflow sequencing
  • tables describing logic
  • diagrams (convert to text)

Extract ALL relevant documents into a unified spec corpus.


PHASE 1 — Universal Format Normalization

Normalize ANY input format:

  • PDF
  • Markdown
  • DOCX
  • HTML
  • TXT
  • Notion export
  • Meeting transcripts

Preserve:

  • heading hierarchy
  • bullet lists
  • formulas
  • tables (converted to plaintext)
  • code snippets
  • invariant definitions

Remove:

  • layout noise
  • styling artifacts
  • watermarks

Output: a clean, canonical spec_corpus.


PHASE 2 — Spec Intent IR (Intermediate Representation)

Extract all intended behavior into the Spec-IR.

Each extracted item MUST include:

  • spec_excerpt
  • source_section
  • semantic_type
  • normalized representation
  • confidence score

Extract:

  • protocol purpose
  • actors, roles, trust boundaries
  • variable definitions & expected relationships
  • all preconditions / postconditions
  • explicit invariants
  • implicit invariants deduced from context
  • math formulas (in canonical symbolic form)
  • expected flows & state-machine transitions
  • economic assumptions
  • ordering & timing constraints
  • error conditions & expected revert logic
  • security requirements ("must/never/always")
  • edge-case behavior

This forms Spec-IR.

See IR_EXAMPLES.md for detailed examples.


PHASE 3 — Code Behavior IR

(WITH TRUE LINE-BY-LINE / BLOCK-BY-BLOCK ANALYSIS)

Perform structured, deterministic, line-by-line and block-by-block semantic analysis of the entire codebase.

For EVERY LINE and EVERY BLOCK, extract:

  • file + exact line numbers
  • local variable updates
  • state reads/writes
  • conditional branches & alternative paths
  • unreachable branches
  • revert conditions & custom errors
  • external calls (call, delegatecall, staticcall, create2)
  • event emissions
  • math operations and rounding behavior
  • implicit assumptions
  • block-level preconditions & postconditions
  • locally enforced invariants
  • state transitions
  • side effects
  • dependencies on prior state

For EVERY FUNCTION, extract:

  • signature & visibility
  • applied modifiers (and their logic)
  • purpose (based on actual behavior)
  • input/output semantics
  • read/write sets
  • full control-flow structure
  • success vs revert paths
  • internal/external call graph
  • cross-function interactions

Also capture:

  • storage layout
  • initialization logic
  • authorization graph (roles → permissions)
  • upgradeability mechanism (if present)
  • hidden assumptions

Output: Code-IR, a granular semantic map with full traceability.

See IR_EXAMPLES.md for detailed examples.


PHASE 4 — Alignment IR (Spec ↔ Code Comparison)

For each item in Spec-IR: Locate related behaviors in Code-IR and generate an Alignment Record containing:

  • spec_excerpt
  • code_excerpt (with file + line numbers)
  • match_type:

- full_match - partial_match - mismatch - missing_in_code - code_stronger_than_spec - code_weaker_than_spec

  • reasoning trace
  • confidence score (0–1)
  • ambiguity rating
  • evidence links

Explicitly check:

  • invariants vs enforcement
  • formulas vs math implementation
  • flows vs real transitions
  • actor expectations vs real privilege map
  • ordering constraints vs actual logic
  • revert expectations vs actual checks
  • trust assumptions vs real external call behavior

Also detect:

  • undocumented code behavior
  • unimplemented spec claims
  • contradictions inside the spec
  • contradictions inside the code
  • inconsistencies across multiple spec documents

Output: Alignment-IR

See IR_EXAMPLES.md for detailed examples.


PHASE 5 — Divergence Classification

Classify each misalignment by severity:

CRITICAL

  • Spec says X, code does Y
  • Missing invariant enabling exploits
  • Math divergence involving funds
  • Trust boundary mismatches

HIGH

  • Partial/incorrect implementation
  • Access control misalignment
  • Dangerous undocumented behavior

MEDIUM

  • Ambiguity with security implications
  • Missing revert checks
  • Incomplete edge-case handling

LOW

  • Documentation drift
  • Minor semantics mismatch

Each finding MUST include:

  • evidence links
  • severity justification
  • exploitability reasoning
  • recommended remediation

See IR_EXAMPLES.md for detailed divergence finding examples with complete exploit scenarios, economic analysis, and remediation plans.


PHASE 6 — Final Audit-Grade Report

Produce a structured compliance report:

  1. Executive Summary
  2. Documentation Sources Identified
  3. Spec Intent Breakdown (Spec-IR)
  4. Code Behavior Summary (Code-IR)
  5. Full Alignment Matrix (Spec → Code → Status)
  6. Divergence Findings (with evidence & severity)
  7. Missing invariants
  8. Incorrect logic
  9. Math inconsistencies
  10. Flow/state machine mismatches
  11. Access control drift
  12. Undocumented behavior
  13. Ambiguity hotspots (spec & code)
  14. Recommended remediations
  15. Documentation update suggestions
  16. Final risk assessment

Output Requirements & Quality Standards

See OUTPUT_REQUIREMENTS.md for:

  • Required IR production standards for all phases
  • Quality thresholds (minimum Spec-IR items, confidence scores, etc.)
  • Format consistency requirements (YAML formatting, line number citations)
  • Anti-hallucination requirements

Completeness Verification

Before finalizing analysis, review the COMPLETENESS_CHECKLIST.md to verify:

  • Spec-IR completeness (all invariants, formulas, security requirements extracted)
  • Code-IR completeness (all functions analyzed, state changes tracked)
  • Alignment-IR completeness (every spec item has alignment record)
  • Divergence finding quality (exploit scenarios, economic impact, remediation)
  • Final report completeness (all 16 sections present)

ANTI-HALLUCINATION REQUIREMENTS

  • If the spec is silent: classify as UNDOCUMENTED.
  • If the code adds behavior: classify as UNDOCUMENTED CODE PATH.
  • If unclear: classify as AMBIGUOUS.
  • Every claim must quote original text or line numbers.
  • Zero speculation.
  • Exhaustive, literal, pedantic reasoning.

Resources

Detailed Examples:

Standards & Requirements:


Agent

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."


END OF SKILL

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.76%
按下载量换算5,100

OpenCode

23%
按下载量换算3,941

Gemini CLI

15.22%
按下载量换算2,608

Cursor

12.68%
按下载量换算2,173

Antigravity

7.44%
按下载量换算1,275

Codex

2.99%
按下载量换算512

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills