Skip to content
Skillv1.0.0

nextjs-master

Use when building or refactoring Next.js 14+ App Router applications — Server Components, TypeScript patterns, Supabase integration, and performance optimization

by fratilanico(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from fratilanico/apex-os-bad-boy (nextjs-master/SKILL.md). Install upstream with npx skills add fratilanico/apex-os-bad-boy --skill nextjs-master. Copyright stays with the author.

Next.js 14+ Mastery Skill

Core Architecture

Server Components (Default)

  • Use Server Components by default - no "use client" unless necessary
  • Client Components only for: interactivity, browser APIs, hooks
  • Minimize useEffect, useState - favor RSC data fetching

App Router Conventions

app/
├── (auth)/           # Route groups
├── api/              # API routes / Edge Functions
├── globals.css       # Global styles
└── layout.tsx        # Root layout with providers

components/
├── ui/               # Shadcn UI components
├── forms/            # Form components with React Hook Form
└── sections/         # Page sections

File-Based Routing Rules

  • page.tsx: Route pages (Server Components)
  • layout.tsx: Shared layouts with proper children typing
  • loading.tsx: Suspense fallbacks
  • error.tsx: Error boundaries with error.ts
  • not-found.tsx: 404 pages

TypeScript Patterns

Dynamic Route Props

interface PageProps {
  params: Promise<{ slug: string }>
  searchParams: Promise<{ [key: string: string | string[] | undefined }>
}

Server Actions

'use server'
export async function createItem(formData: FormData) {
  'use server'
  // Direct database calls - no API routes needed
}

Supabase Integration

Row Level Security (RLS)

  • Always enable RLS on all tables
  • Create policies for: SELECT, INSERT, UPDATE, DELETE
  • Use auth.uid() for user-specific data

Real-time Subscriptions

const channel = supabase
  .channel('table-db')
  .on('postgres_changes', { event: '*', schema: 'public', table: 'tasks' }, payload => {
    // Handle changes
  })
  .subscribe()

Performance Optimization

Core Web Vitals

  • LCP < 2.5s: Optimize images, font loading, SSR
  • CLS < 0.1: Reserve space for dynamic content
  • FID/INP < 100ms: Minimize client JS, defer non-critical

Optimization Techniques

  • Dynamic imports for non-critical components
  • React.memo for pure components
  • Image optimization with Next.js Image
  • Font optimization with next/font
  • Route prefetching with Link

State Management

Server-First Approach

  • Fetch data in Server Components
  • Pass serialized data to Client Components
  • Use URL searchParams for filter state

Client State (when needed)

  • React Hook Form for form state
  • Zustand for global client state
  • React Query for server state synchronization

Error Handling

Error Boundaries

// app/error.tsx
'use client'
export default function Error({ error, reset }) {
  return <div>Error: {error.message}</div>
}

try/catch in Server Actions

'use server'
export async function submitForm(prevState, formData) {
  try {
    // Logic
    return { success: true }
  } catch (e) {
    return { error: e.message }
  }
}

SEO & Metadata

Dynamic Metadata

export async function generateMetadata({ params }) {
  const product = await fetchProduct(params.slug)
  return {
    title: product.title,
    description: product.description,
    openGraph: { images: [product.image] }
  }
}

Testing Requirements

  • Jest + React Testing Library for unit tests
  • Playwright for E2E tests
  • Test components in isolation
  • Mock Supabase responses

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/fratilanico-apex-os-bad-boy-nextjs-master/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

fratilanico-apex-os-bad-boy-nextjs-master.ocm.jsonjson
{
  "ocm": "1",
  "id": "fratilanico-apex-os-bad-boy-nextjs-master",
  "kind": "skill",
  "name": "nextjs-master",
  "description": "Use when building or refactoring Next.js 14+ App Router applications — Server Components, TypeScript patterns, Supabase integration, and performance optimization",
  "publisher": "fratilanico",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding",
      "math"
    ],
    "tags": [
      "skill-md",
      "nextjs",
      "react",
      "typescript",
      "supabase",
      "vercel",
      "app-router",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Use when building or refactoring Next.js 14+ App Router applications — Server Components, TypeScript patterns, Supabase integration, and performance optimization"
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/fratilanico/apex-os-bad-boy",
      "path": "nextjs-master/SKILL.md",
      "ref": "c1d500a0f73bba193991a4df9c953dbbe4b5e293",
      "url": "https://github.com/fratilanico/apex-os-bad-boy/blob/c1d500a0f73bba193991a4df9c953dbbe4b5e293/nextjs-master/SKILL.md",
      "key": "fratilanico/apex-os-bad-boy/nextjs-master/SKILL.md"
    }
  },
  "instructions": "# Next.js 14+ Mastery Skill\n\n## Core Architecture\n\n### Server Components (Default)\n- Use Server Components by default - no \"use client\" unless necessary\n- Client Components only for: interactivity, browser APIs, hooks\n- Minimize useEffect, useState - favor RSC data fetching\n\n### App Router Conventions\n```\napp/\n├── (auth)/           # Route groups\n├── api/              # API routes / Edge Functions\n├── globals.css       # Global styles\n└── layout.tsx        # Root layout with providers\n\ncomponents/\n├── ui/               # Shadcn UI components\n├── forms/            # Form components with React H",
  "cost": {
    "context_tokens": 814
  }
}

Fetch it by URL: GET /api/v1/registry/fratilanico-apex-os-bad-boy-nextjs-master/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.