Scaffold Next.js features with App Router, Server/Client components, Tailwind, and data fetching patterns
npx claudepluginhub cure-consulting-group/productengineeringskillsThis skill uses the workspace's default tool permissions.
Full-stack Next.js feature scaffolding with App Router, Server/Client components, TypeScript, and Tailwind CSS. Platform-aware patterns for static export (Firebase Hosting) and server-side (Vercel/Node).
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Full-stack Next.js feature scaffolding with App Router, Server/Client components, TypeScript, and Tailwind CSS. Platform-aware patterns for static export (Firebase Hosting) and server-side (Vercel/Node).
Before starting, gather project context silently:
PORTFOLIO.md if it exists in the project root or parent directories for product/team contextcat package.json 2>/dev/null || cat build.gradle.kts 2>/dev/null || cat Podfile 2>/dev/null to detect stackgit log --oneline -5 2>/dev/null for recent changesls src/ app/ lib/ functions/ 2>/dev/null to understand project structure| Feature | Pattern |
|---|---|
| Static page (marketing, blog) | Server Component, static export |
| Dynamic page (dashboard, profile) | Server Component + Client islands |
| Interactive form (contact, checkout) | Client Component with Server Action or API route |
| Data table / list | Server Component fetch + Client sort/filter |
| Auth-gated page | Middleware + layout guard |
| Real-time feature (chat, notifications) | Client Component + WebSocket/Firebase listener |
| API endpoint | Route Handler (app/api/) |
| Full CRUD feature | All of the above combined |
src/
├── app/
│ └── [lang]/ # i18n segment (if multi-locale)
│ └── [feature]/
│ ├── page.tsx # Route page (Server Component default)
│ ├── layout.tsx # Feature layout (if needed)
│ ├── loading.tsx # Loading UI (Suspense boundary)
│ ├── error.tsx # Error boundary (Client Component)
│ ├── not-found.tsx # 404 for this route
│ └── [id]/
│ └── page.tsx # Dynamic route
├── components/
│ └── [feature]/
│ ├── FeatureList.tsx # Server or Client depending on interactivity
│ ├── FeatureCard.tsx # Presentational component
│ ├── FeatureForm.tsx # Client Component ("use client")
│ └── FeatureFilters.tsx # Client Component for interactive filtering
├── lib/
│ └── [feature]/
│ ├── actions.ts # Server Actions (mutations)
│ ├── queries.ts # Data fetching functions
│ ├── types.ts # TypeScript interfaces
│ └── validation.ts # Zod schemas for form validation
└── __tests__/
└── [feature]/
├── page.test.tsx # Route tests
└── components.test.tsx # Component tests
"use client" when the component needs useState, useEffect, event handlers, or browser APIsasync function components, not useEffectany, explicit return types on exported functions, Zod for runtime validationcn() utility for conditional classeserror.tsx, every async operation gets try/catchloading.tsxgenerateMetadata for SEOnext/image with explicit width/height. For static export: unoptimized: trueDoes this component need interactivity (state, effects, events)?
├── NO → Server Component (default, no directive)
│ Can it fetch data?
│ ├── YES → async function component, fetch in body
│ └── NO → pure presentational, receives props
└── YES → Client Component ("use client")
Does it need data from server?
├── YES → Parent = Server Component passes data as props
│ OR use Server Action for mutations
└── NO → Self-contained Client Component
// lib/[feature]/queries.ts
import { cache } from 'react';
export const getFeatureById = cache(async (id: string) => {
// Firebase, REST, or database call
// Runs on server only — safe for secrets
});
// lib/[feature]/actions.ts
"use server";
import { revalidatePath } from 'next/cache';
import { z } from 'zod';
const schema = z.object({ name: z.string().min(1) });
export async function createFeature(formData: FormData) {
const parsed = schema.safeParse(Object.fromEntries(formData));
if (!parsed.success) return { error: parsed.error.flatten() };
// Create in database/Firebase
revalidatePath('/[lang]/[feature]');
return { success: true };
}
// For complex client state: useReducer > useState
// For shared client state: React Context (small) or Zustand (large)
// For server cache: React Query / SWR (only if you need client-side refetching)
When output: "export" (Firebase Hosting):
revalidatePath / revalidateTag — fully staticfirebase.json redirectsgenerateStaticParamsunoptimized: true in next.config// Every page.tsx:
export async function generateMetadata({ params }): Promise<Metadata> {
return {
title: 'Page Title | Site Name',
description: 'Clear description under 160 chars',
openGraph: {
title: '...',
description: '...',
type: 'website',
images: ['/og-image.png'],
},
};
}
For blog/content pages, add JSON-LD:
<script type="application/ld+json" dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org",
"@type": "Article",
headline: post.title,
datePublished: post.date,
author: { "@type": "Organization", name: "Company" },
})
}} />
Unit: Vitest + React Testing Library
Integration: Vitest + MSW (mock API responses)
E2E: Playwright (critical user flows)
Test file naming: [component].test.tsx co-located in __tests__/
types.ts)validation.ts)queries.ts)actions.ts)You MUST generate actual TypeScript files using the Write tool:
src/app/{feature}/types.ts — TypeScript interfaces and Zod schemassrc/app/{feature}/actions.ts — server-side mutationssrc/app/{feature}/page.tsx — Server Component with data fetchingsrc/app/{feature}/components/{Feature}Form.tsx, {Feature}List.tsx — Client Components with 'use client'src/app/{feature}/loading.tsx, src/app/{feature}/error.tsxsrc/app/{feature}/__tests__/{feature}.test.tsxgenerateMetadata with OpenGraph in page.tsxBefore generating, use Glob to find existing route patterns (src/app/*/page.tsx) and match project conventions. Read tailwind.config.ts for existing design tokens.
/database-architect — for Firestore/PostgreSQL schema design used by server actions and queries/firebase-architect — for Firestore security rules and Firebase SDK usage patterns/api-architect — for REST/GraphQL API route design when using Route Handlers/testing-strategy — for Vitest and Playwright testing standards/seo-content-engine — for metadata, structured data, and OpenGraph patterns