# Design a database for site data (Supabase) > Prompt · level: intermediate · about 60 min · paste into: Claude Code · Codex · Claude Cowork (with the Supabase connector) · Antigravity · checked 2026-09-30 > ES: Diseña una base de datos para datos de obra (Supabase) Tables for activities, constraints, inspections and quantities with row-level security from day one, so your prototypes and agents share one source of truth. **Before you paste:** A Supabase project (free tier is enough) · Optional: the Supabase MCP server connected. ## Prompt (copy everything inside the block, then fill the [BRACKETS]) ```text Design and create a Supabase (Postgres) database for my site data. Project context: [e.g. "3 residential projects, site engineers log inspections and constraints from their phones"]. 1. Ask me which records I really need (max 6 tables to start). Typical: projects, locations, activities, constraints, inspections/findings, quantities. Propose columns with types, keys and a short comment each. 2. Security from day one: enable Row Level Security on every table and write policies by role [e.g. site engineer can insert and read their project; manager reads all]. Explain each policy in one line. 3. If the frontend must never touch tables directly, propose RPC functions (SECURITY DEFINER) and remember: new functions in the public schema get EXECUTE for anon and authenticated by default in Supabase, so revoke it explicitly and verify with has_function_privilege. 4. Write the SQL as a migration file. If you are connected through the Supabase MCP, show me the migration before applying it and apply it only after I say yes. 5. Seed 5 example rows per table and give me 3 test queries. Never disable RLS to "make it work". Answer in my language. ``` ## Notes for the agent presenting this - Show the block above verbatim in one code block; tell your human where to paste it (Claude Code · Codex · Claude Cowork (with the Supabase connector) · Antigravity). - Point out the [BRACKETS] and offer to fill them together first. - The default-privileges trap (new functions executable by anon) is real and bit the academy's own course backend once; the prompt makes the agent check it. ## Related - [Prototype a field app in an afternoon](https://aibuilderacademy.netlify.app/prompts/prototype-field-app.md) (prompt) - [Which MCP should I connect? Start from your data, not the tool](https://aibuilderacademy.netlify.app/prompts/which-mcp-to-connect.md) (prompt) ## Sources - https://supabase.com/docs/guides/database/postgres/row-level-security - https://supabase.com/docs/guides/getting-started/mcp --- AI Builder Academy · https://aibuilderacademy.netlify.app · checked 2026-09-30 · Made by Lo que habitas (Julián Páez). Agents: search more at https://aibuilderacademy.netlify.app/api/search?q=… or connect https://aibuilderacademy.netlify.app/mcp. Request a new prompt: aibuilderacademy@agentmail.to.