nuxt
antfu/skills
使用 Nuxt 4 构建全栈 Vue 应用程序,内容涵盖服务器端渲染(SSR)、基于文件的路由、自动导入、服务器端路由以及部署。
...展开全部Nuxt 是一个全栈 Vue 框架,提供服务器端渲染、基于文件的路由、自动导入以及强大的模块系统。它采用 Nitro 作为服务器引擎,支持在 Node.js、无服务器和边缘平台上的通用部署。
本技能基于 Nuxt 4.x 版本,生成于 2026-06-22。
Nuxt 4 注:默认
srcDir是app/— Vue 应用代码(app.vue,components/,composables/,pages/、等)位于app/,而server/,shared/,public/,modules/,layers/和nuxt.config.ts则保留在项目根目录下。这些~/@别名现在指向app/;请使用~~/@@作为根目录。
核心
| 主题 | 描述 | 参考 |
|---|---|---|
| 目录结构 | Nuxt 4 app/ srcDir、 shared/, 别名, 约定 |
核心目录结构 |
| 配置 | nuxt.config.ts、app.config.ts、别名、兼容性版本、实验性功能 | 核心配置 |
| CLI 命令 | 开发服务器、构建、生成、预览及实用程序命令 | core-cli |
| 路由 | 基于文件的路由、动态路由、命名视图、布局属性、中间件 | core-routing |
| 数据获取 | useFetch、useAsyncData、$fetch、createUseFetch 工厂、缓存 | core-data-fetching |
| 模块 | 创建和使用Nuxt模块、NuxtKit实用程序 | 核心模块 |
| 部署 | 使用Nitro、Vercel、Netlify和Cloudflare实现跨平台部署 | 核心部署 |
功能
| 主题 | 描述 | 参考 |
|---|---|---|
| 可组合函数的自动导入 | Vue/Nuxt可组合函数、自定义可组合函数、 shared/, useAnnouncer |
features-composables |
| 组件自动导入 | 组件命名、延迟加载、水化策略 | 功能-组件-自动导入 |
| 内置组件 | NuxtLink、NuxtPage、NuxtLayout、NuxtAnnouncer、ClientOnly 等 | features-components |
| 状态管理 | useState 可组合函数、支持服务器端渲染(SSR)的状态、Pinia 集成 | 功能-状态 |
| 服务器路由 | API 路由、服务器中间件、Nitro 服务器引擎 | 服务器功能 |
渲染
| 主题 | 描述 | 参考 |
|---|---|---|
| 渲染模式 | 通用(SSR)、客户端(SPA)、混合渲染、路由规则 | 渲染模式 |
最佳实践
| 主题 | 描述 | 参考 |
|---|---|---|
| 数据获取模式 | 高效数据获取、缓存、并行请求、错误处理 | 数据获取最佳实践 |
| 服务器端渲染(SSR)与数据初始化 | 避免上下文泄漏、数据加载不匹配、可组合模式 | SSR最佳实践 |
高级
| 主题 | 描述 | 参考 |
|---|---|---|
| 层 | 使用可重用层扩展应用程序 | 高级-层 |
| 生命周期钩子 | 构建时、运行时和服务器钩子 | advanced-hooks |
| 模块编写 | 使用Nuxt Kit创建可发布模块、键值组合式组件及依赖关系 | 高级模块开发 |
---
name: nuxt
description: Build full-stack Vue applications with Nuxt 4, covering SSR, file-based routing, auto-imports, server routes, and deployment.
---
Nuxt is a full-stack Vue framework that provides server-side rendering, file-based routing, auto-imports, and a powerful module system. It uses Nitro as its server engine for universal deployment across Node.js, serverless, and edge platforms.
> The skill is based on Nuxt 4.x, generated at 2026-06-22.
> **Nuxt 4 note:** the default `srcDir` is `app/` — Vue app code (`app.vue`, `components/`, `composables/`, `pages/`, etc.) lives under `app/`, while `server/`, `shared/`, `public/`, `modules/`, `layers/` and `nuxt.config.ts` stay at the project root. The `~`/`@` aliases now point at `app/`; use `~~`/`@@` for the root.
## Core
| Topic | Description | Reference |
|-------|-------------|-----------|
| Directory Structure | Nuxt 4 `app/` srcDir, `shared/`, aliases, conventions | [core-directory-structure](references/core-directory-structure.md) |
| Configuration | nuxt.config.ts, app.config.ts, aliases, compatibilityVersion, experimental | [core-config](references/core-config.md) |
| CLI Commands | Dev server, build, generate, preview, and utility commands | [core-cli](references/core-cli.md) |
| Routing | File-based routing, dynamic routes, named views, layout props, middleware | [core-routing](references/core-routing.md) |
| Data Fetching | useFetch, useAsyncData, $fetch, createUseFetch factories, caching | [core-data-fetching](references/core-data-fetching.md) |
| Modules | Creating and using Nuxt modules, Nuxt Kit utilities | [core-modules](references/core-modules.md) |
| Deployment | Platform-agnostic deployment with Nitro, Vercel, Netlify, Cloudflare | [core-deployment](references/core-deployment.md) |
## Features
| Topic | Description | Reference |
|-------|-------------|-----------|
| Composables Auto-imports | Vue/Nuxt composables, custom composables, `shared/`, useAnnouncer | [features-composables](references/features-composables.md) |
| Components Auto-imports | Component naming, lazy loading, hydration strategies | [features-components-autoimport](references/features-components-autoimport.md) |
| Built-in Components | NuxtLink, NuxtPage, NuxtLayout, NuxtAnnouncer, ClientOnly, and more | [features-components](references/features-components.md) |
| State Management | useState composable, SSR-friendly state, Pinia integration | [features-state](references/features-state.md) |
| Server Routes | API routes, server middleware, Nitro server engine | [features-server](references/features-server.md) |
## Rendering
| Topic | Description | Reference |
|-------|-------------|-----------|
| Rendering Modes | Universal (SSR), client-side (SPA), hybrid rendering, route rules | [rendering-modes](references/rendering-modes.md) |
## Best Practices
| Topic | Description | Reference |
|-------|-------------|-----------|
| Data Fetching Patterns | Efficient fetching, caching, parallel requests, error handling | [best-practices-data-fetching](references/best-practices-data-fetching.md) |
| SSR & Hydration | Avoiding context leaks, hydration mismatches, composable patterns | [best-practices-ssr](references/best-practices-ssr.md) |
## Advanced
| Topic | Description | Reference |
|-------|-------------|-----------|
| Layers | Extending applications with reusable layers | [advanced-layers](references/advanced-layers.md) |
| Lifecycle Hooks | Build-time, runtime, and server hooks | [advanced-hooks](references/advanced-hooks.md) |
| Module Authoring | Publishable modules with Nuxt Kit, keyed composables, dependencies | [advanced-module-authoring](references/advanced-module-authoring.md) |
所有文件
0 个文件安装 nuxt
下载技能文件并将其解压到 .claude/skills/ 目录中。
下载ZIP克隆仓库并复制技能文件到您的项目中。
git clone https://github.com/antfu/skills/tree/main/skills/nuxt # Copy SKILL.md to your .claude/skills/ directory
复制





首页
