nuxt-skills
Installation
SKILL.md
Nuxt Skills
Project layout
- Source directory: Prefer
srcDir: 'app'soapp/holds pages, components, composables, layouts, middleware. Reference as~/(e.g.~/components/,~/composables/). - Pages:
app/pages/*.vue— file-based routing. UsedefinePageMeta({ middleware: 'auth' })for route-level middleware. - Layouts:
app/layouts/default.vue(or named). Use<NuxtLayout>orapp.vueto wrap content. - Components:
app/components/— auto-imported; use PascalCase names in templates.
Composables
- Location:
app/composables/*.ts— auto-imported. Export functions nameduseXxx. - Pattern: Accept
Ref<T> | Tfor flexibility; normalize withtypeof x === 'string' ? ref(x) : xwhen needed. - Data fetching: Prefer
useAsyncDatawith a unique key (e.g.time-blocks-${uid}-${day}), async fetcher, andwatchfor reactive params. Return{ data, refresh, pending }.
Data and server
- useAsyncData: Use for client-side fetches that depend on reactive state. Key must be unique per logical query; include reactive identifiers in the key.
- useFetch: Use when the URL/params are the only input; for Supabase or custom clients,
useAsyncData+ client call is usually clearer. - Lazy: Prefer non-lazy by default for above-the-fold data; use
lazy: truewhen appropriate for secondary content.
Auth and routing
- Supabase user:
useSupabaseUser()in middleware or setup. Redirect withnavigateTo('/login')when unauthenticated. - Middleware:
app/middleware/*.ts— export defaultdefineNuxtRouteMiddleware((to, from) => { ... }). Name file for usage (e.g.auth.ts→middleware: 'auth').
Config (nuxt.config.ts)
- defineNuxtConfig: Set
compatibilityDate,srcDir,modules, and module options (e.g.supabase,pwa,app.head). - Aliases:
~and@typically point tosrcDir; use~/for app code.
Conventions
- Use
<script setup lang="ts">in Vue SFCs. - Prefer composables for shared state and side effects; keep pages thin and delegate to components and composables.
- Use
ref/computed/watchfrom Vue; no need to import when using auto-imports (Nuxt provides them).
Weekly Installs
2
Repository
yulei-chen/ssawFirst Seen
Feb 2, 2026
Security Audits
Installed on
cursor2
mcpjam1
claude-code1
junie1
windsurf1
zencoder1