LaunchKit · 2026
Back to Skills

sr-next-clerk-expert

Senior-level Clerk authentication expertise for Next.js 15/16+ applications.

0
0 downloads
by @michaelmonetized

Setup & Installation

openclaw skills install @michaelmonetized/sr-next-clerk-expert

Or with the ClawHub CLI, for registry-managed skill folders outside a full OpenClaw workspace:

npx clawhub install sr-next-clerk-expert

What This Skill Does

Provides senior-level patterns for implementing Clerk authentication in Next.js 15/16+ apps. Covers route protection, middleware configuration, client vs server auth boundaries, and integration with Convex and Stripe. Includes a set of rules that prevent common auth failures like 500 errors, infinite redirects, and handshake loops.

Encodes hard-won production rules that are not obvious from Clerk's official docs, preventing outages caused by calling auth() on public pages or skipping ClerkLoaded wrappers.

When to use it

  • Protecting dashboard routes while keeping marketing pages public
  • Migrating from middleware.ts to proxy.ts for Next.js 16+
  • Debugging Clerk handshake redirects and 500 errors in production
  • Adding Stripe billing flows to an existing Clerk-authenticated app
  • Syncing Clerk users to a Convex database via webhooks

Example Workflow

Here's how your AI assistant might use this skill in practice.

INPUT

User asks: How do I protect my dashboard routes but keep the homepage public in Next.js 16+?

AGENT
  1. 1Creates app/(private)/ route group containing dashboard and settings pages
  2. 2Generates proxy.ts using clerkMiddleware that only protects /(private)(.*) routes
  3. 3Creates app/(private)/layout.tsx that calls auth() and redirects unauthenticated users
  4. 4Updates app/page.tsx to use SignedIn/SignedOut inside ClerkLoaded instead of calling auth()
  5. 5Provides verification checklist to test anonymous access before deploying
OUTPUT

Working route protection setup where public pages remain static and only private routes require authentication

Requirements

Accounts, API keys, or tools you or your AI assistant may need to set up while using this skill.

CLERK_SECRET_KEY environment variable (from Clerk Dashboard)NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY environment variable (from Clerk Dashboard)Clerk account