一键导入
nextjs-best-practices
Next.js App Router principles. Server Components, data fetching, routing patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Next.js App Router principles. Server Components, data fetching, routing patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Route prediction and forecasting problems to the right method. Covers 7 families: Monte Carlo simulation, statistical forecasting (ARIMA/exponential smoothing), machine learning, Bayesian inference, crowd aggregation, causal inference, and first-principles modeling. Use when you need to predict a future outcome, quantify uncertainty, forecast time-series, update a belief with evidence, infer a cause, or synthesize expert opinions. Combines Monte Carlo Predictor, bootstrap, Bayesian update, and exponential smoothing as callable tools; routes to external methods (ML, markets, causal, physics) when those are the right fit.
Monte Carlo prediction framework for evaluating any project, with a real simulation engine. Use when the user wants to validate decisions, predict outcomes, find optimal paths, detect design divergences, or stress-test a project's direction. Activates on: 'predict', 'Monte Carlo', 'scenario analysis', 'what could go wrong', 'best path', 'validate direction', 'risk analysis', 'forecast', 'project trajectory', 'stress test', 'decision matrix', 'should I migrate', 'compare options'.
Your personal AI operating system — a digital twin that advocates for your interests 24/7. Orchestrates sub-agents, maintains persistent memory, forecasts opportunities, guards against threats, and never gives up on finding answers. Built on OpenClaw. Activates on: 'orchestrator', 'my AI', 'digital twin', 'second brain', 'spin up agent', 'find me', 'watch for', 'optimize my', 'what should I do'.
Universal AI Harness — a meta-framework that wraps any AI model to reduce token waste, ensure spec-driven thinking, maintain persistent memory, and produce calibrated, high-accuracy outputs. Combines BMAD spec-driven methodology, Deep Confidence reasoning, Monte Carlo validation, ReAct execution, and continuous learning. Use for any complex task, decision, or build. Activates on: 'think first', 'harness mode', 'spec-driven', 'BMAD', 'deep reasoning', 'plan before acting', 'structured thinking', 'truth-seeking'.
Deep Confidence Harness — a thinking, planning, and execution framework that forces structured reasoning before acting. Combines Monte Carlo scenario analysis, calibrated confidence, multi-perspective debate, and optimal path planning. Use before any complex decision, build, or task. Activates on: 'deep confidence', 'think before you act', 'plan first', 'Atlas mode', 'reason through this', 'what should I do', 'think this through', 'best approach', 'reason carefully', 'plan and execute'.
OpenClaw personal AI assistant configuration for life organization and income generation. Use when setting up, configuring, or instructing an OpenClaw agent named Henry to manage daily life, finances, tasks, calendar, and money-making activities. Activates on: 'Henry', 'OpenClaw Henry', 'my AI assistant', 'organize my life', 'make money with AI', 'set up Henry', 'Henry config'.
| name | nextjs-best-practices |
| description | Next.js App Router principles. Server Components, data fetching, routing patterns. |
| allowed-tools | Read, Write, Edit, Glob, Grep |
Principles for Next.js App Router development.
Does it need...?
│
├── useState, useEffect, event handlers
│ └── Client Component ('use client')
│
├── Direct data fetching, no interactivity
│ └── Server Component (default)
│
└── Both?
└── Split: Server parent + Client child
| Type | Use |
|---|---|
| Server | Data fetching, layout, static content |
| Client | Forms, buttons, interactive UI |
| Pattern | Use |
|---|---|
| Default | Static (cached at build) |
| Revalidate | ISR (time-based refresh) |
| No-store | Dynamic (every request) |
| Source | Pattern |
|---|---|
| Database | Server Component fetch |
| API | fetch with caching |
| User input | Client state + server action |
| File | Purpose |
|---|---|
page.tsx | Route UI |
layout.tsx | Shared layout |
loading.tsx | Loading state |
error.tsx | Error boundary |
not-found.tsx | 404 page |
| Pattern | Use |
|---|---|
Route groups (name) | Organize without URL |
Parallel routes @slot | Multiple same-level pages |
Intercepting (.) | Modal overlays |
| Method | Use |
|---|---|
| GET | Read data |
| POST | Create data |
| PUT/PATCH | Update data |
| DELETE | Remove data |
| Type | Use |
|---|---|
| Static export | Fixed metadata |
| generateMetadata | Dynamic per-route |
| Layer | Control |
|---|---|
| Request | fetch options |
| Data | revalidate/tags |
| Full route | route config |
| Method | Use |
|---|---|
| Time-based | revalidate: 60 |
| On-demand | revalidatePath/Tag |
| No cache | no-store |
Don't put everything in one file.
middleware/auth.tsmiddleware/geo.tsmiddleware.ts combines them.Must Have in next.config.js:
X-Content-Type-Options: nosniffX-Frame-Options: DENY (Prevent clickjacking)Content-Security-Policy (Strict CSP prevents XSS)Instead of revalidating paths, rely on tags.
fetch(url, { next: { tags: ['products'] } })revalidateTag('products')
Result: Updates ALL product pages (list, detail, featured) at once.Next.js does this by default for static pages.
Mocking the Unmockable Since RSCs access DB directly, testing is hard.
Integration Test (Best): Spin up DB, render component, check HTML.
Unit Test (Mocking):
jest.mock('next/headers', () => ({
cookies: () => ({ get: () => ({ value: 'token' }) })
}));
| ❌ Don't | ✅ Do |
|---|---|
| 'use client' everywhere | Server by default |
| Fetch in client components | Fetch in server |
| Skip loading states | Use loading.tsx |
| Ignore error boundaries | Use error.tsx |
| Large client bundles | Dynamic imports |
app/
├── (marketing)/ # Route group
│ └── page.tsx
├── (dashboard)/
│ ├── layout.tsx # Dashboard layout
│ └── page.tsx
├── api/
│ └── [resource]/
│ └── route.ts
└── components/
└── ui/
Remember: Server Components are the default for a reason. Start there, add client only when needed.