opinionated-nextjs-patterns
БесплатноБез исполняемых скриптовНе проверенOpinionated, backend-agnostic Next.js 16 (App Router) architecture — authorization at the data layer, server-side loading with cache()+Promise.all, mutations…
от pproenca★ 231 звезда на GitHubОб этом скилле
Opinionated Next.js 16 Patterns
Implementation-pattern reference for Next.js 16 (App Router) codebases that want a single, opinionated architecture. Contains 50 rules across 8 categories, prioritised by execution-lifecycle cascade impact — authorization and (optional) tenant modeling first, then the request boundary, server fetching, mutations, client boundaries, architecture, and UI conventions.
The rules are backend-agnostic in principle but use Supabase as the concrete example. Each rule teaches the transferable idea (e.g. "authorize at the data layer", "read through a typed repository"); where the backend genuinely matters, a *Transferable:* note explains the pattern for other stores (Drizzle, Prisma). The structure is a Turbo monorepo with @app/* packages you own — built on canonical libraries (next-safe-action, @supabase/ssr, @tanstack/react-query, react-hook-form + zod, shadcn/ui, next-intl, pino), not a vendored starter kit.
When to Apply
Reach for these rules when:
- Writing new code — pages, layouts, server actions, route handlers,
proxy.ts, feature packages, client components, hooks, the data-access package, SQL/migrations, forms. - Reviewing a PR — authorization slips (privileged client without a guard, missing
'server-only'), waterfalls (sequential awaits, client-fetching server data), drift (hand-edited generated types, deep package imports, hardcoded i18n strings). - Refactoring — moving code between
apps/webandpackages/*, splitting actions and services, lifting'use client'boundaries, replacing raw queries with a typed data-access factory, swapping a backend behind the data-access package. - Designing a feature — choosing the right client (request-scoped vs privileged vs browser), deciding action vs route handler, planning the form/server-action contract, scoping a tenant (if multi-tenant).
- Onboarding — understanding why the codebase looks the way it does, with concrete, transferable examples.
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Authorization & Data-Layer Access | CRITICAL | auth- |
| 2 | Multi-Tenancy (optional, SaaS only) | CRITICAL | tenant- |
| 3 | Request Boundary (Proxy) | HIGH | proxy- |
| 4 | Server-Side Data Loading | HIGH | server- |
| 5 | Mutations: Actions & Route Handlers | HIGH | mutate- |
| 6 | Client/Server Boundaries | MEDIUM-HIGH | client- |
| 7 | Architecture & Services | MEDIUM | arch- |
| 8 | Forms & UI Conventions | MEDIUM | ui- |
Quick Reference
1. Authorization & Data-Layer Access (CRITICAL)
auth-use-standard-server-client— Use the request-scoped, auth-bound client; never default to the privileged one.auth-gate-admin-client— Authorize before constructing the service-role client.auth-trust-rls-no-duplicate-checks— Authorize once at the data layer; don't re-check in app code.auth-use-sql-policy-helpers— Centralize scoping predicates in reusable SQL policy helpers.auth-use-require-user— Centralize the auth gate in onerequireUser()helper.auth-server-only-imports— Mark privileged modules withimport 'server-only'.auth-mfa-in-middleware— Enforce MFA at theproxy.tsboundary, not per-page.
2. Multi-Tenancy (CRITICAL — optional, SaaS only)
tenant-accounts-as-tenant-root— One tenant-root table both personal and team workspaces reference.tenant-account-id-on-product-tables— Tenant key + index + scoping policy on every product table.tenant-slug-in-team-urls— Use a human-readable slug in team URLs, not the UUID.tenant-storage-paths-include-account-id— Namespace object-storage paths by tenant id.tenant-never-edit-generated-types— Treat generated DB types as build output; regenerate, never hand-edit.
3. Request Boundary: Proxy (HIGH)
proxy-single-pipeline— Compose the whole request pipeline in oneproxy.ts.proxy-redirect-auth-at-boundary— Perform auth redirects at the proxy, not in pages.proxy-url-pattern-matching— Match proxy routes withURLPattern, not string comparisons.proxy-set-correlation-id— Set a correlation ID at
Установить opinionated-nextjs-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл opinionated-nextjs-patterns?
Opinionated, backend-agnostic Next.js 16 (App Router) architecture — authorization at the data layer, server-side loading with cache()+Promise.all, mutations through next-safe-action + typed route handlers, client/server boundaries ('use client' at leaves + TanStack Query), forms with RHF + Zod, UI via shadcn/ui + Tailwind + Base UI + next-intl, request handling in proxy.ts (Next.js 16's renamed middleware), and a Turbo monorepo of @app/* packages confining the backend behind one data-access package. Examples use Supabase but every rule states the transferable principle. Use when writing, reviewing, or refactoring Next.js 16 code. Trigger on server actions, route handlers, RSC vs 'use client' placement, TanStack Query, RHF/Zod, proxy.ts, or monorepo package layout — even when the user doesn't say 'patterns' or 'best practices'.
Как установить скилл opinionated-nextjs-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл opinionated-nextjs-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic