Install any skill in seconds. Free to start, no credit card required.
Get Started Free →hashgraph-online/javascript-ui-math
Use JavaScript number math safely for front-end UI behavior, including expressions, precedence, coercion, NaN, Infinity, floating-point precision, BigInt limits, modulo wrapping, rounding, random values, and repeatable UI randomness.
Passed 19 of 22 test cases with the skill, and 18 of 22 without it.
1 fixed18 passed either way3 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
A test case the skill fixed. Same model, same prompt, with and without the skill.
A developer uses bitwise right shift `x >> 1` to halve large integer identifiers in JavaScript. However, when `x` exceeds `2147483647` (2^31 - 1), bitwise operators return negative or unexpected results because JS converts bitwise operands to 32-bit signed integers. Write a JavaScript function `safeHalveInteger(x)` that correctly halves large numbers beyond 32 bits without bitwise truncation.
| Checked | Without skill | With skill |
|---|---|---|
| Use `Math.floor(x / 2)` instead of bitwise right shift. | Missed | Passed |
The instructions your model reads when the skill loads.
Use this skill for numeric browser behavior that needs predictable edge-case handling. It helps avoid common JavaScript traps around coercion, precision, modulo behavior, rounding, randomization, and BigInt.
guidelines.md to select the smallest relevant file set.references/ui-numbers/rules.md for implementation decisions.references/ui-numbers/examples.md when editing code.workflows/debug-ui-number-logic.md for multi-step derivation or debugging.| Resource | Purpose |
|---|---|
guidelines.md | Routes tasks to the right reference files |
references/source-map.md | Book source and chapter/section traceability |
references/ui-numbers/knowledge.md | Core concepts and terminology |
references/ui-numbers/rules.md | Practical rules, guidelines, and exceptions |
references/ui-numbers/examples.md | Bad/good examples and refactoring approach |
references/ui-numbers/patterns.md | Reusable formula and implementation patterns |
references/ui-numbers/checklist.md | Review checklist and red flags |
workflows/debug-ui-number-logic.md | Step-by-step workflow |
Derived from Math for Web Design by Paul McFedries, Chapter 2: Math basics for JavaScript.
Citations are tracked in references/source-map.md.
test cases passed, vs 18 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.