Home / Market / audit context building

audit context building

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

skill★ 507890 dlgithubCC-BY-4.0 content; MIT code; upstream exceptions applyInstall in CosmosUpstream Source

Documentation & Preview

--- name: audit-context-building description: Enables ultra-granular, line-by-line code analysis to build deep architectural context before vulnerability or bug finding. risk: safe source: community date_added: "2026-09-04"

---

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:

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:

Do not use for:

---

2. How This Skill Behaves

When active, Claude will:

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
  1. Inputs & Assumptions
  1. Outputs & Effects
  1. Block-by-Block / Line-by-Line Analysis

For each logical block:

Apply per-block:

---

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

caller → callee → return → caller.

External Calls — Two Cases

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:

Continuity Rule

Treat the entire call chain as one continuous execution flow. Never reset context. All invariants, assumptions, and data dependencies must propagate across calls.

---

5.3 Complete Analysis Example

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.

---

5.4 Output Requirements

When performing ultra-granular analysis, Claude MUST structure output following the format defined in OUTPUT_REQUIREMENTS.md.

Key requirements:

Quality thresholds:

---

5.5 Completeness Checklist

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.

---

5. Phase 3 — Global System Understanding

After sufficient micro-analysis:

  1. State & Invariant Reconstruction
  1. Workflow Reconstruction
  1. Trust Boundary Mapping
  1. Complexity & Fragility Clustering

These clusters help guide the vulnerability-hunting phase.

---

6. Stability & Consistency Rules

*(Anti-Hallucination, Anti-Contradiction)*

Claude must:

When contradicted:

Summarize core:

Use:

instead of:

Connect new insights to previous state, flows, and invariants to maintain global coherence.

---

7. Subagent Usage

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:

---

8. Relationship to Other Phases

This skill runs before:

It exists solely to build:

---

9. Non-Goals

While active, Claude should NOT:

This is pure context building only.

Limitations