debug-rls

debug-rls is a skill for Claude Code from butterbase-ai/butterbase-skills. It costs 34 tokens per session (3,494 once invoked), scanned A, original, MIT.

A troubleshooting method for Row-Level Security, or RLS, in Butterbase databases. RLS is a database feature that controls which rows each user or role may view or change, and this skill tests policies by simulating different roles and users.

In plain words
What is it for?
Use it to check RLS policies, reproduce permissions as a specific role or user, diagnose missing or overly broad access rules, and investigate insert-policy failures.
Why use it?
It helps explain errors such as access denied, empty results, exposed data, or failed inserts. It also avoids misleading results from service-key requests, which bypass normal row restrictions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the butterbase-skills plugin — 23 skills, 33 commands shipped together

Good fit Use it to check RLS policies, reproduce permissions as a specific role or user, diagnose missing or overly broad access rules, and investigate insert-policy failures.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/butterbase-ai/butterbase-skills/debug-rls
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.

Any agent
npx skills add butterbase-ai/butterbase-skills --skill debug-rls
Clone the repo
git clone --depth 1 https://github.com/butterbase-ai/butterbase-skills

Made for: Claude Code.

Or install butterbase-skills, the plugin that ships this one along with the rest of its 23 skills, 33 commands.

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 debug-rls

README.md
[![agentmods](https://agentmods.dev/badge/skills/butterbase-ai/butterbase-skills/debug-rls/github.svg)](https://agentmods.dev/skills/butterbase-ai/butterbase-skills/debug-rls)
Your own site
<a href="https://agentmods.dev/skills/butterbase-ai/butterbase-skills/debug-rls"><img src="https://agentmods.dev/badge/skills/butterbase-ai/butterbase-skills/debug-rls/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 debug-rls

Your own site · 80×15
<a href="https://agentmods.dev/skills/butterbase-ai/butterbase-skills/debug-rls"><img src="https://agentmods.dev/badge/skills/butterbase-ai/butterbase-skills/debug-rls.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,494 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00034 $0.03494
Opus 5 $0.00017 $0.01747
Sonnet 5 $0.00007 $0.00699
Haiku 4.5 $0.00003 $0.00349

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

Security

Grade A, and why

debug-rls 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 10d 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.

skills/debug-rls/SKILL.md · 364 lines

How it starts

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

debug-rls

Systematic methodology for debugging Row-Level Security issues in Butterbase. Uses role simulation (as_role/as_user parameters) to verify policy behavior without needing real user sessions.


1. Overview

Row-Level Security (RLS) in Butterbase controls which rows each database role can see or modify. When RLS is misconfigured, users may see no data, too much data, or get unexpected errors on insert. This skill walks through a repeatable four-step process to identify and fix the root cause.

Key principle: MCP tools default to the service key (bb_sk_...), which bypasses all RLS. Always use as_role/as_user to simulate the role your frontend actually uses.


2. Quick Diagnosis

Match the symptom your user reports to the most likely cause before diving into the full protocol.

Symptom Likely cause
User sees no rows RLS enabled but no policy for butterbase_user role
User sees ALL rows RLS not enabled on the table, or request uses service key (bb_sk_)
Insert fails with AUTH_RLS_POLICY_VIOLATION No INSERT policy, or user_column not auto-populated
User sees other users' data Policy USING expression is wrong, or user isolation not set up
Anonymous user gets 403 No policy for butterbase_anon role
Works in MCP tools but not from frontend MCP uses service key (bypasses RLS); frontend uses end-user JWT

3. The Three Roles

Butterbase automatically assigns a database role based on the auth header of each request. You never create these roles — they are built in.

Auth header Database role Behavior
None butterbase_anon Default deny. Only sees rows allowed by explicit anon policies.
Valid end-user JWT butterbase_user current_user_id() returns their UUID. Sees rows matching their policies.
API key (bb_sk_...) butterbase_service Bypasses ALL RLS. Sees everything. Used by MCP tools and admin operations.

Read the full file on GitHub · 364 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. 10d ago First seen · 364 lines · 34 tokens per session scan A ffbe168a9c6a

Subscribe to this mod's changes

debug-rls is a skill published in the GitHub repository butterbase-ai/butterbase-skills (533 stars, last pushed 2mo ago), licensed MIT. It adds 34 tokens to every session and 3,494 once invoked, about $0.0002 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-30.

Related

Other skills, from other repositories

triage-issues

Triage GitHub issues in the googleapis/mcp-toolbox repo: propose the correct labels (type / priority / product / status), check for duplicates, verify a bug has enough info to act on, and draft a triage comment. Use whenever a maintainer asks you to triage, label, categorize, prioritize, or "look at" an issue (or a…

googleapis/mcp-toolbox · 164 tokens

postgresql-indexing

PostgreSQL indexing best practices for Prowler: index design, partial indexes, partitioned table indexing, EXPLAIN ANALYZE validation, concurrent operations, monitoring, and maintenance. Trigger: When creating or modifying PostgreSQL indexes, analyzing query performance with EXPLAIN, debugging slow queries, reviewing…

prowler-cloud/prowler · 108 tokens

butterbase

AI-native, open-source backend-as-a-service with a built-in Model Context Protocol server. Postgres, auth, storage, functions, AI gateway.

butterbase-ai/butterbase · 34 tokens

graphjin-eval

Create, extend, run, baseline, and diagnose GraphJin agent evaluations through the graphjin eval CLI.

dosco/graphjin · 27 tokens

axiom-audit-grdb-performance

Use when the user mentions GRDB performance review, slow GRDB queries, app-group database setup audit, a ValueObservation that stopped updating, or pre-release GRDB scan.

CharlesWiltgen/Axiom · 43 tokens

django-perf-review

Django performance code review. Use when asked to "review Django performance", "find N+1 queries", "optimize Django", "check queryset performance", "database performance", "Django ORM issues", or audit Django code for performance problems.

getsentry/skills · 55 tokens