Skip to content
SkillMixed2,097 tokens in use

dimensional-analysis

Annotates arithmetic-heavy code with units and decimal scales, then reports formulas that combine values of different dimensions.

8,319 stars on the repository CC-BY-SA-4.0trailofbits/skills · plugins/dimensional-analysis/skills/dimensional-analysis
/plugin marketplace add trailofbits/skills
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing dimensional-analysis costs

104tokens idle
2,097tokens in use
16,845tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Mixed

Script-ledMixedModel-led

Scripts do part of the work and the model's judgement does the rest.

This describes the skill's structure, how much of it is scripts. It does not say how well it works. Scripts: .calcifier/recipe.py.

Touches

writes filesdeclared

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Excellent
  • Frontmatter12/15
  • Structure22/25
  • Examples15/15
  • Output15/15
  • Size15/15
  • Resources12/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Excellent

No findings.

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity100
  • Maintenance52
  • Community64
  • Maturity32
  • Momentum40

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.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers