supabase-cli
Skill28 starsChanged 6 months agoMITView on GitHub
CLI automation for Supabase development workflows. Provides scripts for migrations, Edge Functions, secrets management, type generation, and SQL execution with safety checks.
- Reads credentials
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- rogue-dev-studio/ai-agents-roguetheir own version, first seen Jul 31, 2021
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- rogue-dev-studio/ai-agents-rogue★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository63 other files it gives its agents.
- .claude/skills/composition-patterns/AGENTS.mdAGENTS.md
- .claude/skills/react-best-practices/AGENTS.mdAGENTS.md
- .claude/skills/vercel-react-native-skills/AGENTS.mdAGENTS.md
- agy-cliSkill
- aws-cliSkill
- better-authSkill
- brainstormSkill
- claude-seoSkill
- code-qualitySkill
- codex-cliSkill
- color-accessibility-auditSkill
- vercel-composition-patternsSkill
- data-wranglerSkill
- doc-navigatorSkill
- domain-checkerSkill
- fastapi-senior-devSkill
- file-converterSkill
- firebase-cliSkill
- firecrawlSkill
- frontend-designSkill
- gemini-cliSkill
- github-cliSkill
- materialreacttable-masterySkill
- mcp-builderSkill
- mermaid-diagramSkill
- monday-comSkill
- mongodb-atlas-cliSkill
- multi-agent-patternsSkill
- n8n-cliSkill
- natural-languageSkill
- neon-postgres-agent-platformsSkill
- next-cache-componentsSkill
- nextjs-senior-devSkill
- next-upgradeSkill
- notebooklmSkill
- obsidian-skillsSkill
- owasp-securitySkill
- parallel-agentsSkill
- planning-with-filesSkill
- plan-to-tddSkill
- project-change-logSkill
- pydantic-modelSkill
- react-best-practicesSkill
- salesforce-cliSkill
- semantic-codingSkill
- senior-backendSkill
- skill-creatorSkill
- stripe-best-practicesSkill
- swift-concurrency-6-2Skill
- swiftui-patternsSkill
- system-architectSkill
- terraformSkill
- testing-automation-expertSkill
- test-levelsSkill
- token-optimizerSkill
- trailofbits-securitySkill
- ui-ux-pro-maxSkill
- uiux-toolkitSkill
- upgrade-packages-jsSkill
- vercel-cliSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Before running scripts, validate credentials with:
- Distinctive: line 214
Before deploying Edge Functions:
- Distinctive: line 247
When scripts detect missing credentials, they output in this format:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Supabase CLI
CLI automation and operational tooling for Supabase development workflows. This skill provides scripts and utilities for common Supabase operations with built-in safety checks.
When to Use
Invoke when:
- Creating or applying database migrations
- Deploying Edge Functions
- Managing Supabase secrets
- Generating TypeScript types from schema
- Executing SQL with safety checks
- Checking for schema drift
- Validating environment configuration
Prerequisites
Required Tools
# Supabase CLI
brew install supabase/tap/supabase
# or: npx supabase / npm i supabase --save-dev (global npm install is NOT supported)
# Verify installation
supabase --versionEnvironment Variables
Before running scripts, validate credentials with:
python3 .claude/skills/supabase-cli/scripts/validate_env.pyRequired variables:
| Variable | Description | Required For |
SUPABASE_URL | Project URL | All operations |
SUPABASE_ANON_KEY | Public/anon key | Client operations |
SUPABASE_SERVICE_ROLE_KEY | Service role key | Admin operations |
POSTGRES_DB | Direct PostgreSQL URL | Migrations, SQL |
SUPABASE_ACCESS_TOKEN | CLI access token | supabase link, db push, gen types |
Getting the Supabase Access Token
The access token is required for CLI operations like linking projects, pushing migrations, and generating types.
How to get your token:
- Go to https://supabase.com/dashboard/account/tokens
- Click "Generate new token"
- Give it a name (e.g., "CLI Development")
- Copy the token (starts with
sbp_)
How to use it:
Option 1: Store in .env.local (recommended for projects):
# .env.local (add to .gitignore!)
SUPABASE_ACCESS_TOKEN=sbp_your_token_hereOption 2: Export in terminal session:
export SUPABASE_ACCESS_TOKEN="sbp_your_token_here"Option 3: Interactive login (opens browser):
supabase loginLink your project (required before pushing migrations):
# Extract project ref from your SUPABASE_URL (the subdomain)
# Example: https://abcdefghijkl.supabase.co → project ref is "abcdefghijkl"
supabase link --project-ref <your-project-ref>Quick Reference
| Task | Script | Example |
| Validate env | validate_env.py | python3 scripts/validate_env.py |
| New migration | migration_new.ts | bun scripts/migration_new.ts add-users |
| Apply migrations | migration_apply.ts | bun scripts/migration_apply.ts --local |
| Generate types | update_types.ts | bun scripts/update_types.ts |
| Run SQL safely | safe_sql_runner.ts | bun scripts/safe_sql_runner.ts --query "SELECT 1" |
| Check drift | check_drift.sh | bash scripts/check_drift.sh |
| New Edge Function | func_new.ts | bun scripts/func_new.ts my-function |
| Deploy function | func_deploy.ts | bun scripts/func_deploy.ts my-function |
| Sync secrets | secret_sync.py | python3 scripts/secret_sync.py --dry-run |
| Manage secrets | manage_secrets.py | python3 scripts/manage_secrets.py list |
| Reset local DB | reset_local.ts | bun scripts/reset_local.ts |
| Run DB tests | test_db.ts | bun scripts/test_db.ts |
| Scaffold RLS | scaffold_rls.ts | bun scripts/scaffold_rls.ts users --tenant |
Workflow Patterns
Migration Workflow
- Create migration:
bun .claude/skills/supabase-cli/scripts/migration_new.ts add_user_roles - Edit the generated file in
supabase/migrations/ - Apply locally first:
bun .claude/skills/supabase-cli/scripts/migration_apply.ts --local - Check for drift:
bash .claude/skills/supabase-cli/scripts/check_drift.sh - Apply to remote (with confirmation):
bun .claude/skills/supabase-cli/scripts/migration_apply.ts --remote --confirm - Update TypeScript types:
bun .claude/skills/supabase-cli/scripts/update_types.ts
Edge Function Development
- Scaffold new function:
bun .claude/skills/supabase-cli/scripts/func_new.ts webhook-handler --template webhook - Test locally:
supabase functions serve webhook-handler - Deploy:
bun .claude/skills/supabase-cli/scripts/func_deploy.ts webhook-handler
Secret Management
- Sync .env to remote:
python3 .claude/skills/supabase-cli/scripts/secret_sync.py --prefix APP_ --dry-run python3 .claude/skills/supabase-cli/scripts/secret_sync.py --prefix APP_ - List remote secrets:
python3 .claude/skills/supabase-cli/scripts/manage_secrets.py list
Local Development Cycle
- Reset and reseed local database:
bun .claude/skills/supabase-cli/scripts/reset_local.ts - Run database tests:
bun .claude/skills/supabase-cli/scripts/test_db.ts
RLS Policy Scaffolding
Generate RLS policies for new tables:
# Standard user-based policies
bun .claude/skills/supabase-cli/scripts/scaffold_rls.ts products
# Multi-tenant policies (for restaurant_id based isolation)
bun .claude/skills/supabase-cli/scripts/scaffold_rls.ts orders --tenant
# Output to migration file
bun .claude/skills/supabase-cli/scripts/scaffold_rls.ts menu_items --tenant --output supabase/migrations/015_rls.sqlSafety Guidelines
SQL Classification
Scripts classify SQL statements by risk level:
| Level | Statements | Behavior |
| Safe | SELECT, EXPLAIN, SHOW | Execute immediately |
| Write | INSERT, UPDATE, DELETE, ALTER, CREATE | Require transaction wrap |
| Dangerous | DROP, TRUNCATE, DELETE (no WHERE) | Require --confirm flag |
Remote Operation Rules
The following require explicit --confirm flag:
- Migrations to remote database
- Dangerous SQL on remote
- Secret deletion
Pre-Deployment Checks
Before deploying Edge Functions:
- TypeScript compilation check
- Function file existence validation
- Size limits verification
Self-Healing
The CLI surface changes (e.g. db execute was removed in favor of db query;
db push targets the linked REMOTE by default). On any error:
supabase <command> --help → if unclear, WebFetch
https://supabase.com/docs/reference/cli/supabase-<command> (dashes join
subcommands) → adjust → re-run.
Refusal Pattern
REFUSED: `supabase <command>` is destructive against the linked remote project.
I won't skip confirmation. Either (1) confirm the target explicitly
(--local vs --linked), or (2) run it in the Supabase Dashboard.References
For detailed information:
| Topic | Reference File |
| CLI commands | references/cli-commands.md |
| Migration patterns | references/migration-patterns.md |
| Troubleshooting | references/troubleshooting.md |
Error Handling
When scripts detect missing credentials, they output in this format:
MISSING: SUPABASE_SERVICE_ROLE_KEY
ASK_USER: Please provide your Supabase Service Role Key.
LOCATION: Dashboard > Project Settings > API > service_role keyClaude should parse this and use AskUserQuestion to prompt for the missing credential.
Integration
Pairs with:
/plan-feature- Database schema design during feature planningbrainstorm- Architecture decisions before migrationsbeautiful-code- TypeScript type generation quality
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

