agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/frameworks/nuxt/SKILL.md

nuxt

Skill15 starsChanged 42 days agoMITView on GitHub

Expert Nuxt 3 assistance covering Vue 3, auto-imports, file-based routing, Nitro server engine, and universal rendering. Use when developing SEO-optimized full-stack Vue applications.

17 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use nitro.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SentrySkill

    nitro

    Build and deploy universal JavaScript servers with Nitro v3. Use when working with nitro.config.ts, defineNitroConfig, defineHandler, defineConfig, server.ts entry, filesystem routing, route rules, useStorage, defineCachedHandler, useDatabase, definePlugin, runtime hooks, Vercel/Cloudflare deployment, or migrating from Nitro v2/nitropack.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use Nuxt server routes with universal useFetch:

    line 124
  2. Very specific:

    Use useFetch inside <script setup> for top-level component data fetching to eliminate SSR double-fetch.

    line 149
  3. Very specific:

    Use useSeoMeta() for reactive, type-safe SEO management.

    line 151
  4. Very specific:

    Use standard fetch() directly in setup scripts.

    line 156

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Nuxt

Nuxt is an intuitive full-stack framework for Vue.js, providing automatic routing, server-side rendering, static site generation, and optimized Nitro server engine performance.

When to Use

  • Full-Stack Vue 3 Web Applications: Nuxt 3/4 with universal SSR, static generation (SSG), and auto-imports.
  • Enterprise SEO & Fast Loading Pages: Marketing sites and e-commerce stores requiring dynamic meta tags and instant rendering.
  • Edge-Ready Server Engine (Nitro): Deploying serverless functions seamlessly across Cloudflare, Vercel, Netlify, and Node.
  • Modular Frontend Architecture: Utilizing first-party modules (@nuxtjs/tailwindcss, @pinia/nuxt, @vueuse/nuxt).

Quick Start

Nuxt auto-imports components and composables.

<script setup>
// useFetch is auto-imported
const { data: quote } = await useFetch("/api/quote");
</script>

<template>
  <blockquote>{{ quote.text }}</blockquote>
</template>

Core Concepts

Universal Data Fetching with useFetch & useAsyncData

SSR-friendly data fetching with automated deduplication:

<!-- pages/products/[id].vue -->
<script setup lang="ts">
interface Product {
  id: number;
  title: string;
  price: number;
}

const route = useRoute();
const productId = route.params.id;

const {
  data: product,
  pending,
  error,
} = await useFetch<Product>(`/api/products/${productId}`, {
  key: `product-${productId}`,
  lazy: false,
});

useSeoMeta({
  title: () =>
    product.value?.title ? `${product.value.title} - Store` : "Loading...",
  description: () => `Buy ${product.value?.title} online now.`,
});
</script>

<template>
  <div class="product-page">
    <div v-if="pending">Loading product details...</div>
    <div v-else-if="error">Error loading product: {{ error.message }}</div>
    <div v-else-if="product">
      <h1>{{ product.title }}</h1>
      <p class="price">${{ product.price }}</p>
    </div>
  </div>
</template>

Nitro Server Engine API Routes

Creating backend API endpoints directly inside server/api:

// server/api/products/[id].ts
export default defineEventHandler(async (event) => {
  const id = getRouterParam(event, "id");

  if (!id || isNaN(Number(id))) {
    throw createError({
      statusCode: 400,
      statusMessage: "Invalid product ID",
    });
  }

  return {
    id: Number(id),
    title: `Premium Mechanical Keyboard #${id}`,
    price: 149.99,
  };
});

Nuxt Middleware & Route Guards

Client and server route authentication verification:

// middleware/auth.ts
export default defineNuxtRouteMiddleware((to, from) => {
  const user = useCookie("auth_token");

  if (!user.value && to.path.startsWith("/dashboard")) {
    return navigateTo("/login");
  }
});

Common Patterns

Server API Route with useFetch Data Hydration

Problem: Client-side fetch triggers content flash and hurts search engine indexing.

Solution: Use Nuxt server routes with universal useFetch:

// server/api/products.ts
export default defineEventHandler(async (event) => {
  return await db.products.findMany({ take: 20 });
});

// pages/products.vue
<script setup>
const { data: products, pending, error } = await useFetch('/api/products');
</script>

<template>
  <div v-if="pending">Loading products...</div>
  <ul v-else>
    <li v-for="p in products" :key="p.id">{{ p.name }} - ${{ p.price }}</li>
  </ul>
</template>

Best Practices

Do:

  • Use useFetch inside <script setup> for top-level component data fetching to eliminate SSR double-fetch.
  • Leverage Nuxt Server API routes (server/api/) for backend proxying and secret key protection.
  • Use useSeoMeta() for reactive, type-safe SEO management.
  • Enable Nitro route rules (routeRules) for granular caching and ISR per page.

Don't:

  • Use standard fetch() directly in setup scripts; it executes on both server and client without hydration transfer.
  • Access window or document outside onMounted or without checking import.meta.client.
  • Mutate server-side state across user requests.

Troubleshooting

ErrorCauseSolution
window is not defined / document is not definedAccessing browser DOM during server-side prerender step.Wrap browser code in onMounted(() => { ... }) or <ClientOnly>.
[nuxt] [request error] [unhandled] 500Server route threw unhandled exception.Check terminal console output for server stack trace and wrap in try/catch.
Component not found on auto-importNested folder structure requires path prefix in component name.Follow naming convention: components/base/Button.vue -> <BaseButton />.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.