dimensional-analysis
Annotates codebases with dimensional analysis comments documenting units, dimensions, and decimal scaling
Install / Use
npx skills add trailofbits/skills --skill dimensional-analysisInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
AutomationSupported Platforms
Tags
Our assessment of dimensional-analysis
dimensional-analysis scores 92/100 on our quality scale, 461st of 1,411 Automation skills we index (top 33%).
Its SKILL.md is 17 KB long, well organised into 17 sections with 2 code examples: a thorough specification that gives an agent plenty to work with.
With 7,225 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 3 days ago, so dimensional-analysis is actively maintained.
- It is released under the CC-BY-SA-4.0 license; check its terms before commercial use.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
dimensional-analysis compared with similar skills
All 4 of these similar skills score higher than dimensional-analysis; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| dimensional-analysis (this skill)by trailofbits | 92 | 7.2k | 3d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 85.5k | 11d ago | CLAUDE.md |
| rufloby ruvnet | 100 | 73.3k | 1d ago | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 83.8k | today | MCP Server |
| algorithmic-artby anthropics | 100 | 177.9k | 4d ago | SKILL.md |
Frequently asked questions
- How do I install dimensional-analysis?
- Run
npx skills add trailofbits/skills --skill dimensional-analysis. The install tabs above show the steps for each supported agent. - Which AI agents does dimensional-analysis work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is dimensional-analysis safe to use?
- It is CC-BY-SA-4.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is dimensional-analysis still maintained?
- The repository was last updated 3 days ago, so dimensional-analysis is actively maintained.
Skill content
View source on GitHubname: dimensional-analysis description: "Annotates codebases with dimensional analysis comments documenting units, dimensions, and decimal scaling. Use when someone asks to annotate units in a codebase, perform a dimensional analysis, or find vulnerabilities in a DeFi protocol, offchain code, or other blockchain-related codebase with arithmetic. Prevents dimensional mismatches and catches formula bugs early." allowed-tools: Read Write Grep List Glob Task TodoRead TodoWrite
Dimensional Analysis Skill
This skill orchestrates a dimensional-analysis pipeline for codebases that perform numeric computations with mixed units, precisions, or scaling factors. The main skill context is a workflow controller only: it delegates scanning, vocabulary discovery, annotation, propagation, and validation to specialized subagents, then manages batching, persistence, retries, coverage gates, and final reporting.
When to Use
- Annotating a codebase with unit/dimension comments (e.g.,
D18{tok},D27{UoA/tok}) - Performing dimensional analysis on DeFi protocols, financial code, or scientific computations
- Hunting for arithmetic bugs caused by unit mismatches, missing scaling, or precision loss
- Auditing codebases with mixed decimal precisions or fixed-point arithmetic
When NOT to Use
- Codebases with no numeric arithmetic or unit conversions — there is nothing to annotate
- Pure integer counting logic (loop indices, array lengths) with no physical or financial dimensions
- When you only need a quick spot-check of a single formula — read the code directly instead of running the full pipeline
Execution Mode
This skill runs in one mode only: full-auto.
This is a workflow-based skill that delegates step-specific work to specialized agents via the Task tool. You orchestrate the overall process, manage coverage and state persistence, and ensure that every in-scope file is processed through each step of the pipeline.
- Always run the full pipeline in this order: Step 1 -> Step 2 -> Step 3 -> Step 4.
- The main skill context must not perform repository-wide dimensional analysis, annotation, propagation, or bug validation itself when a dedicated subagent exists for that step.
- The main skill context may inspect artifacts, manifests, and subagent outputs only as needed to route work, build prompts, persist state, and determine completion.
- Any mode argument provided by the caller is ignored.
- Report all results at the end in a single summary.
When you start a step, report it:
Starting Step: Step {n}
Scope and Coverage Guarantees
This skill must audit all in-scope arithmetic files, including large repositories.
- In-scope files are defined by Step 1 scanner output (
filesarray), across all priority tiers (CRITICAL, HIGH, MEDIUM, LOW). - If Step 1 narrows inputs for vocabulary discovery (for example, CRITICAL/HIGH only), that narrowing applies to discovery only. It never reduces annotation or validation scope.
arithmetic-scannerpersists the in-scope file manifest toDIMENSIONAL_SCOPE.jsonin the project root, and that manifest is the source of truth for Steps 2-4.- A file is considered fully covered only when all three statuses are present:
step2: anchor annotation completed (or explicit no-anchor result)step3: propagation completed (or explicit no-propagation result)step4: validation completed
dimension-discovererpersists the discovered dimensional vocabulary toDIMENSIONAL_UNITS.mdin the project root for reuse by later steps and future runs.- When a file ends in a terminal
BLOCKEDstate, persist the blocking reason and retry count inDIMENSIONAL_SCOPE.jsonand reflect the same file incoverage.unprocessed_files. - Do not finish while any in-scope file remains unprocessed in any step.
Delegation Contract
arithmetic-scannerowns repository scanning, arithmetic-file prioritization, and writingDIMENSIONAL_SCOPE.json.dimension-discovererowns dimensional vocabulary discovery, unit inference, and writingDIMENSIONAL_UNITS.md.dimension-annotatorowns annotation format decisions, anchor-point edits, and comment-writing behavior.dimension-propagatorowns propagation logic, inferred annotations, and mismatch reporting during tracing.dimension-validatorowns bug detection, red-flag evaluation, rationalization rejection, and confirmation or refutation of propagated mismatches.- The main skill context must not substitute its own dimensional reasoning for skipped or unlaunched subagents. If a step requires specialized reasoning, launch the corresponding subagent.
- Use reference files as subagent support material. Pass them to the relevant step in prompts instead of treating them as instructions for the main skill context.
Workflow
Follow these sections in order. Do not advance until the current step satisfies its completion gate.
Shared Orchestration Rules
DIMENSIONAL_SCOPE.jsonandDIMENSIONAL_UNITS.mdlive in the project root.- The main skill context verifies Step 1 artifacts but does not write either Step 1 artifact itself.
DIMENSIONAL_SCOPE.json.in_scope_filesis the source of truth for Steps 2-4. Never derive later scope from discovery-only inputs.- When a later step reaches terminal
BLOCKED, persist the matchingstep*_reasonandstep*_retry_countfields on the file entry inDIMENSIONAL_SCOPE.json. coverage.unprocessed_filesmust be derived from terminalBLOCKEDentries inDIMENSIONAL_SCOPE.jsonusing{ "path": "...", "blocked_step": "step2|step3|step4", "reason": "...", "retry_count": 1 }.- A step may retry a
BLOCKEDfile once with a focused prompt. If it is stillBLOCKED, keep the documented reason and continue. Do not finalize while any file remainsPENDING.
Step 1: Vocabulary and Scope Discovery
If cached artifacts cannot be reused, delegate repository scanning to arithmetic-scanner and vocabulary discovery to dimension-discoverer. Do not do that step-specific analysis directly in the main skill context.
- Check whether
DIMENSIONAL_UNITS.mdandDIMENSIONAL_SCOPE.jsonalready exist in the project root. - If both exist, read them and confirm:
DIMENSIONAL_SCOPE.json.project_rootmatches the current repo rootDIMENSIONAL_SCOPE.jsoncontainsin_scope_files,discoverer_focus_files,recommended_discovery_order, and per-filestep2,step3,step4fieldsDIMENSIONAL_UNITS.mdis a usable dimensional vocabulary for this repo
- If either artifact is stale, malformed, missing required structure, or clearly for another repo, discard reuse and rerun the rest of Step 1.
- If both artifacts are valid, reuse them directly. If
in_scope_filesis empty, skip Steps 2-4 and produce final output with zero findings. - Otherwise use the
Tasktool to spawn thearithmetic-scanneragent. Its prompt must include:- project root path
- absolute output path for
DIMENSIONAL_SCOPE.json - instruction to write the Step 1 scope manifest to disk and return the same scope data in its report
- The scanner owns Step 1 scope persistence. It must:
- identify dimensional-arithmetic files and prioritize them as usual
- write
DIMENSIONAL_SCOPE.jsonwithproject_root,in_scope_files,discoverer_focus_files, andrecommended_discovery_order - initialize every in-scope file with
step2: "PENDING",step3: "PENDING", andstep4: "PENDING" - still write an empty manifest when no arithmetic files are found
- still narrow
discoverer_focus_filesto CRITICAL/HIGH when more than 50 arithmetic files are found, while keeping all priorities inin_scope_files
- After the scanner completes, read
DIMENSIONAL_SCOPE.jsonfrom disk and confirm it exists and contains the required Step 1 fields before continuing. - Use the
Tasktool to spawn thedimension-discovereragent. Its prompt must include:- project root path
- absolute path to
DIMENSIONAL_SCOPE.json - absolute output path for
DIMENSIONAL_UNITS.md - prioritized
discoverer_focus_fileswith each file's path, priority, score, and category recommended_discovery_order
- The discoverer owns Step 1 vocabulary persistence. It must read
DIMENSIONAL_SCOPE.jsonas the Step 1 source of truth and writeDIMENSIONAL_UNITS.mdwithBase Units,Derived Units, andPrecision Prefixessections. Ifin_scope_filesis empty, it must still write the same headings with empty sections. - Step 1 is complete only when both artifacts exist on disk, pass the reuse checks above, and correctly represent the zero-file case. If
in_scope_filesis empty after the discoverer writesDIMENSIONAL_UNITS.md, skip Steps 2-4 and produce final output with zero findings.
Step 2: Anchor Annotation
The main skill context must not add annotations itself. Use the Task tool to spawn dimension-annotator agents for all anchor-point annotation work. For full examples and annotation format details, see [{baseDir}/references/annotate.md]({baseDir}/references/annotate.md).
- Read
DIMENSIONAL_SCOPE.jsonand build batches fromin_scope_files. Every in-scope file, including MEDIUM and LOW priority files, must receive a Step 2 outcome. - Batch files instead of spawning one agent per file:
<= 10files: one batch11-30files: one batch per category> 30files: one batch per category, splitting categories larger than 10 files into sub-batches of about 8 files
- Launch categories in Step 1 recommended discovery order: math libraries, then oracles, then core logic, then peripheral. Batches inside the same category may run in parallel.
- Before launching annotators, set
step2 = "PENDING"for every in-scope file and persist the updatedDIMENSIONAL_SCOPE.json. - Each annotator prompt must include:
- absolute path to
DIMENSIONAL_UNITS.md - absolute path to
DIMENSIONAL_SCOPE.json - assigned file paths in order
- each file's category and matched patterns from scanner output
- summary of previously annotated interfaces or types from earlier batches, when applicable
- required per-file status output:
ANNOTATED,REVIEWED_NO_ANCHOR_CHANGES, orBLOCKEDplus a one-line justification
- absolute path to
- After each batch, immediately persist each assigned file to exactly one Step 2 status:
ANNOTATEDREVIEWED_NO_ANCHOR_CHANGESBLOCKED
- If a file is
BLOCKED, also persiststep2_reasonandstep2_retry_count. Retry eachBLOCKEDfile once with a focused prompt. - Do not continue to Step 3 while any file remains
PENDINGin on-disk manifest state.
Step 3: Dimension Propagation
The main skill context must not perform propagation reasoning itself. Use the Task tool to spawn dimension-propagator agents to extend annotations through arithmetic, function calls, and assignments. For algebra details, see [{baseDir}/references/dimension-algebra.md]({baseDir}/references/dimension-algebra.md).
- Read
DIMENSIONAL_SCOPE.jsonand build propagation batches fromin_scope_files. Every in-scope file must receive a Step 3 outcome. - Use the same batching rules and category ordering as Step 2.
- Before launching propagators, confirm every file already has a non-pending Step 2 status.
- Then set
step3 = "PENDING"for every in-scope file and persist the updated manifest. - Each propagator prompt must include:
- absolute path to
DIMENSIONAL_UNITS.md - absolute path to
DIMENSIONAL_SCOPE.json - assigned file paths in order
- each file's category and matched patterns
- summary of Step 2 anchor annotations for the assigned files and any upstream interfaces they depend on
- required per-file status output:
PROPAGATED,REVIEWED_NO_PROPAGATION_CHANGES, orBLOCKEDplus a one-line justification
- absolute path to
- After each batch, immediately persist each assigned file to exactly one Step 3 status:
PROPAGATEDREVIEWED_NO_PROPAGATION_CHANGESBLOCKED
- If a file is
BLOCKED,
Truncated for display — read the full file on GitHub.
Related Skills
Agent-Reach
85.5kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
ruflo
73.3k🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Scrapling
83.8k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
