next-stack
4
总安装量
4
周安装量
#48109
全站排名
安装命令
npx skills add https://github.com/janjaszczak/cursor --skill next-stack
Agent 安装分布
opencode
4
gemini-cli
4
github-copilot
4
codex
4
kimi-cli
4
amp
4
Skill 文档
Next Stack (App Router + Prisma + TanStack Query)
Intent
Provide a consistent decision framework + implementation checklist for this stack, so changes stay:
- correct in server/client boundaries,
- consistent with UI & data patterns,
- testable and PR-ready.
When to use
Activate this skill when the task involves any of:
- Next.js App Router pages/layouts/route handlers/server actions
- Prisma-backed reads/writes
- client mutations, optimistic UI, live updates (TanStack Query)
- forms & validation (RHF + Zod)
- shadcn/ui + Tailwind components under
frontend/
Non-negotiables (stack rules)
- Server Components first
- Default to Server Components.
- Add
"use client"only when you need interactivity, local state, effects, or client-only libraries.
- Prisma is server-only
- Never import Prisma in Client Components.
- Ensure any Prisma usage runs in Node runtime (not Edge):
- For Route Handlers that might run on Edge, explicitly set:
export const runtime = "nodejs"(where applicable in your codebase conventions).
- For Route Handlers that might run on Edge, explicitly set:
- Data fetching split
- Prefer server-side reads (RSC, route handlers, server actions) for static/deterministic reads.
- Use TanStack Query for:
- mutations,
- optimistic flows,
- client revalidation,
- âlive-ishâ / frequently changing UI state.
- React Query hygiene
- Stable, deterministic query keys (no unstable objects in keys).
- Precise invalidation (invalidate the smallest relevant scope).
- Forms & validation
- Use React Hook Form + Zod resolver.
- Maintain one Zod schema shared between client & server.
- Server must re-validate (do not trust client).
- Styling & UI
- Tailwind default.
- shadcn/ui lives under
frontend/components/ui/*. - Preserve accessibility props/labels and semantic structure.
- Conventions
- ESLint (AirBnB-style) + Prettier.
- React component files in PascalCase (e.g.,
UserCard.tsx). - Prefer named exports (unless Next.js route file conventions force defaults).
Workflow (how to execute tasks in this stack)
Step 1 â Clarify & make it verifiable
- Ask 1â3 clarifying questions if critical requirements are missing.
- Define acceptance criteria as verifiable checks:
- âwhat page shows what stateâ
- âwhat API returns whatâ
- âwhich tests prove itâ
Step 2 â Decide server vs client boundary
Choose the minimum client surface area:
- If no interactivity: stay in RSC.
- If interaction/mutation: isolate
"use client"to the smallest component subtree.
Step 3 â Pick the data path
Reads
- Prefer RSC/server fetch.
- Be explicit about caching behavior for user-specific or frequently changing data:
- use
cache: "no-store"/ revalidate strategy as appropriate to the app conventions.
- use
Writes / mutations
- Implement server action or route handler as the mutation boundary.
- Client uses React Query
useMutationand invalidates exact keys.
Step 4 â Implement with shared schema
- Create/locate a shared
zodschema module (single source of truth). - Client:
- RHF + zodResolver(schema)
- Server:
- schema.parse(…) (or safeParse with structured error return)
Step 5 â UI integration (shadcn + Tailwind)
- Use shadcn components for primitives; Tailwind for layout/spacing.
- Keep a11y intact: labels, aria attributes, keyboard focus, form errors.
Step 6 â Verification
Before finalizing:
- run lint + typecheck
- unit/component tests (Vitest + RTL) where applicable
- Playwright e2e for critical flows
(Use the repoâs package manager and scripts; inspect package.json / lockfiles and follow existing patterns.)
Step 7 â PR output expectations
PR should include:
- runnable code and relevant tests,
- a short rationale: what you changed, why it matches this stack,
- explicit trade-offs (e.g., âRSC read chosen over React Query because Xâ).
Anti-patterns (reject these)
- Prisma imported from any Client Component module graph
- Blanket
"use client"at high-level layouts/pages without necessity - React Query used for deterministic static reads with no client interactivity need
- Unstable query keys (objects/functions/dates) causing cache misses
- Over-broad invalidation (invalidate everything) instead of precise keys
- Duplicate schemas (one for client, one for server)
Quick decision rules
- Start with RSC; promote to client only when you hit a real constraint.
- If Prisma is involved, ensure Node runtime and keep the boundary server-side.
- If you need optimistic UI or repeated client refresh, use React Queryâbut keep keys stable and invalidation precise.