模板详情

Next.js TypeScript 整洁架构规则

适合使用 TypeScript、React Server Components 和稳健组件架构的 Next.js 团队。

CursorClaude CodeCodexWindsurf.cursor/rules.cursorrulesCLAUDE.mdAGENTS.md
684投票
12,840安装量
已验证状态

安装预览

命令仍是 MVP 预览。真实使用前请检查目标文件和覆盖行为。

npx rulesmarket add nextjs-typescript-clean-architecture
返回模板库
.cursor/rules/nextjs-typescript.mdc or CLAUDE.md
---
description: Next.js TypeScript project rules
globs: ["**/*.{ts,tsx}", "app/**/*", "src/**/*"]
alwaysApply: false
---

# Next.js TypeScript Rules

- Prefer App Router conventions and keep route handlers, server components and client components explicit.
- Use TypeScript strict types for public interfaces, API responses and reusable helpers.
- Keep client components small; move data fetching and secret access to server-only code.
- Do not introduce broad refactors while fixing narrow issues.
- Reuse existing components, tokens and local utilities before adding new abstractions.
- Validate forms at the boundary and return typed error states.
- Add focused tests for shared logic, parsing, permissions and user-facing workflows.
- Never expose API keys, cookies, tokens or private environment values in client code.

应该先安装到哪个文件?

Cursor 项目规则优先使用 .cursor/rules;跨多个 AI 编程工具协作时可使用 CLAUDE.md 或 AGENTS.md。

它能替代真正的架构文档吗?

不能。它只是轻量项目指令基线,应链接到仓库里真实的设计决策。