Learn-skills.dev supabase-automation
Automate Supabase database queries, table management, project administration, storage, edge functions, and SQL execution via Rube MCP (Composio). Always search tools first for current schemas.
git clone https://github.com/NeverSight/learn-skills.dev
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/aaaaqwq/claude-code-skills/supabase-automation" ~/.claude/skills/neversight-learn-skills-dev-supabase-automation && rm -rf "$T"
data/skills-md/aaaaqwq/claude-code-skills/supabase-automation/SKILL.mdSupabase Automation via Rube MCP
Automate Supabase operations including database queries, table schema inspection, SQL execution, project and organization management, storage buckets, edge functions, and service health monitoring through Composio's Supabase toolkit.
Prerequisites
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active Supabase connection via
with toolkitRUBE_MANAGE_CONNECTIONSsupabase - Always call
first to get current tool schemasRUBE_SEARCH_TOOLS
Setup
Get Rube MCP: Add
https://rube.app/mcp as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
- Verify Rube MCP is available by confirming
respondsRUBE_SEARCH_TOOLS - Call
with toolkitRUBE_MANAGE_CONNECTIONSsupabase - If connection is not ACTIVE, follow the returned auth link to complete Supabase authentication
- Confirm connection status shows ACTIVE before running any workflows
Core Workflows
1. Query and Manage Database Tables
When to use: User wants to read data from tables, inspect schemas, or perform CRUD operations
Tool sequence:
- List projects to find the target project_ref [Prerequisite]SUPABASE_LIST_ALL_PROJECTS
- List all tables and views in the database [Prerequisite]SUPABASE_LIST_TABLES
- Get detailed column types, constraints, and relationships [Prerequisite for writes]SUPABASE_GET_TABLE_SCHEMAS
- Query rows with filtering, sorting, and pagination [Required for reads]SUPABASE_SELECT_FROM_TABLE
- Execute arbitrary SQL for complex queries, inserts, updates, or deletes [Required for writes]SUPABASE_BETA_RUN_SQL_QUERY
Key parameters for SELECT_FROM_TABLE:
: 20-character lowercase project referenceproject_ref
: Table or view name to querytable
: Comma-separated column list (supports nested selections and JSON paths likeselect
)profile->avatar_url
: Array of filter objects withfilters
,column
,operatorvalue
: Sort expression likeordercreated_at.desc
: Max rows to return (minimum 1)limit
: Rows to skip for paginationoffset
PostgREST filter operators:
,eq
: Equal / not equalneq
,gt
,gte
,lt
: Comparison operatorslte
,like
: Pattern matching (case-sensitive / insensitive)ilike
: IS check (for null, true, false)is
: In a list of valuesin
,cs
: Contains / contained by (arrays)cd
,fts
,plfts
,phfts
: Full-text search variantswfts
Key parameters for RUN_SQL_QUERY:
: Project reference (20 lowercase letters, patternref
)^[a-z]{20}$
: Valid PostgreSQL SQL statementquery
: Boolean to force read-only transaction (safer for SELECTs)read_only
Pitfalls:
must be exactly 20 lowercase letters (a-z only, no numbers or hyphens)project_ref
is read-only; useSELECT_FROM_TABLE
for INSERT, UPDATE, DELETE operationsRUN_SQL_QUERY- For PostgreSQL array columns (text[], integer[]), use
orARRAY['item1', 'item2']
syntax, NOT JSON array syntax'{"item1", "item2"}''["item1", "item2"]' - SQL identifiers that are case-sensitive must be double-quoted in queries
- Complex DDL operations may timeout (~60 second limit); break into smaller queries
- ERROR 42P01 "relation does not exist" usually means unquoted case-sensitive identifiers
- ERROR 42883 "function does not exist" means you are calling non-standard helpers; prefer information_schema queries
2. Manage Projects and Organizations
When to use: User wants to list projects, inspect configurations, or manage organizations
Tool sequence:
- List all organizations (IDs and names) [Required]SUPABASE_LIST_ALL_ORGANIZATIONS
- Get detailed org info by slug [Optional]SUPABASE_GETS_INFORMATION_ABOUT_THE_ORGANIZATION
- List org members with roles and MFA status [Optional]SUPABASE_LIST_MEMBERS_OF_AN_ORGANIZATION
- List all projects with metadata [Required]SUPABASE_LIST_ALL_PROJECTS
- Get database configuration [Optional]SUPABASE_GETS_PROJECT_S_POSTGRES_CONFIG
- Get authentication configuration [Optional]SUPABASE_GETS_PROJECT_S_AUTH_CONFIG
- Get API keys (sensitive -- handle carefully) [Optional]SUPABASE_GET_PROJECT_API_KEYS
- Check service health [Optional]SUPABASE_GETS_PROJECT_S_SERVICE_HEALTH_STATUS
Key parameters:
: Project reference for project-specific toolsref
: Organization slug (URL-friendly identifier) for org toolsslug
: Array of services for health check:services
,auth
,db
,db_postgres_user
,pg_bouncer
,pooler
,realtime
,reststorage
Pitfalls:
returns bothLIST_ALL_ORGANIZATIONS
andid
;slug
expectsLIST_MEMBERS_OF_AN_ORGANIZATION
, notslugid
returns live secrets -- NEVER log, display, or persist full key valuesGET_PROJECT_API_KEYS
requires a non-emptyGETS_PROJECT_S_SERVICE_HEALTH_STATUS
array; empty array causes invalid_request errorservices- Config tools may return 401/403 if token lacks required scope; handle gracefully rather than failing the whole workflow
3. Inspect Database Schema
When to use: User wants to understand table structure, columns, constraints, or generate types
Tool sequence:
- Find the target project [Prerequisite]SUPABASE_LIST_ALL_PROJECTS
- Enumerate all tables and views with metadata [Required]SUPABASE_LIST_TABLES
- Get detailed schema for specific tables [Required]SUPABASE_GET_TABLE_SCHEMAS
- Generate TypeScript types from schema [Optional]SUPABASE_GENERATE_TYPE_SCRIPT_TYPES
Key parameters for LIST_TABLES:
: Project referenceproject_ref
: Array of schema names to search (e.g.,schemas
); omit for all non-system schemas["public"]
: Include views alongside tables (default true)include_views
: Include row count estimates and sizes (default true)include_metadata
: Include pg_catalog, information_schema, etc. (default false)include_system_schemas
Key parameters for GET_TABLE_SCHEMAS:
: Project referenceproject_ref
: Array of table names (max 20 per request); supports schema prefix liketable_names
,public.usersauth.users
: Include foreign key info (default true)include_relationships
: Include index info (default true)include_indexes
: Cleaner output by hiding null fields (default true)exclude_null_values
Key parameters for GENERATE_TYPE_SCRIPT_TYPES:
: Project referenceref
: Comma-separated schema names (defaultincluded_schemas
)"public"
Pitfalls:
- Table names without schema prefix assume
schemapublic
androw_count
from LIST_TABLES may be null for views or recently created tables; treat as unknown, not zerosize_bytes- GET_TABLE_SCHEMAS has a max of 20 tables per request; batch if needed
- TypeScript types include all tables in specified schemas; cannot filter individual tables
4. Manage Edge Functions
When to use: User wants to list, inspect, or work with Supabase Edge Functions
Tool sequence:
- Find the project reference [Prerequisite]SUPABASE_LIST_ALL_PROJECTS
- List all edge functions with metadata [Required]SUPABASE_LIST_ALL_FUNCTIONS
- Get detailed info for a specific function [Optional]SUPABASE_RETRIEVE_A_FUNCTION
Key parameters:
: Project referenceref- Function slug for RETRIEVE_A_FUNCTION
Pitfalls:
returns metadata only, not function code or logsLIST_ALL_FUNCTIONS
andcreated_at
may be epoch milliseconds; convert to human-readable timestampsupdated_at- These tools cannot create or deploy edge functions; they are read-only inspection tools
- Permission errors may occur without org/project admin rights
5. Manage Storage Buckets
When to use: User wants to list storage buckets or manage file storage
Tool sequence:
- Find the project reference [Prerequisite]SUPABASE_LIST_ALL_PROJECTS
- List all storage buckets [Required]SUPABASE_LISTS_ALL_BUCKETS
Key parameters:
: Project referenceref
Pitfalls:
returns bucket list only, not bucket contents or access policiesLISTS_ALL_BUCKETS- For file uploads,
handles CORS preflight for TUS resumable uploads onlySUPABASE_RESUMABLE_UPLOAD_SIGN_OPTIONS_WITH_ID - Direct file operations may require using
with the Supabase storage APIproxy_execute
Common Patterns
ID Resolution
- Project reference:
-- extractSUPABASE_LIST_ALL_PROJECTS
field (20 lowercase letters)ref - Organization slug:
-- useSUPABASE_LIST_ALL_ORGANIZATIONS
(notslug
) for downstream org toolsid - Table names:
-- enumerate available tables before queryingSUPABASE_LIST_TABLES - Schema discovery:
-- inspect columns and constraints before writesSUPABASE_GET_TABLE_SCHEMAS
Pagination
: UsesSUPABASE_SELECT_FROM_TABLE
+offset
pagination. Increment offset by limit until fewer rows than limit are returned.limit
: May paginate for large accounts; follow cursors/pages until exhausted.SUPABASE_LIST_ALL_PROJECTS
: May paginate for large databases.SUPABASE_LIST_TABLES
SQL Best Practices
- Always use
orSUPABASE_GET_TABLE_SCHEMAS
before writing SQLSUPABASE_LIST_TABLES - Use
for SELECT queries to prevent accidental mutationsread_only: true - Quote case-sensitive identifiers:
notSELECT * FROM "MyTable"SELECT * FROM MyTable - Use PostgreSQL array syntax for array columns:
notARRAY['a', 'b']['a', 'b'] - Break complex DDL into smaller statements to avoid timeouts
Known Pitfalls
ID Formats
- Project references are exactly 20 lowercase letters (a-z): pattern
^[a-z]{20}$ - Organization identifiers come as both
(UUID) andid
(URL-friendly string); tools vary in which they acceptslug
requiresLIST_MEMBERS_OF_AN_ORGANIZATION
, notslugid
SQL Execution
has ~60 second timeout for complex operationsBETA_RUN_SQL_QUERY- PostgreSQL array syntax required:
orARRAY['item']
, NOT JSON syntax'{"item"}''["item"]' - Case-sensitive identifiers must be double-quoted in SQL
- ERROR 42P01: relation does not exist (check quoting and schema prefix)
- ERROR 42883: function does not exist (use information_schema instead of custom helpers)
Sensitive Data
returns service-role keys -- NEVER expose full valuesGET_PROJECT_API_KEYS- Auth config tools exclude secrets but may still contain sensitive configuration
- Always mask or truncate API keys in output
Schema Metadata
androw_count
fromsize_bytes
can be null; do not treat as zeroLIST_TABLES- System schemas are excluded by default; set
to see theminclude_system_schemas: true - Views appear alongside tables unless
include_views: false
Rate Limits and Permissions
- Enrichment tools (API keys, configs) may return 401/403 without proper scopes; skip gracefully
- Large table listings may require pagination
fails with emptyGETS_PROJECT_S_SERVICE_HEALTH_STATUS
array -- always specify at least oneservices
Quick Reference
| Task | Tool Slug | Key Params |
|---|---|---|
| List organizations | | (none) |
| Get org info | | |
| List org members | | |
| List projects | | (none) |
| List tables | | , |
| Get table schemas | | , |
| Query table | | , , , |
| Run SQL | | , , |
| Generate TS types | | , |
| Postgres config | | |
| Auth config | | |
| Get API keys | | |
| Service health | | , |
| List edge functions | | |
| Get edge function | | , function slug |
| List storage buckets | | |
| List DB branches | | |