mcpField
S
supabase-usage

supabase-usage

github.com/fcakyonData & databases1.2k37 installsUpdated today
Repository

About supabase-usage

A reference skill for Supabase database work, covering Auth, Row Level Security, relationships, and query practices. It provides database exploration steps and guidance for safer access policies and efficient queries.

Key features

  1. 01Explore tables and schemas
  2. 02Run read-only SQL queries
  3. 03Apply Auth and RLS practices
  4. 04Work with relationships and nested queries
  5. 05Use filtering and pagination patterns
  6. 06Consult detailed reference files

Use cases

  1. 01Inspect a Supabase database structure
  2. 02Review access policies for public tables
  3. 03Build filtered and paginated queries
  4. 04Look up authentication or relationship patterns

MCP support

It describes Supabase MCP tools for listing tables, inspecting schemas, and executing read-only SQL. These tools let MCP clients explore database structure and run queries.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/fcakyon/claude-codex-settings --skill supabase-usage

After installing, type/supabase-usagein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
auth.md
query-patterns.md
relationships.md
rls.md

Details

From the project README

Supabase Database Patterns

Patterns for working with Supabase databases including Auth, Row Level Security, table relationships, and query best practices.

Overview

  • MCP Tools: Query and explore database structure
  • Authentication: User management, sessions, auth tables
  • Row Level Security: Policy patterns for data access control
  • Table Relationships: Foreign keys, joins, nested queries
  • Query Patterns: Filtering, pagination, performance

MCP Tools

Available tools for database exploration:

  • mcp__supabase__list_tables - List all tables in the database
  • mcp__supabase__get_table_schema - Get schema for a specific table
  • mcp__supabase__execute_sql - Run read-only SQL queries

Workflow:

  1. Start with list_tables to understand database structure
  2. Use get_table_schema to inspect columns and types
  3. Use execute_sql for custom queries (read-only)

Best Practices

DO
  • ✓ Enable RLS on all public tables
  • ✓ Use (select auth.uid()) in RLS policies for performance
  • ✓ Add indexes on RLS-checked columns
  • ✓ Specify roles with TO authenticated in policies
  • ✓ Use on delete cascade for foreign keys to auth.users
  • ✓ Use cursor-based pagination for large datasets
  • ✓ Select only needed columns: .select('id, name') not .select('*')
DON'T
  • ✗ Store sensitive data without RLS
  • ✗ Use auth.uid() directly in policies (use (select auth.uid()))
  • ✗ Create policies without specifying roles
  • ✗ Forget indexes on frequently filtered columns
  • ✗ Use offset pagination for deep pages (>1000 rows)
  • ✗ Expose auth.users directly via API (use public profiles table)

Quick Reference

Common Filters
FilterJavaScriptPython
Equals.eq('col', val).eq("col", val)
Not equals.neq('col', val).neq("col", val)
Greater than.gt('col', val).gt("col", val)
Greater or equal.gte('col', val).gte("col", val)
Less than.lt('col', val).lt("col", val)
Less or equal.lte('col', val).lte("col", val)
Pattern match.ilike('col', '%val%').ilike("col", "%val%")
In list.in('col', [a,b]).in_("col", [a,b])
Is null.is('col', null).is_("col", "null")
OR.or('a.eq.1,b.eq.2').or_("a.eq.1,b.eq.2")
Auth Tables Quick Reference
TableKey Columns
auth.usersid, email, phone, created_at, last_sign_in_at, raw_user_meta_data
auth.sessionsid, user_id, created_at, updated_at
auth.identitiesid, user_id, provider, identity_data
RLS Policy Template
create policy "policy_name" on table_name
to authenticated  -- or anon, or specific role
for select        -- select, insert, update, delete, or all
using ( (select auth.uid()) = user_id )
with check ( (select auth.uid()) = user_id );  -- for insert/update

Additional Resources

For detailed patterns and code examples, consult:

  • references/auth.md - Authentication with JS/Python SDK, user profiles
  • references/rls.md - Row Level Security policies and performance tips
  • references/relationships.md - Table relationships and nested queries
  • references/query-patterns.md - Filtering, pagination, counting, indexes

Comments

Markdown supported