SU

supabase-observability

Implement end-to-end monitoring for Supabase using native reports, CLI inspect tools, and query analytics for troubleshooting.

Install

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

Installs to .claude/skills/supabase-observability

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.

Set up monitoring and observability for Supabase projects using Dashboard reports, CLI inspect commands, pg_stat_statements, log drains, and alerting. Use when implementing monitoring, diagnosing slow queries, forwarding logs, or configuring alerts for Supabase project health. Trigger with phrases like "supabase monitoring", "supabase metrics", "supabase observability", "supabase logs", "supabase alerts", "supabase inspect", "supabase log drain".
450 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Monitor API, database, auth, and storage metrics via Dashboard
  • Perform deep Postgres diagnostics using CLI inspect subcommands
  • Analyze query performance with pg_stat_statements
  • Forward logs to external aggregators like Datadog
  • Collect custom metrics via scheduled Edge Functions
  • Configure alerts for quota and health thresholds

How it works

It utilizes built-in dashboard reports, CLI inspection tools, and database extensions to monitor health, while using log drains and Edge Functions for external alerting and custom metric collection.

Inputs & outputs

You give it
Supabase project reference and diagnostic command
You get back
Performance metrics, query analytics, or log drain configuration

When to use supabase-observability

  • Monitoring Supabase API and DB metrics
  • Diagnosing slow database queries
  • Setting up alerts for quota or usage thresholds
  • Aggregating project logs

About this skill

Supabase Observability

Overview

Monitor Supabase projects end-to-end: Dashboard reports for API/database/auth metrics, supabase inspect db CLI for deep Postgres diagnostics, pg_stat_statements for query analytics, log drains for external aggregation, Edge Functions for custom metrics, and alerting on quota thresholds.

Follow the three steps below from this file for the high-level workflow, then drill into the linked references/ files for the full commands, SQL, and function source.

Prerequisites

  • Supabase CLI installed (npx supabase --version)
  • Supabase project linked (supabase link --project-ref <ref>)
  • Pro plan or higher for log drain support and extended log retention
  • @supabase/supabase-js v2+ installed for application-level monitoring

Instructions

Step 1: Dashboard Reports and CLI Inspect Commands

Start with the built-in Dashboard > Reports (API Requests, Database, Auth Usage, Storage, Realtime) for high-level metrics. For deeper Postgres diagnostics, use the supabase inspect db subcommands — begin with cache hit ratio and sequential scans:

# Cache hit ratio — should be > 99% (below 95% means upgrade compute)
npx supabase inspect db cache-hit --linked

# Sequential scans — tables needing indexes
npx supabase inspect db seq-scans --linked

The full report table plus all nine inspect subcommands (table sizes, index usage, long-running queries, bloat, blocking, replication slots, and more) are in references/cli-inspect-commands.md.

Step 2: Query Analytics with pg_stat_statements and Log Drains

Enable pg_stat_statements for query-level metrics, then rank queries by execution time:

create extension if not exists pg_stat_statements;

-- Top slowest queries by average execution time
select substring(query, 1, 80) as query_preview, calls,
  round(mean_exec_time::numeric, 2) as avg_ms
from pg_stat_statements
where mean_exec_time > 50
order by mean_exec_time desc limit 20;

Forward logs to external aggregation with a log drain:

npx supabase log-drains add --name datadog-drain --type datadog \
  --datadog-api-key "$DATADOG_API_KEY" --datadog-region us1 --linked

The complete slow-query / high-frequency / connection-monitoring SQL set and every log-drain command (Datadog, webhook, list, remove) are in references/query-analytics-and-log-drains.md.

Step 3: Custom Metrics, Alerting, and Health Checks

Emit business-level metrics from a scheduled Edge Function, alert on quota thresholds, and expose a health endpoint for uptime monitors. The skeleton of the metrics collector:

// supabase/functions/collect-metrics/index.ts — see reference for full source
const DB_LIMIT_MB = 8000; // 8GB Pro plan limit
if (dbSize > DB_LIMIT_MB * 0.85) {
  console.warn(`[QUOTA_ALERT] Database at ${Math.round(dbSize / DB_LIMIT_MB * 100)}% capacity`);
}

Schedule it every 15 minutes via [functions.collect-metrics] in config.toml. The complete collector, the multi-service health-check endpoint, and Realtime connection monitoring are in references/custom-metrics-and-health-checks.md. For external alert rules, see the Prometheus AlertManager set in references/alert-configuration.md.

Output

  • Dashboard reports configured for API, database, and auth monitoring
  • CLI inspect commands available for Postgres diagnostics (table sizes, index usage, cache hits, sequential scans, long-running queries)
  • pg_stat_statements enabled with slow-query and high-frequency-query views
  • Log drains forwarding to external tools (Datadog, Logflare, or webhook)
  • Custom metrics Edge Function collecting quota-relevant data on a schedule
  • Health check endpoint returning per-service status with latency
  • Alerting on quota thresholds (database size, user count)

Error Handling

IssueCauseSolution
pg_stat_statements returns no rowsExtension not enabledEnable via Dashboard > Database > Extensions
supabase inspect db failsCLI not linked to projectRun supabase link --project-ref <ref>
Log drain not receiving eventsAPI key invalid or region mismatchVerify credentials; check supabase log-drains list
Cache hit ratio below 95%Working set exceeds RAMUpgrade compute add-on or optimize queries
Health check returns 503One or more services degradedCheck detail field in response; verify service role key
Edge Function cron not firingMissing schedule in config.tomlAdd [functions.<name>] with schedule field and redeploy
Long-running queries growingMissing indexes or lock contentionRun inspect db seq-scans and inspect db blocking

Examples

A one-shot diagnostic bash script that runs every inspect command in sequence, plus the app_metrics backing table schema with a 90-day retention policy, are in references/diagnostic-scripts.md. For application-level Prometheus instrumentation of the Supabase client, see references/metrics-collection.md.

Resources

Next Steps

For incident response procedures, see supabase-incident-runbook. For performance optimization, see supabase-performance-tuning.

When not to use it

  • When the project is not linked to the Supabase CLI
  • When using a Free plan that lacks log drain support

Prerequisites

Supabase CLI installedSupabase project linkedPro plan or higher for log drains@supabase/supabase-js v2+ installed

Limitations

  • Cache hit ratio below 95% indicates compute resource constraints
  • Health check endpoint requires service role key for status details

How it compares

Unlike manual dashboard checking, this provides automated CLI-based diagnostics and programmatic log forwarding for long-term tracking.

Compared to similar skills

supabase-observability side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
supabase-observability (this skill)027dReviewIntermediate
monitoring-database-transactions127dReviewAdvanced
altinity-expert-clickhouse-metrics06moNo flagsIntermediate
postgres-pro03moNo 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