SU

supabase-incident-runbook

Execute structured triage and mitigation for Supabase outages, connection issues, and database errors.

Install

mkdir -p .claude/skills/supabase-incident-runbook && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3372" && unzip -o skill.zip -d .claude/skills/supabase-incident-runbook && rm skill.zip

Installs to .claude/skills/supabase-incident-runbook

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Execute Supabase incident response: dashboard health checks, connection pool status, pg_stat_activity queries, RLS debugging, Edge Function logs, storage health, and escalation. Use when responding to Supabase outages, investigating production errors, debugging connection issues, or preparing evidence for Supabase support escalation. Trigger with "supabase incident", "supabase outage", "supabase down", "supabase on-call", "supabase emergency", "supabase broken", or "supabase connection issues".
499 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Triage Supabase issues as platform or application-level
  • Perform database diagnostics using pg_stat_activity
  • Debug Row Level Security (RLS) policies
  • Inspect Edge Function execution and logs
  • Verify Supabase storage health
  • Prepare an evidence bundle for Supabase support escalation

How it works

The skill guides through checking Supabase status, running database queries, and debugging RLS, Edge Functions, and storage.

Inputs & outputs

You give it
Supabase project experiencing issues
You get back
Assessment of issue origin, diagnostic data, and evidence for support escalation

When to use supabase-incident-runbook

  • Responding to Supabase outages
  • Investigating connection pool exhaustion
  • Debugging RLS issues
  • Preparing escalation evidence

About this skill

Supabase Incident Runbook

Overview

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.

Prerequisites

  • Supabase project with dashboard access at supabase.com/dashboard
  • @supabase/supabase-js v2+ installed in your project
  • Supabase CLI installed for Edge Function log access
  • Direct database connection string (for psql diagnostics)
  • Access to status.supabase.com for platform health

Instructions

Step 1: Triage — Platform vs. Application

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.

Step 2: Database Diagnostics with pg_stat_activity

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.

Step 3: RLS Debugging, Edge Functions, and Storage

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,
       pg_get_expr(qual, polrelid) AS using_expression
FROM pg_policy
JOIN pg_class ON pg_class.oid = polrelid
WHERE relname = 'your_table_name';

Continue with JWT-claim simulation in the SQL Editor, the anon-vs-service-role SDK diff (debugRLS), Edge Function log tailing (npx supabase functions logs), cold-start detection, and a storage bucket upload/download check — full blocks in references/diagnostics.md.

Output

After running this incident runbook, you will have:

  • Platform status assessment — confirmed whether the issue is Supabase-side or application-side
  • SDK health check — latency measurement and connectivity verification via createClient
  • Connection pool analysispg_stat_activity showing active, idle, and leaked connections
  • Long-running query identification — stuck queries with PIDs ready for cancellation
  • RLS policy diagnosis — side-by-side comparison of anon vs. service role query results
  • Edge Function status — deployment status, cold start detection, and log inspection
  • Storage health report — bucket accessibility and upload/download verification
  • Evidence bundle — complete diagnostic data for Supabase support escalation

Error Handling

ErrorCauseSolution
FetchError: request failedSupabase API unreachableCheck status.supabase.com; verify network/DNS
connection refused on port 5432Direct DB access blocked or wrong credentialsUse pooler URL (port 6543) or check dashboard connection strings
too many clients alreadyConnection pool exhaustedKill idle-in-transaction connections; enable Supavisor pooling
permission denied for tableRLS blocking or wrong roleCheck policies with pg_policy; verify JWT claims
WORKER_LIMIT in Edge FunctionMemory/CPU exceededReduce function payload size; optimize imports
JWT expiredToken not refreshingVerify autoRefreshToken: true in createClient options
storage/object-not-foundFile deleted or wrong pathCheck bucket policies; verify path with service role client
rate limit exceeded (429)Too many API requestsImplement exponential backoff; contact Supabase for limit increase

Examples

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.

Resources

Next Steps

  • For GDPR compliance and data handling, see supabase-data-handling
  • For performance tuning and query optimization, see supabase-performance-tuning
  • For observability and monitoring setup, see supabase-observability
  • For common error patterns and fixes, see supabase-common-errors

Prerequisites

Supabase project with dashboard access@supabase/supabase-js v2+ installedSupabase CLI installedDirect database connection string

How it compares

This provides a structured, step-by-step diagnostic process, unlike ad-hoc troubleshooting.

Compared to similar skills

supabase-incident-runbook side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
supabase-incident-runbook (this skill)127dReviewIntermediate
supabase-advanced-troubleshooting127dCautionAdvanced
plain-optimize12moNo flagsIntermediate
data-safety-auditor37moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

Search skills

Search the agent skills registry