supabase-production

Enforce server-only Supabase access, deny-all RLS, and CLI-driven migrations for production databases.

579|76|Updated Oct 29, 2026
Ready to run
npx skills add https://github.com/phuryn/product-engineering --skill supabase-production-phuryn
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: supabase-production
Source: https://github.com/phuryn/product-engineering/tree/main/app-stack/skills/supabase-production
Command: npx skills add https://github.com/phuryn/product-engineering --skill supabase-production-phuryn

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Supabase quickstarts and defaults expose security gaps: browser keys, RLS as the access control boundary, and migrations applied through dashboards or integrations rather than version-controlled CLI commands. This Skill enforces the architectural choices that prevent credential leaks, unauthorized data access, and schema drift between environments. ## Core Features & Use Cases - Deny-all RLS enforcement: Guarantees every table has RLS enabled with zero policies, blocking any key except the server-side secret key from direct table access. - Server-only credential management: One module holds the secret key with no session persistence; all other runtimes (Workers, jobs, scheduled tasks) get their own Postgres logins with function-level grants only. - CLI-driven schema management: Migrations are version-controlled files applied through the CLI against an explicitly stated database URL, never through the dashboard or GitHub integration, eliminating schema drift and silent failures. - Use Case: A SaaS application serving multiple tenants must prevent a leaked publishable key from reading any row. Apply deny-all RLS, tie tenant isolation to three authorization functions, and prove it with an automated catalog suite that runs in CI. ## Quick Start Before building the database layer, read the access model to decide whether your app server holds the secret key alone, then verify that development migrations apply through the CLI with an explicit connection string.

Frequently Asked Questions about supabase-production

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent a leaked Supabase publishable key from reading my database?▼

Enable RLS on every table with zero policies (deny-all for every non-server role), then verify with a catalog suite that asserts no policies exist and only the secret key bypasses RLS. The publishable key then reads nothing, no matter which endpoint it reaches.

Should I apply Supabase migrations through the GitHub integration or the CLI?▼

Use the CLI with an explicit --db-url pointing to your target database. Never use the GitHub integration or link the CLI to a remembered project. This prevents silent migrations to the wrong environment and ensures every deployment is intentional and auditable.

Can my Worker or scheduled job use the same Supabase secret key as the app server?▼

No. Each separate runtime gets its own Postgres login with EXECUTE grants on only its functions, never the secret key. A leaked login then does only what that component does. The secret key bypasses RLS entirely and must stay server-only.

What happens if I edit a migration after it has been applied to production?▼

Never edit an applied migration. Write a new compensating migration instead. Applied migrations must be immutable so the ledger and file directory stay in sync and every environment can replay the same sequence.

Why does my migration fail when applying it to production with the CLI?▼

Check that the --db-url points to the correct production database, that the connection string carries the session pooler host if your machine lacks IPv6, and that every parameter uses the correct TLS mode (sslmode=verify-full with Supabase's CA certificate or sslmode=require without certificate verification).

How do I know if my production project applies migrations automatically when I push to git?▼

Read the production project's branches in the dashboard or with 'supabase branches list --project-ref'. If the GitHub integration's 'Deploy to production' option is enabled, a push applies pending migrations; otherwise, migrations are never applied automatically and you must apply them by CLI before promoting code.