vueuse
Install this skill
npx skills add onmax/nuxt-skillsWorks across Claude Code, Cursor, Codex, Copilot & Antigravity
VueUse is a primary library of utility functions for Vue 3 Composition API, providing pre-written logic for common browser, state, and reactivity challenges. Instead of writing custom logic for DOM observation, local storage synchronization, or event debouncing, developers can import tested functions that handle these tasks with built-in reactivity and cleanup. It supports both standard Vue 3 setups and Nuxt projects, with the latter benefiting from automatic imports. The library abstracts complex browser APIs into simple, readable hooks that follow Vue’s reactive patterns. By standardizing these frequent implementation details, the library helps maintain consistent code structures across projects, particularly for handling side effects that would otherwise require manual lifecycle management or event listeners.
When to Use This Skill
- •Persisting user-defined theme preferences or form drafts between page reloads
- •Implementing infinite scroll or lazy loading via intersection observers
- •Handling complex input interactions like drag-and-drop or debounced search inputs
- •Synchronizing UI updates with window resizing or device orientation changes
How to Invoke This Skill
Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:
- “How do I sync state to localStorage in Vue?
- “Show me how to use debouncing in Vue 3
- “What is the best way to track window size changes?
- “How do I use an intersection observer as a composable?
- “Help me implement a shared state singleton
Pro Tips
- 💡Always check the comprehensive VueUse documentation first; a composable likely exists for your specific use case, saving significant development time.
- 💡Combine multiple VueUse composables for complex scenarios, such as `useFetch` with `useIntervalFn` for efficient data polling.
- 💡Utilize the Nuxt module for automatic composable imports, simplifying your component code and reducing boilerplate.
What this skill does
- •Synchronizes reactive state with localStorage and sessionStorage
- •Tracks browser environment interactions like mouse position, window size, and media queries
- •Provides debounced and throttled versions of standard Vue watch and ref primitives
- •Manages complex DOM observations including IntersectionObserver and ResizeObserver
- •Offers network-ready hooks for WebSocket and Fetch requests
When not to use it
- ✕When a project requires only one simple functionality and wants to avoid adding a dependency
- ✕When custom logic needs strict control over every frame of animation or performance cycle
Example workflow
- Install @vueuse/core via your package manager
- Identify the specific browser or state requirement in your component
- Browse the library documentation or reference file to find the matching hook
- Import the hook and invoke it within the setup function or script setup
- Bind the returned reactive variables directly to your component template
Prerequisites
- –Vue 3.5+
- –Basic understanding of the Composition API
Pitfalls & limitations
- !Many functions access browser APIs and will throw errors if called directly in SSR during the build phase
- !Component ref elements must be resolved correctly using unrefElement to avoid null reference errors
- !Over-importing large utility sets can impact bundle size if not tree-shaken correctly
FAQ
How it compares
VueUse replaces manual boilerplate code for standard Web APIs with high-quality, pre-tested, and reactive primitives, whereas manual implementation often requires redundant lifecycle management and error-prone side-effect cleanup.
📄 Full skill instructions — original source: onmax/nuxt-skills
Collection of essential Vue Composition utilities. Check VueUse before writing custom composables - most patterns already implemented.
**Current stable:** VueUse 14.x for Vue 3.5+
## Installation
**Vue 3:**
pnpm add @vueuse/core**Nuxt:**
pnpm add @vueuse/nuxt @vueuse/core// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@vueuse/nuxt'],
})Nuxt module auto-imports composables - no import needed.
## Categories
| Category | Examples |
| ---------- | ---------------------------------------------------------- |
| State | useLocalStorage, useSessionStorage, useRefHistory |
| Elements | useElementSize, useIntersectionObserver, useResizeObserver |
| Browser | useClipboard, useFullscreen, useMediaQuery |
| Sensors | useMouse, useKeyboard, useDeviceOrientation |
| Network | useFetch, useWebSocket, useEventSource |
| Animation | useTransition, useInterval, useTimeout |
| Component | useVModel, useVirtualList, useTemplateRefsList |
| Watch | watchDebounced, watchThrottled, watchOnce |
| Reactivity | createSharedComposable, toRef, toReactive |
| Array | useArrayFilter, useArrayMap, useSorted |
| Time | useDateFormat, useNow, useTimeAgo |
| Utilities | useDebounce, useThrottle, useMemoize |
## Quick Reference
Load composable files based on what you need:
| Working on... | Load file |
| -------------------- | ------------------------------------------------------ |
| Finding a composable | [references/composables.md](references/composables.md) |
| Specific composable |
composables/<name>.md |## Loading Files
**Start with [references/composables.md](references/composables.md)** to find the right composable.
Then load the specific composable file for detailed usage:
composables/use-mouse.md, composables/use-local-storage.md, etc.**DO NOT load all files at once** - wastes context on irrelevant patterns.
## Common Patterns
**State persistence:**
const state = useLocalStorage('my-key', { count: 0 })**Mouse tracking:**
const { x, y } = useMouse()**Debounced ref:**
const search = ref('')
const debouncedSearch = refDebounced(search, 300)**Shared composable (singleton):**
const useSharedMouse = createSharedComposable(useMouse)## SSR Gotchas
Many VueUse composables use browser APIs unavailable during SSR.
**Check with
isClient:**import { isClient } from '@vueuse/core'
if (isClient) {
// Browser-only code
const { width } = useWindowSize()
}**Wrap in onMounted:**
const width = ref(0)
onMounted(() => {
// Only runs in browser
const { width: w } = useWindowSize()
width.value = w.value
})**Use SSR-safe composables:**
// These check isClient internally
const mouse = useMouse() // Returns {x: 0, y: 0} on server
const storage = useLocalStorage('key', 'default') // Uses default on server**
@vueuse/nuxt auto-handles SSR** - composables return safe defaults on server.## Target Element Refs
When targeting component refs instead of DOM elements:
import type { MaybeElementRef } from '@vueuse/core'
// Component ref needs .$el to get DOM element
const compRef = ref<ComponentInstance>()
const { width } = useElementSize(compRef) // ❌ Won't work
// Use MaybeElementRef pattern
import { unrefElement } from '@vueuse/core'
const el = computed(() => unrefElement(compRef)) // Gets .$el
const { width } = useElementSize(el) // ✅ Works**Or access
$el directly:**const compRef = ref<ComponentInstance>()
onMounted(() => {
const el = compRef.value?.$el as HTMLElement
const { width } = useElementSize(el)
})How to Use This Skill Unit
Option A: Project-Specific (Recommended)
- Click "Download" above
- In your project, create the directory:
.agent/skills/vueuse/ - Save the file as
SKILL.md - The agent will automatically discover the skill based on its description.
Option B: Global Installation (All Agents)
Save the file to these locations to make it available across all projects:
- Claude Code:
~/.claude/skills/onmax/nuxt-skills/vueuse/SKILL.md - Cursor:
~/.cursor/skills/onmax/nuxt-skills/vueuse/SKILL.md - Antigravity:
~/.gemini/antigravity/skills/onmax/nuxt-skills/vueuse/SKILL.md
🚀 Install with CLI:npx skills add onmax/nuxt-skills