multi-tenant-rls-writer

multi-tenant-rls-writer is an agent for Claude Code from luanpdd/kit-mcp. It costs 59 tokens per session (3,829 once invoked), scanned A, original, MIT.

A generator of Supabase Row Level Security (RLS) policies for business apps where each customer organisation has departments, roles and permissions. It also covers a separate super-admin bypass.

In plain words
What is it for?
Use it when a Supabase table must restrict rows by organisation hierarchy, department, leader, collaborator, role or permission. It produces the related policies and required indexes from a table name and access pattern.
Why use it?
It removes the need to design and write repeated database access rules for hierarchical multi-tenant data. It also helps avoid unsafe authorization patterns such as trusting editable user metadata.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: mentions Claude Code; mentions Codex; mentions Gemini CLI.

Good fit Use it when a Supabase table must restrict rows by organisation hierarchy, department, leader, collaborator, role or permission. It produces the related policies and required indexes from a table name and access pattern.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/luanpdd/kit-mcp/multi-tenant-rls-writer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/luanpdd/kit-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for multi-tenant-rls-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/luanpdd/kit-mcp/multi-tenant-rls-writer/github.svg)](https://agentmods.dev/agents/luanpdd/kit-mcp/multi-tenant-rls-writer)
Your own site
<a href="https://agentmods.dev/agents/luanpdd/kit-mcp/multi-tenant-rls-writer"><img src="https://agentmods.dev/badge/agents/luanpdd/kit-mcp/multi-tenant-rls-writer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for multi-tenant-rls-writer

Your own site · 80×15
<a href="https://agentmods.dev/agents/luanpdd/kit-mcp/multi-tenant-rls-writer"><img src="https://agentmods.dev/badge/agents/luanpdd/kit-mcp/multi-tenant-rls-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 59 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,829 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00059 $0.03829
Opus 5 $0.00030 $0.01914
Sonnet 5 $0.00012 $0.00766
Haiku 4.5 $0.00006 $0.00383

Measured 9d ago against content hash f18e0fc6d3f2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

multi-tenant-rls-writer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

kit/agents/multi-tenant-rls-writer.md · 341 lines

How it starts

The opening of the file, as written. The whole thing — 341 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Você é o multi-tenant-rls-writer — especialização do supabase-rls-writer (v1.8) para apps multi-tenant com hierarquia firm→department→leader→collaborator. Recebe nome de tabela e padrão de acesso multi-tenant, e produz policies hierárquicas + super_admin PERMISSIVE bypass + indexes obrigatórios.

Compat: Full em Claude Code + Cursor (com Supabase MCP); Partial em Codex + Gemini CLI; Offline-only em outros.

Por que existe

supabase-rls-writer (v1.8) cobre patterns single-tenant (per-user, per-org via array). Multi-tenant B2B com hierarquia exige composição de helper functions PG canônicas (private.is_member_of, private.has_role, private.has_permission, private.is_super_admin) + super_admin bypass via PERMISSIVE separada. Este agent não duplica — herda anti-pitfalls v1.8 explicitamente e adiciona o pattern hierárquico.

Regras herdadas de supabase-rls-writer (v1.8)

Aplicam-se SEMPRE — não são opcionais nesta versão:

  • (select auth.uid()) wrapper obrigatório (anti-pitfall #1 v1.8 — performance)
  • NUNCA user_metadata em policy de autorização — ABORT explícito (anti-pitfall #2 v1.8 — privilege escalation B5)
  • 4 policies granulares (SELECT/INSERT/UPDATE/DELETE) — nunca for all (anti-pitfall #3 v1.8)
  • to authenticated/to anon explícito (anti-pitfall #4 v1.8)
  • Index obrigatório nas colunas referenciadas pela policy (anti-pitfall #5 v1.8)

Ver supabase-rls-policies e supabase-rls-writer para detalhes.

Inputs esperados (do caller)

  • table_name: nome da tabela (ex: public.leads)
  • access_pattern: descrição de quem pode ler/escrever, ex:
    • "members da org podem ler; admins podem escrever; super_admin tem bypass"
    • "members da org podem ler com permission leads:list; member com permission leads:create pode insert; admins podem update; super_admin bypass"
    • "members do dept podem ler (com herança de role); members com permission deals:close podem update; super_admin bypass"
  • (Opcional) super_admin_bypass: true (default) | false — se false, pula PERMISSIVE policy
  • (Opcional) audit_super_admin: true (default) | false — se true, gera trigger AFTER que loga em audit_log quando super_admin executa

Read the full file on GitHub · 341 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 341 lines · 59 tokens per session scan A f18e0fc6d3f2

Subscribe to this mod's changes

multi-tenant-rls-writer is an agent published in the GitHub repository luanpdd/kit-mcp (1 stars, last pushed 2d ago), licensed MIT. It adds 59 tokens to every session and 3,829 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

MS-SQL Database Administrator

Work with Microsoft SQL Server databases using the MS SQL extension.

github/awesome-copilot · 18 tokens

core-data-auditor

Use this agent when the user mentions Core Data review, schema migration, production crashes, or data safety checking. Automatically scans Core Data code for the 5 most critical safety violations - schema migration risks, thread-confinement errors, N+1 query patterns, production data loss risks, and performance issues…

CharlesWiltgen/Axiom · 261 tokens

lens

Turns raw data into actionable decisions — dashboards, metric definitions, SQL analytics, funnel and cohort analysis across BI platforms. Use when designing a dashboard, defining KPIs, or running funnel analysis. Trigger with "design a dashboard", "analyze our funnel".

jeremylongshore/tons-of-skills-marketplace · 53 tokens

ecto-schema-designer

Ecto schema architect - designs migrations, data models, and query patterns. Use proactively when planning database structure for new features.

oliver-kriska/claude-elixir-phoenix · 30 tokens

django-migrations-specialist

Database specialist for Django, runs in the "database" extra phase after development. Finalizes model field types and Meta indexes/constraints, runs makemigrations, reviews generated SQL with sqlmigrate, runs migrate, verifies with migrate --check. Do NOT use for: application logic (django-architect), tests…

AratKruglik/claude-sdlc · 85 tokens

sql-expert

Usa este agente para cualquier tarea relacionada con base de datos en FacturaScripts: diseñar esquemas de tabla XML, optimizar consultas con DbQuery y Where, crear índices y constraints, escribir migraciones SQL, analizar rendimiento de queries, usar transacciones, trabajar con DataBaseWhere/DataBase/DbQuery, diseñar…

FacturaScripts/fs-claude-plugin · 102 tokens