跳到正文
Skillpedia
通用编程48k · #3837

audit-context-building

它能做什么

这个工具帮助 AI 逐行理解程序代码,就像一步步拆解一块钟表一样。它先深入弄清楚各部分如何运作,然后再去寻找问题。

适用场景

  • ✓在查找错误之前,需要先理解复杂代码时。
  • ✓想确保 AI 已经掌握程序的所有细节时。
  • ✓准备安全审计或架构评审时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/audit-context-building/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/audit-context-building/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请逐行分析这段代码,重点理解每一步的作用以及其中所做的假设。”

每周 5 个新技能,1 分钟读完。

工作原理

AI 会逐行、逐个代码块地检查,反复使用“为什么?”之类的方法来挖掘代码背后的逻辑。它会构建一张关于程序的详细“思维导图”,把各个部分与整体联系起来。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Deep Context Builder Skill (Ultra-Granular Pure Context Mode)

1. Purpose

This skill governs how Claude thinks during the context-building phase of an audit.

When active, Claude will:

  • Perform line-by-line / block-by-block code analysis by default.
  • Apply First Principles, 5 Whys, and 5 Hows at micro scale.
  • Continuously link insights → functions → modules → entire system.
  • Maintain a stable, explicit mental model that evolves with new evidence.
  • Identify invariants, assumptions, flows, and reasoning hazards.

This skill defines a structured analysis format (see Example: Function Micro-Analysis below) and runs before the vulnerability-hunting phase.


When to Use

Use when:

  • Deep comprehension is needed before bug or vulnerability discovery.
  • You want bottom-up understanding instead of high-level guessing.
  • Reducing hallucinations, contradictions, and context loss is critical.
  • Preparing for security auditing, architecture review, or threat modeling.

Do not use for:

  • Vulnerability findings
  • Fix recommendations
  • Exploit reasoning
  • Severity/impact rating

2. How This Skill Behaves

When active, Claude will:

  • Default to ultra-granular analysis of each block and line.
  • Apply micro-level First Principles, 5 Whys, and 5 Hows.
  • Build and refine a persistent global mental model.
  • Update earlier assumptions when contradicted ("Earlier I thought X; now Y.").
  • Periodically anchor summaries to maintain stable context.
  • Avoid speculation; express uncertainty explicitly when needed.

Goal: deep, accurate understanding, not conclusions.


Rationalizations (Do Not Skip)

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

3. Phase 1 — Initial Orientation (Bottom-Up Scan)

Before deep analysis, Claude performs a minimal mapping:

  1. Identify major modules/files/contracts.
  2. Note obvious public/external entrypoints.
  3. Identify likely actors (users, owners, relayers, oracles, other contracts).
  4. Identify important storage variables, dicts, state structs, or cells.
  5. Build a preliminary structure without assuming behavior.

This establishes anchors for detailed analysis.


4. Phase 2 — Ultra-Granular Function Analysis (Default Mode)

Every non-trivial function receives full micro analysis.

5.1 Per-Function Microstructure Checklist

For each function:

  1. Purpose

    • Why the function exists and its role in the system.
  2. Inputs & Assumptions

    • Parameters and implicit inputs (state, sender, env).
    • Preconditions and constraints.
  3. Outputs & Effects

    • Return values.
    • State/storage writes.
    • Events/messages.
    • External interactions.
  4. Block-by-Block / Line-by-Line Analysis For each logical block:

    • What it does.
    • Why it appears here (ordering logic).
    • What assumptions it relies on.
    • What invariants it establishes or maintains.
    • What later logic depends on it.

    Apply per-block:

    • First Principles
    • 5 Whys
    • 5 Hows

5.2 Cross-Function & External Flow Analysis

(Full Integration of Jump-Into-External-Code Rule)

When encountering calls, continue the same micro-first analysis across boundaries.

Internal Calls

  • Jump into the callee immediately.
  • Perform block-by-block analysis of relevant code.
  • Track flow of data, assumptions, and invariants: caller → callee → return → caller.
  • Note if callee logic behaves differently in this specific call context.

External Calls — Two Cases

Case A — External Call to a Contract Whose Code Exists in the Codebase Treat as an internal call:

  • Jump into the target contract/function.
  • Continue block-by-block micro-analysis.
  • Propagate invariants and assumptions seamlessly.

…

常见问题

它会直接帮我找出 bug 吗?

不会直接找。它的主要目标是建立对代码的深入理解,找 bug 是在这种理解的基础上进行的后续工作。

代码看起来很简单,为什么还要逐行分析?

即使是简单的函数,组合在一起时也可能引发问题。细致的分析能确保不会遗漏任何重要的假设或细节。

这里的“第一性原理”和“5 个为什么”是什么意思?

它们都是用来追问逻辑的方法。“第一性原理”(First Principles)指从最基本的事实出发进行思考;“5 个为什么”(5 Whys)则是不断追问“为什么”,直到找到问题的根本原因。

详情

作者的原始描述

Enables ultra-granular, line-by-line code analysis to build deep architectural context before vulnerability or bug finding.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#3837
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能