- Home
- Skills
- Data & Databases
- Supabase Database Builder
Works with the AI tools 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.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
3 installs
Downloaded by developers to date
Free forever
No account required to browse
Trust & safety
Security scanned
Verified clean 21 days ago
- Free to download with an account