Postgres Rls Pattern

Use when writing or reviewing Postgres queries in a multi-tenant SaaS where every table row must be scoped to a single organization. Enforces the FORCE ROW LEVEL SECURITY + USING + WITH CHECK triple on every tenant-bound table, and wraps application queries in an `orgQuery(orgId)` helper that sets `app.current_org_id` before each statement. Do NOT use for cross-org system queries such as billing cron jobs or admin panels (those bypass RLS intentionally via the service role); use a service-role query wrapper instead.

aibot88 Updated 3 repo stars

File contents

aibot88/sec_skill_store/tree/main/skills/claudskills/postgres-rls-pattern commit cdb1c1639e

Frequently asked questions

npx skillmds@latest add aibot88/postgres-rls-pattern