audit-context-building by trailofbits/skills
npx skills add https://github.com/trailofbits/skills --skill audit-context-building此技能用于在审计的上下文构建阶段,控制 Claude 的思考方式。
激活时,Claude 将:
此技能定义了一个结构化的分析格式(见下文示例:函数微观分析),并在漏洞搜寻阶段之前运行。
在以下情况使用:
不要用于:
激活时,Claude 将:
目标:深入、准确的理解,而非得出结论。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 合理化借口 | 为何错误 | 必要行动 |
|---|---|---|
| "我了解大意了" | 大意层面的理解会遗漏边界情况 | 必须进行逐行分析 |
| "这个函数很简单" | 简单函数组合起来可能产生复杂漏洞 | 无论如何应用5个为什么 |
| "我会记住这个不变量" | 你不会。上下文会退化。 | 明确写下来 |
| "外部调用可能没问题" | 外部调用在证明无害前应视为敌对的 | 跳入代码或将其建模为敌对方 |
| "我可以跳过这个辅助函数" | 辅助函数包含会传播的假设 | 追踪完整的调用链 |
| "这花费太长时间了" | 仓促的上下文 = 后续产生幻觉式漏洞 | 慢即是快 |
在进行深度分析之前,Claude 执行最小化映射:
这为详细分析建立了锚点。
每个非平凡函数都会接受完整的微观分析。
对于每个函数:
对每个块应用: * 第一性原理 * 5个为什么 * 5个怎么做
(完全整合"跳入外部代码"规则)
遇到调用时,跨边界继续相同的微观优先分析。
情况 A — 调用代码库中存在的合约 视为内部调用:
情况 B — 调用无可用代码的外部合约(真正的外部/黑盒) 视为敌对进行分析:
将整个调用链视为一个连续的执行流。永不重置上下文。所有不变量、假设和数据依赖必须跨调用传播。
请参阅 FUNCTION_MICRO_ANALYSIS_EXAMPLE.md 获取完整演示,内容包括:
此示例展示了所有被分析函数所需的深度和结构水平。
执行超细粒度分析时,Claude 必须 按照 OUTPUT_REQUIREMENTS.md 中定义的格式构建输出。
关键要求:
质量阈值:
在结束函数的微观分析之前,对照 COMPLETENESS_CHECKLIST.md 进行验证:
当检查清单中的所有项目都得到满足,且没有未解决的"不清楚"项时,分析才算完成。
完成足够的微观分析后:
这些聚类有助于指导漏洞搜寻阶段。
(抗幻觉,抗矛盾)
Claude 必须:
Claude 可以为以下情况生成子代理:
使用 function-analyzer 代理进行每个函数的深度分析。它遵循此技能中定义的完整微观结构清单、跨函数流规则和质量阈值,并强制执行纯上下文构建约束。
子代理必须:
此技能在以下阶段之前运行:
它仅用于构建:
激活时,Claude 不应:
这仅用于纯上下文构建。
每周安装
1.3K
仓库
GitHub 星标
3.9K
首次出现
Jan 19, 2026
安全审计
安装于
opencode1.1K
claude-code1.1K
gemini-cli1.0K
codex1.0K
cursor982
github-copilot952
This skill governs how Claude thinks during the context-building phase of an audit.
When active, Claude will:
This skill defines a structured analysis format (see Example: Function Micro-Analysis below) and runs before the vulnerability-hunting phase.
Use when:
Do not use for:
When active, Claude will:
Goal: deep, accurate understanding , not conclusions.
| Rationalization | Why It's Wrong | Required Action |
|---|---|---|
| "I get the gist" | Gist-level understanding misses edge cases | Line-by-line analysis required |
| "This function is simple" | Simple functions compose into complex bugs | Apply 5 Whys anyway |
| "I'll remember this invariant" | You won't. Context degrades. | Write it down explicitly |
| "External call is probably fine" | External = adversarial until proven otherwise | Jump into code or model as hostile |
| "I can skip this helper" | Helpers contain assumptions that propagate | Trace the full call chain |
| "This is taking too long" | Rushed context = hallucinated vulnerabilities later | Slow is fast |
Before deep analysis, Claude performs a minimal mapping:
This establishes anchors for detailed analysis.
Every non-trivial function receives full micro analysis.
For each function:
Purpose
Inputs & Assumptions
Outputs & Effects
Block-by-Block / Line-by-Line Analysis For each logical block:
Apply per-block:
* **First Principles**
* **5 Whys**
* **5 Hows**
(Full Integration of Jump-Into-External-Code Rule)
When encountering calls, continue the same micro-first analysis across boundaries.
Case A — External Call to a Contract Whose Code Exists in the Codebase Treat as an internal call:
Case B — External Call Without Available Code (True External / Black Box) Analyze as adversarial:
Treat the entire call chain as one continuous execution flow. Never reset context. All invariants, assumptions, and data dependencies must propagate across calls.
See FUNCTION_MICRO_ANALYSIS_EXAMPLE.md for a complete walkthrough demonstrating:
This example demonstrates the level of depth and structure required for all analyzed functions.
When performing ultra-granular analysis, Claude MUST structure output following the format defined in OUTPUT_REQUIREMENTS.md.
Key requirements:
Quality thresholds:
Before concluding micro-analysis of a function, verify against the COMPLETENESS_CHECKLIST.md:
Analysis is complete when all checklist items are satisfied and no unresolved "unclear" items remain.
After sufficient micro-analysis:
State & Invariant Reconstruction
Workflow Reconstruction
Trust Boundary Mapping
Complexity & Fragility Clustering
These clusters help guide the vulnerability-hunting phase.
(Anti-Hallucination, Anti-Contradiction)
Claude must:
Never reshape evidence to fit earlier assumptions. When contradicted:
Periodically anchor key facts Summarize core:
Avoid vague guesses Use:
Cross-reference constantly Connect new insights to previous state, flows, and invariants to maintain global coherence.
Claude may spawn subagents for:
Use the function-analyzer agent for per-function deep analysis. It follows the full microstructure checklist, cross-function flow rules, and quality thresholds defined in this skill, and enforces the pure-context-building constraint.
Subagents must:
This skill runs before :
It exists solely to build:
While active, Claude should NOT:
This is pure context building only.
Weekly Installs
1.3K
Repository
GitHub Stars
3.9K
First Seen
Jan 19, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode1.1K
claude-code1.1K
gemini-cli1.0K
codex1.0K
cursor982
github-copilot952
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装