Agent skill
supabase-connection
Manejo seguro de autenticación, RLS y conexión a base de datos y storage con Supabase.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/supabase-connection
SKILL.md
Supabase Connection Skill
Description
Estándares para conectar e interactuar con Supabase (Base de datos, Auth y Storage) tanto desde Frontend como Backend.
Trigger
- Modificaciones en esquemas de BD (
schema.prismao SQL). - Implementación de Login/Auth.
- Subida de archivos (Storage).
- Edición de políticas RLS.
Resources
Best Practices
-
Row Level Security (RLS) SIEMPRE:
- Nunca desactivar RLS en producción.
- Definir políticas claras en SQL o mediante Prisma (si aplica).
- Utilizar
auth.uid()para restringir acceso a datos de usuario.
-
Cliente Tipado:
- En Frontend: Usar
createClientComponentClientocreateServerComponentClient(Next.js Auth Helpers) para propagar cookies de sesión automáticamente. - En Backend (Python): Usar
supabase-pycon la claveSERVICE_ROLESOLO para tareas administrativas. Para acciones de usuario, pasar el JWT.
- En Frontend: Usar
-
Variables de Entorno:
NEXT_PUBLIC_SUPABASE_URL: URL pública.NEXT_PUBLIC_SUPABASE_ANON_KEY: Clave pública (segura para navegador).SUPABASE_SERVICE_ROLE_KEY: PRIVADA. Nunca exponer al cliente.
-
Backend (FastAPI) Auth:
- Validar el JWT de Supabase en cada endpoint protegido.
- No confiar ciegamente en el frontend.
Code Snippets
Next.js Server Component (Fetch Data)
import { createServerComponentClient } from '@supabase/auth-helpers-nextjs'
import { cookies } from 'next/headers'
export default async function Page() {
const supabase = createServerComponentClient({ cookies })
const { data } = await supabase.from('todos').select()
return <pre>{JSON.stringify(data, null, 2)}</pre>
}
Python FastAPI (Verify JWT)
from supabase import create_client, Client
url: str = os.environ.get("SUPABASE_URL")
key: str = os.environ.get("SUPABASE_KEY")
supabase: Client = create_client(url, key)
def get_current_user(token: str):
user = supabase.auth.get_user(token)
if not user:
raise HTTPException(status_code=401, detail="Invalid token")
return user
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?