nextjs-supabase-auth
What it does
This skill gives your AI agent expert patterns for adding Supabase authentication to a Next.js app. It is for developers building login, protected pages and sessions with Supabase.
When to use it
- ✓When you add Supabase login or sign-up to a Next.js App Router app.
- ✓When you need to protect pages so only signed-in users can open them.
- ✓When you want to set up the OAuth callback route for Supabase sign-in.
Skill link
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/nextjs-supabase-auth/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Add Supabase email login to my Next.js app and protect the dashboard route.”
5 new skills a week. 1 minute to read.
How it works
The agent creates properly configured Supabase clients for each context, refreshes sessions in middleware, and handles the OAuth callback to exchange the code for a session.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Next.js + Supabase Auth
You are an expert in integrating Supabase Auth with Next.js App Router. You understand the server/client boundary, how to handle auth in middleware, Server Components, Client Components, and Server Actions.
Your core principles:
- Use @supabase/ssr for App Router integration
- Handle tokens in middleware for protected routes
- Never expose auth tokens to client unnecessarily
- Use Server Actions for auth operations when possible
- Understand the cookie-based session flow
Capabilities
- nextjs-auth
- supabase-auth-nextjs
- auth-middleware
- auth-callback
Requirements
- nextjs-app-router
- supabase-backend
Patterns
Supabase Client Setup
Create properly configured Supabase clients for different contexts
Auth Middleware
Protect routes and refresh sessions in middleware
Auth Callback Route
Handle OAuth callback and exchange code for session
Anti-Patterns
❌ getSession in Server Components
❌ Auth State in Client Without Listener
❌ Storing Tokens Manually
Related Skills
Works well with: nextjs-app-router, supabase-backend
FAQ
Which Supabase package does it use?
It uses the @supabase/ssr package for App Router integration.
Where should tokens be handled?
The skill says to handle tokens in middleware and avoid exposing them to the client.
What mistakes does it warn about?
It warns against using getSession in Server Components and against storing tokens manually.
Details
Original description by the author
Expert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected route.
Popularity
- GitHub stars
- 33k
- Ranking position
- #8784
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
owasp-security
33kTeaches your agent OWASP security guidance for web apps, APIs, mobile, containers and AI agents, so it can spot common weaknesses and suggest fixes.
agent-management
33kLets your agent create, list, hibernate, wake, rename and delete AI agents using the AI Maestro command line, managing each agent's lifecycle.
agent-messaging
33kLets your agent send, receive and reply to signed messages between AI agents, using the Agent Messaging Protocol, mostly on your own machine.
docs-search
33kLets your agent search auto-generated code documentation for function signatures, class definitions and comments, so it checks the real API before changing code.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.