nextjs-framework

A guide for building Next.js applications with the App Router, including server and client components, data fetching, caching, and protected pages.

In plain words
What is it for?
Use it when adding authenticated routes, moving to the App Router, improving fetch behavior, handling errors and navigation, or fixing server/client component issues.
Why use it?
It explains framework rules and common mistakes that can cause build failures, slow data loading, hydration problems, or incorrectly protected routes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/monkilabs/opencastle/nextjs
Any agent
npx skills add monkilabs/opencastle --skill nextjs
Clone the repo
git clone --depth 1 https://github.com/monkilabs/opencastle

Made for: Claude Code, Codex.

Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 552 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00057 $0.00552
Opus 5 $0.00028 $0.00276
Sonnet 5 $0.00011 $0.00110
Haiku 4.5 $0.00006 $0.00055

Measured 2d ago against content hash c3b4832002cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

nextjs-framework scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (config.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

Four tiers: per-request `fetch` memoization (automatic) → Data Cache (cross-request, cached by default, opt out with `cache: 'no-store'`) → Full Route Cache (static HTML + RSC payload at build) → client Router Cache (pre
src/orchestrator/plugins/nextjs/SKILL.md · 36 lines

What it actually says

Next.js Framework

Critical rule

Never use next/dynamic with { ssr: false } inside a Server Component — it crashes at build/runtime. Extract it into a 'use client' wrapper and import that from the server normally.

// 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} />; }

Gotchas

  • error.tsx must be a Client Component, and needs to exist per segment — otherwise an unhandled error takes down the page. template.tsx re-mounts on navigation where layout.tsx persists. default.tsx is the parallel-route fallback.
  • Independent fetches awaited in sequence become a waterfall — use Promise.all(). Fetching in useEffect where a Server Component could fetch costs an extra roundtrip plus a loading flash.
  • getServerSideProps / getStaticProps are Pages Router only; App Router uses async Server Components.
  • Auth: check the session at the top of an async Server Component and redirect('/login') before returning any UI. Middleware with matcher: ['/dashboard/:path*'] covers whole subtrees.
  • Dynamic segments: [slug], catch-all [...slug], optional catch-all [[...slug]].
  • Put providers in a Providers Client Component rather than growing layout.tsx; 'use client' on everything defeats RSC.

Caching layers

Four tiers: per-request fetch memoization (automatic) → Data Cache (cross-request, cached by default, opt out with cache: 'no-store') → Full Route Cache (static HTML + RSC payload at build) → client Router Cache (prefetched and visited routes). Tag with fetch(url, { next: { tags: ['posts'] } }), then invalidate from a Server Action via revalidateTag('posts') or revalidatePath('/posts').

Docs: https://nextjs.org/docs

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 36 lines · 57 tokens per session scan A c3b4832002cf

Subscribe to this mod's changes

nextjs-framework is a skill published in the GitHub repository monkilabs/opencastle (61 stars, last pushed 5d ago), licensed MIT. It adds 57 tokens to every session and 552 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

product-architect

Complete product development system with 64 agents and 35 frameworks. Use when the user wants to build a product, write a PRD, plan an MVP or roadmap, design an app, research a market or check whether a feature already exists or is novel, do competitive analysis, run a security audit, build a financial model, plan…

ankitjha67/product-architect · 211 tokens

codex-delegation

Use when a coding task would benefit from delegating work to Codex in the background — a deep independent second opinion, security or architecture analysis, or a parallel implementation running while the session continues. Lets Claude drive the codex companion itself (task, review, status --wait, result) without the…

zebbern/agent-collab · 74 tokens

cursor-delegation

Use when a coding task would benefit from delegating work to Cursor in the background — fast parallel implementation, scaffolding, or an everyday review running while the session continues. Lets Claude drive the cursor companion itself (task, review, status --wait, result) without the user typing /cursor: commands.

zebbern/agent-collab · 66 tokens

cursor-cli-runtime

Internal helper contract for calling the cursor-companion runtime from Claude Code.

zebbern/agent-collab · 17 tokens

cursor-prompting

Internal guidance for composing cursor-agent prompts and picking models for coding, review, diagnosis, and research tasks inside the Cursor Claude Code plugin.

zebbern/agent-collab · 31 tokens

goal-runner

Use when the user asks to advance, continue, or work on the project's long-horizon goal (or to set one up) — the policy for goal-driven increments driven through the goal companion, one increment at a time, delegated via the codex/cursor delegation skills, honestly recorded.

zebbern/agent-collab · 62 tokens