Skip to content
PromptPilot AI

Library / Coding & Technology / Database

Supabase: write and test RLS policies

Row Level Security that is actually tested.

Cursor / coding agentsClaude CodeChatGPTClaudenextjsnode
Who it's for
Developers using AI coding tools
Use case
Database
Output
Agent task · Free
You'll need to fill in
table
Prevents: RLS enabled but policies too broad, or service-role key used in the browser.
Write Row Level Security for the [table] table.
Access rules: [e.g. users read/write their own rows; anyone reads rows where visibility = 'public'].
- Enable RLS and write one policy per operation (select/insert/update/delete) using auth.uid().
- Use column-level grants if some columns must not be user-editable.
- Write SQL tests that switch role (anon / authenticated with different user ids) and prove each rule, including a negative case per rule.
- Never use the service-role key in client code.

Copies your prompt and opens the official site in a new tab. You may need to paste it yourself (Ctrl/⌘ + V). Nothing is sent to the AI by us.

Replace [bracketed] parts with your own details before sending. Want it tailored? Build a custom website & app development prompt.

Before vs after

A typical one-line request compared with this prompt. We only show sample responses where we've written an illustration.

BeforeWhat people usually type

Prompt

database

1 words · no role, context, format or constraints

AfterThis library prompt

Prompt

Write Row Level Security for the [table] table.
Access rules: [e.g. users read/write their own rows; anyone reads rows where visibility = 'public'].
- Enable RLS and write one policy per operation (select/insert/update/delete) using auth.uid().
- Use column-level grants if some columns must not be user-editable.
- Write SQL tests that switch role (anon / authenticated with different user ids) and prove each rule, including a negative case per rule.
- Never use the service-role key in client code.

79 words · generated instantly from templates, no AI called

What we added

  • Your details: [brackets] for the facts only you know
  • Constraints: rules and limits
  • Output format with tables: structure of the answer

Related prompts