Explains how to configure App Router, implement server/client components, optimize data fetching, and secure routes. Use when the user mentions: 'add an authenticated route', 'migrate to App Router', 'optimize fetch caching', or 'fix RSC hydration'.
100
100%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
Never use next/dynamic with { ssr: false } inside a Server Component. Extract the dynamic piece to a dedicated 'use client' component and import it from server components normally.
// ✅ Correct: wrap dynamic import in a 'use client' component
// components/MapClient.tsx
'use client';
import dynamic from 'next/dynamic';
const Map = dynamic(() => import('./Map'), { ssr: false });
export function MapClient(props: MapProps) { return <Map {...props} />; }
// Then import from a Server Component as normal:
// app/page.tsx
import { MapClient } from '@/components/MapClient';
export default function Page() { return <MapClient center={[0, 0]} />; }// app/dashboard/page.tsx
import { redirect } from 'next/navigation';
import { getSession } from '@/lib/auth';
export default async function Page() {
const session = await getSession();
if (!session) redirect('/login');
// ... render dashboard
}For middleware-based protection see REFERENCE.md § Middleware examples.
// app/actions.ts
'use server';
import { revalidatePath } from 'next/cache';
export async function updatePost(id: string, data: FormData) {
await db.posts.update(id, Object.fromEntries(data));
revalidatePath('/posts');
}// Server Component — cached by default; opt out with cache: 'no-store'
async function getPosts() {
const res = await fetch('/api/posts', { next: { tags: ['posts'] } });
return res.json() as Promise<Post[]>;
}
// On-demand revalidation: revalidateTag('posts') or revalidatePath('/posts')Caching tiers (request memo → data cache → full route cache → router cache) and revalidation patterns are in REFERENCE.md § Caching Details.
app/<route>/page.tsx as an async Server Component.getSession() at the top and redirect('/login') when missing.app/<route>/error.tsx for error boundaries.tsc --noEmit recognizes the file and there are no missing imports.tsc --noEmit and fix type errors.tsc --noEmit exits with code 0./login./login.Project-specific conventions and deeper tables (routing, caching, component guidance) live in REFERENCE.md.
f5c8508
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.