/supabase-pack:supabase-incident-runbookfrom supabase-pack
Structured incident response for Supabase outages: triage platform vs application, run pg_stat_activity diagnostics, debug RLS, Edge Functions, and storage, then bundle evidence for support escalation.
Ships in supabase-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A structured response for Supabase-backed application failures. Work three
layers in order: triage platform vs. application, run pg_stat_activity
database diagnostics, then debug RLS, Edge Functions, and storage — ending with
an evidence bundle for support escalation.
When to use: Production errors involving Supabase, degraded API response times, connection pool exhaustion, silent data filtering from RLS, Edge Function cold start failures, or storage upload/download errors.
Each step below gives the workflow plus a first command. The complete copy-paste blocks for every step live in references/diagnostics.md.
@supabase/supabase-js v2+ installed in your projectpsql diagnostics)Determine whether the issue is a Supabase platform incident or an application-level bug. Check the official status page first, then verify SDK client connectivity. Use Read to inspect the app's Supabase env config and Grep to scan application logs for HTTP error codes (401=auth, 429=rate limit, 500=server).
# Check official status page — is this a platform-wide incident?
curl -sf https://status.supabase.com/api/v2/status.json | jq '.status'
# Expected: { "indicator": "none", "description": "All Systems Operational" }
If the status page is green, run the SDK healthCheck() (a select 1 against a
small _health_check table) to measure latency and confirm connectivity. A
green platform plus a failing health check points at your queries, RLS, or Edge
Functions — the SDK block, incident-check query, and full decision tree are in
references/diagnostics.md.
Connect directly via psql (or the Supabase SQL Editor) to inspect connections, find stuck queries, and detect leaks.
-- Current connections grouped by state — the first thing to run
SELECT state, count(*) AS connections,
max(extract(epoch FROM age(now(), state_change)))::int AS max_idle_seconds
FROM pg_stat_activity
WHERE datname = current_database()
GROUP BY state ORDER BY connections DESC;
-- WARNING: If idle > 20 or idle_in_transaction > 0, you have a leak
From there, drill into long-running queries, connection-limit headroom
(pct_used > 80% means enable Supavisor pooling), the pg_cancel_backend /
pg_terminate_backend kill switches, and an app-side get_connection_stats()
RPC — all in
references/diagnostics.md.
Debug silent data filtering from Row Level Security, inspect Edge Function execution, and verify storage. The classic RLS tell is an anon query returning fewer rows than the same query under the service role.
-- List every RLS policy on the affected table
SELECT policyname, cmd, permissive, roles, qual AS using_expression
FROM pg_policies
WHERE schemaname = 'public' AND tablename = 'your_table_name';
Continue with JWT-claim simulation in the SQL Editor, the anon-vs-service-role
SDK diff (debugRLS), remote Edge Function log inspection in the Dashboard, cold-start detection, and a storage bucket upload/download check — full
blocks in
references/diagnostics.md.
After running this incident runbook, you will have:
createClientpg_stat_activity showing active, idle, and leaked connections| Error | Cause | Solution |
|---|---|---|
FetchError: request failed | Supabase API unreachable | Check status.supabase.com; verify network/DNS |
connection refused on port 5432 | Direct DB access blocked or wrong credentials | Use pooler URL (port 6543) or check dashboard connection strings |
too many clients already | Connection pool exhausted | Kill idle-in-transaction connections; enable Supavisor pooling |
permission denied for table | RLS blocking or wrong role | Check policies with pg_policies; verify JWT claims |
WORKER_LIMIT in Edge Function | Memory/CPU exceeded | Reduce function payload size; optimize imports |
JWT expired | Token not refreshing | Verify autoRefreshToken: true in createClient options |
storage/object-not-found | File deleted or wrong path | Check bucket policies; verify path with service role client |
rate limit exceeded (429) | Too many API requests | Implement exponential backoff; contact Supabase for limit increase |
Example 1 — Quick triage script. A single async function that pings database, auth, storage, and realtime in sequence and prints an OK/ERROR line per service — the fastest "what's actually down?" check.
// One-line database probe (the first check in the full triage script)
const { error } = await supabase.from('_health_check').select('id').limit(1);
console.log('Database:', error ? `ERROR: ${error.message}` : 'OK');
Two more worked examples — a connection-leak detector SQL query that labels each
connection LEAK/STALE/OK, and an escalation evidence-bundle builder that
assembles diagnostics into JSON for Supabase support — are in
references/examples.md.
supabase-data-handlingsupabase-performance-tuningsupabase-observabilitysupabase-common-errorsWhat SKILL.md sets; muted values are Claude Code's defaults
30 skills in this plugin
/supabase-advanced-troubleshootingDeep Supabase diagnostics: pg_stat_statements for slow queries, lock debugging
with pg_locks, connection leak detection, RLS policy conflicts, Edge Function
cold starts, and Realtime connection drop analysis.
Use when standard troubleshooting fails, when investigating performance
regressions, when debugging race conditions, or when building evidence for a
Supabase support escalation.
Trigger with "supabase deep debug", "supabase slow query", "supabase lock
contention", "supabase connection leak", "supabase RLS conflict", "supabase
cold start".
/supabase-architecture-variantsUse when choosing how to integrate Supabase into a specific stack — setting up
Next.js SSR auth flows, wiring an SPA or React Native client, configuring mobile
deep links, or designing multi-tenant data isolation. Covers where the client runs
(browser vs server) and which key it uses (anon respects RLS, service_role bypasses it).
Trigger with phrases like "supabase next.js", "supabase SSR", "supabase react native",
"supabase SPA", "supabase serverless", "supabase multi-tenant", "supabase server component",
"supabase architecture", "supabase service_role server".
/supabase-auth-storage-realtime-coreImplement Supabase Auth (signUp, signIn, OAuth, session management), Storage (upload, download, signed URLs, bucket policies), and Realtime (Postgres changes, broadcast, presence). Use when building user auth flows, file upload features, or live-updating UIs with Supabase. Trigger with phrases like "supabase auth", "supabase storage upload", "supabase realtime subscribe", "supabase oauth", "supabase file upload", "supabase presence", "supabase rls storage". /supabase-ci-integrationConfigure Supabase continuous-integration and deployment pipelines with
GitHub Actions: link projects, push migrations, deploy Edge Functions,
generate types, and run tests against local Supabase instances.
Use when setting up CI pipelines for Supabase, automating database
migrations, deploying Edge Functions in CI, or running integration tests.
Trigger with phrases like "supabase CI", "supabase GitHub Actions",
"supabase deploy pipeline", "CI supabase migrations", "supabase preview branches".
/supabase-common-errorsDiagnose and fix Supabase errors across PostgREST, PostgreSQL, Auth, Storage, and Realtime.
Use when encountering error codes like PGRST301, 42501, 23505, or auth failures.
Use when debugging failed queries, RLS policy violations, or HTTP 4xx/5xx responses.
Trigger with "supabase error", "fix supabase", "PGRST", "supabase 403", "RLS not working",
"supabase auth error", "unique constraint", "foreign key violation".
/supabase-cost-tuningOptimize Supabase costs through plan selection, database tuning, storage cleanup,
connection pooling, and Edge Function optimization.
Use when analyzing Supabase billing, reducing costs, right-sizing compute,
or implementing usage tracking and budget alerts.
Trigger with phrases like "supabase cost", "supabase billing",
"reduce supabase costs", "supabase pricing", "supabase expensive", "supabase budget".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin supabase-packOther plugins' skills for the same job