dimensional-analysis

Analyze codebases for unit mismatches, scaling errors, and precision loss.

Updated Nov 23, 2025
One-click install
npx skills add https://github.com/manuelbrandner85/Weltenbibliothekapp --skill dimensional-analysis-manuelbrandner85
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dimensional-analysis
Source: https://github.com/manuelbrandner85/Weltenbibliothekapp/tree/main/.agents/skills/dimensional-analysis
Command: npx skills add https://github.com/manuelbrandner85/Weltenbibliothekapp --skill dimensional-analysis-manuelbrandner85

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates critical arithmetic errors in complex codebases by enforcing strict dimensional consistency, preventing unit mismatches, and catching precision scaling bugs before they reach production.

Core Features & Use Cases

  • Automated Annotation: Systematically annotates numeric variables and function signatures with dimensional units and scaling factors.
  • Propagation & Validation: Traces dimensional logic through arithmetic operations and function calls to detect mismatches and precision loss.
  • Use Case: In a DeFi protocol, this Skill ensures that a token amount (D18) is never accidentally added to a share amount (D18) or multiplied by an unscaled price, preventing catastrophic financial loss.

Quick Start

Run the dimensional-analysis skill to audit the current repository and generate a full dimensional report.

Frequently Asked Questions about dimensional-analysis

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

FAQPage Schema
How do I prevent arithmetic bugs and unit mismatches in DeFi protocol code?

Dimensional analysis prevents arithmetic bugs by enforcing strict unit consistency and detecting scaling errors in DeFi protocols. It traces dimensional logic through operations to ensure token and share amounts are not accidentally mismatched.

How does automated dimensional analysis detect precision loss in fixed-point arithmetic?

Automated dimensional analysis detects precision loss by annotating numeric variables with scaling factors and propagating these dimensions through arithmetic operations. It identifies mismatches and scaling errors during function calls to validate dimensional consistency.

Can I use dimensional analysis to audit financial systems for unit conversion errors?

Yes, you can use dimensional analysis to audit financial systems. It performs comprehensive checks on codebases involving numeric computations and unit conversions to identify unit mismatches and prevent catastrophic financial loss.

What is the best way to trace scaling factors through function calls in scientific code?

The best way to trace scaling factors is through automated annotation and propagation tracing. This systematically tags variables with dimensional units and follows the logic through function calls to detect any dimensional inconsistencies.

Does dimensional analysis work without external dependencies for code audits?

Yes, dimensional analysis operates without external dependencies. It orchestrates a self-contained multi-step pipeline including vocabulary discovery, anchor annotation, propagation tracing, and bug validation directly on the current repository.

When should I run a dimensional analysis report on my codebase?

You should run a dimensional analysis report before production deployment to catch precision scaling bugs. It is essential for codebases involving complex numeric computations, unit conversions, and fixed-point arithmetic like DeFi protocols.