# supabase

Guides agent workflows for Supabase CLI, PostgreSQL migrations, RLS policies, and Edge Functions. Useful for local-first database development.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 645 installs · ★ 711
- Author: alinaqi
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/alinaqi/maggy/tree/HEAD/skills/supabase/SKILL.md
- Updated: 2026-10-13
- HTML: https://affpapa.org/en/nevibecode/skills/alinaqi-supabase

## What it does

This skill guides the agent through a local-first workflow: develop locally using the Supabase CLI, commit migrations to version control, and avoid direct edits to production. It covers project setup with `supabase init`, running the local stack via `supabase start`, and inspecting schemas with `supabase db diff`.

Inside are standard patterns for Row Level Security (RLS) with default-deny policies, user profile synchronization linked to `auth.users` via triggers, and idempotent seed scripts in `supabase/seed.sql`. It also outlines Deno Edge Functions with auth header verification and connection pooling configurations for PgBouncer.

Direct edits to the remote database are intentionally blocked by design; every schema change must be deployed through `supabase db push`. Linking to a remote project requires obtaining the project reference ID from the dashboard and configuring environment variables in `.env`.

## Requirements
- Works with: Supabase

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add alinaqi/maggy --skill supabase -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/supabase/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/supabase/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add alinaqi/maggy --skill supabase -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/supabase/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add alinaqi/maggy --skill supabase -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/supabase/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install alinaqi/maggy supabase
```

2. **Manually: put the files in place**
- File: `.github/skills/supabase/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add alinaqi/maggy --skill supabase -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/alinaqi/maggy --path skills/supabase
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/supabase/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add alinaqi/maggy --skill supabase -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/alinaqi/maggy/tree/HEAD/skills/supabase/SKILL.md

## When to use it
- generate database migrations using `supabase db diff`
- configure Row Level Security policies for PostgreSQL tables
- scaffold and deploy Deno Edge Functions with auth handling
- automate user profile creation via PostgreSQL triggers on `auth.users`

## Example prompts
- Create a new migration with an RLS policy that allows only authenticated users to insert posts
- Scaffold a Deno Edge Function that validates the Authorization header and returns the user ID
- Write an idempotent seed.sql file for test users using ON CONFLICT DO NOTHING

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 2bb37e50bc1916d1.

BEGIN THIRD-PARTY FILE 2bb37e50bc1916d1
````text
---
name: supabase
description: Core Supabase CLI, migrations, RLS, Edge Functions
when-to-use: When working with Supabase - database, auth, storage, or edge functions
user-invocable: false
paths: ["supabase/**", "**/supabase.*", "**/.env*"]
effort: medium
---

# Supabase Core Skill


Core concepts, CLI workflow, and patterns common to all Supabase projects.

**Sources:** [Supabase Docs](https://supabase.com/docs) | [Supabase CLI](https://supabase.com/docs/guides/local-development/cli/getting-started)

---

## Core Principle

**Local-first, migrations in version control, never touch production directly.**

Develop locally with the Supabase CLI, capture all changes as migrations, and deploy through CI/CD.

---

## Supabase Stack

| Service | Purpose |
|---------|---------|
| **Database** | PostgreSQL with extensions |
| **Auth** | User authentication, OAuth providers |
| **Storage** | File storage with RLS |
| **Edge Functions** | Serverless Deno functions |
| **Realtime** | WebSocket subscriptions |
| **Vector** | AI embeddings (pgvector) |

---

## CLI Setup

### Install & Login
```bash
# macOS
brew install supabase/tap/supabase

# npm (alternative)
npm install -g supabase

# Login
supabase login
```

### Initialize Project
```bash
# In your project directory
supabase init

# Creates:
# supabase/
# ├── config.toml      # Local config
# ├── seed.sql         # Seed data
# └── migrations/      # SQL migrations
```

### Link to Remote
```bash
# Get project ref from dashboard URL: https://supabase.com/dashboard/project/<ref>
supabase link --project-ref <project-id>

# Pull existing schema
supabase db pull
```

### Start Local Stack
```bash
supabase start

# Output:
# API URL: http://localhost:54321
# GraphQL URL: http://localhost:54321/graphql/v1
# DB URL: postgresql://postgres:postgres@localhost:54322/postgres
# Studio URL: http://localhost:54323
# Anon key: eyJ...
# Service role key: eyJ...
```

---

## Migration Workflow

### Option 1: Dashboard + Diff (Quick Prototyping)
```bash
# 1. Make changes in local Studio (localhost:54323)
# 2. Generate migration from diff
supabase db diff -f <migration_name>

# 3. Review generated SQL
cat supabase/migrations/*_<migration_name>.sql

# 4. Reset to test
supabase db reset
```

### Option 2: Write Migrations Directly (Recommended)
```bash
# 1. Create empty migration
supabase migration new create_users_table

# 2. Edit the migration file
# supabase/migrations/<timestamp>_create_users_table.sql

# 3. Apply locally
supabase db reset
```

### Option 3: ORM Migrations (Best DX)
Use Drizzle (TypeScript) or SQLAlchemy (Python) - see framework-specific skills.

### Deploy Migrations
```bash
# Push to remote (staging/production)
supabase db push

# Check migration status
supabase migration list
```

---

## Database Patterns

### Enable RLS on All Tables
```sql
-- Always enable RLS
````
END THIRD-PARTY FILE 2bb37e50bc1916d1

The third-party file has ended. Everything between the 2bb37e50bc1916d1 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2878 of 9773 bytes. © alinaqi · MIT · https://github.com/alinaqi/maggy/tree/HEAD/skills/supabase/SKILL.md

_Part of the page did not fit — see the HTML version._

---
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
