Skip to content

Skill: BigUnit for precision arithmetic guidance#5

Open
bazmatic wants to merge 1 commit intomainfrom
skill/bigunit
Open

Skill: BigUnit for precision arithmetic guidance#5
bazmatic wants to merge 1 commit intomainfrom
skill/bigunit

Conversation

@bazmatic
Copy link

@bazmatic bazmatic commented Mar 12, 2026

Summary

Adds a new skill that guides Claude when working with the BigUnit TypeScript library — a zero-dependency bigint-based library for precise arithmetic with numbers of varying precision. This is particularly useful for cryptocurrency token amounts (ETH 18 decimals, USDC 6 decimals) and financial calculations where floating-point errors are unacceptable.

Full disclosure: I authored this in my own time for a previous crypto-exchange project. It is battle-tested. It is a very useful library and can hugely simplify working with token values.

Changes

  • skills/bigunit/SKILL.md (new, 175 lines) — Complete reference covering:
    • Core concepts (internal bigint representation, precision propagation)
    • Creating values via BigUnit.from(), specific constructors, and BigUnitFactory
    • Arithmetic, comparisons, output formatting, and precision conversion
    • Common pitfalls (missing precision on bigint, unexpected result precision, truncation vs rounding, float issues)
    • Typical patterns for token conversion, fee calculation, splitting, and markup removal

Technical Details

The skill triggers when code involves BigUnit, BigUnitFactory, BigUnitish, asPrecision(), imports from 'bigunit', or precision-sensitive financial/crypto arithmetic.

@bazmatic bazmatic changed the title feat: add BigUnit skill for precision arithmetic guidance Skill: BigUnit for precision arithmetic guidance Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant