Skip to content

secondsky/claude-skills / plugins/nuxt-content/skills/nuxt-content

nuxt-content

Verified

Nuxt Content v3 Git-based CMS for Markdown/MDC content sites. Use for blogs, docs, content-driven apps with type-safe queries, schema validation (Zod/Valibot), full-text search, navigation utilities. Supports Nuxt Studio production editing, Cloudflare D1/Pages deployment, Vercel deployment, SQL storage, MDC components, content collections.

scripts/setup-nuxt-content.sh

View on GitHub
#!/bin/bash
# Nuxt Content Setup Script
# Initializes a new Nuxt Content v3 project

set -euo pipefail

# Script-global CONFIG_FILE: tracked by the cleanup trap so the sed .tmp
# tempfile never leaks even on early exit / failure. Populated below when
# we edit nuxt.config.ts and reset implicitly by process exit.
CONFIG_FILE=""

cleanup_sed_tmp() {
    if [ -n "${CONFIG_FILE:-}" ] && [ -f "${CONFIG_FILE}.tmp" ]; then
        rm -f "${CONFIG_FILE}.tmp"
    fi
}
trap cleanup_sed_tmp EXIT

echo "πŸš€ Nuxt Content v3 Setup"
echo "========================"
echo ""

# Check if we're in a Nuxt project
if [ ! -f "nuxt.config.ts" ] && [ ! -f "nuxt.config.js" ]; then
  echo "❌ Error: No nuxt.config file found. Are you in a Nuxt project?"
  echo "   Run 'npx nuxi init my-project' first."
  exit 1
fi

# Detect package manager
if [ -f "bun.lockb" ]; then
  PKG_MGR="bun"
  INSTALL_CMD="bun add"
elif [ -f "pnpm-lock.yaml" ]; then
  PKG_MGR="pnpm"
  INSTALL_CMD="pnpm add"
elif [ -f "yarn.lock" ]; then
  PKG_MGR="yarn"
  INSTALL_CMD="yarn add"
else
  PKG_MGR="npm"
  INSTALL_CMD="npm install"
fi

echo "πŸ“¦ Detected package manager: $PKG_MGR"
echo ""

# Install dependencies
echo "πŸ“₯ Installing @nuxt/content and better-sqlite3..."
$INSTALL_CMD @nuxt/content better-sqlite3

# Install Zod v4 for schema validation
echo "πŸ“₯ Installing zod v4 for schema validation..."
$INSTALL_CMD -D zod@^4.3.6

echo ""
echo "βœ… Dependencies installed!"
echo ""

# Add module to nuxt.config.ts if not already present
if ! grep -q "@nuxt/content" nuxt.config.ts 2>/dev/null; then
  echo "πŸ“ Adding @nuxt/content to nuxt.config.ts..."

  # Track CONFIG_FILE for the cleanup trap (installed above). The trap
  # guarantees nuxt.config.ts.tmp is removed even if sed fails or the
  # script exits early, instead of relying on chained `&& rm` which would
  # leak the tempfile on a non-zero sed exit.
  CONFIG_FILE="nuxt.config.ts"

  # Create backup
  cp "$CONFIG_FILE" "${CONFIG_FILE}.backup"

  # Add module (simple approach - user may need to adjust)
  if grep -q "modules: \[" "$CONFIG_FILE"; then
    sed -i.tmp "s|modules: \[|modules: ['@nuxt/content', |" "$CONFIG_FILE"
    rm -f "${CONFIG_FILE}.tmp"
  else
    echo "⚠️  Please manually add '@nuxt/content' to your modules array"
  fi
fi

# Create content.config.ts
if [ ! -f "content.config.ts" ]; then
  echo "πŸ“ Creating content.config.ts..."
  cat > content.config.ts << 'EOF'
import { defineContentConfig, defineCollection } from '@nuxt/content'
import { z } from 'zod'

export default defineContentConfig({
  collections: {
    content: defineCollection({
      type: 'page',
      source: '**/*.md',
      schema: z.object({
        title: z.string().optional(),
        description: z.string().optional(),
        date: z.date().optional(),
        tags: z.array(z.string()).default([])
      })
    })
  }
})
EOF
  echo "βœ… Created content.config.ts"
else
  echo "⚠️  content.config.ts already exists, skipping..."
fi

# Create content directory
if [ ! -d "content" ]; then
  echo "πŸ“ Creating content/ directory..."
  mkdir -p content

  # Create example content file
  cat > content/index.md << 'EOF'
---
title: Welcome to Nuxt Content
description: Your content-driven site powered by Nuxt Content v3
date: 2024-01-01
tags: ['nuxt', 'content']
---

# Welcome to Nuxt Content v3

This is your first content page! Edit this file in `content/index.md`.

## Features

- πŸ“ **Markdown Support** - Write content in Markdown
- 🎨 **MDC Syntax** - Use Vue components in Markdown
- πŸ” **Type-Safe Queries** - Query content with TypeScript
- πŸš€ **Git-Based** - Content stored in your repository

## Next Steps

1. Add more content files to `content/`
2. Create collections in `content.config.ts`
3. Query content with `queryCollection()`
4. Render with `<ContentRenderer>`

Happy writing! πŸŽ‰
EOF
  echo "βœ… Created content/ directory with example file"
else
  echo "⚠️  content/ directory already exists, skipping..."
fi

# Create example page to render content
if [ ! -d "pages" ]; then
  mkdir -p pages
fi

if [ ! -f "pages/[...slug].vue" ]; then
  echo "πŸ“ Creating pages/[...slug].vue..."
  cat > 'pages/[...slug].vue' << 'EOF'
<script setup>
const route = useRoute()
const { data: page } = await useAsyncData(route.path, () =>
  queryCollection('content').path(route.path).first()
)

if (!page.value) {
  throw createError({ statusCode: 404, message: 'Page not found' })
}

useHead({
  title: page.value.title,
  meta: [
    { name: 'description', content: page.value.description }
  ]
})
</script>

<template>
  <div class="container mx-auto px-4 py-8">
    <article class="prose dark:prose-invert max-w-none">
      <h1>{{ page.title }}</h1>
      <ContentRenderer :value="page" />
    </article>
  </div>
</template>
EOF
  echo "βœ… Created pages/[...slug].vue"
else
  echo "⚠️  pages/[...slug].vue already exists, skipping..."
fi

echo ""
echo "πŸŽ‰ Nuxt Content v3 setup complete!"
echo ""
echo "Next steps:"
echo "  1. Run your dev server: $PKG_MGR run dev"
echo "  2. Visit http://localhost:3000"
echo "  3. Edit content/index.md"
echo "  4. Check SKILL.md for complete documentation"
echo ""
echo "πŸ“š Resources:"
echo "  - Docs: https://content.nuxt.com/"
echo "  - Skill: skills/nuxt-content/SKILL.md"
echo ""
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path β€” even casually (like "the xlsx in my downloads") β€” and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall