audit-prep-assistant
Install this skill
npx skills add trailofbits/skillsWorks across Claude Code, Cursor, Codex, Copilot & Antigravity
The Audit Prep Assistant acts as a technical project manager for security engagements. It streamlines the period leading up to a third-party security assessment by organizing project artifacts, remediating static analysis findings, and closing documentation gaps. Instead of manual ad-hoc preparation, this assistant guides developers through a systematic readiness process. It helps define clear audit objectives, ensures the codebase is in a deployable state for reviewers, and enforces standard practices like build instruction verification and dependency locking. By automating the cleanup of dead code and calculating actual test coverage, it ensures that expensive audit time is spent on logic and security vulnerabilities rather than basic environment setup, outdated documentation, or trivial code quality issues.
When to Use This Skill
- β’Preparing a protocol codebase for an upcoming external security audit
- β’Standardizing build and setup procedures for complex multi-module repositories
- β’Cleaning up technical debt and dead code before a major security review
- β’Creating documentation artifacts for trust boundaries and function invariants
How to Invoke This Skill
Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:
- βHelp me prepare for my upcoming security audit
- βRun static analysis and triage the results
- βAudit my project's readiness for a code review
- βGenerate a sequence diagram for the protocol's core workflows
- βIdentify untested code paths in my current repository
Pro Tips
- π‘Start by focusing on the 'Set Review Goals' step to align the AI's efforts with your specific audit objectives and communicate them to your security team.
- π‘For large codebases, run static analysis tools incrementally on critical modules first, then expand to the entire project to manage findings effectively.
- π‘Always manually review the suggested fixes and generated documentation, using them as a starting point for deeper human analysis and refinement.
What this skill does
- β’Orchestrates static analysis execution for Solidity, Rust, and Go projects
- β’Audits test coverage metrics to identify and address untested execution paths
- β’Standardizes build environments by documenting dependencies and testing clean builds
- β’Generates architectural documentation including sequence diagrams and system glossaries
- β’Maps system actors, privilege levels, and trust boundaries for auditors
When not to use it
- βDuring an active emergency response or live incident
- βWhen the project lacks a baseline test suite or automated build process
Example workflow
- Initiate the preparation phase by defining project goals and security concerns
- Execute static analysis tools and resolve reported vulnerabilities
- Analyze and expand test coverage to eliminate untested branches
- Produce build documentation and verify compilation in a clean container
- Generate architectural diagrams and formalize function invariants
Prerequisites
- βWorking test suite
- βDefined repository architecture
- βAccess to static analysis CLI tools for your language
Pitfalls & limitations
- !Failing to account for dependencies not tracked in the build file
- !Over-reliance on automation without manual verification of documentation claims
- !Late-stage code changes invalidating earlier audit preparation steps
FAQ
How it compares
Unlike a generic prompt that might provide surface-level advice, this tool enforces a structured, industry-standard checklist specifically designed to meet the rigorous expectations of professional security auditors.
Source & trust
π Full skill instructions β original source: trailofbits/skills
## Purpose
I'll help you prepare for a security review using Trail of Bits' checklist. A well-prepared codebase makes the review process smoother and more effective.
**Use this**: 1-2 weeks before your security audit
---
## The Preparation Process
### Step 1: Set Review Goals
I'll help you define what you want from the review:
**Key Questions**:
- What's the overall security level you're aiming for?
- What areas concern you most?
- Previous audit issues?
- Complex components?
- Fragile parts?
- What's the worst-case scenario for your project?
I'll document your goals to share with the assessment team.
---
### Step 2: Resolve Easy Issues
I'll run static analysis and help you fix low-hanging fruit:
**Run Static Analysis**:
For Solidity:
slither . --exclude-dependenciesFor Rust:
dylint --allFor Go:
golangci-lint runFor Go/Rust/C++:
# CodeQL and Semgrep checksThen I'll:
- Triage all findings
- Help fix easy issues
- Document accepted risks
**Increase Test Coverage**:
- Analyze current coverage
- Identify untested code
- Suggest new tests
- Run full test suite
**Remove Dead Code**:
- Find unused functions/variables
- Identify unused libraries
- Locate stale features
- Suggest cleanup
**Goal**: Clean static analysis report, high test coverage, minimal dead code
---
### Step 3: Ensure Code Accessibility
I'll help make your code clear and accessible:
**Provide Detailed File List**:
- List all files in scope
- Mark out-of-scope files
- Explain folder structure
- Document dependencies
**Create Build Instructions**:
- Write step-by-step setup guide
- Test on fresh environment
- Document dependencies and versions
- Verify build succeeds
**Freeze Stable Version**:
- Identify commit hash for review
- Create dedicated branch
- Tag release version
- Lock dependencies
**Identify Boilerplate**:
- Mark copied/forked code
- Highlight your modifications
- Document third-party code
- Focus review on your code
---
### Step 4: Generate Documentation
I'll help create comprehensive documentation:
**Flowcharts and Sequence Diagrams**:
- Map primary workflows
- Show component relationships
- Visualize data flow
- Identify critical paths
**User Stories**:
- Define user roles
- Document use cases
- Explain interactions
- Clarify expectations
**On-chain/Off-chain Assumptions**:
- Data validation procedures
- Oracle information
- Bridge assumptions
- Trust boundaries
**Actors and Privileges**:
- List all actors
- Document roles
- Define privileges
- Map access controls
**External Developer Docs**:
- Link docs to code
- Keep synchronized
- Explain architecture
- Document APIs
**Function Documentation**:
- System and function invariants
- Parameter ranges (min/max values)
- Arithmetic formulas and precision loss
- Complex logic explanations
- NatSpec for Solidity
**Glossary**:
- Define domain terms
- Explain acronyms
- Consistent terminology
- Business logic concepts
**Video Walkthroughs** (optional):
- Complex workflows
- Areas of concern
- Architecture overview
---
## How I Work
When invoked, I will:
1. **Help set review goals** - Ask about concerns and document them
2. **Run static analysis** - Execute appropriate tools for your platform
3. **Analyze test coverage** - Identify gaps and suggest improvements
4. **Find dead code** - Search for unused code and libraries
5. **Review accessibility** - Check build instructions and scope clarity
6. **Generate documentation** - Create flowcharts, user stories, glossaries
7. **Create prep checklist** - Track what's done and what's remaining
I'll adapt based on:
- Your platform (Solidity, Rust, Go, etc.)
- Available tools
- Existing documentation
- Review timeline
---
## Rationalizations (Do Not Skip)
| Rationalization | Why It's Wrong | Required Action |
|-----------------|----------------|-----------------|
| "README covers setup, no need for detailed build instructions" | READMEs assume context auditors don't have | Test build on fresh environment, document every dependency version |
| "Static analysis already ran, no need to run again" | Codebase changed since last run | Execute static analysis tools, generate fresh report |
| "Test coverage looks decent" | "Looks decent" isn't measured coverage | Run coverage tools, identify specific untested code paths |
| "Not much dead code to worry about" | Dead code hides during manual review | Use automated detection tools to find unused functions/variables |
| "Architecture is straightforward, no diagrams needed" | Text descriptions miss visual patterns | Generate actual flowcharts and sequence diagrams |
| "Can freeze version right before audit" | Last-minute freezing creates rushed handoff | Identify and document commit hash now, create dedicated branch |
| "Terms are self-explanatory" | Domain knowledge isn't universal | Create comprehensive glossary with all domain-specific terms |
| "I'll do this step later" | Steps build on each other - skipping creates gaps | Complete all 4 steps sequentially, track progress with checklist |
---
## Example Output
When I finish helping you prepare, you'll have concrete deliverables like:
=== AUDIT PREP PACKAGE ===
Project: DeFi DEX Protocol
Audit Date: March 15, 2024
Preparation Status: Complete
---
## REVIEW GOALS DOCUMENT
Security Objectives:
- Verify economic security of liquidity pool swaps
- Validate oracle manipulation resistance
- Assess flash loan attack vectors
Areas of Concern:
1. Complex AMM pricing calculation (src/SwapRouter.sol:89-156)
2. Multi-hop swap routing logic (src/Router.sol)
3. Oracle price aggregation (src/PriceOracle.sol:45-78)
Worst-Case Scenario:
- Flash loan attack drains liquidity pools via oracle manipulation
Questions for Auditors:
- Can the AMM pricing model produce negative slippage under edge cases?
- Is the slippage protection sufficient to prevent sandwich attacks?
- How resilient is the system to temporary oracle failures?
---
## STATIC ANALYSIS REPORT
Slither Scan Results:
β High: 0 issues
β Medium: 0 issues
β Low: 2 issues (triaged - documented in TRIAGE.md)
βΉ Info: 5 issues (code style, acceptable)
Tool: slither . --exclude-dependencies
Date: March 1, 2024
Status: CLEAN (all critical issues resolved)
---
## TEST COVERAGE REPORT
Overall Coverage: 94%
- Statements: 1,245 / 1,321 (94%)
- Branches: 456 / 498 (92%)
- Functions: 89 / 92 (97%)
Uncovered Areas:
- Emergency pause admin functions (tested manually)
- Governance migration path (one-time use)
Command: forge coverage
Status: EXCELLENT
---
## CODE SCOPE
In-Scope Files (8):
β src/SwapRouter.sol (456 lines)
β src/LiquidityPool.sol (234 lines)
β src/PairFactory.sol (389 lines)
β src/PriceOracle.sol (167 lines)
β src/LiquidityManager.sol (298 lines)
β src/Governance.sol (201 lines)
β src/FlashLoan.sol (145 lines)
β src/RewardsDistributor.sol (178 lines)
Out-of-Scope:
- lib/ (OpenZeppelin, external dependencies)
- test/ (test contracts)
- scripts/ (deployment scripts)
Total In-Scope: 2,068 lines of Solidity
---
## BUILD INSTRUCTIONS
Prerequisites:
- Foundry 0.2.0+
- Node.js 18+
- Git
Setup:bashgit clone https://github.com/project/repo.git
cd repo
git checkout audit-march-2024 # Frozen branch
forge install
forge build
forge test
Verification:
β Build succeeds without errors
β All 127 tests pass
β No warnings from compiler
---
## DOCUMENTATION
Generated Artifacts:
β ARCHITECTURE.md - System overview with diagrams
β USER_STORIES.md - 12 user interaction flows
β GLOSSARY.md - 34 domain terms defined
β docs/diagrams/contract-interactions.png
β docs/diagrams/swap-flow.png
β docs/diagrams/state-machine.png
NatSpec Coverage: 100% of public functions
---
## DEPLOYMENT INFO
Network: Ethereum Mainnet
Commit: abc123def456 (audit-march-2024 branch)
Deployed Contracts:
- SwapRouter: 0x1234...
- PriceOracle: 0x5678...
[... etc]
---
PACKAGE READY FOR AUDIT β
Next Step: Share with Trail of Bits assessment team---
## What You'll Get
**Review Goals Document**:
- Security objectives
- Areas of concern
- Worst-case scenarios
- Questions for auditors
**Clean Codebase**:
- Triaged static analysis (or clean report)
- High test coverage
- No dead code
- Clear scope
**Accessibility Package**:
- File list with scope
- Build instructions
- Frozen commit/branch
- Boilerplate identified
**Documentation Suite**:
- Flowcharts and diagrams
- User stories
- Architecture docs
- Actor/privilege map
- Inline code comments
- Glossary
- Video walkthroughs (if created)
**Audit Prep Checklist**:
- [ ] Review goals documented
- [ ] Static analysis clean/triaged
- [ ] Test coverage >80%
- [ ] Dead code removed
- [ ] Build instructions verified
- [ ] Stable version frozen
- [ ] Flowcharts created
- [ ] User stories documented
- [ ] Assumptions documented
- [ ] Actors/privileges listed
- [ ] Function docs complete
- [ ] Glossary created
---
## Timeline
**2 weeks before audit**:
- Set review goals
- Run static analysis
- Start fixing issues
**1 week before audit**:
- Increase test coverage
- Remove dead code
- Freeze stable version
- Start documentation
**Few days before audit**:
- Complete documentation
- Verify build instructions
- Create final checklist
- Send package to auditors
---
## Ready to Prep
Let me know when you're ready and I'll help you prepare for your security review!
How to Use This Skill Unit
Option A: Project-Specific (Recommended)
- Click "Download" above
- In your project, create the directory:
.agent/skills/audit-prep-assistant/ - Save the file as
SKILL.md - The agent will automatically discover the skill based on its description.
Option B: Global Installation (All Agents)
Save the file to these locations to make it available across all projects:
- Claude Code:
~/.claude/skills/trailofbits/skills/audit-prep-assistant/SKILL.md - Cursor:
~/.cursor/skills/trailofbits/skills/audit-prep-assistant/SKILL.md - Antigravity:
~/.gemini/antigravity/skills/trailofbits/skills/audit-prep-assistant/SKILL.md
π Install with CLI:npx skills add trailofbits/skills
