auth

Implements Clerk, Descope, and Auth0 authentication for Next.js applications on Vercel.

Updated Jul 31, 2026
One-click install
npx skills add https://github.com/AarnavBaddam/skills --skill auth-aarnavbaddam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth
Source: https://github.com/AarnavBaddam/skills/tree/main/auth
Command: npx skills add https://github.com/AarnavBaddam/skills --skill auth-aarnavbaddam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up user authentication in Next.js applications involves choosing between providers, configuring middleware, protecting routes, and handling sign-in flows, each with provider-specific SDK patterns and breaking changes that are easy to get wrong. ## Core Features & Use Cases - Clerk Integration: Covers the native Vercel Marketplace install, auto-provisioned environment variables, clerkMiddleware route protection, pre-built SignIn/SignUp components, and Core 3 breaking changes like async auth(). - Descope and Auth0 Setup: Provides provider configuration, middleware, and session access patterns for passwordless flows (Descope) and enterprise SSO (Auth0). - Decision Matrix: Maps requirements like fastest Vercel setup, passwordless login, enterprise SAML, and pre-built UI to the right provider. - Use Case: You are building a Next.js dashboard on Vercel and need protected routes with sign-in pages. Use this Skill to install Clerk via the Marketplace, configure clerkMiddleware with createRouteMatcher, and add drop-in SignIn and SignUp pages. ## Quick Start Set up Clerk authentication in my Next.js app with middleware protection for the dashboard routes and sign-in and sign-up pages.

Frequently Asked Questions about auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Clerk authentication to a Next.js app?

Install Clerk via the Vercel Marketplace with vercel integration add clerk, then run npm install @clerk/nextjs. Add clerkMiddleware to middleware.ts, wrap your root layout in ClerkProvider, and create sign-in and sign-up pages using the pre-built SignIn and SignUp components.

Clerk vs Auth0 vs Descope for Next.js authentication?

Clerk offers the fastest Vercel setup with native Marketplace integration and pre-built UI components. Descope suits passwordless and social login flows with a visual flow builder. Auth0 fits enterprise needs like SSO, SAML, and multi-tenant identity.

How do I protect routes with Clerk middleware in Next.js?

Use clerkMiddleware with createRouteMatcher to define protected routes like /dashboard or /api, then call await auth.protect() inside the middleware handler for matching requests. Unauthenticated users are redirected to sign in automatically.

Does Clerk Core 3 change how auth() works?

Yes, in Clerk Core 3 auth() is asynchronous, so you must use const { userId } = await auth(). The old authMiddleware is removed in favor of clerkMiddleware, and clerkClient() is also async. Run npx @clerk/upgrade to apply codemods automatically.

How do I protect an API route in Next.js with Clerk?

Call await auth() inside your route handler and check the returned userId. If userId is null, return a 401 JSON response; otherwise proceed with the authenticated request logic.