home / skills / jcastillotx / vibe-skeleton-app / supabase-best-practices
This skill enforces Supabase best practices across security, schema design, authentication, real-time, edge functions, and performance for robust apps.
npx playbooks add skill jcastillotx/vibe-skeleton-app --skill supabase-best-practicesReview the files below or copy the command above to add this skill to your agents.
---
name: supabase-best-practices
description: Supabase development standards. Triggers when working with Supabase projects, Row Level Security, real-time subscriptions, or Edge Functions.
trigger_patterns:
- supabase
- row level security
- rls
- auth.uid
- edge function
- realtime
- supabase-js
auto_load_with: []
---
# Supabase Best Practices
Comprehensive coding standards for Supabase development, optimized for AI agents and LLMs.
## Overview
This skill provides 22 rules organized across 8 categories:
1. **Security (RLS) (rls-)** - Row Level Security policies, auth patterns [CRITICAL]
2. **Database Design (schema-)** - Foreign keys, constraints, migrations [CRITICAL]
3. **Authentication (auth-)** - OAuth, MFA, session management [HIGH]
4. **Real-time (realtime-)** - Subscriptions, presence, broadcast [HIGH]
5. **Edge Functions (edge-)** - Deno deploy, secrets, logging [MEDIUM-HIGH]
6. **Storage (storage-)** - Bucket policies, transformations [MEDIUM]
7. **Performance (perf-)** - Connection pooling, indexes [MEDIUM]
8. **Client Libraries (client-)** - Type generation, hooks [LOW-MEDIUM]
## Usage
Reference this skill when:
- Designing Supabase database schemas
- Implementing Row Level Security
- Building real-time features
- Creating Edge Functions
- Configuring authentication
## Build
```bash
pnpm build # Compile rules to AGENTS.md
pnpm validate # Validate rule files
```
This skill codifies Supabase development standards for secure, maintainable projects. It focuses on Row Level Security, database design, real-time features, Edge Functions, authentication, storage, performance, and client tooling. Use it as a checklist to reduce risks and speed up common Supabase tasks.
The skill inspects project patterns and recommends concrete rules across eight categories: security (RLS), schema design, auth, realtime, Edge Functions, storage, performance, and client libraries. It flags risky configurations, suggests hardened defaults, and provides actionable steps for migrations, policy definitions, subscription handling, and deployment best practices. Outputs aim to be implementable in code or CI checks.
Will this skill break existing behavior when enforcing rules?
No — recommendations prioritize safe rollout: add policies in permissive mode, run tests and gradual enforcement before blocking access.
How do I test Row Level Security effectively?
Use separate test users and service accounts in staging, run integration tests covering allowed and denied access, and include automated policy validations in CI.
Can I use Edge Functions for heavy compute or long-running jobs?
Edge Functions are best for short, secure server-side logic. Offload heavy or long-running tasks to background workers or managed job queues.