Dimensional Analysis walks a codebase that does numeric work with mixed units, precisions or scaling factors, such as a DeFi protocol or off-chain pricing code. It builds a vocabulary of units, writes dimensional comments like D18{tok} next to values, propagates them through formulas and reports the places where they do not add up.
The run is fully automatic and goes through four phases: scope discovery, anchor annotation, propagation and validation. Findings are limited to unit mismatches, scaling errors and wrong conversions.
What You Get
- Dimensional comments added to functions and variables across all in-scope arithmetic files
- A DIMENSIONAL_UNITS.md vocabulary file that later runs reuse
- A DIMENSIONAL_SCOPE.json manifest tracking each file through annotation, propagation and validation
- Findings graded critical, high and medium, with location, root cause and a fix suggestion
- A final JSON summary with coverage counters and any blocked files
Common Use Cases
- Auditing a DeFi protocol for token decimals and WAD/RAY scale mistakes
- Documenting the units of every price, share and ratio in a lending or vault contract
- Reviewing off-chain pricing or accounting code for unit confusion
- Checking that oracle outputs are rescaled before they enter a formula
What Makes It Unique
Most audit skills look for known vulnerability classes. This one checks one property, whether every formula is dimensionally consistent, and records the result as comments in the code. It requires full coverage: a file is only done when annotation, propagation and validation have all run, and it ships a list of rationalizations to reject, such as “the formula looks standard” or “the decimals are all 18”.
Under The Hood
The skill is prose instructions with reference files for each phase. It dispatches five sub-agents (scanner, discoverer, annotator, propagator, validator) and tells the model to read, search and edit files in the target repository. It writes comments into source files and creates DIMENSIONAL_UNITS.md and DIMENSIONAL_SCOPE.json in the project root. The folder also holds a Python recipe for the Calcifier runner that drives the same phases with worker agents limited to the project directory. It makes no network calls and does not commit changes.