nuxt
БесплатноБез исполняемых скриптовНе проверенNuxt is the full-stack Vue framework with server-side rendering, auto-imports, file-based routing and a Nitro server for API routes. Use it when a user asks…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Nuxt
Overview
Nuxt is the Vue meta-framework: file-based routing, auto-imported components and composables, server rendering with hydration, and a Nitro server that serves server/api endpoints and deploys to Node, serverless and edge platforms. The current major version is Nuxt 4. Its source folder is app/ (pages, components, composables, layouts, app.vue), while server/, public/ and nuxt.config.ts stay in the project root. Nuxt 3 projects keep those folders at the root.
Instructions
Create a project
npm create nuxt@latest shop-blog
cd shop-blog && npm install && npm run dev
The dev server listens on http://localhost:3000. npm run build writes .output/; run it with node .output/server/index.mjs (set PORT and HOST to change the listener). npm run generate prerenders a fully static site.
Pages and data fetching
<script setup lang="ts">
const { data: posts } = await useFetch('/api/posts')
</script>
<template>
<div>
<h1>Blog</h1>
<article v-for="post in posts" :key="post.slug">
<NuxtLink :to="`/posts/${post.slug}`">
<h2>{{ post.title }}</h2>
<p>{{ post.excerpt }}</p>
</NuxtLink>
</article>
</div>
</template>
<script setup lang="ts">
const route = useRoute('posts-slug')
const { data: post, error } = await useFetch(() => `/api/posts/${route.params.slug}`)
if (error.value) {
throw createError({ statusCode: 404, statusMessage: 'Post not found', fatal: true })
}
useSeoMeta({
title: () => post.value?.title,
description: () => post.value?.excerpt,
ogTitle: () => post.value?.title,
})
</script>
<template>
<article v-if="post">
<h1>{{ post.title }}</h1>
<p>{{ post.content }}</p>
</article>
</template>
useFetch(url) is useAsyncData plus $fetch: it runs on the server, ships the result in the payload and does not refetch on hydration. Use useAsyncData(key, handler) for anything that is not a plain URL. Use $fetch (not useFetch) inside event handlers such as a button click. data is a shallow ref; use deep: true if you mutate nested fields. useRoute('posts-slug') with the route name gives typed params.
Server API routes
Files in server/api/ become endpoints; the suffix picks the method (index.get.ts, index.post.ts). Anything exported from server/utils/ is auto-imported in server code.
// server/utils/posts.ts
export interface Post { slug: string; title: string; excerpt: string; content: string }
const posts: Post[] = [
{ slug: 'hello-nuxt', title: 'Hello Nuxt', excerpt: 'First post', content: 'Nitro serves this.' },
{ slug: 'routing-rules', title: 'Route rules', excerpt: 'Hybrid rendering', content: 'ISR, SSR and SPA per route.' },
]
export const listPosts = () => posts
export const findPost = (slug: string) => posts.find((p) => p.slug === slug)
// server/api/posts/[slug].get.ts
export default defineEventHandler((event) => {
const slug = getRouterParam(event, 'slug')!
const post = findPost(slug)
if (!post) throw createError({ statusCode: 404, statusMessage: 'Post not found' })
return post
})
Validate request bodies instead of trusting readBody. readValidatedBody takes any function that throws on bad input, such as zod's parse; a failure answers 400.
Install the validator first with npm install zod.
// server/api/posts/index.post.ts
import { z } from 'zod'
const schema = z.object({ title: z.string().min(3), content: z.string().min(1) })
export default defineEventHandler(async (event) => {
const body = await readValidatedBody(event, schema.parse)
setResponseStatus(event, 201)
return { slug: body.title.toLowerCase().replace(/\s+/g, '-'), ...body }
})
Server middleware in server/middleware/ runs on every request. Secrets belong in runtimeConfig (override adminToken at runtime with the NUXT_ADMIN_TOKEN environment variable):
// server/middleware/auth.ts
export default defineEventHandler((event) => {
const path = getRequestURL(event).pathname
if (!path.startsWith('/api/admin')) return
if (getHeader(event, 'authorization') !== `Bearer ${useRuntimeConfig(event).adminToken}`) {
throw createError({ statusCode: 401, statusMessage: 'Unauthorized' })
}
})
The /api/admin/ping route the middleware protects:
// server/api/admin/ping.get.ts
export default defineEventHandler(() => ({ ok: true }))
Rendering modes per route
// nuxt.config.ts
export default defineNuxtConfig({
compatibilityDate: '2025-07-15',
runtimeConfig: { adminToken: '' },
routeRules: {
'/': { prerender: true },
'/posts/**': { isr: 3600 },
'/admin/**': { ssr: false },
},
})
prerender: true builds the page once at build time, isr: 3600 caches the rendered page on supported hosts (Vercel, Netlify) and revalidates hourly, ssr: false makes that section a client-rendered SPA.
Shared state and comp
Установить nuxt в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл nuxt?
Nuxt is the full-stack Vue framework with server-side rendering, auto-imports, file-based routing and a Nitro server for API routes. Use it when a user asks to build or fix a Nuxt app, set up per-route rendering (SSR, prerender, ISR, SPA), fetch data with useFetch or useAsyncData, write server/api endpoints, share state with useState, set page SEO meta, or deploy a Nuxt 3 or Nuxt 4 site.
Как установить скилл nuxt?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nuxt запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic