Agent skill · Security

debug-rls

Use when users report access denied errors, see wrong data, RLS policies are not working, or when troubleshooting Row-Level Security issues in Butterbase

butterbase.ai2,831★ · +400/wk · 1 repos on radarProfile →
claude-codeMIT
Install
npx skills add butterbase-ai/butterbase-skills --skill debug-rls --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 14 KB
Bundled scripts: none
Path: skills/debug-rls/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 532

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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 expressio

What's inside
Steps it walks through
  1. 1. Overview
  2. 2. Quick Diagnosis
  3. 3. The Three Roles
  4. 4. Four-Step Debugging Protocol
  5. Step 1: Check if RLS is enabled
  6. Step 2: Inspect existing policies
  7. Step 3: Test as different roles
  8. Step 4: Check auto-populate trigger
  9. 5. Common Fixes
  10. Fix 1: Enable basic user isolation
  11. Fix 2: Add public read access
  12. Fix 3: Fix missing auto-populate trigger
  13. Fix 4: Add cross-table restrictive check
  14. 6. Expression Reference
More from butterbase-skills
All skills →
About this skill
What does the debug-rls skill do?

Use when users report access denied errors, see wrong data, RLS policies are not working, or when troubleshooting Row-Level Security issues in Butterbase

How do I install it?

Run `npx skills add butterbase-ai/butterbase-skills --skill debug-rls --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From butterbase-ai/butterbase-skills, a repository with 532 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going