audit-context-building

Build a line-by-line mental model of codebases for security audits.

6.5k|561|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/trailofbits/skills --skill audit-context-building-trailofbits
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: audit-context-building
Source: https://github.com/trailofbits/skills/tree/main/plugins/audit-context-building/skills/audit-context-building
Command: npx skills add https://github.com/trailofbits/skills --skill audit-context-building-trailofbits

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a disciplined, ultra-granular approach to code analysis to prevent context loss during security audits by building a stable mental model of the entire system.

Core Features & Use Cases

  • Default to line-by-line / block-by-block analysis and apply First Principles, 5 Whys, and 5 Hows at micro scale.
  • Build and maintain a persistent global mental model that links insights to functions, modules, and the whole system.
  • Phase-driven workflow: Phase 1 initial orientation, Phase 2 ultra-granular function analysis with a structured per-block checklist, Phase 3 global system understanding and trust boundary mapping.
  • Supports subagents for complex logic, multi-module reconstruction, and anti-hallucination stability rules to ensure coherence.
  • Cross-function dependencies, invariants tracking, and complete documentation of assumptions and risks guide the vulnerability-hunting phase.

Quick Start

Use the audit-context-building skill to initiate ultra-granular analysis and establish a deep, stable mental model before vulnerability hunting.

Frequently Asked Questions about audit-context-building

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent context loss when performing a deep security audit on a complex codebase?▼

Preventing context loss during a security audit requires building a persistent mental model through phase-driven, line-by-line code analysis that maps cross-function dependencies and tracks invariants across modules.

What is the best way to map cross-function dependencies before vulnerability hunting?▼

Mapping cross-function dependencies involves applying First Principles, 5 Whys, and 5 Hows at the micro scale during a dedicated analysis phase, ensuring a complete global system understanding before hunting vulnerabilities.

How do I apply First Principles and 5 Whys for code analysis during a security audit?▼

You apply First Principles and 5 Whys at the micro scale by conducting block-by-block function analysis, enforcing a structured checklist to reconstruct logic and document assumptions before mapping trust boundaries.

Can I use subagents to handle complex logic paths when building context for a security audit?▼

Yes, subagents are supported for reconstructing complex logic paths and multi-module interactions, working alongside anti-hallucination stability rules to ensure coherence while building the system mental model.

Does this code analysis approach work for auditing smart contracts and complex modules?▼

Yes, this ultra-granular analysis workflow is explicitly applicable across contracts and modules, enabling deep phase-driven analysis to map trust boundaries and document risks before the vulnerability hunting phase.

Why does my security audit miss vulnerabilities in complex code paths?▼

Security audits miss vulnerabilities in complex code paths when lacking a stable mental model; applying a structured, phase-driven micro-analysis with explicit completeness boundaries prevents overlooking critical cross-function dependencies.