plugins/smedjen/skills/nextjs-app-router/SKILL.md
Next.js App Router patterns — server components, route handlers, caching, layouts, and data fetching.
npx skillsauth add hjemmesidekongen/ai nextjs-app-routerInstall 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.
App Router (Next.js 13+) defaults everything to Server Components. The mental model shift: run as much as possible on the server, opt into the client only when you need it.
Server Component (default): data fetching, DB access, sensitive env vars, large dependencies, static or async rendering. No hooks, no event handlers, no browser APIs.
Client Component ('use client'): useState, useEffect, event handlers, browser APIs (window, localStorage), third-party components that require client context.
Rule of thumb: push 'use client' to the leaves. A Server Component can import a Client Component, but not the reverse — a Client Component cannot import a Server Component directly.
Fetch directly in async Server Components. No API layer needed for internal data.
// app/products/page.tsx — Server Component
export default async function ProductsPage() {
const products = await db.product.findMany(); // direct DB call
return <ProductList products={products} />;
}
Parallel fetching with Promise.all avoids waterfalls: const [user, posts] = await Promise.all([getUser(id), getPosts(id)]).
Three caches: fetch cache (static/ISR), router cache (client in-memory), full route cache (server static). Control fetch behavior with the cache and next options: cache: 'no-store' for dynamic, next: { revalidate: 60 } for ISR, next: { tags: ['x'] } for tag-based invalidation. Use revalidatePath / revalidateTag for on-demand purges from webhooks or mutations.
useEffect.loading.tsx auto-wraps the segment in Suspense — always add one for async routes.error.tsx must be 'use client' — it needs the reset() callback.See references/process.md for file conventions, parallel/intercepting routes, middleware, metadata API, server actions, and anti-patterns with examples.
development
Creates a brand from scratch through market research and interactive sparring. Runs competitive research via Perplexity, then guides the user through positioning, audience, voice, values, and content pillars. Produces the full brand guideline set at .ai/brand/{name}/. Use when building a new brand, defining brand strategy for a product, or when /våbenskjold:create is invoked.
testing
Loads brand guidelines from .ai/brand/{name}/ and makes them available to the current context. Progressive disclosure: L1 confirms brand exists, L2 loads summary, L3 loads specific files on demand. Use when a downstream skill or user needs brand context, or when /våbenskjold:apply is invoked.
documentation
Guided reinvention of an existing brand guideline. Loads current brand from .ai/brand/{name}/, identifies what to keep vs change, and walks the user through targeted evolution. Preserves brand equity while updating positioning, voice, or values. Use when refreshing a brand or when /våbenskjold:evolve is invoked.
development
Codifies an existing brand from materials, samples, and references. Analyzes provided content to extract voice patterns, values, and positioning. Produces the same guideline format as brand-strategy. Use when a brand already exists but isn't documented, or when /våbenskjold:audit is invoked.