dimensional-analysis — Claude Code skill: audit units
Audits numeric code for unit confusion and decimal-scale errors, then adds dimensional comments. Use it when formulas or conversions need a unit-level review.
npx skills add trailofbits/skills --skill dimensional-analysis -a claude-codeWhat dimensional-analysis does
The skill traces numeric calculations for incompatible units or scales. It can flag incorrect token decimals, WAD/RAY scale mistakes, prices with an unclear numerator or denominator, and missing scale adjustments after oracle calls.
It runs in full-auto mode through scanning, vocabulary discovery, annotation, and validation. The workflow writes DIMENSIONAL_SCOPE.json at the project root and reuses DIMENSIONAL_UNITS.md when present, otherwise it creates the vocabulary. Comments use notation such as D18{tok} and {s}.
Native agent dispatch and write access to an explicitly scoped target are required. It edits comments in files directly, so that is a reason to run it only where those changes are acceptable. The skill does not commit or publish the target.
What it helps with
- detect additions of values from different tokens
- check WAD/RAY and other decimal scales
- find incorrect token decimals in calculations
- add unit comments to numeric values
- trace conversions after an oracle call
Example prompts for the agent
- Run dimensional-analysis on the arithmetic in this repository and add unit comments.
- Audit these formulas for token decimal and WAD/RAY scale errors.
- Annotate the numeric calculations with dimensions and flag incompatible units.
How to install dimensional-analysis
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill dimensional-analysis -a claude-code2Manually: put the files in place
~/.claude/skills/dimensional-analysis/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/dimensional-analysis/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill dimensional-analysis -a codex2Manually: put the files in place
.agents/skills/dimensional-analysis/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill dimensional-analysis -a cursor2Manually: put the files in place
.cursor/skills/dimensional-analysis/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install trailofbits/skills dimensional-analysis2Manually: put the files in place
.github/skills/dimensional-analysis/SKILL.md1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill dimensional-analysis -a gemini-cli2Platform CLI
gemini skills install https://github.com/trailofbits/skills --path plugins/dimensional-analysis/skills/dimensional-analysisManually: put the files in place
.devin/skills/dimensional-analysis/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add trailofbits/skills --skill dimensional-analysis -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about dimensional-analysis
How do I install dimensional-analysis in Claude Code?
Run npx skills add trailofbits/skills --skill dimensional-analysis -a claude-code, then run npx skills add trailofbits/skills --skill dimensional-analysis -a claude-code again. The skill file is at ~/.claude/skills/dimensional-analysis/SKILL.md.
What does dimensional-analysis do?
It reviews numeric computations for unit, precision, and scaling conflicts. The skill adds dimensional annotations and checks formulas for invalid conversions.
What does dimensional-analysis require to run?
It requires native agent dispatch and write access to an explicitly scoped target. If a stage cannot run, it preserves its outputs and marks that stage as blocked.