Token导航 LogoToken导航

Agent Skill · 前端设计

supabase-auth-ssr-setup(Supabase auth SSR 设置)

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

supabase-auth-ssr-setup 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 6,896。

总安装 445周安装 18GitHub Stars 3下载 140核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:supabase-auth-ssr-setup(Supabase auth SSR 设置)
来源仓库:https://github.com/hopeoverture/worldbuilding-app-skills
仓库路径:skills/supabase-auth-ssr-setup
安装命令:
npx skills add https://github.com/hopeoverture/worldbuilding-app-skills --skill supabase-auth-ssr-setup
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/hopeoverture/worldbuilding-app-skills --skill supabase-auth-ssr-setup

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

辅助安全审计和认证流程分析,支持常见漏洞排查。适合梳理敏感配置和检查依赖风险。通过 npx 命令从指定 GitHub 仓库安装并使用该技能。涉及密钥或用户数据时需确认最小权限和操作边界。supabase-auth-ssr-setup 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/supabase-auth-ssr-setup

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/hopeoverture/worldbuilding-app-skills --skill…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

supabase-auth-ssr-setup 怎么安装?

在终端执行 npx skills add https://github.com/hopeoverture/worldbuilding-app-skills --skill supabase-a…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

supabase-auth-ssr-setup 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

supabase-auth-ssr-setup 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

supabase-auth-ssr-setup 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

supabase-auth-ssr-setup 用的人多吗?

公开数据是累计安装 445 次,近一周安装 18 次,下载 140 次,GitHub 3 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

supabase-auth-ssr-setup 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
supabase-auth-ssr-setup

Supabase auth SSR 设置 · 本页

4453接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Supabase Auth SSR Setup

Overview

Configure Supabase Authentication for Next.js App Router with server-side rendering (SSR), secure cookie-based sessions, middleware protection, and complete authentication flows.

Installation and Configuration Steps

1. Install Dependencies

Install Supabase SSR package for Next.js:

npm install @supabase/supabase-js @supabase/ssr

2. Create Supabase Client Utilities

Create three client configurations for different contexts (browser, server, middleware):

File: lib/supabase/client.ts (Browser client)

Use the template from assets/supabase-client.ts. This client:

  • Runs only in browser context
  • Uses secure cookies for session storage
  • Automatically refreshes tokens

File: lib/supabase/server.ts (Server component client)

Use the template from assets/supabase-server.ts. This client:

  • Creates server-side Supabase client with cookie access
  • Used in Server Components and Server Actions
  • Provides read-only cookie access for security

File: lib/supabase/middleware.ts (Middleware client)

Use the template from assets/supabase-middleware.ts. This client:

  • Used in Next.js middleware for route protection
  • Can update cookies in responses
  • Refreshes sessions on route navigation

3. Configure Environment Variables

Add Supabase credentials to .env.local:

NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

Get these values from your Supabase project settings under API.

Security note: The anon key is safe to expose publicly. Real security comes from Row Level Security (RLS) policies in your database.

4. Create Middleware for Route Protection

Create middleware.ts in project root using the template from assets/middleware.ts. This middleware:

  • Refreshes Supabase session on every request
  • Protects routes matching specified patterns
  • Redirects unauthenticated users to login
  • Allows public routes to bypass authentication

Configure protected routes by adjusting the matcher pattern:

export const config = {
  matcher: [
    '/dashboard/:path*',
    '/settings/:path*',
    '/api/protected/:path*',
  ],
};

5. Create Authentication Utilities

Create helper functions for common auth operations using templates from assets/auth-utils.ts:

Get current user server-side:

import { getCurrentUser } from '@/lib/auth/utils';

const user = await getCurrentUser();

Require authentication:

import { requireAuth } from '@/lib/auth/utils';

const user = await requireAuth(); // Throws error if not authenticated

Get session:

import { getSession } from '@/lib/auth/utils';

const session = await getSession();

These utilities simplify authentication checks in Server Components and Server Actions.

6. Create Logout Server Action

Create app/actions/auth.ts using the template from assets/auth-actions.ts. This provides:

Logout action:

  • Clears Supabase session
  • Removes auth cookies
  • Redirects to home page

Use in client components:

import { logout } from '@/app/actions/auth';

<button onClick={() => logout()}>
  Sign Out
</button>

7. Create Login Page

Create app/login/page.tsx using the template from assets/login-page.tsx. This page:

  • Provides email/password login form
  • Handles magic link authentication
  • Supports OAuth providers (Google, GitHub, etc.)
  • Redirects authenticated users
  • Shows error messages

Customize the login page:

  • Add your branding and styling
  • Enable/disable OAuth providers
  • Add password reset link
  • Include sign-up link

8. Create Protected Route Example

Create a protected dashboard page at app/dashboard/page.tsx using the template from assets/dashboard-page.tsx. This demonstrates:

  • Using requireAuth() to protect routes
  • Displaying user information
  • Including logout functionality
  • Server-side authentication check

9. Set Up Callback Route for OAuth

If using OAuth providers, create app/auth/callback/route.ts using the template from assets/auth-callback-route.ts. This handler:

  • Exchanges OAuth code for session
  • Sets secure session cookies
  • Redirects to intended destination
  • Handles OAuth errors

Configure OAuth in Supabase dashboard:

  1. Go to Authentication > Providers
  2. Enable desired providers (Google, GitHub, etc.)
  3. Add redirect URL: https://your-domain.com/auth/callback

Authentication Flow

Login Flow

  1. User visits /login
  2. User enters credentials or clicks OAuth
  3. Supabase authenticates and sets session cookie
  4. User redirected to dashboard or intended page
  5. Middleware validates session on protected routes

Session Refresh Flow

  1. User navigates to any route
  2. Middleware runs and refreshes session if needed
  3. Updated session cookie sent to client
  4. Server Components have access to fresh session

Logout Flow

  1. User clicks logout button
  2. Server Action calls Supabase signOut()
  3. Session and cookies cleared
  4. User redirected to home page

Route Protection Patterns

Protecting Individual Pages

Use requireAuth() at the top of Server Components:

import { requireAuth } from '@/lib/auth/utils';

export default async function ProtectedPage() {
  const user = await requireAuth();

  return <div>Hello {user.email}</div>;
}

Protecting Route Groups

Use Next.js route groups with layout:

// app/(protected)/layout.tsx
import { requireAuth } from '@/lib/auth/utils';

export default async function ProtectedLayout({ children }) {
  await requireAuth();
  return <>{children}</>;
}

All routes in (protected) group are automatically protected.

Optional Authentication

Check if user is logged in without requiring it:

import { getCurrentUser } from '@/lib/auth/utils';

export default async function OptionalAuthPage() {
  const user = await getCurrentUser();

  return (
    <div>
      {user ? `Welcome ${user.email}` : 'Please log in'}
    </div>
  );
}

Server Actions with Authentication

Protect Server Actions using requireAuth():

'use server';

import { requireAuth } from '@/lib/auth/utils';
import { createServerClient } from '@/lib/supabase/server';

export async function updateProfile(formData: FormData) {
  const user = await requireAuth();
  const supabase = createServerClient();

  const { error } = await supabase
    .from('profiles')
    .update({ name: formData.get('name') })
    .eq('id', user.id);

  if (error) throw error;
}

Troubleshooting

Session not persisting: Verify cookies are being set. Check browser dev tools > Application > Cookies. Ensure domain matches.

Middleware redirect loop: Check matcher pattern doesn't include login page. Verify /login is accessible without auth.

OAuth redirect fails: Confirm callback URL matches exactly in Supabase dashboard. Check for trailing slashes.

TypeScript errors: Install types: npm install -D @types/node. Ensure supabase is typed correctly.

401 errors on protected routes: Session may be expired. Check Supabase dashboard > Authentication > Settings for session timeout.

Resources

scripts/

No executable scripts needed for this skill.

references/

  • authentication-patterns.md - Common auth patterns and best practices for Next.js + Supabase
  • security-considerations.md - Security best practices for session handling and cookie configuration

assets/

  • supabase-client.ts - Browser-side Supabase client configuration
  • supabase-server.ts - Server-side Supabase client for Server Components
  • supabase-middleware.ts - Middleware Supabase client for session refresh
  • middleware.ts - Next.js middleware for route protection
  • auth-utils.ts - Helper functions for authentication checks
  • auth-actions.ts - Server Actions for logout and other auth operations
  • login-page.tsx - Complete login page with email/password and OAuth
  • dashboard-page.tsx - Example protected page using requireAuth
  • auth-callback-route.ts - OAuth callback handler for provider authentication

平台分布

Codex

34.35%
按下载量换算48

Claude

28.97%
按下载量换算41

Cursor

21.28%
按下载量换算30

Gemini CLI

9.13%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills