ericrisco/rsc-harness / skills/nextjs
nextjs
UnverifiedUse when building, reviewing, testing, securing, or optimizing a Next.js App Router app: Server vs Client boundaries, `use server` actions, route handlers, the v15 vs v16 `use cache` caching model, metadata/SEO, auth, and Core Web Vitals. NOT framework-agnostic React or a Vite SPA (that is `react`), and NOT visual/UI design (that is `design`).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 20.2 KB |
| evals/README.md | markdown | 2.5 KB |
| evals/cases.yaml | config | 5.7 KB |
| references/data-and-caching.md | markdown | 12.4 KB |
| references/metadata.md | markdown | 7.8 KB |
| references/performance.md | markdown | 10.9 KB |
| references/react.md | markdown | 12.1 KB |
| references/security.md | markdown | 8.3 KB |
| references/testing.md | markdown | 9.2 KB |
| scripts/verify.shexecutable | script | 5.6 KB |
evals/cases.yaml
View on GitHubskill: nextjs
should_trigger:
- prompt: "My page component does `const { id } = params` and TypeScript is yelling at me that params is a Promise. What gives?"
why: "Classic v15+ App Router migration bug (params/searchParams are Promises) — squarely the skill's params-await territory, even though the user never says 'Next.js'."
- prompt: "I'm getting 'You're importing a component that needs useState. It only works in a Client Component but none of its parents are marked with use client.' How do I fix this?"
why: "RSC server/client boundary error from the App Router; the skill owns the 'use client' boundary laws and composition-via-children fix."
- prompt: "Add a server action to rename a project and wire up the form with optimistic UI and validation."
why: "Server Actions + useActionState/useOptimistic + zod — core skill scope, including the 'auth inside every action' rule."
- prompt: "We just upgraded and now there's a proxy.ts at the repo root instead of middleware.ts. Is that a mistake? Should I rename it back?"
why: "Next.js 16 routing signal; the skill explicitly says proxy.ts is correct on v16 and must NOT be renamed — a near-trap the skill resolves."
- prompt: "Our dashboard hero image keeps causing layout shift and the LCP is over 4 seconds. Help me fix the Core Web Vitals."
why: "Next.js perf / Core Web Vitals with next/image, priority, and CLS — the skill's performance section, without the tool being named."
- prompt: "How do I cache this product list across requests and bust the cache when a product changes? We're on next 16 with cacheComponents on."
why: "Caching/revalidation under the v16 Cache Components model ('use cache' + cacheTag/updateTag); the skill gates v15 vs v16 advice."
- prompt: "Set up generateMetadata for our blog post pages with OpenGraph images and a sitemap.ts."
why: "App Router metadata/SEO build-side API (generateMetadata, sitemap.ts, next/og) — explicitly in scope."
should_not_trigger:
- prompt: "I'm building a React SPA with Vite and react-router. How do I set up nested routes and a data loader?"
route_to: "none"
why: "Pure client-side React SPA (Vite/react-router), no Next.js App Router or RSC dimension — the skill explicitly excludes Vite/CRA SPAs and defers to a generic React skill."
- prompt: "Write a FastAPI endpoint with a Pydantic model that validates the request body and returns 422 on bad input."
route_to: "fastapi"
why: "Non-Next backend in Python; belongs to the fastapi sibling, which the skill names as the redirect target."
- prompt: "Optimize this Postgres query — it does a sequential scan on a 5M-row orders table. What index should I add?"
route_to: "postgresdb"
why: "Pure SQL/index tuning with no Next.js layer; the data layer behind the DAL is postgresdb's domain."
- prompt: "Review my Express auth code for OWASP issues — is my JWT validation and password hashing secure?"
route_to: "security-audit"
why: "Generic (non-Next) backend security review on an Express app; security-audit owns framework-agnostic security, which the skill says it complements not duplicates."
- prompt: "My old Next.js app uses the pages/ directory with getServerSideProps. How do I add a new dynamic page there?"
route_to: "none"
why: "Pages Router work, which the skill explicitly excludes — it notes the difference and defers to the Next.js Pages docs rather than handling it."
- prompt: "Build the SEO content strategy and JSON-LD keyword plan for our launch — what should the articles target?"
route_to: "marketing"
why: "SEO/GEO strategy and content decisions belong to marketing; this skill only emits the metadata tags, it does not decide the content."
capability:
- scenario: "User on Next.js 15 (middleware.ts, no cacheComponents) asks: 'Add a server action that lets a logged-in user rename their own project, with a validated form and a way to refresh the list afterward.'"
must_include:
- "Detects/assumes the v15 model and uses v15 caching APIs (revalidateTag/revalidatePath via next/cache), NOT v16 'use cache'/updateTag"
- "File starts with the 'use server' directive in a server-action module (e.g. app/.../actions.ts)"
- "Calls auth() (or equivalent session check) INSIDE the action and returns an error if unauthenticated — states that a server action is a public POST endpoint not protected by middleware"
- "Authorizes ownership (checks the project belongs to the current user) before mutating, i.e. defense in the data layer not just the client"
- "Validates FormData with zod safeParse before touching the DB and returns a discriminated-union result like { status: 'ok' | 'error' }"
- "Client form uses useActionState(action, null) and surfaces isPending + an error with role=\"alert\""
- "Invalidates the cached list after mutation (revalidateTag or revalidatePath)"
- scenario: "User asks: 'Our /dashboard page is slow — the LCP image shifts the layout and stats block the whole page from rendering. Make it fast.'"
must_include:
- "Uses next/image with explicit width/height (or fill + sized parent) and priority on the LCP image to kill CLS and prioritize the hero"
- "Wraps the slow stats in <Suspense> with a fallback (or a loading.tsx) so the shell streams immediately instead of blocking"
- "Keeps the page a Server Component and pushes any interactivity into a small 'use client' island"
- "Parallelizes independent data fetches (Promise.all / sibling Suspense) to remove request waterfalls"
- "Names concrete Core Web Vitals targets: LCP < 2.5s, CLS < 0.1, INP < 200ms"
- "Mentions next/font (self-host, display: swap) and/or measuring before adding manual memoization rather than speculative useMemo"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |