- Home
- Skills
- Data & Databases
- Supabase Database Builder
Works with the AI Agents you already use
Supabase Database Builder
Generate production-ready Supabase SQL schemas with RLS policies, indexes, and migrations.
Free
Supabase Database Builder
Example session with this skill installed
Design a Supabase schema for a task management app where users have multiple projects, and projects have many tasks. Tasks need a status and priority. Use RLS for user isolation.
- Read your context and instructions
- Compiled the supabase database builder
I have generated a normalized schema for your task management application. This includes user-isolated RLS policies, automated timestamp triggers, and optimized indexes.
Supabase Database Schema
-- Enable Extensions
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
-- Table: profiles
CREATE TABLE profiles (
id uuid REFERENCES auth.users ON DELETE CASCADE PRIMARY KEY,
username text UNIQUE,
updated_at timestamptz DEFAULT now()
);
-- Table: projects
CREATE TABLE projects (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
owner_id uuid REFERENCES profiles(id) ON DELETE CASCADE NOT NULL,
title text NOT NULL,
description text,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now()
);
-- Table: tasks
CREATE TABLE tasks (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
project_id uuid REFERENCES projects(id) ON DELETE CASCADE NOT NULL,
title text NOT NULL,
status text DEFAULT 'todo' CHECK (status IN ('todo', 'in_progress', 'done')),
priority int DEFAULT 1,
created_at timestamptz DEFAULT now(),
updated_at timestamptz DEFAULT now()
);
-- Indexes
CREATE INDEX idx_projects_owner_id ON projects(owner_id);
CREATE INDEX idx_tasks_project_id ON tasks(project_id);
-- RLS Policies
ALTER TABLE profiles ENABLE ROW LEVEL SECURITY;
ALTER TABLE projects ENABLE ROW LEVEL SECURITY;
ALTER TABLE tasks ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users can view own profile" ON profiles FOR SELECT USING (auth.uid() = id);
CREATE POLICY "Users can manage own projects" ON projects FOR ALL USING (auth.uid() = owner_id);
CREATE POLICY "Users can manage tasks in their projects" ON tasks FOR ALL USING (
EXISTS (
SELECT 1 FROM projects
WHERE projects.id = tasks.project_id
AND projects.owner_id = auth.uid()
)
);
-- Updated At Trigger Function
CREATE OR REPLACE FUNCTION handle_updated_at()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = now();
RETURN NEW;
END;
$$ language 'plpgsql';
CREATE TRIGGER tr_projects_updated_at BEFORE UPDATE ON projects FOR EACH ROW EXECUTE PROCEDURE handle_updated_at();
CREATE TRIGGER tr_tasks_updated_at BEFORE UPDATE ON tasks FOR EACH ROW EXECUTE PROCEDURE handle_updated_at();
🔗 Relationships:
profiles.id->auth.users.idprojects.owner_id->profiles.idtasks.project_id->projects.id
📝 Usage Examples:
-- Insert a new project
INSERT INTO projects (owner_id, title) VALUES (auth.uid(), 'Work Sprint');
-- Get all tasks for a specific project with owner check
SELECT t.* FROM tasks t
JOIN projects p ON t.project_id = p.id
WHERE p.owner_id = auth.uid();
Next steps
- Copy the SQL block into your Supabase SQL Editor.
- Run the migration to create tables and RLS policies.
- Test the RLS policies by logging in as a user and attempting to query tasks.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem
Designing normalized schemas and writing manual RLS policies is error-prone and time-consuming. Developers often struggle with securing multi-tenant applications or forgetting essential indexes and updated_at triggers.
What it does
- Generates normalized SQL schemas using Supabase-specific types like
uuidandtimestamptz. - Configures Row-Level Security (RLS) policies for user-owned data and role-based access.
- Applies automatic
updated_attriggers and foreign key constraints with properON DELETEbehavior. - Builds indexes for foreign keys and frequently queried columns to ensure performance.
Frameworks & tools
Supabase, PostgreSQL, SQL migrations.
Why this beats prompting it yourself
Standard LLM prompts often overlook security or create flat, unindexed tables. This skill enforces strict normalization, mandatory RLS enablement, and provides immediate testing queries to verify your backend structure.
Use cases
- Building a multi-tenant SaaS backend with isolated user data.
- Creating a content management system with role-based permissions.
- Scaffolding a relational schema for complex social media interactions.
- Generating migration files for new feature releases in an existing project.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.
Does not generate client-side TypeScript types or Edge Functions. Requires manual execution of generated SQL in the Supabase dashboard or CLI.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
7 uses
Times used to date
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 2 months ago
- Free with an Agensi account
Permissions
No special permissions declared or detected