Agent skill

Nuxt Data

by secondsky in secondsky/claude-skills

| Nuxt 4 data management: composables, data fetching with useFetch/useAsyncData, and state management with useState and Pinia.

MITAuto-check passedFrontend & Design

Install Nuxt Data

skills CLI
$ npx skills add secondsky/claude-skills --skill nuxt-data -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install secondsky/claude-skills nuxt-data --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/nuxt-v4/skills/nuxt-data .claude/skills/nuxt-data && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
nuxt-data
GitHub stars
227
Token cost
~3.4k tokens
SKILL.md length
361 words
Files
4 (incl. references)
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

| Nuxt 4 data management: composables, data fetching with useFetch/useAsyncData, and state management with useState and Pinia.

  • : creating custom composables
  • SKILL.md covers Quick Reference, When to Load References, Composables and Data Fetching, plus 2 more sections
  • Runs TypeScript scripts from its folder; calls bun
  • Fetching data with useFetch

What it does

Nuxt Data is an agent skill from secondsky/claude-skills. | Nuxt 4 data management: composables, data fetching with useFetch/useAsyncData, and state management with useState and Pinia. Use when: creating custom composables, fetching data with useFetch or useAsyncData, managing global state with useState, integrating Pinia, debugging reactive data issues, or implementing SSR-safe state patterns.

Its SKILL.md is about 3.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/composables.md`, `references/data-fetching.md` and `templates/composables/useAuth.ts`).

It sits in Frontend & Design, covering State management. It works with Nuxt. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • : creating custom composables
  • Fetching data with useFetch
  • Managing global state with useState
  • Integrating Pinia

Example prompts

  • “/nuxt-data”

Requirements

  • Node.js

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (TypeScript), which the agent can run.

    Shell commands in SKILL.md call:

    • bun

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Nuxt Data loads about 3.4k tokens when it runs, and up to ~12k if it reads all its reference files. Until then it costs about 87 tokens; SKILL.md has 361 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~87
When it runs · the whole SKILL.md, loaded when a task matches
~3.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~12k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 361 words, ~3,402 tokens.

Download SKILL.mdSave it as .claude/skills/nuxt-data/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
nuxt-data
description
| Nuxt 4 data management: composables, data fetching with useFetch/useAsyncData, and state management with useState and Pinia. Use when: creating custom composables, fetching data with useFetch or useAsyncData, managing global state with useState, integrating Pinia, debugging reactive data issues, or implementing SSR-safe state patterns.
license
MIT
metadata.version
4.0.0
metadata.author
Claude Skills Maintainers
metadata.category
Framework
metadata.framework
Nuxt
metadata.framework-version
4.x
metadata.last-verified
2025-12-28
metadata.keywords
useFetch, useAsyncData, $fetch, useState, composables, Pinia, data fetching, state management, reactive, shallow reactivity, reactive keys, transform…

Nuxt 4 Data Management

Composables, data fetching, and state management patterns for Nuxt 4 applications.

Quick Reference

Data Fetching Methods
MethodUse CaseSSRCachingReactive
useFetchSimple API callsYesYesYes
useAsyncDataCustom async logicYesYesYes
$fetchClient-side only, eventsNoNoNo
Composable Naming
PrefixPurposeExample
useState/logic composableuseAuth, useCart
fetchData fetching onlyfetchUsers (rare)

When to Load References

Load references/composables.md when:

  • Writing custom composables with complex state
  • Debugging state management issues or memory leaks
  • Implementing SSR-safe patterns with browser APIs
  • Building authentication or complex state composables
  • Understanding singleton vs per-call composable patterns

Load references/data-fetching.md when:

  • Implementing API data fetching with reactive parameters
  • Troubleshooting shallow vs deep reactivity issues
  • Debugging data not refreshing when params change
  • Implementing pagination, infinite scroll, or search
  • Understanding transform functions, caching, or error handling

Load references/pinia-integration.md when:

  • Setting up Pinia for complex state management
  • Creating stores with getters and actions
  • Integrating Pinia with SSR
  • Persisting state across page reloads

Composables

useState - The Foundation

useState creates SSR-safe, shared reactive state that persists across component instances.

typescript
// composables/useCounter.ts
export const useCounter = () => {
  // Singleton - shared across all components
  const count = useState('counter', () => 0)

  const increment = () => count.value++
  const decrement = () => count.value--
  const reset = () => count.value = 0

  return { count, increment, decrement, reset }
}
useState vs ref - Critical Distinction
typescript
// CORRECT: Shared state (singleton pattern)
export const useAuth = () => {
  const user = useState('auth-user', () => null)  // Shared!
  return { user }
}

// WRONG: Creates new instance every call!
export const useAuth = () => {
  const user = ref(null)  // Not shared!
  return { user }
}

Rule: Use useState for shared/global state. Use ref for local component state only.

Complete Authentication Composable
typescript
// composables/useAuth.ts
export const useAuth = () => {
  const user = useState<User | null>('auth-user', () => null)
  const isAuthenticated = computed(() => !!user.value)
  const isLoading = useState('auth-loading', () => false)

  const login = async (email: string, password: string) => {
    isLoading.value = true
    try {
      const data = await $fetch('/api/auth/login', {
        method: 'POST',
        body: { email, password }
      })
      user.value = data.user
      return { success: true }
    } catch (error) {
      return { success: false, error: error.message }
    } finally {
      isLoading.value = false
    }
  }

  const logout = async () => {
    await $fetch('/api/auth/logout', { method: 'POST' })
    user.value = null
    navigateTo('/login')
  }

  const checkSession = async () => {
    if (import.meta.server) return  // Skip on server
    try {
      const data = await $fetch('/api/auth/session')
      user.value = data.user
    } catch {
      user.value = null
    }
  }

  return { user, isAuthenticated, isLoading, login, logout, checkSession }
}
SSR-Safe Browser APIs
typescript
// composables/useLocalStorage.ts
export const useLocalStorage = <T>(key: string, defaultValue: T) => {
  const data = useState<T>(key, () => defaultValue)

  // Only access localStorage on client
  if (import.meta.client) {
    const stored = localStorage.getItem(key)
    if (stored) {
      data.value = JSON.parse(stored)
    }

    // Watch and persist changes
    watch(data, (newValue) => {
      localStorage.setItem(key, JSON.stringify(newValue))
    }, { deep: true })
  }

  return data
}

Data Fetching

useFetch - Basic Usage
typescript
// Simple GET request
const { data, error, pending, refresh } = await useFetch('/api/users')

// With options
const { data: users } = await useFetch('/api/users', {
  method: 'GET',
  query: { limit: 10, offset: 0 },
  headers: { 'X-Custom-Header': 'value' }
})
Reactive Parameters
vue
<script setup lang="ts">
const page = ref(1)
const search = ref('')

// Auto-refetches when page or search changes
const { data: users, pending } = await useFetch('/api/users', {
  query: {
    page,
    search,
    limit: 10
  }
})

// Or with computed
const query = computed(() => ({
  page: page.value,
  search: search.value,
  limit: 10
}))

const { data } = await useFetch('/api/users', { query })
</script>
Transform Data
typescript
const { data: userNames } = await useFetch('/api/users', {
  transform: (users) => users.map(u => u.name)
})

// data.value is now string[] instead of User[]
Pick Specific Fields
typescript
const { data } = await useFetch('/api/user', {
  pick: ['id', 'name', 'email']  // Only these fields in payload
})
useAsyncData - Custom Logic
typescript
// Multiple parallel requests
const { data } = await useAsyncData('dashboard', async () => {
  const [users, posts, stats] = await Promise.all([
    $fetch('/api/users'),
    $fetch('/api/posts'),
    $fetch('/api/stats')
  ])
  return { users, posts, stats }
})

// Access: data.value.users, data.value.posts, data.value.stats
Show full SKILL.md (145 more words)Show less
Error Handling
typescript
const { data, error, status } = await useFetch('/api/users')

// Check error
if (error.value) {
  console.error('Error:', error.value.message)
  console.error('Status:', error.value.statusCode)
}

// Status values: 'idle' | 'pending' | 'success' | 'error'
if (status.value === 'error') {
  showError(error.value)
}
Manual Refresh
typescript
const { data, refresh, execute } = await useFetch('/api/users', {
  immediate: false  // Don't fetch on mount
})

// Fetch manually
await execute()

// Refresh (re-fetch)
await refresh()

// Refresh with new params
await refresh({ dedupe: true })
Shallow vs Deep Reactivity (v4 Change)
typescript
// Nuxt 4 default: Shallow reactivity
const { data } = await useFetch('/api/user')
data.value.name = 'New Name'  // Won't trigger reactivity!

// Enable deep reactivity for mutations
const { data } = await useFetch('/api/user', {
  deep: true
})
data.value.name = 'New Name'  // Now works!

// Or refresh instead of mutating
const { data, refresh } = await useFetch('/api/user')
await $fetch('/api/user', { method: 'PATCH', body: { name: 'New Name' } })
await refresh()  // Re-fetch updated data
Caching and Deduplication
typescript
const { data } = await useFetch('/api/users', {
  key: 'users-list',           // Custom cache key
  dedupe: 'cancel',            // Cancel duplicate requests
  getCachedData: (key, nuxtApp) => {
    // Return cached data if valid
    return nuxtApp.payload.data[key]
  }
})
Lazy Loading Data
typescript
// useLazyFetch - Navigation happens immediately, data loads in background
const { data, pending } = useLazyFetch('/api/users')

// useLazyAsyncData
const { data, pending } = useLazyAsyncData('users', () => $fetch('/api/users'))
$fetch - Client-Side Only
typescript
// In event handlers (not during SSR)
const submitForm = async () => {
  const result = await $fetch('/api/submit', {
    method: 'POST',
    body: formData.value
  })
}

// In server routes
export default defineEventHandler(async (event) => {
  const externalData = await $fetch('https://api.example.com/data')
  return externalData
})

State Management

useState Patterns
typescript
// Simple counter
const count = useState('count', () => 0)

// Complex object
const settings = useState('settings', () => ({
  theme: 'light',
  notifications: true,
  language: 'en'
}))

// Typed state
interface User {
  id: string
  name: string
  email: string
}
const user = useState<User | null>('user', () => null)
Shared Cart Example
typescript
// composables/useCart.ts
interface CartItem {
  id: string
  name: string
  price: number
  quantity: number
}

export const useCart = () => {
  const items = useState<CartItem[]>('cart-items', () => [])

  const total = computed(() =>
    items.value.reduce((sum, item) => sum + item.price * item.quantity, 0)
  )

  const itemCount = computed(() =>
    items.value.reduce((sum, item) => sum + item.quantity, 0)
  )

  const addItem = (product: Omit<CartItem, 'quantity'>) => {
    const existing = items.value.find(i => i.id === product.id)
    if (existing) {
      existing.quantity++
    } else {
      items.value.push({ ...product, quantity: 1 })
    }
  }

  const removeItem = (id: string) => {
    items.value = items.value.filter(i => i.id !== id)
  }

  const updateQuantity = (id: string, quantity: number) => {
    const item = items.value.find(i => i.id === id)
    if (item) {
      item.quantity = Math.max(0, quantity)
      if (item.quantity === 0) removeItem(id)
    }
  }

  const clearCart = () => {
    items.value = []
  }

  return { items, total, itemCount, addItem, removeItem, updateQuantity, clearCart }
}
Pinia Integration
bash
bun add pinia @pinia/nuxt
typescript
// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@pinia/nuxt']
})

// stores/auth.ts
import { defineStore } from 'pinia'

export const useAuthStore = defineStore('auth', {
  state: () => ({
    user: null as User | null,
    token: null as string | null
  }),

  getters: {
    isAuthenticated: (state) => !!state.user,
    userName: (state) => state.user?.name ?? 'Guest'
  },

  actions: {
    async login(email: string, password: string) {
      const { user, token } = await $fetch('/api/auth/login', {
        method: 'POST',
        body: { email, password }
      })
      this.user = user
      this.token = token
    },

    logout() {
      this.user = null
      this.token = null
    }
  }
})

// Usage in components
const authStore = useAuthStore()
await authStore.login('user@example.com', 'password')
console.log(authStore.userName)

Common Anti-Patterns

Using ref Instead of useState
typescript
// WRONG - Creates new instance every time!
export const useAuth = () => {
  const user = ref(null)  // Not shared
  return { user }
}

// CORRECT
export const useAuth = () => {
  const user = useState('auth-user', () => null)
  return { user }
}
Missing Error Handling
typescript
// WRONG
const { data } = await useFetch('/api/users')
console.log(data.value.length)  // Crashes if error!

// CORRECT
const { data, error } = await useFetch('/api/users')
if (error.value) {
  showToast({ type: 'error', message: error.value.message })
  return
}
console.log(data.value.length)
Non-Deterministic Transform
typescript
// WRONG - Causes hydration mismatch!
const { data } = await useFetch('/api/users', {
  transform: (users) => users.sort(() => Math.random() - 0.5)
})

// CORRECT
const { data } = await useFetch('/api/users', {
  transform: (users) => users.sort((a, b) => a.name.localeCompare(b.name))
})
Mutating Shallow Refs
typescript
// WRONG - v4 uses shallow refs by default
const { data } = await useFetch('/api/user')
data.value.name = 'New Name'  // Won't trigger reactivity!

// CORRECT - Option 1: Enable deep
const { data } = await useFetch('/api/user', { deep: true })
data.value.name = 'New Name'

// CORRECT - Option 2: Replace entire value
data.value = { ...data.value, name: 'New Name' }

// CORRECT - Option 3: Refresh after mutation
await $fetch('/api/user', { method: 'PATCH', body: { name: 'New Name' } })
await refresh()

Troubleshooting

Data Not Refreshing When Params Change:

  • Ensure params are reactive: { query: { page } } where page = ref(1)
  • Check you're using the ref itself, not .value

Hydration Mismatch with useState:

  • Ensure key is unique: useState('unique-key', () => value)
  • Avoid Math.random() or Date.now() in initial values

State Lost on Navigation:

  • Use useState instead of ref for persistent state
  • Check you're using the same key across components

Infinite Refetch Loop:

  • Check for reactive dependencies in transform function
  • Use watch with { immediate: false } for side effects
  • nuxt-core: Project setup, routing, configuration
  • nuxt-server: Server routes, API patterns
  • nuxt-production: Performance, testing, deployment

Version: 4.0.0 | Last Updated: 2025-12-28 | License: MIT

© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in plugins/nuxt-v4/skills/nuxt-data of secondsky/claude-skills.

  • SKILL.md
  • references/composables.md
  • references/data-fetching.md
  • templates/composables/useAuth.ts

Open the folder on GitHubat commit 8837836

Compare with similar skills

Nuxt Data next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Nuxt Data compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Nuxt Data this skillsecondsky/claude-skills227—~3.4kAutomated safety check: PassMIT
PiniaJetBrains/skills3639 repos~682Automated safety check: PassNone
Feature Sliced Designfeature-sliced/skills109—~5.5kAutomated safety check: PassNone
Vue ExpertJeffallan/claude-skills12k—~1.1kAutomated safety check: PassMIT
Vue Patternsaffaan-m/ECC274k1 repos~3.3kAutomated safety check: PassMIT
Vue Masterycigery-useio/useio-skills103—~1.8kAutomated safety check: PassMIT

Similar skills

  • Pinia

    JetBrains/skills

    Official

    Pinia official Vue state management library, type-safe and extensible.

    363 GitHub starsUsed in 9 repos~682 tokens
    Frontend & DesignAuto-check passed
  • Feature Sliced Design

    feature-sliced/skills

    Official Feature-Sliced Design (FSD) v2.1 skill for applying the methodology to frontend projects.

    109 GitHub stars~5.5k tokensUpdated 21 days ago
    Frontend & DesignAuto-check passed
  • Vue Expert

    Jeffallan/claude-skills

    Builds Vue 3 apps with the Composition API and script setup, Pinia state, Nuxt 3, Vite tuning and Quasar or Capacitor mobile builds, checked with vue-tsc and Vitest.

    12k GitHub stars~1.1k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Vue Patterns

    affaan-m/ECC

    Vue.js 3 Composition API patterns, component architecture, reactivity best practices, Pinia state management, Vue Router navigation, and Nuxt SSR patterns.

    274k GitHub starsUsed in 1 repo~3.3k tokens
    Frontend & DesignAuto-check passed
  • Vue Mastery

    cigery-useio/useio-skills

    Vue 3 expert skill for writing production-grade code. An agent skill from cigery-useio/useio-skills.

    103 GitHub stars~1.8k tokensUpdated 14 days ago
    Frontend & DesignAuto-check passed
  • Next Generate Skill

    jiushiwon/wg-skills

    当用户要创建 Next.js 14+(React 生态的全栈框架,非 Vue 的 Nuxt)App Router + TypeScript + Zustand 全栈项目时使用。引导完成需求澄清、项目初始化、SSR/RSC 配置、请求层集成、API Routes、认证中间件、后置验证。严格对齐 frontend-request-skill 请求层规范。触发词:"帮我做一个 Next.js…

    110 GitHub stars~3.2k tokensUpdated 3 days ago
    Frontend & DesignAuto-check: notes

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Works with

Questions about Nuxt Data

What does Nuxt Data do?

| Nuxt 4 data management: composables, data fetching with useFetch/useAsyncData, and state management with useState and Pinia. Nuxt Data is an agent skill from secondsky/claude-skills. | Nuxt 4 data management: composables, data fetching with useFetch/useAsyncData, and state management with useState and Pinia.

When should I use Nuxt Data?

Nuxt Data fits situations like: : creating custom composables; fetching data with useFetch; managing global state with useState; integrating Pinia.

How do I install Nuxt Data in Claude Code?

Run `npx skills add secondsky/claude-skills --skill nuxt-data -a claude-code`. Or copy the skill folder (plugins/nuxt-v4/skills/nuxt-data in secondsky/claude-skills) into .claude/skills/nuxt-data in your project. Claude Code loads it when a task matches its description.

How do I install Nuxt Data in Codex?

Run `npx skills add secondsky/claude-skills --skill nuxt-data -a codex`. Or copy the skill folder (plugins/nuxt-v4/skills/nuxt-data in secondsky/claude-skills) into .agents/skills/nuxt-data in your project. Codex loads it when a task matches its description.

Can I use Nuxt Data in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add secondsky/claude-skills --skill nuxt-data -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/nuxt-data, .gemini/skills/nuxt-data, .github/skills/nuxt-data and .opencode/skills/nuxt-data in your project.

What does Nuxt Data need to run?

Going by SKILL.md and its folder, Nuxt Data needs TypeScript for the scripts in its folder and the command-line tools its instructions call (bun). Our summary lists: Node.js.

Does Nuxt Data access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Nuxt Data safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Nuxt Data use?

Nuxt Data is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Nuxt Data use?

About 3.4k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 8.2k tokens, read only when the agent opens those files.

What are the alternatives to Nuxt Data?

Skills that share tags, products or a category with Nuxt Data: Pinia (JetBrains/skills, 363 stars), Feature Sliced Design (feature-sliced/skills, 109 stars), Vue Expert (Jeffallan/claude-skills, 12k stars) and Vue Patterns (affaan-m/ECC, 274k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Nuxt Data?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.