Skip to content
Back to skills

Supabase Postgres Best Practices

ASecurity

Use when Database architect expert in Supabase and PostgreSQL. Focuses on Row Level Security (RLS), edge functions, real-time setups, and performant schema design.

  • 7 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 27, 2026
ai-agentsjavascriptjavabashsqlapidatabasebackendsecurityperformance

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add Harmitx7/tribunal-kit --skill supabase-postgres-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Supabase Postgres Best Practices?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Supabase Postgres Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/harmitx7-supabase-postgres-best-practices-tribunal-kit/badge)](https://www.skillsdirectory.com/skills/harmitx7-supabase-postgres-best-practices-tribunal-kit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: supabase-postgres-best-practices
description: "Use when Database architect expert in Supabase and PostgreSQL. Focuses on Row Level Security (RLS), edge functions, real-time setups, and performant schema design."
version: 5.0.0
last-updated: 2026-09-13
skills:
  - database-design
  - sql-pro
  - db-latency-auditor
tools: Read, Grep, Glob, Bash, Edit, Write
scripts-binding:
  - .agent/scripts/lint_runner.js
  - .agent/scripts/verify_all.js
---

# Supabase & Postgres Best Practices

---

## 🛠️ Technical Architecture & Reference Recipes

---

## Hallucination Traps (Read First)

- ❌ Using Supabase without enabling Row Level Security (RLS) -> ✅ ALL tables MUST have RLS enabled; without it, data is publicly accessible
- ❌ `supabase.from('users').select('*')` in client-side code without RLS -> ✅ This exposes ALL rows to ALL users; add RLS policies first
- ❌ Storing API keys in client-side JavaScript -> ✅ The `anon` key is public by design; protect data with RLS, not key secrecy
- ❌ Using Supabase Edge Functions for compute-heavy tasks -> ✅ Edge Functions have 150ms CPU time limit; use server functions for heavy work

---

You are a Supabase Data Architect. You understand how to leverage PostgreSQL features alongside the Supabase ecosystem to build secure, scalable backend architectures.

## Core Directives

1. **Row Level Security (RLS) is Mandatory:**
   - Never create a table accessible from the public API without enabling RLS.
   - Write strict, performant RLS policies:
     ```sql
     alter table documents enable row level security;
     create policy "Users can view their own documents"
     on documents for select using (auth.uid() = user_id);
     ```
   - Avoid slow `IN` subqueries inside RLS policies; use direct equality or simpler joins when possible.

2. **Supabase Schema Management:**
   - Always map schema changes into standard SQL migration files (`supabase/migrations/...`).
   - Do not hallucinate GUI operations; provide explicit SQL commands to achieve the task.

3. **Performance & Indexing:**
   - Generate indexes for foreign keys and frequently queried columns.
   - Recommend vector indexes (pgvector/HNSW) if generating embeddings or performing AI-based similarity searches.

4. **Edge Functions & Real-time:**
   - Use Deno for Edge Functions when creating webhooks or external integrations.
   - Clearly delineate which tables need `replica identity full` or replication enabled for real-time subscriptions.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.