Skip to content
Skills Library
Programming · Building & coding

nuxt3

/nuxt3

Nuxt 3 full-stack Vue framework. Covers file-based routing, data fetching, server routes, and auto-imports. Use when building Nuxt applications. USE WHEN: user mentions "Nuxt", "Nuxt 3", asks about "useFetch", "Nuxt server routes", "Nitro", "Nuxt auto-imports", "Nuxt composables", "Nuxt middleware", "SSR with Vue" DO NOT USE FOR: Vue without Nuxt - use `frontend-vue` instead; Next.js - use `nextjs-app-router` instead; Nuxt 2 - consult KB for migration; Astro - use `astro` instead

Licence
MIT
Last repository change
21.10.2026

Assessment and security

95/ 100Class: good
Format20 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
1
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.

What it does and when to use it

Nuxt 3 full-stack Vue framework. Covers file-based routing, data fetching, server routes, and auto-imports. Use when building Nuxt applications. USE WHEN: user mentions "Nuxt", "Nuxt 3", asks about "useFetch", "Nuxt server routes", "Nitro", "Nuxt auto-imports", "Nuxt composables", "Nuxt middleware", "SSR with Vue" DO NOT USE FOR: Vue without Nuxt - use `frontend-vue` instead; Next.js - use `nextjs-app-router` instead; Nuxt 2 - consult KB for migration; Astro - use `astro` instead

Triggers from the description

NuxtNuxt 3useFetchNuxt server routesNitroNuxt auto-importsNuxt composablesNuxt middleware
Original author description

Nuxt 3 full-stack Vue framework. Covers file-based routing, data fetching, server routes, and auto-imports. Use when building Nuxt applications. USE WHEN: user mentions "Nuxt", "Nuxt 3", asks about "useFetch", "Nuxt server routes", "Nitro", "Nuxt auto-imports", "Nuxt composables", "Nuxt middleware", "SSR with Vue" DO NOT USE FOR: Vue without Nuxt - use `frontend-vue` instead; Next.js - use `nextjs-app-router` instead; Nuxt 2 - consult KB for migration; Astro - use `astro` instead

How it works

  1. Directory Structure
  2. Page Component
  3. Data Fetching
  4. Server Routes
  5. Key Features
  6. When NOT to Use This Skill
  7. Anti-Patterns
  8. Quick Troubleshooting
  9. Production Readiness
  10. Reference Documentation
Original SKILL.md headings · 215 lines, 839 words
SKILL.md preview
---
name: nuxt3
description: |
  Nuxt 3 full-stack Vue framework. Covers file-based routing, data
  fetching, server routes, and auto-imports. Use when building Nuxt
  applications.

  USE WHEN: user mentions "Nuxt", "Nuxt 3", asks about "useFetch", "Nuxt server routes", "Nitro", "Nuxt auto-imports", "Nuxt composables", "Nuxt middleware", "SSR with Vue"

  DO NOT USE FOR: Vue without Nuxt - use `frontend-vue` instead; Next.js - use `nextjs-app-router` instead; Nuxt 2 - consult KB for migration; Astro - use `astro` instead
allowed-tools: Read, Grep, Glob, Write, Edit
---
# Nuxt 3 Core Knowledge

> **Full Reference**: See [advanced.md](advanced.md) for WebSocket composable, Nitro WebSocket handlers, Socket.IO integration, plugin pattern, SSE, and room management patterns.

> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `nuxt` for comprehensive documentation.

## Directory Structure

| Directory | Purpose |
|-----------|---------|
| `pages/` | File-based routing |
| `components/` | Auto-imported components |
| `composables/` | Auto-imported composables |
| `server/` | Server routes & middleware |
| `layouts/` | Page layouts |
| `middleware/` | Route middleware |

## Page Component

```vue
<script setup lang="ts">
// Auto-imports work: ref, computed, useFetch, etc.
const { data, pending } = await useFetch('/api/users')

definePageMeta({
  layout: 'admin',
  middleware: 'auth'
})
</script>

<template>
  <div v-if="pending">Loading...</div>
  <div v-else>{{ data }}</div>
</template>
```

## Data Fetching

| Composable | Purpose |
|------------|---------|
| `useFetch` | SSR-friendly fetch with caching |
| `useAsyncData` | Custom async logic |
| `$fetch` | Direct fetch (no SSR handling) |
| `useLazyFetch` | Non-blocking fetch |

## Server Routes

```ts
// server/api/users.get.ts
export default defineEventHandler(async (event) => {
  const query = getQuery(event)
  return await db.users.findMany()
})

// server/api/users.post.ts
export default defineEventHandler(async (event) => {
  const body = await readBody(event)
  return await db.users.create(body)
})
```

## Key Features

- Auto-imports (components, composables, utils)
- Hybrid rendering (SSR, SSG, ISR, SPA)
- Nitro server engine
- Built-in state with `useState`

## When NOT to Use This Skill

This skill is for Nuxt 3 (Vue meta-framework). DO NOT use for:

- **Vue without Nuxt**: Use `frontend-vue` skill instead
- **Nuxt 2**: Consult KB for migration to Nuxt 3
- **Next.js (React meta-framework)**: Use `nextjs-app-router` skill instead
- **Remix (React meta-framework)**: Use `remix` skill instead
- **SvelteKit**: Use `sveltekit` skill instead
- **Astro**: Use `astro` skill instead
- **Vite-only setup**: Use `frontend-vue` with Vite configuration

## Anti-Patterns

| Anti-Pattern | Why It's Wrong | Correct Approach |
|--------------|----------------|------------------|
| Using $fetch instead of useFetch | No SSR handling, data not cached | Use useFetch for SSR-friendly fetching |
| Fetching in onMounted | Client-side only, no SSR | Fetch in setup with useFetch/useAsyncData |
| Not using auto-imports | Unnecessary boilerplate | Rely on auto-imports for components/composables |
| Secrets in public runtimeConfig | Exposed to client, security risk | Use server-only runtimeConfig (not public) |
| Ignoring route rules | Missed performance opportunities | Set prerender, swr, or ssr rules per route |
| No error.vue | Poor error UX | Create error.vue for global error handling |

## Quick Troubleshooting

| Issue | Possible Cause | Solution |
|-------|----------------|----------|
| "useFetch is not defined" | Auto-imports not working | Check .nuxt/tsconfig.json is generated, restart dev server |
| Data not available on SSR | Using $fetch instead of useFetch | Replace $fetch with useFetch |
| "useState is not defined" | Auto-import issue | Use useState composable (Nuxt 3), ensure .nuxt is built |
| API route 404 in production | Route not generated | Check server/api/ structure, rebuild |
| Hydration mismatch | Server/client render differently | Use <ClientOnly>, ensure consistent state |
| Components not auto-imported | Not in components/ directory | Move to components/ or configure in nuxt.config |

## Production Readiness

### Security Configuration

```typescript
// nuxt.config.ts
export default defineNuxtConfig({
  runtimeConfig: {
    // Server-only (not exposed to client)
    dbPassword: process.env.DB_PASSWORD,

    // Exposed to client via useRuntimeConfig()
    public: {
      apiBase: process.env.API_BASE,
    },
  },
});
```

### Error Handling

```vue
<!-- error.vue -->
<script setup lang="ts">
import type { NuxtError } from '#app';

const props = defineProps<{ error: NuxtError }>();
const handleError = () => clearError({ redirect: '/' });
</script>

<template>
  <div class="error-page">
    <h1>{{ error.statusCode }}</h1>
    <p>{{ error.message }}</p>
    <button @click="handleError">Go Home</button>
  </div>
</template>
```

### Performance

```typescript
// nuxt.config.ts
export default defineNuxtConfig({
  routeRules: {
    '/': { prerender: true },
    '/blog/**': { swr: 3600 }, // Stale-while-revalidate
    '/admin/**': { ssr: false }, // Client-only
  },
});
```

### API Security

```typescript
// server/api/users.post.ts
export default defineEventHandler(async (event) => {
  // Validate input
  const body = await readValidatedBody(event, (body) => {
    return z.object({
      email: z.string().email(),
      name: z.string().min(2),
    }).parse(body);
  });

  // Auth check
  const session = await requireAuth(event);

  return await createUser(body);
});
```

### Testing

```typescript
import { mountSuspended } from '@nuxt/test-utils/runtime';
import IndexPage from '~/pages/index.vue';

describe('Index Page', () => {
  it('renders correctly', async () => {
    const component = await mountSuspended(IndexPage);
    expect(component.text()).toContain('Welcome');
  });
});
```

### Monitoring Metrics

| Metric | Target |
|--------|--------|
| Time to First Byte | < 200ms |
| First Contentful Paint | < 1.5s |
| Hydration time | < 500ms |
| API response time | < 100ms |

### Checklist

- [ ] Security headers configured
- [ ] Runtime config for secrets
- [ ] Error handling (error.vue, plugins)
- [ ] Route rules (prerender, swr, ssr)
- [ ] Image optimization
- [ ] Lazy loaded components
- [ ] API validation (Zod)
- [ ] Rate limiting on API routes
- [ ] Auth middleware for protected routes
- [ ] E2E tests with @nuxt/test-utils

## Reference Documentation

- [Directory Structure](quick-ref/directory-structure.md)
- [Data Fetching Patterns](quick-ref/data-fetching.md)
Files in this package (4)
  • SKILL.md 7 KB
  • advanced.md 6 KB
  • quick-ref/data-fetching.md 3 KB
  • quick-ref/directory-structure.md 3 KB

Versions

The database has no other skills named nuxt3.

Database snapshot: 13.11.2026 · package version 0fba57bf30ae (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 85nuxt
    Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.
  • 85nuxt
    Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.
  • 85nuxt
    Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.
  • 85nuxt
    Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.
  • 90vue-nuxt
    Use this skill when the user says 'Nuxt', 'Nuxt 3', 'Nuxt structure', 'Nuxt composables', 'Nuxt server routes', 'useFetch', 'useAsyncData', 'Nuxt layers', 'Nuxt architecture', or when building a Nuxt 3 application. This skill enforces: directory-based routing in pages/, useFetch…
  • 85nuxt
    Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.