dimensional-analysis

Annotates codebases with dimensional analysis comments to detect unit mismatches and arithmetic bugs.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/marumo333/atrox --skill dimensional-analysis-marumo333
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dimensional-analysis
Source: https://github.com/marumo333/atrox/tree/main/.claude/skills/trailofbits/plugins/dimensional-analysis/skills/dimensional-analysis
Command: npx skills add https://github.com/marumo333/atrox --skill dimensional-analysis-marumo333

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Codebases with mixed units, decimal precisions, and scaling factors (especially DeFi protocols and financial code) hide subtle arithmetic bugs like unit mismatches, missing scaling, and precision loss that manual review often misses. ## Core Features & Use Cases - Dimensional Annotation: Adds unit and precision comments (e.g., D18{tok}, D27{UoA/tok}) to variables, function parameters, and formulas across the codebase. - Dimension Propagation & Validation: Traces dimensions through arithmetic, function calls, and assignments, then validates mismatches to confirm or refute potential bugs. - Orchestrated Pipeline: Delegates scanning, vocabulary discovery, annotation, propagation, and bug detection to specialized subagents with coverage tracking via DIMENSIONAL_SCOPE.json. - Use Case: Audit a lending protocol's Solidity contracts to catch a Chainlink D8 price feed being assigned to a D27 variable, a mismatch that would misprice positions by 10^19. ## Quick Start Ask the AI to perform a dimensional analysis on this repository to annotate units and find arithmetic bugs.

Frequently Asked Questions about dimensional-analysis

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

FAQPage Schema
How do I find unit mismatch bugs in a DeFi protocol?▼

Run a dimensional analysis that annotates every numeric value with its unit and precision, propagates dimensions through arithmetic, and validates assignments. This catches bugs like oracle prices in D8 precision assigned to D27 variables or adding tokens to shares.

What is dimensional analysis for smart contract auditing?▼

Dimensional analysis for smart contracts tracks semantic units (tokens, shares, prices) and decimal scaling through every calculation. It verifies that additions use identical dimensions and that multiplications handle precision correctly, catching formula bugs early.

Does dimensional analysis work for languages other than Solidity?▼

Yes, the dimensional algebra rules and bug patterns are language-agnostic. The annotation format adapts to comment syntax in Rust, TypeScript, Python, or any language performing arithmetic with mixed units and scaling factors.

When should I not run a full dimensional analysis pipeline?▼

Skip it for codebases with no numeric arithmetic or unit conversions, pure integer counting logic like loop indices, or when you only need a quick spot-check of a single formula that you can read directly.

How does the skill handle large repositories with many arithmetic files?▼

It batches files by category and priority tier, spawning subagents per batch rather than per file, and persists per-file status in DIMENSIONAL_SCOPE.json. Blocked files get one focused retry, and the run cannot finish while any in-scope file remains pending.