# supabase-schema-architect

A subagent that designs PostgreSQL schemas in Supabase, plans migrations and writes RLS policies. Useful when your database grows and access rules need sorting out.

- subagent · `type=agent` · Claude Code · 3839 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/agents/database/supabase-schema-architect.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/agents/supabase-schema-architect

## What it does

The subagent covers three areas: schema, migrations, RLS. It designs normalized tables, relationships and indexes, prepares reversible migrations with a rollback plan, and describes Row Level Security policies with role-based access. Its tools are plain: `Read`, `Write`, `Edit`, `Bash` — it reads project files, edits them and runs commands.

The workflow runs in order: analyze the current schema, assess application requirements, write migration scripts and policies, then validate on staging and test the rollback. The reply includes a schema breakdown, new tables with columns and indexes, policies with a performance note, and implementation files — migration SQL, policy definitions, TypeScript types.

Some targets are baked into the prompt: normalization up to 3NF, snake_case naming, RLS coverage for tables holding sensitive data, migrations wrapped in transactions. Treat those as aims, not hard limits. Analyzing the current schema requires a Supabase connection over MCP; without it the agent works only with what sits in your project files.

## Requirements
- Works with: Supabase

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --agent database/supabase-schema-architect
```

2. **Manually: put the files in place**
- File: `.claude/agents/supabase-schema-architect.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

### Codex

**Manually: put the files in place**
- File: `.codex/agents/supabase-schema-architect.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/supabase-schema-architect.md` — Cursor also reads .claude/agents/

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/agents/database/supabase-schema-architect.md

## When to use it
- design a normalized schema for a new feature
- write a migration with a rollback plan that works
- lock down tables with RLS policies without breaking access
- lay out relationships and indexes so queries stay fast
- generate TypeScript types for a changed schema

## Example prompts
- analyze the current Supabase schema and propose a migration for an orders table
- write RLS policies for the profiles table so a user sees only their own row
- draft a migration plan with rollback for renaming columns in users

## Similar
- [supabase-postgres-best-practices](https://affpapa.org/en/nevibecode/skills/supabase-postgres-best-practices.md) — skill · 40 installs
- [power-platform-architect](https://affpapa.org/en/nevibecode/skills/power-platform-architect.md) — skill · 205 installs
- [graphql-architect](https://affpapa.org/en/nevibecode/agents/graphql-architect.md) — subagent · 1038 installs
- [recsys-pipeline-architect](https://affpapa.org/en/nevibecode/skills/recsys-pipeline-architect.md) — skill · 4200 installs
- [ai-engineer](https://affpapa.org/en/nevibecode/agents/ai-engineer.md) — subagent · 7687 installs
- [business-analyst](https://affpapa.org/en/nevibecode/agents/business-analyst.md) — subagent · 3855 installs
- [sql-pro](https://affpapa.org/en/nevibecode/agents/voltagent-community-sql-pro.md) — subagent · 3602 installs
- [sql-pro](https://affpapa.org/en/nevibecode/agents/sql-pro.md) — subagent · 3602 installs

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 224 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
