Index of every page on this site: llms.txt
All skills
onmax avatar

/nuxt-content

@2e74504 official
by Maxonmax/nuxt-skills722 stars
38
Run it yourself

Build typed, content-driven Nuxt applications with @nuxt/content. Use when working with content.config.ts, collections, queryCollection, Markdown or MDC rendering, content databases, hooks, custom sources, search, or Content v2 migrations.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/nuxt-content

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescollections.md

≈983 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Collections

Use collections as the schema and routing boundary for content. Once content.config.ts exists, Nuxt Content imports only files matched by a collection source.

Choose the collection type

  • page adds path, title, description, seo, body, and navigation; use it when one content file maps to one route.
  • data adds the common file fields but leaves the domain schema to you; use it for authors, products, configuration, and other structured records.
  • Every collection includes id, stem, extension, and meta.

Keep each source file in one collection. Overlapping collection globs can break live reload, so use exclude to make ownership explicit.

Validators and editor metadata

Import validators from their packages. The z re-export from @nuxt/content is deprecated.

import { defineCollection, defineContentConfig, property } from '@nuxt/content'
import { z } from 'zod/v4'

export default defineContentConfig({
  collections: {
    products: defineCollection({
      type: 'data',
      source: 'products/*.json',
      schema: z.object({
        sku: z.string(),
        category: z.string(),
        price: z.number(),
        image: property(z.string()).editor({ input: 'media' }),
      }),
      indexes: [
        { columns: ['category', 'price'] },
        { columns: ['sku'], unique: true },
      ],
    }),
  },
})

Nuxt Content supports Zod 3, Zod 4, and Valibot through JSON Schema conversion. Use property(schema).editor(...) for Studio input metadata and property(schema).inherit(...) when a schema should follow a Vue component's props. Keep indexes beside the collection they optimize; columns, unique, and name are collection index options.

Source shapes

// Local content directory
source: 'docs/**'

// Explicit include, exclusions, and route prefix
source: {
  include: 'fr/**',
  exclude: ['fr/drafts/**'],
  prefix: '/fr',
}

// Files outside content/
source: {
  cwd: resolve('packages/handbook'),
  include: '**/*.md',
}

// Remote Git repository
source: {
  repository: {
    url: 'https://github.com/org/docs',
    branch: 'main',
    auth: { token: process.env.DOCS_TOKEN },
  },
  include: 'content/**',
}

Remote repositories require include. Keep credentials in environment variables and use the narrowest repository token that can read the source.

For API-backed content, use defineCollectionSource with stable getKeys() results and a getItem(key) implementation. The returned items still pass through the collection schema, so keys and field types must be deterministic.

Navigation and locale sources

Navigation metadata lives in .navigation.yml. A source such as **/*.md excludes that file; use ** or an include pattern that covers Markdown and YAML when navigation is required.

const common = z.object({ locale: z.enum(['en', 'fr']) })

export default defineContentConfig({
  collections: {
    docs_en: defineCollection({
      type: 'page',
      source: { include: 'en/**', prefix: '/' },
      schema: common,
    }),
    docs_fr: defineCollection({
      type: 'page',
      source: { include: 'fr/**', prefix: '/fr' },
      schema: common,
    }),
  },
})

Pick the collection from the active locale, then query its generated path. For @nuxtjs/i18n route behavior, apply that module's guidance after the collection boundary is settled.

Checks

  • npx nuxi typecheck resolves every collection and custom field.
  • Each source glob includes the intended files and excludes competing collections.
  • Fields added by hooks or transformers exist in the collection schema.
  • Query indexes cover actual filter/sort patterns rather than every field.

Official references: define collections, sources, validators.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning1mo5 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides guidance for using the Nuxt Content module. It correctly emphasizes the use of environment variables for managing sensitive tokens and database credentials. However, the skill’s core functionality involves ingesting data from external sources such as Git repositories and APIs, which introduces a potential surface for indirect prompt injection if those sources are compromised.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: MEDIUM · 1 issue

  • Runlayer8mo

    6 files scanned · No issues

  • ZeroLeaks6mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 2e74504. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 4 months ago

README badge

README badge for onmax/nuxt-skills/nuxt-content

Provides guidance for Nuxt Content v3 collections, querying, and rendering—including typed schemas, SQL-backed queries with queryCollection, MDC components, database configuration, and NuxtStudio integration. Use this when building content-driven Nuxt apps with markdown or structured data sources.

Generated from the current SKILL.md.

Does this skill cover NuxtStudio integration?
Yes. The skill includes guidance on NuxtStudio integration, preview mode, and live editing via the studio.md reference file.
Can I use remote content sources like GitHub repos?
Yes. The skill covers defineCollectionSource and source.repository patterns for pulling content from external APIs and GitHub repositories.
Does this skill handle i18n for multi-language content?
Yes. The skill includes patterns for i18n multi-language content setup.
What databases are supported for content storage?
The skill covers configuration for SQLite, PostgreSQL, D1, and LibSQL.
Is this for general Nuxt development or specifically content-driven apps?
This skill is specifically for content-driven Nuxt apps. For general Nuxt basics, use the nuxt skill instead.

Generated from the current SKILL.md. These answers refresh after source changes.