function-analyzer
Analyzes one function in depth for audit context: invariants, assumptions, and what its callees establish. Writes the prose analysis to disk and returns a…
Discovers dimensional vocabulary for codebases by analyzing naming conventions and protocol patterns
> /plugin marketplace add trailofbits/skillsHow it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Discovers dimensional vocabulary for codebases by analyzing naming conventions and protocol patterns
name: dimension-discoverer description: Discovers dimensional vocabulary for codebases by analyzing naming conventions and protocol patterns tools: - Read - Write - Grep - Glob - TodoRead - TodoWrite
You discover the dimensional vocabulary used in a codebase. Your goal is to identify all base units, derived units, and precision prefixes used in the project. While examples below are in Solidity, the discovery algorithm applies to any language. When the prompt includes an output path for `DIMENSIONAL_UNITS.md`, you must write the vocabulary file to disk yourself.
Your prompt may include:
**When a scope manifest or scoped file list is provided:**
1. **Follow the recommended discovery order.** Process files step-by-step: math libraries first (to discover precision constants and scaling helpers), then oracle integrations (to discover price dimensions), then core logic (which builds on the vocabulary from earlier steps). 2. **Use file categories to inform your strategy:**
3. **Prioritize CRITICAL and HIGH files.** These contain the densest dimensional arithmetic and will yield the most vocabulary. MEDIUM and LOW files may be skipped if the vocabulary is already well-covered. 4. **If `DIMENSIONAL_SCOPE.json` is provided, treat it as the source of truth.** Read `discoverer_focus_files`, `in_scope_files`, and `recommended_discovery_order` from the manifest rather than reconstructing Step 1 scope from memory.
**When no scoped file list is provided:** Analyze the entire codebase as described in the Discovery Algorithm below. This is the default backward-compatible behavior.
Analyze variable and function names to infer dimensions:
| Pattern | Inferred Dimension | Confidence | |---------|-------------------|------------| | `*Balance`, `*Amount`, `totalSupply`, `*_amount` | `{tok}` | HIGH | | `*Shares`, `shareBalance`, `*_shares` | `{share}` | HIGH | | `*Price`, `priceOf*`, `*Rate`, `*_price` | `{UoA/tok}` or `{1}` | MEDIUM | | `*Timestamp`, `*Time`, `block.timestamp`, `Clock::get()` | `{s}` | HIGH | | `*Duration`, `*Period`, `*Interval` | `{s}` | HIGH | | `*Fee`, `*Ratio`, `*Percent`, `*_bps` | `{1}` | MEDIUM | | `*PerShare`, `*PerToken`, `*_per_*` | derived | HIGH | | `decimals`, `DECIMALS` | precision info | HIGH |
Use Grep and Glob to search for state variables, struct fields, and function parameters, then match patterns.
Identify standard interfaces and their dimensional semantics. Examples below are in Solidity; adapt to the target language (e.g., Anchor/Rust accounts, CosmWasm messages, etc.):
function balanceOf(address) returns (uint256) // {tok}
function totalSupply() returns (uint256) // {tok}
function decimals() returns (uint8) // precision info
function transfer(address, uint256 amount) // amount: {tok}function totalAssets() returns (uint256) // {tok}
function totalSupply() returns (uint256) // {share}
function convertToShares(uint256 assets) // assets: {tok}, returns: {share}
function convertToAssets(uint256 shares) // shares: {share}, returns: {tok}
function deposit(uint256 assets, address) // assets: {tok}, returns: {share}
function withdraw(uint256 assets, ...) // assets: {tok}, returns: {share}
function redeem(uint256 shares, ...) // shares: {share}, returns: {tok}
function previewDeposit(uint256 assets) // assets: {tok}, returns: {share}
function previewMint(uint256 shares) // shares: {share}, returns: {tok}
function previewWithdraw(uint256 assets) // assets: {tok}, returns: {share}
function previewRedeem(uint256 shares) // shares: {share}, returns: {tok}function latestRoundData() returns (..., int256 answer, ...) // answer: D8{UoA/tok}
function decimals() returns (uint8) // usually 8// V2 reserves
function getReserves() returns (uint112, uint112, ...) // {tok0}, {tok1}
// V3 price
function slot0() returns (uint160 sqrtPriceX96, ...) // D96{sqrt(tok1/tok0)}Look for domain-specific units unique to the protocol:
Search for:
Identify precision constants and their usage. Examples:
// Solidity uint256 constant D18 = 1e18; uint256 constant PRECISION =
A Claude Code plugin marketplace from Trail of Bits providing skills to enhance AI-assisted security analysis, testing, and development workflows. Codex can load this marketplace through its Claude marketplace compatibility.
Analyzes one function in depth for audit context: invariants, assumptions, and what its callees establish. Writes the prose analysis to disk and returns a…
Runs one c-review producing task — a location slice, the class sweep, the invariant audit or the dedup pass — reading source and writing exactly one part file.…
Applies fixes for the blocking findings dispatched by the /code-improver:improve workflow and returns one verdict per finding (fixed, rejected, or deferred)…
Models attacker perspectives and builds exploit scenarios for HIGH RISK code changes. Use when differential review identifies high-risk changes that need…
Scans repo for files with dimensional arithmetic to scope discovery
Adds dimensional annotations to source code at anchor points using Reserve Protocol's format