← 返回
安全合规 中文

NextJS

Build Next.js 15 apps with App Router, server components, caching, auth, and production patterns.
使用 App Router、服务端组件、缓存、认证和生产级模式构建 Next.js 15 应用。
ivangdavila ivangdavila 来源
安全合规 clawhub v1.1.0 1 版本 99853.9 Key: 无需
★ 4
Stars
📥 4,022
下载
💾 93
安装
1
版本
#latest

概述

Setup

On first use, read setup.md for project integration.

When to Use

User needs Next.js expertise — routing, data fetching, caching, authentication, or deployment. Agent handles App Router patterns, server/client boundaries, and production optimization.

Architecture

Project patterns stored in ~/nextjs/. See memory-template.md for setup.

~/nextjs/
├── memory.md          # Project conventions, patterns
└── projects/          # Per-project learnings

Quick Reference

TopicFile
-------------
Setupsetup.md
Memory templatememory-template.md
Routing (parallel, intercepting)routing.md
Data fetching & streamingdata-fetching.md
Caching & revalidationcaching.md
Authenticationauth.md
Deploymentdeployment.md

Core Rules

1. Server Components by Default

Everything is Server Component in App Router. Add 'use client' only for useState, useEffect, event handlers, or browser APIs. Server Components can't be imported into Client — pass as children.

2. Fetch Data on Server

Fetch in Server Components, not useEffect. Use Promise.all for parallel requests. See data-fetching.md for patterns.

3. Cache Intentionally

fetch is cached by default — use cache: 'no-store' for dynamic data. Set revalidate for ISR. See caching.md for strategies.

4. Server Actions for Mutations

Use 'use server' functions for form submissions and data mutations. Progressive enhancement — works without JS. See data-fetching.md.

5. Environment Security

NEXT_PUBLIC_ exposes to client bundle. Server Components access all env vars. Use .env.local for secrets.

6. Streaming for Large Data

Use boundaries to stream content progressively. Wrap slow components individually. See data-fetching.md.

7. Auth at Middleware Level

Protect routes in middleware, not in pages. Middleware runs on Edge — lightweight auth checks only. See auth.md.

Server vs Client

Server ComponentClient Component
------------------------------------
Default in App RouterRequires 'use client'
Can be asyncCannot be async
Access backend, env varsAccess hooks, browser APIs
Zero JS shippedJS shipped to browser

Decision: Start Server. Add 'use client' only for: useState, useEffect, onClick, browser APIs.

Common Traps

TrapFix
-----------
router.push in ServerUse redirect()
prefetches allprefetch={false}
next/image no sizeAdd width/height or fill
Metadata in ClientMove to Server or generateMetadata
useEffect for dataFetch in Server Component
Import Server→ClientPass as children/props
Middleware DB callCall API route instead
Missing await params (v15)Params are async in Next.js 15

Next.js 15 Changes

  • params and searchParams are now Promise — must await
  • fetch not cached by default — opt-in with cache: 'force-cache'
  • Use React 19 hooks: useActionState, useFormStatus

Related Skills

Install with clawhub install if user confirms:

  • react — React fundamentals and patterns
  • typescript — Type safety for better DX
  • prisma — Database ORM for Next.js apps
  • tailwindcss — Styling with utility classes
  • nodejs — Server runtime knowledge

Feedback

  • If useful: clawhub star nextjs
  • Stay updated: clawhub sync

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-03-28 15:13 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,383 📥 320,798
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 325,699
office-efficiency

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 449 📥 150,096