Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计提醒

supabase-clerk-syncSupabase clerk sync 命令行

Agent Skill

supabase-clerk-sync 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

235

周安装

10

GitHub Stars

10

下载量

82
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/vanman2024/ai-dev-marketplace --skill supabase-clerk-sync

简介

处理 GitHub 仓库、Issue 和 Pull Request 等协作信息。

  • 适用于围绕仓库状态和代码变更进行整理的需求。
  • 通过 npx 命令从指定 GitHub 仓库安装并使用该技能。
  • 建议确认权限范围和维护状态,避免触发不必要的联网或文件操作。
  • supabase-clerk-sync 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Supabase-Clerk Sync

Comprehensive integration patterns for syncing Clerk authentication with Supabase databases, including JWT configuration, RLS policies, webhook setup, and user data synchronization.

Instructions

When Integrating Clerk with Supabase

  1. JWT Configuration Strategy

- Configure Supabase to validate Clerk JWT tokens - Extract Clerk JWT template from dashboard - Configure Supabase auth settings with Clerk JWKS endpoint - Map Clerk user claims to Supabase RLS policies - Handle JWT expiration and refresh flows

  1. User Sync Architecture

- Choose sync strategy: Webhook-based (recommended) or Client-side - Set up Clerk webhooks for user lifecycle events - Create Supabase tables for user profile data - Implement idempotent sync operations - Handle race conditions and eventual consistency

  1. RLS Policy Design

- Use Clerk sub claim as user identifier in policies - Extract user metadata from JWT for policy decisions - Implement role-based access with Clerk organizations - Create policies for user-owned resources - Test policies with different JWT claims

  1. Webhook Implementation

- Verify Clerk webhook signatures (svix library) - Handle user.created, user.updated, user.deleted events - Implement retry logic for failed syncs - Log sync operations for debugging - Use Supabase service role key for webhook operations

Integration Workflow

Phase 1: JWT Setup

  1. Get Clerk JWKS URL from dashboard
  2. Configure Supabase auth.jwt_secret
  3. Update Supabase JWT settings with Clerk issuer
  4. Test JWT validation with sample tokens

Phase 2: Database Schema

  1. Create users table with Clerk ID mapping
  2. Add user metadata columns
  3. Set up RLS policies using JWT claims
  4. Create indexes for performance

Phase 3: Webhook Configuration

  1. Deploy webhook endpoint (Supabase Edge Function or external)
  2. Register webhook URL in Clerk dashboard
  3. Select user events to sync
  4. Implement signature verification

Phase 4: Client Integration

  1. Configure Supabase client with Clerk session token
  2. Implement token refresh in client
  3. Test authenticated requests
  4. Handle authentication errors

Security Best Practices

JWT Validation:

  • Always verify JWT signature with Clerk JWKS
  • Validate issuer matches Clerk instance
  • Check token expiration
  • Reject tokens with missing required claims

RLS Policies:

  • Use auth.uid() to extract Clerk user ID from JWT
  • Never trust client-provided user IDs
  • Test policies with different user roles
  • Implement least-privilege access

Webhook Security:

  • Verify Svix signatures on all webhook requests
  • Use HTTPS for webhook endpoints
  • Store Clerk webhook secret securely
  • Implement rate limiting on webhook endpoints

API Keys:

  • Never hardcode API keys in client code
  • Use environment variables for secrets
  • Rotate keys periodically
  • Use Supabase anon key for client, service role for webhooks

Sync Strategies

Webhook-Based Sync (Recommended):

  • Real-time synchronization
  • Server-side security
  • Centralized logic
  • Better error handling
  • Recommended for production

Client-Side Sync:

  • User initiates sync on login
  • Requires RLS policies for user writes
  • Simpler setup for prototypes
  • Race conditions possible

Common Integration Patterns

Pattern 1: Public Profile with Private Data

users_public (readable by all, RLS enforced)
  - clerk_id
  - username
  - avatar_url

users_private (readable only by owner)
  - clerk_id
  - email
  - metadata

Pattern 2: Organization-Based Access

RLS Policy:
  auth.jwt()->>'org_id' = organizations.clerk_org_id

Pattern 3: Role-Based Permissions

RLS Policy:
  auth.jwt()->>'role' IN ('admin', 'editor')

Troubleshooting

JWT Validation Fails:

  • Verify JWKS URL is correct
  • Check Supabase JWT secret configuration
  • Ensure token hasn't expired
  • Validate issuer claim matches

User Sync Delays:

  • Check webhook delivery in Clerk dashboard
  • Verify webhook endpoint is accessible
  • Review webhook logs for errors
  • Confirm Supabase connection

RLS Policy Denies Access:

  • Inspect JWT claims in request
  • Test policy SQL in Supabase SQL editor
  • Verify user ID extraction from JWT
  • Check table permissions

Scripts

Automated setup and configuration scripts:

  • scripts/setup-sync.sh - Configure Supabase for Clerk JWT validation
  • scripts/configure-rls.sh - Generate RLS policies for Clerk authentication
  • scripts/create-webhooks.sh - Deploy webhook infrastructure
  • scripts/test-jwt.sh - Test JWT validation and claim extraction
  • scripts/sync-users.sh - Manually trigger user synchronization

Templates

Integration code templates for different scenarios:

TypeScript Templates

  • templates/supabase-client-clerk.ts - Supabase client with Clerk session token
  • templates/webhook-sync.ts - Clerk webhook handler for user sync
  • templates/edge-function-webhook.ts - Supabase Edge Function webhook
  • templates/middleware-auth.ts - Next.js middleware with Clerk + Supabase

SQL Templates

  • templates/rls-policies-clerk.sql - Comprehensive RLS policies
  • templates/user-schema.sql - User tables schema
  • templates/triggers.sql - Database triggers for audit logging

Configuration Templates

  • templates/env.example - Environment variables template
  • templates/clerk-jwt-template.json - JWT template configuration

Examples

Complete working examples:

  • examples/complete-integration.tsx - Full Next.js app with Clerk + Supabase
  • examples/webhook-handler.ts - Production webhook implementation
  • examples/protected-route.tsx - Protected page with RLS
  • examples/organization-access.tsx - Multi-tenant with organizations

Migration Guide

From Supabase Auth to Clerk

  1. Export Users:

- Extract user data from Supabase auth.users - Prepare user import CSV for Clerk

  1. Update Database:

- Add clerk_id column to user tables - Migrate RLS policies to use JWT claims - Update foreign key references

  1. Deploy Webhooks:

- Set up webhook infrastructure - Enable user sync

  1. Update Client:

- Replace Supabase auth with Clerk - Update Supabase client initialization - Test authentication flows

  1. Cutover:

- Enable Clerk in production - Disable Supabase Auth - Monitor for issues

Performance Optimization

Database Indexes:

CREATE INDEX idx_users_clerk_id ON users(clerk_id);
CREATE INDEX idx_orgs_clerk_org_id ON organizations(clerk_org_id);

Webhook Performance:

  • Use database connection pooling
  • Batch user updates when possible
  • Implement async processing for large syncs
  • Cache frequently accessed user data

Client Performance:

  • Cache Supabase client instance
  • Refresh tokens proactively
  • Use Supabase realtime for live updates
  • Implement optimistic updates

Reference Documentation

Clerk:

  • JWT Templates: Configure custom claims for Supabase
  • Webhooks: Event types and payload structure
  • Organizations: Multi-tenant patterns

Supabase:

  • JWT Authentication: Custom JWT provider setup
  • RLS Policies: Policy syntax and testing
  • Edge Functions: Serverless webhook handlers
  • PostgreSQL Functions: Custom JWT claim extraction

Security Checklist

Before going to production:

  • JWT signature validation configured
  • Webhook signatures verified
  • RLS policies tested with different users
  • Service role key stored securely
  • Webhook endpoint uses HTTPS
  • Rate limiting implemented
  • Error logging configured
  • User data encrypted at rest
  • API keys rotated
  • Audit logging enabled

Use When

  • Integrating Clerk authentication with Supabase database
  • Syncing user profiles from Clerk to Supabase
  • Implementing Row Level Security with Clerk JWT tokens
  • Setting up webhooks for real-time user synchronization
  • Building multi-tenant applications with Clerk organizations
  • Migrating from Supabase Auth to Clerk
  • Configuring secure database access with external auth provider
  • Implementing organization-based data access patterns

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.06%
按下载量换算28

Claude

28.85%
按下载量换算24

Cursor

19.03%
按下载量换算16

Gemini CLI

9.07%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills