Supabase Development

VerifiedSafe

Backend development with Supabase: authentication, database, storage, realtime, and performance best practices.

Sby Skills Guide Bot
DevelopmentIntermediate
7/24/2026
Claude CodeCursorCodex
#supabase#postgres#authentication#rls#backend

Recommended for

Automated summary

This skill guides backend development with Supabase: client setup, authentication, Postgres queries, RLS policies, storage and Realtime, along with performance guidance.

Strengths

  • Covers Supabase's core building blocks (auth, database, storage, realtime) with directly reusable TypeScript snippets
  • Gives RLS real weight and explains how to write policies without costly subqueries
  • Offers concrete Postgres advice: partial and composite indexes, data types, EXPLAIN ANALYZE, cursor pagination
  • Flags production pitfalls such as Supavisor pooling in serverless and avoiding SELECT *

Limitations

  • Does not address Supabase CLI migrations, Edge Functions, or SSR integration with @supabase/ssr
  • Code examples stay minimal: no error handling, validation, or response typing
  • The document is cut off at the cursor-pagination section, which is left undeveloped
When to use it

Use it when setting up or reviewing authentication, schema design, RLS policies, or Postgres performance in a Supabase project.

When not to use it

Avoid it when the need involves CLI migrations, Edge Functions, or cookie-based server-side auth, which the skill does not cover.

Security analysis

Safe
Quality score82/100

The skill provides reference code and best practices for Supabase development. It does not instruct destructive actions, exfiltration, or obfuscated payloads. Allowed tools include Bash, but no shell commands are embedded in the skill content, and the SQL/TypeScript examples are legitimate development guidance.

No concerns found

How this analysis is made

Examples

Set up auth
Set up Supabase authentication in my Next.js app with email/password sign-up plus Google OAuth, and add a sign-out button.
Write RLS policies
Write RLS policies for my profiles table so users can only select and update their own row, and make sure they don't use slow subqueries.
Optimize queries
My orders queries are slow on Supabase — review the schema, add the right indexes, and switch the list endpoint to cursor-based pagination.

name: dev-supabase description: Backend development with Supabase. Trigger when the user wants to configure auth, the database, or Supabase storage. allowed-tools:

  • Read
  • Write
  • Edit
  • Bash
  • Glob
  • Grep context: fork

Supabase Development

Configuration

import { createClient } from '@supabase/supabase-js';

export const supabase = createClient(
  process.env.NEXT_PUBLIC_SUPABASE_URL!,
  process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
);

Authentication

// Sign up
await supabase.auth.signUp({ email, password });

// Sign in
await supabase.auth.signInWithPassword({ email, password });

// OAuth
await supabase.auth.signInWithOAuth({ provider: 'google' });

// Sign out
await supabase.auth.signOut();

Database with RLS

-- Enable RLS
ALTER TABLE profiles ENABLE ROW LEVEL SECURITY;

-- Policy: users can read own data
CREATE POLICY "Users read own profile"
ON profiles FOR SELECT
USING (auth.uid() = id);

-- Policy: users can update own data
CREATE POLICY "Users update own profile"
ON profiles FOR UPDATE
USING (auth.uid() = id);

Queries

// Select
const { data } = await supabase
  .from('profiles')
  .select('*')
  .eq('id', userId);

// Insert
await supabase.from('profiles').insert({ name, email });

// Update
await supabase.from('profiles').update({ name }).eq('id', userId);

// Delete
await supabase.from('profiles').delete().eq('id', userId);

Storage

// Upload
await supabase.storage.from('avatars').upload(path, file);

// Get URL
supabase.storage.from('avatars').getPublicUrl(path);

Realtime

supabase
  .channel('messages')
  .on('postgres_changes', { event: 'INSERT', table: 'messages' }, callback)
  .subscribe();

Postgres Performance Best Practices

Critical priority: Query Performance

-- ALWAYS use indexes on filtered columns
CREATE INDEX idx_profiles_email ON profiles(email);
CREATE INDEX idx_orders_user_id ON orders(user_id);
CREATE INDEX idx_orders_created_at ON orders(created_at);

-- Partial index for frequent queries
CREATE INDEX idx_active_users ON profiles(id) WHERE is_active = true;

-- Composite index for multi-column queries
CREATE INDEX idx_orders_user_status ON orders(user_id, status);

-- ANALYZE slow queries
EXPLAIN ANALYZE SELECT * FROM orders WHERE user_id = 'xxx';

Critical priority: Connection Management

// USE Supabase's connection pooling (Supavisor)
// In Transaction mode for serverless
const supabase = createClient(url, key, {
  db: { schema: 'public' },
  auth: { persistSession: true },
});

// AVOID direct connections in serverless
// Always use the pooler (port 6543 instead of 5432)

High priority: Schema Design

-- Correct data types (no VARCHAR when UUID is enough)
CREATE TABLE orders (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  user_id UUID NOT NULL REFERENCES profiles(id),
  total_cents INTEGER NOT NULL,  -- Not FLOAT for amounts
  status TEXT NOT NULL DEFAULT 'pending',
  metadata JSONB DEFAULT '{}',  -- JSONB not JSON
  created_at TIMESTAMPTZ DEFAULT now()
);

-- Avoid SELECT * in production
-- Specify the necessary columns
const { data } = await supabase
  .from('orders')
  .select('id, status, total_cents')  -- NOT '*'
  .eq('user_id', userId);

Medium priority: Security & RLS

-- Performant RLS: avoid subqueries in policies
-- GOOD: direct comparison
CREATE POLICY "own_data" ON orders
  FOR ALL USING (user_id = auth.uid());

-- BAD: subquery in the policy (slow)
CREATE POLICY "team_data" ON orders
  FOR ALL USING (
    user_id IN (SELECT member_id FROM team_members WHERE team_id = current_setting('app.team_id'))
  );

-- BETTER: use a JWT claim
CREATE POLICY "team_data" ON orders
  FOR ALL USING (
    team_id = (auth.jwt() -> 'app_metadata' ->> 'team_id')::uuid
  );

Medium priority: Data Access Patterns

-- Cursor-based pagination (not OFFSET for large tables)
-- GOOD: cursor-based
const { data } = await supabase
  .from('orders')
  .select('*')
  .gt('created_at', lastSeenDate)
  .order('created_at', { ascending: true })
  .limit(20);

-- BAD: offset-based (slow on large tables)
const { data } = await supabase
  .from('orders')
  .select('*')
  .range(1000, 1020);  // Scans 1020 rows

Monitoring

-- Slowest queries
SELECT query, calls, mean_exec_time, total_exec_time
FROM pg_stat_statements
ORDER BY mean_exec_time DESC
LIMIT 10;

-- Tables without index used
SELECT relname, seq_scan, seq_tup_read
FROM pg_stat_user_tables
WHERE seq_scan > 100
ORDER BY seq_tup_read DESC;

-- Unused indexes
SELECT indexrelname, idx_scan
FROM pg_stat_user_indexes
WHERE idx_scan = 0;

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/supabase-development-mryiqgy1/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/supabase-development-mryiqgy1' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/supabase-development-mryiqgy1/download' --output '.skill-downloads/supabase-development-mryiqgy1/SKILL.md.part' && mv '.skill-downloads/supabase-development-mryiqgy1/SKILL.md.part' '.skill-downloads/supabase-development-mryiqgy1/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/supabase-development-mryiqgy1/SKILL.md' && test -s '.skill-downloads/supabase-development-mryiqgy1/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/dev-supabase' && cp -R '.skill-downloads/supabase-development-mryiqgy1' '.claude/skills/dev-supabase'

Cursor
test -f '.skill-downloads/supabase-development-mryiqgy1/SKILL.md' && test -s '.skill-downloads/supabase-development-mryiqgy1/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/dev-supabase' && cp -R '.skill-downloads/supabase-development-mryiqgy1' '.cursor/skills/dev-supabase'

Codex
test -f '.skill-downloads/supabase-development-mryiqgy1/SKILL.md' && test -s '.skill-downloads/supabase-development-mryiqgy1/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/dev-supabase' && cp -R '.skill-downloads/supabase-development-mryiqgy1' '.agents/skills/dev-supabase'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/supabase-development-mryiqgy1'

openskills read 'supabase-development-mryiqgy1'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/supabase-development-mryiqgy1/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills