Co-Pilot / 辅助式
更新于 a month ago
spec-to-code-compliance
Ttrailofbits
1.8k
trailofbits/skills/plugins/spec-to-code-compliance
💡 摘要
该技能检查代码与区块链审计规范的一致性,确保对齐并识别差距。
🎯 适合人群
区块链开发者智能合约审计员合规官技术项目经理质量保证工程师
🤖 AI 吐槽: “看起来很能打,但别让配置把人劝退。”
安全分析中风险
风险:Medium。建议检查:文件读写范围与路径穿越风险。以最小权限运行,并在生产环境启用前审计代码与依赖。
Spec-to-Code Compliance
Specification-to-code compliance checker for blockchain audits with evidence-based alignment analysis.
Author: Omar Inuwa
When to Use
Use this skill when you need to:
- Verify that code implements exactly what documentation specifies
- Find gaps between intended behavior and actual implementation
- Audit smart contracts against whitepapers or design documents
- Identify undocumented code behavior or unimplemented spec claims
What It Does
This skill performs deterministic, evidence-based alignment between specifications and code:
- Documentation Discovery - Finds all spec sources (whitepapers, READMEs, design notes)
- Spec Intent Extraction - Normalizes all intended behavior into structured format
- Code Behavior Analysis - Line-by-line semantic analysis of actual implementation
- Alignment Comparison - Maps spec items to code with match types and confidence scores
- Divergence Classification - Categorizes misalignments by severity (Critical/High/Medium/Low)
Key Principle
Zero speculation. Every claim must be backed by:
- Exact quotes from documentation (section/title)
- Specific code references (file + line numbers)
- Confidence scores (0-1) for all mappings
Installation
/plugin install trailofbits/skills/plugins/spec-to-code-compliance
Phases
- Documentation Discovery - Identify all spec sources
- Format Normalization - Create clean spec corpus
- Spec Intent IR - Extract all intended behavior
- Code Behavior IR - Line-by-line code analysis
- Alignment IR - Compare spec to code
- Divergence Classification - Categorize misalignments
- Final Report - Generate audit-grade compliance report
Match Types
full_match- Code exactly implements specpartial_match- Incomplete implementationmismatch- Spec says X, code does Ymissing_in_code- Spec claim not implementedcode_stronger_than_spec- Code adds behaviorcode_weaker_than_spec- Code misses requirements
Anti-Hallucination Rules
- If spec is silent: classify as UNDOCUMENTED
- If code adds behavior: classify as UNDOCUMENTED CODE PATH
- If unclear: classify as AMBIGUOUS
- Every claim must quote original text or line numbers
Related Skills
context-building- Deep code understandingissue-writer- Format compliance gaps as findings
五维分析
清晰度9/10
创新性8/10
实用性9/10
完整性8/10
可维护性8/10
优缺点分析
优点
- 提供详细的合规分析
- 识别规范与代码之间的差距
- 支持多种文档格式
缺点
- 可能需要大量文档
- 大型项目的设置复杂
- 对于大型代码库可能耗时
相关技能
免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。
版权归原作者所有 trailofbits.
