AGENT SKILL
nextjs-app-router
Structure a Next.js App Router project with correct server/client boundaries
- License 许可
- Apache-2.0
- 所属仓库
- linktogo/maggie
- 最近更新
- 2026-11-14
- Stars
- ★ 2
- Forks
- 2
01 前言 Front Matter
- name
- nextjs-app-router
- globs
- [ "app/**/*.tsx", "app/**/*.ts" ]
- description
- Structure a Next.js App Router project with correct server/client boundaries
03 SKILL.md 正文
Next.js App Router
Components are Server Components by default. Only opt into the client when you need interactivity — it ships JavaScript to the browser.
Rules
- Add
'use client'only to leaf components that use state, effects, event handlers, or browser APIs. Keep it as low in the tree as possible. - Do data fetching in Server Components (async components,
fetch, or a server-side data layer). Do not fetch in auseEffectto render the first paint. - Never import server-only code (DB clients, secrets,
fs) into a client component. Guard server modules withimport 'server-only'. - Use the file conventions:
layout.tsxfor shared shells,loading.tsxfor Suspense fallbacks,error.tsxfor error boundaries,page.tsxfor routes. - Mutations go through Server Actions or route handlers, then
revalidatePath/revalidateTagto refresh cached data — do not manually patch client state and hope it matches the server.
Anti-patterns
- Marking a whole page
'use client'to fix one interactive widget. - Passing non-serializable values (functions, class instances) from a Server to a Client Component as props.
- Leaking an API key into a client bundle by importing config that reads it.
04 同仓库更多 Skills
vuejs-state-management
Manage Vue application state with Pinia and the right state locality
★ 2
vuejs-composition-api
Write Vue 3 components with the Composition API, script setup, and composables
★ 2
reactjs-hooks
Use React hooks correctly — dependencies, effects, and custom hooks
★ 2
reactjs-component-design
Write small, composable React components with clean props and no needless state
★ 2
postgres-query-performance
Diagnose and fix slow PostgreSQL queries with indexes and EXPLAIN
★ 2
postgres-migrations
Write safe, reversible, zero-downtime PostgreSQL schema migrations
★ 2