本文へスキップ
Skillpedia
セキュリティ33k · #8784

nextjs-supabase-auth

できること

このスキルにより、AIはNext.jsアプリにSupabaseの認証を追加する専門的なパターンを使えます。Supabaseでログイン、保護されたページ、セッションを作る開発者向けです。

使う場面

  • ✓Next.jsのApp RouterアプリにSupabaseのログインやサインアップを追加するとき。
  • ✓サインインしたユーザーだけが開けるように、ページを保護する必要があるとき。
  • ✓Supabaseのサインイン用のOAuthコールバックのルートを設定したいとき。

スキルのリンク

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/nextjs-supabase-auth/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/nextjs-supabase-auth/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私のNext.jsアプリにSupabaseのメールログインを追加して、ダッシュボードのルートを保護してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、それぞれの文脈に合わせて適切に設定されたSupabaseのクライアントを作り、ミドルウェアでセッションを更新し、OAuthのコールバックを処理してコードをセッションに交換します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)を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:

  1. Use @supabase/ssr for App Router integration
  2. Handle tokens in middleware for protected routes
  3. Never expose auth tokens to client unnecessarily
  4. Use Server Actions for auth operations when possible
  5. 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

よくある質問

どのSupabaseのパッケージを使いますか?

App Routerとの連携には、@supabase/ssrパッケージを使います。

トークンはどこで扱うべきですか?

このスキルは、トークンをミドルウェアで扱い、クライアントに公開しないよう勧めています。

どんな間違いについて警告していますか?

Server ComponentsでのgetSessionの使用と、トークンの手動での保存に警告しています。

詳細

作者による元の説明

Expert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected route.

repo: davila7/claude-code-templates

人気

GitHubのスター
33k
ランキング
#8784
ライセンス
MIT
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル