.claude/skills/nextjs-patterns/SKILL.md
Next.js 15 App Router patterns, server/client components, layouts, and routing conventions for YHIN
npx skillsauth add LilMikey-CN/YHIN nextjs-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Default to Server Components. Only add "use client" when you need:
// src/app/[locale]/layout.tsx — root layout with i18n
import { NextIntlClientProvider } from 'next-intl';
import { getMessages } from 'next-intl/server';
export default async function LocaleLayout({
children,
params: { locale }
}: {
children: React.ReactNode;
params: { locale: string };
}) {
const messages = await getMessages();
return (
<NextIntlClientProvider messages={messages}>
<div className="min-h-screen bg-background">
<Navbar />
<main className="container mx-auto px-4 py-8">
{children}
</main>
</div>
</NextIntlClientProvider>
);
}
Use route groups (groupName) for layout segmentation without affecting URL:
(auth) — login, register (no sidebar, centered layout)(main) — dashboard, resources, matches (with sidebar navigation)Every route group should have:
loading.tsx — skeleton UI (use shadcn Skeleton)error.tsx — error boundary with retry buttonnot-found.tsx — 404 pagefetch() to call your own API routes — use tRPC's server-side caller insteadEvery page should export metadata for SEO:
export async function generateMetadata({ params }: Props) {
const t = await getTranslations('page-name');
return { title: t('title'), description: t('description') };
}
documentation
One-time setup that gathers design context for your project and saves it to your AI config file. Run once to establish persistent design guidelines.
data-ai
Prisma ORM patterns including schema design, JSONB fields, pgvector integration, and migration workflow for YHIN
development
Core matching algorithm using pgvector semantic similarity. Finds "I have, they need" and "I need, they have" connections between users.
testing
Internationalization workflow using next-intl for Chinese/English bilingual support. Read this before adding any user-facing text.