Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

clerk-nextjs-patterns

Skill by rafay99-epic

Gives an AI assistant Next.js patterns for Clerk authentication, including middleware, Server Actions, API route auth and user-scoped caching. Aimed at developers building Next.js apps with Clerk.

  • Score 62
  • 3 stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install clerk-nextjs-patterns

Built from the published package, never by AI.

git clone --depth 1 https://github.com/rafay99-epic/wryte.xyz /tmp/wryte.xyz && mkdir -p ~/.claude/skills && cp -r /tmp/wryte.xyz/.agents/skills/clerk-nextjs-patterns ~/.claude/skills/clerk-nextjs-patterns

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install clerk-nextjs-patterns in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

clerk-nextjs-patterns is an agent skill with guidance on authentication in Next.js apps that use Clerk. It explains when to use await auth() from @clerk/nextjs/server in Server Components and the useAuth() hook in Client Components. It also covers middleware setup (public-first versus protected-first), protecting Server Actions, returning 401 or 403 from API routes, and caching auth data per user.

The SKILL.md points to five reference files, one for each topic, and includes a table of common pitfalls. It notes differences for Clerk Core 2 and for Next.js 15 and earlier, where middleware.ts is used instead of proxy.ts. The skill expects a Clerk publishable key and a Clerk secret key. It is aimed at developers building Next.js apps with Clerk.

Written from the project's SKILL.md and checked against it.

What it can do

  • Server vs client authExplains await auth() in Server Components versus the useAuth() hook in Client Components.
  • Middleware strategiesCovers public-first and protected-first middleware configuration.
  • Server Actions protectionShows how to protect mutations by checking auth at the start of an action.
  • API route authExplains when to return 401 (not signed in) versus 403 (no permission).
  • User-scoped cachingDescribes caching auth data with userId included in the cache key.
  • Conditional renderingShows the Show component for rendering content based on auth state.

What you need

  • Clerk publishable key
  • Clerk secret key
  • Next.js project

Try asking

  • Show me how to call auth() correctly in a Next.js Server Component.
  • Help me protect this Server Action so only signed-in users can run it.
  • Which HTTP status should my API route return when the user lacks permission?

Good to know

  • The five reference files linked from the SKILL.md are not included in this source.
  • Some features differ in Clerk Core 2 and are marked as skip-if-current-SDK notes.
  • Next.js 15 and earlier use middleware.ts instead of proxy.ts.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: .agents/skills/clerk-nextjs-patterns/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

Allowed tools: WebFetch

Alternatives to clerk-nextjs-patterns

All alternatives →
openclaw-github-repo-commandersickn33
94

Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.

AAA Skill 50k
gradiogradio-app
94

Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.

AAA Skill 44k
hig-components-menussickn33
94

Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.

AAA Skill 50k
fastapi-templateswshobson
94

Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.

AAA Skill 43k
appfunctionsandroid
94

Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.

AAA Skill 11k
agent-qa-authoringsickn33
94

Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.

AAA Skill 50k

Compare with openclaw-github-repo-commander, gradio or hig-components-menus

clerk-nextjs-patterns: common questions

When should I use await auth() instead of useAuth()?

The source says to use await auth() from @clerk/nextjs/server in Server Components and the useAuth() hook from @clerk/nextjs in Client Components. It advises never mixing the two.

Does this skill work with Next.js 15 or earlier?

Yes, the source notes that Next.js 15 and earlier use middleware.ts in place of proxy.ts for middleware configuration.

Why does my cache return another user's data?

The source says the usual cause is a missing userId in the unstable_cache key. Including userId in the key fixes it.

How do I install clerk-nextjs-patterns?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is clerk-nextjs-patterns free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is clerk-nextjs-patterns safe to use?

It scores 62 of 100. Grades: maintenance A, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to clerk-nextjs-patterns?

Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.

clerk-nextjs-patterns Install

Add to stack

Loading.