
vueuse-math-skilld
Math composables for Vue 3 from @vueuse/math. Use when writing or debugging code that imports "@vueuse/math", or when clamping, projecting, rounding, averaging, summing, or combining reactive numbers in Vue.
- Installs
- 119
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill vueuse-math-skilld- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads vueuse-math-skilld automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
@vueuse/math 15.0.0
Reactive math for Vue 3. Every composable resolves inputs with toValue inside a computed, so arguments accept plain numbers, refs, or getters (MaybeRefOrGetter<number>), and the result is a ComputedRef<number> that tracks every input (dist/index.js:70-71). The one exception: useClamp with a mutable ref returns a writable computed (dist/index.d.ts:83).
Environment
- Install:
npm i @vueuse/math @vueuse/core(README.md:10).@vueuse/coreis needed only when combining with core functions such aswhenever. - Vue
^3.5.0peer dependency (package.json:42), minimum since v14. - Node.js
>= 22(package.json:39); v15 dropped Node.js 20 (release). - ESM-only since v13:
"type": "module", no CommonJS build (package.json:3; release). Use dynamicimport()if a CJS context must load it. "sideEffects": false(package.json:24): unused composables tree shake away.- Runtime dependency:
@vueuse/shared@15.0.0(package.json:45), which suppliesclampandreactify. - Entry
dist/index.js, typesdist/index.d.ts(package.json:30,34).
Exports
From dist/index.d.ts:167:
- Functions:
createGenericProjection,createProjection,logicAnd,logicNot,logicOr,useAbs,useAverage,useCeil,useClamp,useFloor,useMath,useMax,useMin,usePrecision,useProjection,useRound,useSum,useTrunc - Types:
ProjectorFunction,UseProjection,UseMathKeys,UseMathReturn,UsePrecisionOptions - Deprecated aliases:
and,or,not(dist/index.d.ts:20-21,32-33,44-45)
Signatures, behavior notes, and per-function examples: references/api.md. Version-specific changes: references/migrations.md.
Common tasks
Writable clamped state; pass a mutable ref so assignments are clamped automatically:
import { useClamp } from '@vueuse/math'
const level = ref(0)
const clamped = useClamp(level, 0, 10)
clamped.value = 15 // clamped.value and level.value are 10
Read-only clamp; pass a getter or readonly ref (dist/index.js:113):
const ratio = useClamp(() => raw.value / total.value, 0, 1)
Aggregate fixed refs with rest arguments instead of building an array (dist/index.d.ts:154-155):
const total = useSum(refA, refB, refC)
const peak = useMax(refA, refB, refC)
Map a value between domains, for sliders, charts, or progress UIs:
const progress = useProjection(scrollY, [0, pageHeight], [0, 100])
Reuse one projection across components; domains may be reactive:
const toPercent = createProjection(domain, [0, 100])
const a = toPercent(inputA)
Round to decimal places and keep a number, not the string toFixed returns:
const price = usePrecision(ref(3.1415), 2) // 3.14
const up = usePrecision(ref(3.1415), 2, { math: 'ceil' }) // 3.15
Combine boolean flags reactively, then feed side effects to whenever from @vueuse/core:
import { whenever } from '@vueuse/core'
import { logicAnd } from '@vueuse/math'
whenever(logicAnd(ready, hasData), run)
Rules and pitfalls
- Never use the aliases
and,or,not; deprecated since v14 in favor oflogicAnd,logicOr,logicNot(dist/index.d.ts:20,32,44; release). useAveragedivides byarray.lengthwith no empty check: empty input yieldsNaN(dist/index.js:91-96). Guard the empty case yourself.useMax()with no inputs resolves to-InfinityanduseMin()toInfinity, because both spread intoMath.max/Math.min(dist/index.js:157-176).- Aggregations (
useSum,useAverage,useMin,useMax) accept refs, getters, numbers, arrays of those, and flatten nested arrays one level viatoValueArgsFlat(dist/index.js:75-81). usePrecisionavoids float drift by scaling through the decimal string of the value (accurateMultiply,dist/index.js:187-193);options.mathdefaults to'round'(dist/index.d.ts:122).useMathaccepts onlyMathkeys that are functions, such as'pow'or'sqrt', never constants likePI(dist/index.d.ts:96).- Projection is linear by default:
(input - from[0]) / (from[1] - from[0]) * (to[1] - to[0]) + to[0](dist/index.js:12-14). For non-linear mapping (log scales, easing), pass a customprojector, or usecreateGenericProjectionfor non-number domains (dist/index.d.ts:4-6). - Prefer these composables over
computed(() => Math.x(...))in templates and watchers; they centralize theMathcall, stay reactive to every argument, and carry@__NO_SIDE_EFFECTS__annotations for tree shaking (dist/index.js:4,15,111).
FAQ
What does the vueuse-math-skilld skill do?
Math composables for Vue 3 from @vueuse/math. Use when writing or debugging code that imports "@vueuse/math", or when clamping, projecting, rounding, averaging, summing, or combining reactive numbers in Vue.
How do I install vueuse-math-skilld?
Run npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill vueuse-math-skilld in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/vueuse-math-skilld/ (personal) or .claude/skills/vueuse-math-skilld/ (project).
Which AI agents can use vueuse-math-skilld?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is vueuse-math-skilld safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains vueuse-math-skilld?
It is published by skilld-dev in skilld-dev/vue-ecosystem-skills. It has 119 recorded installs.
More from skilld-dev/vue-ecosystem-skills
quasar-skilld
skilld-dev/vue-ecosystem-skills
Build, configure, and debug apps with the Quasar framework (quasar npm package, v2.33.1). Use when writing, reviewing, or debugging code that imports "quasar" or "quasar/wrappers", configuring Quasar with Vite, Vitest, Storybook, UMD, or Quasar CLI, styling with Quasar Sass variables, or upgrading between Quasar v2 releases.
vue-i18n-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
vue-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
vuetify-skilld
skilld-dev/vue-ecosystem-skills
Vue Material Component Framework. Use when writing, debugging, or configuring code that imports vuetify v4.x. Covers createVuetify setup, components and labs, composables, theming, icons, dates and locale, styles and SASS variables, treeshaking, and v3 to v4 migration.
pinia-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
vue-router-skilld
skilld-dev/vue-ecosystem-skills
Open the skill to read its SKILL.md instructions.
Popular education & science skills
teach
mattpocock/skills
Teach the user a new skill or concept, within this workspace.
scaffold-exercises
mattpocock/skills
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
paper-context-resolver
lllllllama/rigorpilot-skills
Rigor Paper Context helper for README-first deep learning repo reproduction. Use only when the README and repository files leave a narrow reproduction-critical gap and the task is to resolve a specific paper detail such as dataset split, preprocessing, evaluation protocol, checkpoint mapping, or runtime assumption from primary paper sources while recording conflicts. Do not use for general paper summary, repo scanning, environment setup, command execution, title-only paper lookup, or replacing README guidance by default.
caveman-learn
juliusbrussee/caveman
Act on a Caveman learn report - review the ranked token sinks, apply cost-lowering fixes with per-edit consent, and report what those fixes returned. Use when asked to lower an agent's token cost, what caveman has saved, to trim a heavy CLAUDE.md, or to offload re-pasted context into cavemem.
gsap-plugins
greensock/gsap-skills
Official GSAP skill for GSAP plugins — registration, ScrollToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observer, SplitText, ScrambleText, SVG and physics plugins, CustomEase, EasePack, CustomWiggle, CustomBounce, GSDevTools. Use when the user asks about a GSAP plugin, scroll-to, flip animations, draggable, SVG drawing, or plugin registration.
teach-impeccable
pbakaus/impeccable
DEPRECATED: Use /impeccable teach instead. This command has been folded into the impeccable skill.