skills/supabase-google-auth/SKILL.md
Guide for integrating Google OAuth login into Supabase + React projects. Use when user asks to add Google login, integrate Gmail account sign-in, implement Supabase Google OAuth, use supabase signInWithOAuth, add Google login button, set up Auth Provider, create login dialog, or implement auth-gating. Covers Google Cloud Console setup, Supabase provider configuration, React Auth Hook pattern, LoginPromptDialog, and route protection.
npx skillsauth add tibelf/ai_project_init supabase-google-authInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
在 Supabase + React 项目中集成 Google 账号登录,分三步完成: 配置 → React 实现 → 路由保护。
读取详细步骤:references/supabase-console-setup.md
要点:
https://<project-id>.supabase.co/auth/v1/callback 加入授权重定向 URIVITE_SUPABASE_URL 和 VITE_SUPABASE_PUBLISHABLE_KEY读取完整代码模式:references/react-patterns.md
共三个模式:
Pattern 1 — Auth Hook(useAuth.tsx)
AuthContext + AuthProvidersupabase.auth.onAuthStateChange 监听状态变化supabase.auth.getSession() 初始化已有 session{ user, loading, signOut }App.tsx 根节点包裹 <AuthProvider>Pattern 2 — LoginPromptDialog
supabase.auth.signInWithOAuth({ provider: 'google', options: { redirectTo: window.location.origin } })useEffect 检测 user 变为非 null 时自动关闭弹窗Pattern 3 — Auth-Gating 路由保护
ALLOWED_EMAILS.includes(user.email) → 不在列表则 <Navigate to="/" />如项目使用 react-i18next,将登录相关字符串提取到翻译文件:
auth.loginTitle、auth.loginDescription、auth.googleLoginconst { t } = useTranslation() 替换硬编码字符串详见 references/react-patterns.md 末尾的 i18n 章节。
| 文件 | 内容 |
|------|------|
| references/supabase-console-setup.md | Google Cloud Console + Supabase Console 完整配置步骤、环境变量、常见错误 |
| references/react-patterns.md | 三个 React 模式的完整代码:Auth Hook、LoginPromptDialog、路由保护 |
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
tools
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
development
When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," or "SEO health check." For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema-markup.