clerk-auth-standard

Implement Clerk authentication with RBAC and JWT verification in Next.js.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/imaginationeverywhere/clara-code --skill clerk-auth-standard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clerk-auth-standard
Source: https://github.com/imaginationeverywhere/clara-code/tree/main/.cursor/skills/clerk-auth-standard
Command: npx skills add https://github.com/imaginationeverywhere/clara-code --skill clerk-auth-standard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

Clerk-based authentication is essential for securing Next.js applications, requiring reliable route protection, sign-in flows, and backend verification. This Skill provides production-ready patterns for implementing Clerk authentication with Next.js middleware, custom sign-in pages (customer and admin), provider setup for Apollo Client, and robust RBAC via publicMetadata roles, plus backend JWT verification for GraphQL resolvers.

Core Features & Use Cases

  • Route protection via Next.js middleware to guard protected areas.
  • Custom sign-in pages for customer and admin experiences.
  • Clerk Provider setup with Apollo Client integration for authenticated requests.
  • RBAC integration using publicMetadata roles for authorization.
  • Backend JWT verification for secure GraphQL resolvers.

Quick Start

Configure Clerk in your Next.js app, wire up the middleware-protected routes, and point your sign-in pages at the provided Clerk routes.

Frequently Asked Questions about clerk-auth-standard

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

FAQPage Schema
How do I set up Clerk authentication with Next.js middleware for route protection?

Next.js middleware route protection via Clerk intercepts requests and redirects unauthenticated users. You configure the middleware to check Clerk session status and define protected route patterns that require authentication before rendering or API access.

Can I use Clerk publicMetadata for RBAC role-based access control?

Clerk publicMetadata RBAC stores user roles in the publicMetadata field for authorization checks. You assign roles like admin or customer in publicMetadata and evaluate them in middleware or GraphQL resolvers to gate access to protected resources.

How do I verify Clerk JWT tokens in GraphQL resolvers?

Clerk JWT verification for GraphQL resolvers validates the session token on the backend before executing queries. You extract the JWT from request headers, verify its signature using Clerk's keys, and check role claims to authorize resolver execution.

Does Apollo Client work with Clerk authentication provider?

Apollo Client integrates with the Clerk provider by passing the authenticated session token into Apollo request headers. You wrap Apollo Client setup in the Clerk provider context and configure the auth link to inject the Clerk JWT for authenticated GraphQL requests.

How do I create custom sign-in pages for admin and customer roles in Clerk?

Custom Clerk sign-in pages for admin and customer roles are built as dedicated Next.js routes pointing at Clerk's authentication flow. You design separate UI components for each audience and route users to the appropriate Clerk sign-in path based on their intended role.