contextarch
5
一条 CLI 向导生成 .cursorrules、AGENTS.md、CLAUDE.md 与 copilot-instructions.md,自动识别 30+ 技术栈。
1 条规则
# Next.js 15 + TypeScript + Tailwind + Prisma
## How to work in this repo
- Do what was asked; don't refactor adjacent code or add speculative abstractions.
- Before editing, read the file and its direct callers.
- Ask one clarifying question when ambiguous rather than guessing.
## TypeScript
- Prefer `type` for object shapes; `interface` only when extending third-party types.
- Never `any` — use `unknown` and narrow, or write a proper type.
- No non-null assertions (`!`) except in tests or right after a type guard.
- `import type { ... }` for type-only imports.
- Prefer discriminated unions over enums.
## Next.js (App Router)
- App Router (`app/`) only. Pages Router in legacy projects only.
- Server Components by default. Add `"use client"` only when you need state, effects, or browser APIs.
- Data fetching lives in Server Components or Route Handlers — never `useEffect`.
- Server Actions for mutations; validate every input with Zod before doing work.
- Use `loading.tsx` and `error.tsx` boundaries. Stream with `<Suspense>` where it helps.
- `next/image` for images, `next/font` for fonts. Never `<img>` or Google Fonts `<link>`.
- Cache with `fetch` options (`next: { revalidate }`, `cache: 'force-cache'`) — don't reinvent.
- Metadata via `generateMetadata` or static `metadata` export. Not ad-hoc.
- Never put server-only secrets in client components — they leak into the bundle.
## React
- Function components only.
- `useState` for local UI state, `useReducer` for multi-transition state, a store only for cross-tree state.
- Memoize (`useMemo`, `useCallback`, `React.memo`) only when there's measured render cost.
- Effects are for syncing with external systems; compute derived state in render.
- Keys on lists are stable IDs, never array indexes.
- Buttons are `<button>`, links are `<a>`, inputs have labels.
## Tailwind CSS
- Utility classes; extract to components only when a class list repeats 3+ times.
- Use design tokens in `tailwind.config.ts` — no magic `#hex` in markup.
- Use `clsx` / `cn()` for conditional classes, not template-string concatenation.
## Prisma
- Schema is source of truth. Migrations via `prisma migrate`; never raw SQL drift.
- Select only the fields you need — don't return full rows to clients.
- Wrap multi-step mutations in `prisma.$transaction([...])`.
- Singleton client in server code; don't instantiate `new PrismaClient()` per request.
## Guardrails
- Never commit secrets, API keys, or credentials.
- Don't invent dependencies — if a package isn't in the manifest, confirm before adding.
- When a command fails, read the actual error. Don't retry blindly or use `--force`.
- Prefer editing existing files over creating new ones.
- If you touch public types or exported APIs, check every caller.
---
Generated by `npx contextarch init` — https://contextarch.ai相关插件
learnship↓ 5
正确实践 agentic 工程,提供 42 套结构化工作流、跨会话持久记忆、集成学习伙伴和精良的 UI 设计系统。ai-memory↓ 3
将编辑器聊天记录(Cursor、Claude Code、Windsurf、Copilot、Codex)转化为类型化的 Markdown 记忆、AGENTS.md、Cursor Rules 与 Anthropic Skill,本地优先且可纳入 git 跟踪。Archcore↓ 0
让 AI agent 按照你项目的架构、规则和决策来编写代码。Misar.Blog MCP Server↓ 0
在 Claude Code、Cursor 或 Windsurf 中直接发布博客文章、管理草稿、生成 AI 封面图并从 Misar.Blog 拉取分析数据。VirtualSMS↓ 41
VirtualSMS:AI Agent 真实 SIM 号码,145+ 国家、2000+ 服务、18 个 MCP 工具。RTFM↓ 1
AI 编码 Agent 开源检索层:15 种格式索引,FTS5 + 语义搜索 + 知识图谱,经 MCP 提供精准上下文。本地、开源、免费。reason-cavalier↓ 1
面向 Cursor 及相关 agent 的跨工具 AI 编码工作流插件。supericons↓ 1
Supericons MCP 让 AI 编码 agent 从含 2 万多个图标的语义注册库中搜索、推荐并获取 SVG 图标。