[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6QTAA04PTMJFMB1RSSNK63X":3,"skill-same:01M6QTAA04PTMJFMB1RSSNK63X":92},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":57,"ownerHtmlUrl":58,"ownerBlogUrl":59,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M6QTAA04PTMJFMB1RSSNK63X","nuxt-data",null,"Nuxt 4 data management: composables, data fetching with useFetch\u002FuseAsyncData,\nand state management with useState and Pinia.\n\nUse when: creating custom composables, fetching data with useFetch or useAsyncData,\nmanaging global state with useState, integrating Pinia, debugging reactive data issues,\nor implementing SSR-safe state patterns.\n\nKeywords: useFetch, useAsyncData, $fetch, useState, composables, Pinia,\ndata fetching, state management, reactive, shallow reactivity, reactive keys,\ntransform, pending, error, refresh, dedupe, caching","VRIL-LABS\u002Fskill-jam","VRIL-LABS","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F272046472?v=4","01M6QR9PNWM28WZYJJASER1RG2","𝗩𝗥𝗜𝗟 𝗟𝗔𝗕𝗦","01M6QR9PT6Q6JDCQ97EQBDX6E4",2,"MIT","https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fai-ml\u002Fclaude-skills-main\u002Fclaude-skills-main\u002Fplugins\u002Fnuxt-v4\u002Fskills\u002Fnuxt-data\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"data","nuxt","nuxt data","caching","reactive","custom","data fetching","implementing","2025","error","transform","data management","safe","patterns","fetch","pinia","framework","issues","debugging","ssr","2026-11-10 10:12:30",false,"---\nname: nuxt-data\ndescription: |\n  Nuxt 4 data management: composables, data fetching with useFetch\u002FuseAsyncData,\n  and state management with useState and Pinia.\n\n  Use when: creating custom composables, fetching data with useFetch or useAsyncData,\n  managing global state with useState, integrating Pinia, debugging reactive data issues,\n  or implementing SSR-safe state patterns.\n\n  Keywords: useFetch, useAsyncData, $fetch, useState, composables, Pinia,\n  data fetching, state management, reactive, shallow reactivity, reactive keys,\n  transform, pending, error, refresh, dedupe, caching\nlicense: MIT\nmetadata:\n  version: 4.0.0\n  author: Claude Skills Maintainers\n  category: Framework\n  framework: Nuxt\n  framework-version: 4.x\n  last-verified: 2025-12-28\n---\n\n# Nuxt 4 Data Management\n\nComposables, data fetching, and state management patterns for Nuxt 4 applications.\n\n## Quick Reference\n\n### Data Fetching Methods\n\n| Method | Use Case | SSR | Caching | Reactive |\n|--------|----------|-----|---------|----------|\n| `useFetch` | Simple API calls | Yes | Yes | Yes |\n| `useAsyncData` | Custom async logic | Yes | Yes | Yes |\n| `$fetch` | Client-side only, events | No | No | No |\n\n### Composable Naming\n\n| Prefix | Purpose | Example |\n|--------|---------|---------|\n| `use` | State\u002Flogic composable | `useAuth`, `useCart` |\n| `fetch` | Data fetching only | `fetchUsers` (rare) |\n\n## When to Load References\n\n**Load `references\u002Fcomposables.md` when:**\n- Writing custom composables with complex state\n- Debugging state management issues or memory leaks\n- Implementing SSR-safe patterns with browser APIs\n- Building authentication or complex state composables\n- Understanding singleton vs per-call composable patterns\n\n**Load `references\u002Fdata-fetching.md` when:**\n- Implementing API data fetching with reactive parameters\n- Troubleshooting shallow vs deep reactivity issues\n- Debugging data not refreshing when params change\n- Implementing pagination, infinite scroll, or search\n- Understanding transform functions, caching, or error handling\n\n**Load `references\u002Fpinia-integration.md` when:**\n- Setting up Pinia for complex state management\n- Creating stores with getters and actions\n- Integrating Pinia with SSR\n- Persisting state across page reloads\n\n## Composables\n\n### useState - The Foundation\n\n`useState` creates SSR-safe, shared reactive state that persists across component instances.\n\n```typescript\n\u002F\u002F composables\u002FuseCounter.ts\nexport const useCounter = () => {\n  \u002F\u002F Singleton - shared across all components\n  const count = useState('counter', () => 0)\n\n  const increment = () => count.value++\n  const decrement = () => count.value--\n  const reset = () => count.value = 0\n\n  return { count, increment, decrement, reset }\n}\n```\n\n### useState vs ref - Critical Distinction\n\n```typescript\n\u002F\u002F CORRECT: Shared state (singleton pattern)\nexport const useAuth = () => {\n  const user = useState('auth-user', () => null)  \u002F\u002F Shared!\n  return { user }\n}\n\n\u002F\u002F WRONG: Creates new instance every call!\nexport const useAuth = () => {\n  const user = ref(null)  \u002F\u002F Not shared!\n  return { user }\n}\n```\n\n**Rule**: Use `useState` for shared\u002Fglobal state. Use `ref` for local component state only.\n\n### Complete Authentication Composable\n\n```typescript\n\u002F\u002F composables\u002FuseAuth.ts\nexport const useAuth = () => {\n  const user = useState\u003CUser | null>('auth-user', () => null)\n  const isAuthenticated = computed(() => !!user.value)\n  const isLoading = useState('auth-loading', () => false)\n\n  const login = async (email: string, password: string) => {\n    isLoading.value = true\n    try {\n      const data = await $fetch('\u002Fapi\u002Fauth\u002Flogin', {\n        method: 'POST',\n        body: { email, password }\n      })\n      user.value = data.user\n      return { success: true }\n    } catch (error) {\n      return { success: false, error: error.message }\n    } finally {\n      isLoading.value = false\n    }\n  }\n\n  const logout = async () => {\n    await $fetch('\u002Fapi\u002Fauth\u002Flogout', { method: 'POST' })\n    user.value = null\n    navigateTo('\u002Flogin')\n  }\n\n  const checkSession = async () => {\n    if (import.meta.server) return  \u002F\u002F Skip on server\n    try {\n      const data = await $fetch('\u002Fapi\u002Fauth\u002Fsession')\n      user.value = data.user\n    } catch {\n      user.value = null\n    }\n  }\n\n  return { user, isAuthenticated, isLoading, login, logout, checkSession }\n}\n```\n\n### SSR-Safe Browser APIs\n\n```typescript\n\u002F\u002F composables\u002FuseLocalStorage.ts\nexport const useLocalStorage = \u003CT>(key: string, defaultValue: T) => {\n  const data = useState\u003CT>(key, () => defaultValue)\n\n  \u002F\u002F Only access localStorage on client\n  if (import.meta.client) {\n    const stored = localStorage.getItem(key)\n    if (stored) {\n      data.value = JSON.parse(stored)\n    }\n\n    \u002F\u002F Watch and persist changes\n    watch(data, (newValue) => {\n      localStorage.setItem(key, JSON.stringify(newValue))\n    }, { deep: true })\n  }\n\n  return data\n}\n```\n\n## Data Fetching\n\n### useFetch - Basic Usage\n\n```typescript\n\u002F\u002F Simple GET request\nconst { data, error, pending, refresh } = await useFetch('\u002Fapi\u002Fusers')\n\n\u002F\u002F With options\nconst { data: users } = await useFetch('\u002Fapi\u002Fusers', {\n  method: 'GET',\n  query: { limit: 10, offset: 0 },\n  headers: { 'X-Custom-Header': 'value' }\n})\n```\n\n### Reactive Parameters\n\n```vue\n\u003Cscript setup lang=\"ts\">\nconst page = ref(1)\nconst search = ref('')\n\n\u002F\u002F Auto-refetches when page or search changes\nconst { data: users, pending } = await useFetch('\u002Fapi\u002Fusers', {\n  query: {\n    page,\n    search,\n    limit: 10\n  }\n})\n\n\u002F\u002F Or with computed\nconst query = computed(() => ({\n  page: page.value,\n  search: search.value,\n  limit: 10\n}))\n\nconst { data } = await useFetch('\u002Fapi\u002Fusers', { query })\n\u003C\u002Fscript>\n```\n\n### Transform Data\n\n```typescript\nconst { data: userNames } = await useFetch('\u002Fapi\u002Fusers', {\n  transform: (users) => users.map(u => u.name)\n})\n\n\u002F\u002F data.value is now string[] instead of User[]\n```\n\n### Pick Specific Fields\n\n```typescript\nconst { data } = await useFetch('\u002Fapi\u002Fuser', {\n  pick: ['id', 'name', 'email']  \u002F\u002F Only these fields in payload\n})\n```\n\n### useAsyncData - Custom Logic\n\n```typescript\n\u002F\u002F Multiple parallel requests\nconst { data } = await useAsyncData('dashboard', async () => {\n  const [users, posts, stats] = await Promise.all([\n    $fetch('\u002Fapi\u002Fusers'),\n    $fetch('\u002Fapi\u002Fposts'),\n    $fetch('\u002Fapi\u002Fstats')\n  ])\n  return { users, posts, stats }\n})\n\n\u002F\u002F Access: data.value.users, data.value.posts, data.value.stats\n```\n\n### Error Handling\n\n```typescript\nconst { data, error, status } = await useFetch('\u002Fapi\u002Fusers')\n\n\u002F\u002F Check error\nif (error.value) {\n  console.error('Error:', error.value.message)\n  console.error('Status:', error.value.statusCode)\n}\n\n\u002F\u002F Status values: 'idle' | 'pending' | 'success' | 'error'\nif (status.value === 'error') {\n  showError(error.value)\n}\n```\n\n### Manual Refresh\n\n```typescript\nconst { data, refresh, execute } = await useFetch('\u002Fapi\u002Fusers', {\n  immediate: false  \u002F\u002F Don't fetch on mount\n})\n\n\u002F\u002F Fetch manually\nawait execute()\n\n\u002F\u002F Refresh (re-fetch)\nawait refresh()\n\n\u002F\u002F Refresh with new params\nawait refresh({ dedupe: true })\n```\n\n### Shallow vs Deep Reactivity (v4 Change)\n\n```typescript\n\u002F\u002F Nuxt 4 default: Shallow reactivity\nconst { data } = await useFetch('\u002Fapi\u002Fuser')\ndata.value.name = 'New Name'  \u002F\u002F Won't trigger reactivity!\n\n\u002F\u002F Enable deep reactivity for mutations\nconst { data } = await useFetch('\u002Fapi\u002Fuser', {\n  deep: true\n})\ndata.value.name = 'New Name'  \u002F\u002F Now works!\n\n\u002F\u002F Or refresh instead of mutating\nconst { data, refresh } = await useFetch('\u002Fapi\u002Fuser')\nawait $fetch('\u002Fapi\u002Fuser', { method: 'PATCH', body: { name: 'New Name' } })\nawait refresh()  \u002F\u002F Re-fetch updated data\n```\n\n### Caching and Deduplication\n\n```typescript\nconst { data } = await useFetch('\u002Fapi\u002Fusers', {\n  key: 'users-list',           \u002F\u002F Custom cache key\n  dedupe: 'cancel',            \u002F\u002F Cancel duplicate requests\n  getCachedData: (key, nuxtApp) => {\n    \u002F\u002F Return cached data if valid\n    return nuxtApp.payload.data[key]\n  }\n})\n```\n\n### Lazy Loading Data\n\n```typescript\n\u002F\u002F useLazyFetch - Navigation happens immediately, data loads in background\nconst { data, pending } = useLazyFetch('\u002Fapi\u002Fusers')\n\n\u002F\u002F useLazyAsyncData\nconst { data, pending } = useLazyAsyncData('users', () => $fetch('\u002Fapi\u002Fusers'))\n```\n\n### $fetch - Client-Side Only\n\n```typescript\n\u002F\u002F In event handlers (not during SSR)\nconst submitForm = async () => {\n  const result = await $fetch('\u002Fapi\u002Fsubmit', {\n    method: 'POST',\n    body: formData.value\n  })\n}\n\n\u002F\u002F In server routes\nexport default defineEventHandler(async (event) => {\n  const externalData = await $fetch('https:\u002F\u002Fapi.example.com\u002Fdata')\n  return externalData\n})\n```\n\n## State Management\n\n### useState Patterns\n\n```typescript\n\u002F\u002F Simple counter\nconst count = useState('count', () => 0)\n\n\u002F\u002F Complex object\nconst settings = useState('settings', () => ({\n  theme: 'light',\n  notifications: true,\n  language: 'en'\n}))\n\n\u002F\u002F Typed state\ninterface User {\n  id: string\n  name: string\n  email: string\n}\nconst user = useState\u003CUser | null>('user', () => null)\n```\n\n### Shared Cart Example\n\n```typescript\n\u002F\u002F composables\u002FuseCart.ts\ninterface CartItem {\n  id: string\n  name: string\n  price: number\n  quantity: number\n}\n\nexport const useCart = () => {\n  const items = useState\u003CCartItem[]>('cart-items', () => [])\n\n  const total = computed(() =>\n    items.value.reduce((sum, item) => sum + item.price * item.quantity, 0)\n  )\n\n  const itemCount = computed(() =>\n    items.value.reduce((sum, item) => sum + item.quantity, 0)\n  )\n\n  const addItem = (product: Omit\u003CCartItem, 'quantity'>) => {\n    const existing = items.value.find(i => i.id === product.id)\n    if (existing) {\n      existing.quantity++\n    } else {\n      items.value.push({ ...product, quantity: 1 })\n    }\n  }\n\n  const removeItem = (id: string) => {\n    items.value = items.value.filter(i => i.id !== id)\n  }\n\n  const updateQuantity = (id: string, quantity: number) => {\n    const item = items.value.find(i => i.id === id)\n    if (item) {\n      item.quantity = Math.max(0, quantity)\n      if (item.quantity === 0) removeItem(id)\n    }\n  }\n\n  const clearCart = () => {\n    items.value = []\n  }\n\n  return { items, total, itemCount, addItem, removeItem, updateQuantity, clearCart }\n}\n```\n\n### Pinia Integration\n\n```bash\nbun add pinia @pinia\u002Fnuxt\n```\n\n```typescript\n\u002F\u002F nuxt.config.ts\nexport default defineNuxtConfig({\n  modules: ['@pinia\u002Fnuxt']\n})\n\n\u002F\u002F stores\u002Fauth.ts\nimport { defineStore } from 'pinia'\n\nexport const useAuthStore = defineStore('auth', {\n  state: () => ({\n    user: null as User | null,\n    token: null as string | null\n  }),\n\n  getters: {\n    isAuthenticated: (state) => !!state.user,\n    userName: (state) => state.user?.name ?? 'Guest'\n  },\n\n  actions: {\n    async login(email: string, password: string) {\n      const { user, token } = await $fetch('\u002Fapi\u002Fauth\u002Flogin', {\n        method: 'POST',\n        body: { email, password }\n      })\n      this.user = user\n      this.token = token\n    },\n\n    logout() {\n      this.user = null\n      this.token = null\n    }\n  }\n})\n\n\u002F\u002F Usage in components\nconst authStore = useAuthStore()\nawait authStore.login('user@example.com', 'password')\nconsole.log(authStore.userName)\n```\n\n## Common Anti-Patterns\n\n### Using ref Instead of useState\n\n```typescript\n\u002F\u002F WRONG - Creates new instance every time!\nexport const useAuth = () => {\n  const user = ref(null)  \u002F\u002F Not shared\n  return { user }\n}\n\n\u002F\u002F CORRECT\nexport const useAuth = () => {\n  const user = useState('auth-user', () => null)\n  return { user }\n}\n```\n\n### Missing Error Handling\n\n```typescript\n\u002F\u002F WRONG\nconst { data } = await useFetch('\u002Fapi\u002Fusers')\nconsole.log(data.value.length)  \u002F\u002F Crashes if error!\n\n\u002F\u002F CORRECT\nconst { data, error } = await useFetch('\u002Fapi\u002Fusers')\nif (error.value) {\n  showToast({ type: 'error', message: error.value.message })\n  return\n}\nconsole.log(data.value.length)\n```\n\n### Non-Deterministic Transform\n\n```typescript\n\u002F\u002F WRONG - Causes hydration mismatch!\nconst { data } = await useFetch('\u002Fapi\u002Fusers', {\n  transform: (users) => users.sort(() => Math.random() - 0.5)\n})\n\n\u002F\u002F CORRECT\nconst { data } = await useFetch('\u002Fapi\u002Fusers', {\n  transform: (users) => users.sort((a, b) => a.name.localeCompare(b.name))\n})\n```\n\n### Mutating Shallow Refs\n\n```typescript\n\u002F\u002F WRONG - v4 uses shallow refs by default\nconst { data } = await useFetch('\u002Fapi\u002Fuser')\ndata.value.name = 'New Name'  \u002F\u002F Won't trigger reactivity!\n\n\u002F\u002F CORRECT - Option 1: Enable deep\nconst { data } = await useFetch('\u002Fapi\u002Fuser', { deep: true })\ndata.value.name = 'New Name'\n\n\u002F\u002F CORRECT - Option 2: Replace entire value\ndata.value = { ...data.value, name: 'New Name' }\n\n\u002F\u002F CORRECT - Option 3: Refresh after mutation\nawait $fetch('\u002Fapi\u002Fuser', { method: 'PATCH', body: { name: 'New Name' } })\nawait refresh()\n```\n\n## Troubleshooting\n\n**Data Not Refreshing When Params Change:**\n- Ensure params are reactive: `{ query: { page } }` where `page = ref(1)`\n- Check you're using the ref itself, not `.value`\n\n**Hydration Mismatch with useState:**\n- Ensure key is unique: `useState('unique-key', () => value)`\n- Avoid `Math.random()` or `Date.now()` in initial values\n\n**State Lost on Navigation:**\n- Use `useState` instead of `ref` for persistent state\n- Check you're using the same key across components\n\n**Infinite Refetch Loop:**\n- Check for reactive dependencies in transform function\n- Use `watch` with `{ immediate: false }` for side effects\n\n## Related Skills\n\n- **nuxt-core**: Project setup, routing, configuration\n- **nuxt-server**: Server routes, API patterns\n- **nuxt-production**: Performance, testing, deployment\n\n---\n\n**Version**: 4.0.0 | **Last Updated**: 2025-12-28 | **License**: MIT\n","# Nuxt 4 Data Management\n\nComposables, data fetching, and state management patterns for Nuxt 4 applications.\n\n## Quick Reference\n\n### Data Fetching Methods\n\n| Method | Use Case | SSR | Caching | Reactive |\n|--------|----------|-----|---------|----------|\n| `useFetch` | Simple API calls | Yes | Yes | Yes |\n| `useAsyncData` | Custom async logic | Yes | Yes | Yes |\n| `$fetch` | Client-side only, events | No | No | No |\n\n### Composable Naming\n\n| Prefix | Purpose | Example |\n|--------|---------|---------|\n| `use` | State\u002Flogic composable | `useAuth`, `useCart` |\n| `fetch` | Data fetching only | `fetchUsers` (rare) |\n\n## When to Load References\n\n**Load `references\u002Fcomposables.md` when:**\n- Writing custom composables with complex state\n- Debugging state management issues or memory leaks\n- Implementing SSR-safe patterns with browser APIs\n- Building authentication or complex state composables\n- Understanding singleton vs per-call composable patterns\n\n**Load `references\u002Fdata-fetching.md` when:**\n- Implementing API data fetching with reactive parameters\n- Troubleshooting shallow vs deep reactivity issues\n- Debugging data not refreshing when params change\n- Implementing pagination, infinite scroll, or search\n- Understanding transform functions, caching, or error handling\n\n**Load `references\u002Fpinia-integration.md` when:**\n- Setting up Pinia for complex state management\n- Creating stores with getters and actions\n- Integrating Pinia with SSR\n- Persisting state across page reloads\n\n## Composables\n\n### useState - The Foundation\n\n`useState` creates SSR-safe, shared reactive state that persists across component instances.\n\n```typescript\n\u002F\u002F composables\u002FuseCounter.ts\nexport const useCounter = () => {\n  \u002F\u002F Singleton - shared across all components\n  const count = useState('counter', () => 0)\n\n  const increment = () => count.value++\n  const decrement = () => count.value--\n  const reset = () => count.value = 0\n\n  return { count, increment, decrement, reset }\n}\n```\n\n### useState vs ref - Critical Distinction\n\n```typescript\n\u002F\u002F CORRECT: Shared state (singleton pattern)\nexport const useAuth = () => {\n  const user = useState('auth-user', () => null)  \u002F\u002F Shared!\n  return { user }\n}\n\n\u002F\u002F WRONG: Creates new instance every call!\nexport const useAuth = () => {\n  const user = ref(null)  \u002F\u002F Not shared!\n  return { user }\n}\n```\n\n**Rule**: Use `useState` for shared\u002Fglobal state. Use `ref` for local component state only.\n\n### Complete Authentication Composable\n\n```typescript\n\u002F\u002F composables\u002FuseAuth.ts\nexport const useAuth = () => {\n  const user = useState\u003CUser | null>('auth-user', () => null)\n  const isAuthenticated = computed(() => !!user.value)\n  const isLoading = useState('auth-loading', () => false)\n\n  const login = async (email: string, password: string) => {\n    isLoading.value = true\n    try {\n      const data = await $fetch('\u002Fapi\u002Fauth\u002Flogin', {\n        method: 'POST',\n        body: { email, password }\n      })\n      user.value = data.user\n      return { success: true }\n    } catch (error) {\n      return { success: false, error: error.message }\n    } finally {\n      isLoading.value = false\n    }\n  }\n\n  const logout = async () => {\n    await $fetch('\u002Fapi\u002Fauth\u002Flogout', { method: 'POST' })\n    user.value = null\n    navigateTo('\u002Flogin')\n  }\n\n  const checkSession = async () => {\n    if (import.meta.server) return  \u002F\u002F Skip on server\n    try {\n      const data = await $fetch('\u002Fapi\u002Fauth\u002Fsession')\n      user.value = data.user\n    } catch {\n      user.value = null\n    }\n  }\n\n  return { user, isAuthenticated, isLoading, login, logout, checkSession }\n}\n```\n\n### SSR-Safe Browser APIs\n\n```typescript\n\u002F\u002F composables\u002FuseLocalStorage.ts\nexport const useLocalStorage = \u003CT>(key: string, defaultValue: T) => {\n  const data = useState\u003CT>(key, () => defaultValue)\n\n  \u002F\u002F Only access localStorage on client\n  if (import.meta.client) {\n    const stored = localStorage.getItem(key)\n    if (stored) {\n      data.value = JSON.parse(stored)\n    }\n\n    \u002F\u002F Watch and persist changes\n    watch(data, (newValue) => {\n      localStorage.setItem(key, JSON.stringify(newValue))\n    }, { deep: true })\n  }\n\n  return data\n}\n```\n\n## Data Fetching\n\n### useFetch - Basic Usage\n\n```typescript\n\u002F\u002F Simple GET request\nconst { data, error, pending, refresh } = await useFetch('\u002Fapi\u002Fusers')\n\n\u002F\u002F With options\nconst { data: users } = await useFetch('\u002Fapi\u002Fusers', {\n  method: 'GET',\n  query: { limit: 10, offset: 0 },\n  headers: { 'X-Custom-Header': 'value' }\n})\n```\n\n### Reactive Parameters\n\n```vue\n\u003Cscript setup lang=\"ts\">\nconst page = ref(1)\nconst search = ref('')\n\n\u002F\u002F Auto-refetches when page or search changes\nconst { data: users, pending } = await useFetch('\u002Fapi\u002Fusers', {\n  query: {\n    page,\n    search,\n    limit: 10\n  }\n})\n\n\u002F\u002F Or with computed\nconst query = computed(() => ({\n  page: page.value,\n  search: search.value,\n  limit: 10\n}))\n\nconst { data } = await useFetch('\u002Fapi\u002Fusers', { query })\n\u003C\u002Fscript>\n```\n\n### Transform Data\n\n```typescript\nconst { data: userNames } = await useFetch('\u002Fapi\u002Fusers', {\n  transform: (users) => users.map(u => u.name)\n})\n\n\u002F\u002F data.value is now string[] instead of User[]\n```\n\n### Pick Specific Fields\n\n```typescript\nconst { data } = await useFetch('\u002Fapi\u002Fuser', {\n  pick: ['id', 'name', 'email']  \u002F\u002F Only these fields in payload\n})\n```\n\n### useAsyncData - Custom Logic\n\n```typescript\n\u002F\u002F Multiple parallel requests\nconst { data } = await useAsyncData('dashboard', async () => {\n  const [users, posts, stats] = await Promise.all([\n    $fetch('\u002Fapi\u002Fusers'),\n    $fetch('\u002Fapi\u002Fposts'),\n    $fetch('\u002Fapi\u002Fstats')\n  ])\n  return { users, posts, stats }\n})\n\n\u002F\u002F Access: data.value.users, data.value.posts, data.value.stats\n```\n\n### Error Handling\n\n```typescript\nconst { data, error, status } = await useFetch('\u002Fapi\u002Fusers')\n\n\u002F\u002F Check error\nif (error.value) {\n  console.error('Error:', error.value.message)\n  console.error('Status:', error.value.statusCode)\n}\n\n\u002F\u002F Status values: 'idle' | 'pending' | 'success' | 'error'\nif (status.value === 'error') {\n  showError(error.value)\n}\n```\n\n### Manual Refresh\n\n```typescript\nconst { data, refresh, execute } = await useFetch('\u002Fapi\u002Fusers', {\n  immediate: false  \u002F\u002F Don't fetch on mount\n})\n\n\u002F\u002F Fetch manually\nawait execute()\n\n\u002F\u002F Refresh (re-fetch)\nawait refresh()\n\n\u002F\u002F Refresh with new params\nawait refresh({ dedupe: true })\n```\n\n### Shallow vs Deep Reactivity (v4 Change)\n\n```typescript\n\u002F\u002F Nuxt 4 default: Shallow reactivity\nconst { data } = await useFetch('\u002Fapi\u002Fuser')\ndata.value.name = 'New Name'  \u002F\u002F Won't trigger reactivity!\n\n\u002F\u002F Enable deep reactivity for mutations\nconst { data } = await useFetch('\u002Fapi\u002Fuser', {\n  deep: true\n})\ndata.value.name = 'New Name'  \u002F\u002F Now works!\n\n\u002F\u002F Or refresh instead of mutating\nconst { data, refresh } = await useFetch('\u002Fapi\u002Fuser')\nawait $fetch('\u002Fapi\u002Fuser', { method: 'PATCH', body: { name: 'New Name' } })\nawait refresh()  \u002F\u002F Re-fetch updated data\n```\n\n### Caching and Deduplication\n\n```typescript\nconst { data } = await useFetch('\u002Fapi\u002Fusers', {\n  key: 'users-list',           \u002F\u002F Custom cache key\n  dedupe: 'cancel',            \u002F\u002F Cancel duplicate requests\n  getCachedData: (key, nuxtApp) => {\n    \u002F\u002F Return cached data if valid\n    return nuxtApp.payload.data[key]\n  }\n})\n```\n\n### Lazy Loading Data\n\n```typescript\n\u002F\u002F useLazyFetch - Navigation happens immediately, data loads in background\nconst { data, pending } = useLazyFetch('\u002Fapi\u002Fusers')\n\n\u002F\u002F useLazyAsyncData\nconst { data, pending } = useLazyAsyncData('users', () => $fetch('\u002Fapi\u002Fusers'))\n```\n\n### $fetch - Client-Side Only\n\n```typescript\n\u002F\u002F In event handlers (not during SSR)\nconst submitForm = async () => {\n  const result = await $fetch('\u002Fapi\u002Fsubmit', {\n    method: 'POST',\n    body: formData.value\n  })\n}\n\n\u002F\u002F In server routes\nexport default defineEventHandler(async (event) => {\n  const externalData = await $fetch('https:\u002F\u002Fapi.example.com\u002Fdata')\n  return externalData\n})\n```\n\n## State Management\n\n### useState Patterns\n\n```typescript\n\u002F\u002F Simple counter\nconst count = useState('count', () => 0)\n\n\u002F\u002F Complex object\nconst settings = useState('settings', () => ({\n  theme: 'light',\n  notifications: true,\n  language: 'en'\n}))\n\n\u002F\u002F Typed state\ninterface User {\n  id: string\n  name: string\n  email: string\n}\nconst user = useState\u003CUser | null>('user', () => null)\n```\n\n### Shared Cart Example\n\n```typescript\n\u002F\u002F composables\u002FuseCart.ts\ninterface CartItem {\n  id: string\n  name: string\n  price: number\n  quantity: number\n}\n\nexport const useCart = () => {\n  const items = useState\u003CCartItem[]>('cart-items', () => [])\n\n  const total = computed(() =>\n    items.value.reduce((sum, item) => sum + item.price * item.quantity, 0)\n  )\n\n  const itemCount = computed(() =>\n    items.value.reduce((sum, item) => sum + item.quantity, 0)\n  )\n\n  const addItem = (product: Omit\u003CCartItem, 'quantity'>) => {\n    const existing = items.value.find(i => i.id === product.id)\n    if (existing) {\n      existing.quantity++\n    } else {\n      items.value.push({ ...product, quantity: 1 })\n    }\n  }\n\n  const removeItem = (id: string) => {\n    items.value = items.value.filter(i => i.id !== id)\n  }\n\n  const updateQuantity = (id: string, quantity: number) => {\n    const item = items.value.find(i => i.id === id)\n    if (item) {\n      item.quantity = Math.max(0, quantity)\n      if (item.quantity === 0) removeItem(id)\n    }\n  }\n\n  const clearCart = () => {\n    items.value = []\n  }\n\n  return { items, total, itemCount, addItem, removeItem, updateQuantity, clearCart }\n}\n```\n\n### Pinia Integration\n\n```bash\nbun add pinia @pinia\u002Fnuxt\n```\n\n```typescript\n\u002F\u002F nuxt.config.ts\nexport default defineNuxtConfig({\n  modules: ['@pinia\u002Fnuxt']\n})\n\n\u002F\u002F stores\u002Fauth.ts\nimport { defineStore } from 'pinia'\n\nexport const useAuthStore = defineStore('auth', {\n  state: () => ({\n    user: null as User | null,\n    token: null as string | null\n  }),\n\n  getters: {\n    isAuthenticated: (state) => !!state.user,\n    userName: (state) => state.user?.name ?? 'Guest'\n  },\n\n  actions: {\n    async login(email: string, password: string) {\n      const { user, token } = await $fetch('\u002Fapi\u002Fauth\u002Flogin', {\n        method: 'POST',\n        body: { email, password }\n      })\n      this.user = user\n      this.token = token\n    },\n\n    logout() {\n      this.user = null\n      this.token = null\n    }\n  }\n})\n\n\u002F\u002F Usage in components\nconst authStore = useAuthStore()\nawait authStore.login('user@example.com', 'password')\nconsole.log(authStore.userName)\n```\n\n## Common Anti-Patterns\n\n### Using ref Instead of useState\n\n```typescript\n\u002F\u002F WRONG - Creates new instance every time!\nexport const useAuth = () => {\n  const user = ref(null)  \u002F\u002F Not shared\n  return { user }\n}\n\n\u002F\u002F CORRECT\nexport const useAuth = () => {\n  const user = useState('auth-user', () => null)\n  return { user }\n}\n```\n\n### Missing Error Handling\n\n```typescript\n\u002F\u002F WRONG\nconst { data } = await useFetch('\u002Fapi\u002Fusers')\nconsole.log(data.value.length)  \u002F\u002F Crashes if error!\n\n\u002F\u002F CORRECT\nconst { data, error } = await useFetch('\u002Fapi\u002Fusers')\nif (error.value) {\n  showToast({ type: 'error', message: error.value.message })\n  return\n}\nconsole.log(data.value.length)\n```\n\n### Non-Deterministic Transform\n\n```typescript\n\u002F\u002F WRONG - Causes hydration mismatch!\nconst { data } = await useFetch('\u002Fapi\u002Fusers', {\n  transform: (users) => users.sort(() => Math.random() - 0.5)\n})\n\n\u002F\u002F CORRECT\nconst { data } = await useFetch('\u002Fapi\u002Fusers', {\n  transform: (users) => users.sort((a, b) => a.name.localeCompare(b.name))\n})\n```\n\n### Mutating Shallow Refs\n\n```typescript\n\u002F\u002F WRONG - v4 uses shallow refs by default\nconst { data } = await useFetch('\u002Fapi\u002Fuser')\ndata.value.name = 'New Name'  \u002F\u002F Won't trigger reactivity!\n\n\u002F\u002F CORRECT - Option 1: Enable deep\nconst { data } = await useFetch('\u002Fapi\u002Fuser', { deep: true })\ndata.value.name = 'New Name'\n\n\u002F\u002F CORRECT - Option 2: Replace entire value\ndata.value = { ...data.value, name: 'New Name' }\n\n\u002F\u002F CORRECT - Option 3: Refresh after mutation\nawait $fetch('\u002Fapi\u002Fuser', { method: 'PATCH', body: { name: 'New Name' } })\nawait refresh()\n```\n\n## Troubleshooting\n\n**Data Not Refreshing When Params Change:**\n- Ensure params are reactive: `{ query: { page } }` where `page = ref(1)`\n- Check you're using the ref itself, not `.value`\n\n**Hydration Mismatch with useState:**\n- Ensure key is unique: `useState('unique-key', () => value)`\n- Avoid `Math.random()` or `Date.now()` in initial values\n\n**State Lost on Navigation:**\n- Use `useState` instead of `ref` for persistent state\n- Check you're using the same key across components\n\n**Infinite Refetch Loop:**\n- Check for reactive dependencies in transform function\n- Use `watch` with `{ immediate: false }` for side effects\n\n## Related Skills\n\n- **nuxt-core**: Project setup, routing, configuration\n- **nuxt-server**: Server routes, API patterns\n- **nuxt-production**: Performance, testing, deployment\n\n---\n\n**Version**: 4.0.0 | **Last Updated**: 2025-12-28 | **License**: MIT\n",{"name":5,"license":15,"metadata":44,"description":51},{"author":45,"version":46,"category":47,"framework":48,"last-verified":49,"framework-version":50},"Claude Skills Maintainers","4.0.0","Framework","Nuxt",1766880000000,"4.x","Nuxt 4 data management: composables, data fetching with useFetch\u002FuseAsyncData,\nand state management with useState and Pinia.\n\nUse when: creating custom composables, fetching data with useFetch or useAsyncData,\nmanaging global state with useState, integrating Pinia, debugging reactive data issues,\nor implementing SSR-safe state patterns.\n\nKeywords: useFetch, useAsyncData, $fetch, useState, composables, Pinia,\ndata fetching, state management, reactive, shallow reactivity, reactive keys,\ntransform, pending, error, refresh, dedupe, caching\n","main","5b00ad8b9f0787969474ff5e9ec417bb55f23827","skills\u002Fai-ml\u002Fclaude-skills-main\u002Fclaude-skills-main\u002Fplugins\u002Fnuxt-v4\u002Fskills\u002Fnuxt-data",0,"https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam","https:\u002F\u002Fvril.li","https:\u002F\u002Fgithub.com\u002FVRIL-LABS","vril.li","𝗥𝗲𝘀𝗲𝗮𝗿𝗰𝗵 𝗮𝗻𝗱 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗺𝗲𝗻𝘁 𝗖𝗼𝗻𝘀𝗼𝗿𝘁𝗶𝘂𝗺","2026-08-24 09:21:38",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add VRIL-LABS\u002Fskill-jam --skill nuxt-data",{"tool":68,"command":69},"bunx","bunx skills add VRIL-LABS\u002Fskill-jam --skill nuxt-data",{"tool":71,"command":72},"pnpm","pnpm dlx skills add VRIL-LABS\u002Fskill-jam --skill nuxt-data","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fai-ml\u002Fclaude-skills-main\u002Fclaude-skills-main\u002Fplugins\u002Fnuxt-v4\u002Fskills\u002Fnuxt-data\u002FSKILL.md",true,[76,82,86],{"path":77,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fcomposables.md","REFERENCE","参考文档",16360,"https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fai-ml\u002Fclaude-skills-main\u002Fclaude-skills-main\u002Fplugins\u002Fnuxt-v4\u002Fskills\u002Fnuxt-data\u002Freferences\u002Fcomposables.md",{"path":83,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fdata-fetching.md",16293,"https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fai-ml\u002Fclaude-skills-main\u002Fclaude-skills-main\u002Fplugins\u002Fnuxt-v4\u002Fskills\u002Fnuxt-data\u002Freferences\u002Fdata-fetching.md",{"path":87,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":90,"sourceHtmlUrl":91},"templates\u002Fcomposables\u002FuseAuth.ts","SCRIPT","脚本",3111,"https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fai-ml\u002Fclaude-skills-main\u002Fclaude-skills-main\u002Fplugins\u002Fnuxt-v4\u002Fskills\u002Fnuxt-data\u002Ftemplates\u002Fcomposables\u002FuseAuth.ts",[93,120,133,146,170,193],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":39},"01M6R2CQRG190P09DAHMF8M5QP","three-best-practices","Three.js performance optimization and best practices guidelines. Use when writing, reviewing, or optimizing Three.js code. Triggers on tasks involving 3D scenes, WebGL\u002FWebGPU rendering, geometries, materials, textures, lighting, shaders, or TSL.","https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fweb-frontend\u002Fneversight-skills_feed-three-best-practices-1.0.2\u002FSKILL.md",[],[100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119],"best practices","three","three best practices","writing","performance","webgpu","guidelines","tasks","code","shaders","Optimization","3D","use","agent-skills","scenes","lighting","triggers","rendering","when","best practices guidelines",{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":39},"01M6R2BPMDYK9XKWPARY0S5MS3","javascript-best-practices","Modern JavaScript best practices and performance optimization guidelines. Use when writing, reviewing, or refactoring JavaScript code to ensure optimal performance, maintainability, and modern patterns.","https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fweb-frontend\u002Fneversight-skills_feed-javascript-best-practices-1.0.2\u002FSKILL.md",[],[127,100,128,103,104,106,108,110,129,130,112,32,131,132,118],"javascript","JavaScript Best Practices","refactoring","performance optimization","maintainability","name",{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":39},"01M6R2B41BN09FYH76BAC5FT7X","css-best-practices","Guidelines for building modern, performant, and accessible CSS using MDN best practices. Use this when styling components, fixing layout shifts, or optimizing CSS performance.","https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fweb-frontend\u002Fneversight-skills_feed-css-best-practices-1.0.3\u002FSKILL.md",[],[140,100,141,104,142,106,112,143,144,145,118],"css","css best practices","components","styling","layout","for",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":39},"01M6R2A1CEF123TZCNM1XJ2XQ4","frontend-dev","Full-stack frontend development combining premium UI design, cinematic animations,\nAI-generated media assets, persuasive copywriting, and visual art. Builds complete,\nvisually striking web pages with real media, advanced motion, and compelling copy.\nUse when: building landing pages, marketing sites, product pages, dashboards,\ngenerating media assets (image\u002Fvideo\u002Faudio\u002Fmusic), writing conversion copy,\ncreating generative art, or implementing cinematic scroll animations.","https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fweb-frontend\u002Fminimax-ai-skills-frontend-dev-1.0.1\u002FSKILL.md",[],[153,154,155,156,103,157,140,158,159,160,161,162,163,164,165,166,167,26,168,169],"frontend","dev","frontend dev","design","image","react","ui","Video","Media","Audio","Tailwind","stack","music","aida","framer motion","framer","generative",{"skillNo":171,"name":172,"nameZh":6,"description":173,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":39},"01M6R20VQ98KDX4J37TGE0FNHW","exa-rate-limits","Implement Exa rate limiting, backoff, and idempotency patterns.\nUse when handling rate limit errors, implementing retry logic,\nor optimizing API request throughput for Exa.\nTrigger with phrases like \"exa rate limit\", \"exa throttling\",\n\"exa 429\", \"exa retry\", \"exa backoff\".","https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fsearch-research\u002Fjeremylongshore-claude-code-plugins-plus-skills-exa-rate-limits-1.0.0\u002FSKILL.md",[],[177,178,179,180,181,182,183,184,185,32,186,187,188,189,190,26,145,191,192,118],"exa","exa rate limits","rate","limits","throttling","api","read","write","edit","io","throughput","retry","errors","limit","rate limit","request",{"skillNo":194,"name":195,"nameZh":6,"description":196,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":197,"categories":198,"keywords":199,"publishedAt":39},"01M6R20FV0TM7ZZTZNG7JQ1A82","exa-deploy-integration","Deploy Exa integrations to Vercel, Fly.io, and Cloud Run platforms.\nUse when deploying Exa-powered applications to production,\nconfiguring platform-specific secrets, or setting up deployment pipelines.\nTrigger with phrases like \"deploy exa\", \"exa Vercel\",\n\"exa production deploy\", \"exa Cloud Run\", \"exa Fly.io\".","https:\u002F\u002Fgithub.com\u002FVRIL-LABS\u002Fskill-jam\u002Fblob\u002Fmain\u002Fskills\u002Fsearch-research\u002Fjeremylongshore-claude-code-plugins-plus-skills-exa-deploy-integration-1.0.0\u002FSKILL.md",[],[200,201,177,202,203,204,205,206,207,208,183,184,185,209,210,211,186,212,213,118],"deploy","integration","exa deploy integration","deployment","run","secrets","fly","Bash","integrations","vercel","up","platform","trigger","cloud run"]