mcpField
O
opinionated-nextjs-patterns

opinionated-nextjs-patterns

github.com/pproencaDevelopment218128 installsUpdated 11w ago
Repository

About opinionated-nextjs-patterns

A reference skill for teams building or reviewing Next.js 16 App Router codebases. Its 50 rules organize architecture and implementation guidance by execution lifecycle, using Supabase as a concrete example while explaining transferable patterns.

Key features

  1. 0150 rules in eight categories
  2. 02Authorization and data-layer access patterns
  3. 03Server-side loading and mutations
  4. 04Client/server boundary guidance
  5. 05Turbo monorepo architecture
  6. 06Forms and UI conventions

Use cases

  1. 01Implementing a new Next.js feature
  2. 02Reviewing authorization and request flows
  3. 03Refactoring data access and package boundaries
  4. 04Onboarding developers to a codebase

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pproenca/dot-skills --skill opinionated-nextjs-patterns

After installing, type/opinionated-nextjs-patternsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
metadata.json
assets/templates/
_template.md
references/
_sections.md
arch-app-vs-packages-boundary.md
arch-config-driven-navigation.md
arch-data-access-adapter.md
arch-feature-package-layout.md
arch-import-via-package-exports.md
arch-policy-engine-for-business-rules.md
arch-provider-gateway-pattern.md
auth-gate-admin-client.md
auth-mfa-in-middleware.md
auth-server-only-imports.md
auth-trust-rls-no-duplicate-checks.md
auth-use-require-user.md
auth-use-sql-policy-helpers.md
auth-use-standard-server-client.md
client-pass-server-data-as-props.md
client-realtime-cleanup-subscription.md
client-stable-query-keys.md
client-use-action-hook.md
client-use-client-at-leaves.md
client-use-supabase-with-react-query.md
mutate-enhance-route-handler.md
mutate-revalidate-path-after-write.md
mutate-thin-action-service-holds-logic.md
mutate-use-getlogger-not-console.md
mutate-use-safe-action-clients.md
mutate-webhook-verify-signature.md

Details

From the project README

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/web and packages/*, 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

PriorityCategoryImpactPrefix
1Authorization & Data-Layer AccessCRITICALauth-
2Multi-Tenancy (optional, SaaS only)CRITICALtenant-
3Request Boundary (Proxy)HIGHproxy-
4Server-Side Data LoadingHIGHserver-
5Mutations: Actions & Route HandlersHIGHmutate-
6Client/Server BoundariesMEDIUM-HIGHclient-
7Architecture & ServicesMEDIUMarch-
8Forms & UI ConventionsMEDIUMui-

Quick Reference

1. Authorization & Data-Layer Access (CRITICAL)
2. Multi-Tenancy (CRITICAL — optional, SaaS only)
3. Request Boundary: Proxy (HIGH)
4. Server-Side Data Loading (HIGH)
5. Mutations: Actions & Route Handlers (HIGH)
6. Client/Server Boundaries (MEDIUM-HIGH)
7. Architecture & Services (MEDIUM)
8. Forms & UI Conventions (MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering by lifecycle impact
assets/templates/_template.mdTemplate for adding new rules
metadata.jsonVersion, organization, references

Related Skills

  • base-ui-migrator — bulk-migrate Radix asChild patterns to Base UI render props.
  • tailwind-refactor — refactor hardcoded colors to semantic tokens.
  • react-optimise — performance optimisations for React components.
  • nextjs-bundle-optimizer — bundle analysis and reduction for Next.js apps.

Comments

Markdown supported