/supabase-pack:supabase-observabilityfrom supabase-pack
Sets up monitoring and observability for Supabase projects using Dashboard reports, CLI inspect commands, pg_stat_statements, log drains, and alerting. Use when diagnosing slow queries, forwarding logs, or configuring alerts.
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.
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.
npx supabase --version)supabase link --project-ref <ref>)@supabase/supabase-js v2+ installed for application-level monitoringStart 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.
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:
Configure an approved destination under Project Settings > Log Drains in the Dashboard. Review exported data, retention, credentials, and destination region before enabling forwarding; confirm arrival using synthetic events.
The complete slow-query / high-frequency / connection-monitoring SQL set and the Dashboard log-drain configuration and verification workflow are in references/query-analytics-and-log-drains.md.
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 approved invocations with pg_cron and pg_net, retrieving the URL and appropriate function credential from Vault; a function TOML schedule field is not supported. 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.
pg_stat_statements enabled with slow-query and high-frequency-query views| Issue | Cause | Solution |
|---|---|---|
pg_stat_statements returns no rows | Extension not enabled | Enable via Dashboard > Database > Extensions |
supabase inspect db fails | CLI not linked to project | Run supabase link --project-ref <ref> |
| Log drain not receiving events | API key invalid or region mismatch | Verify the destination and drain status in Project Settings > Log Drains |
| Cache hit ratio below 95% | Working set exceeds RAM | Upgrade compute add-on or optimize queries |
| Health check returns 503 | One or more services degraded | Check detail field in response; verify service role key |
| Edge Function cron not firing | Cron job or HTTP/authentication failure | Inspect the reviewed cron job and invocation logs; verify Vault references and the function auth mode |
| Long-running queries growing | Missing indexes or lock contention | Run inspect db seq-scans and inspect db blocking |
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.
For incident response procedures, see supabase-incident-runbook.
For performance optimization, see supabase-performance-tuning.
references/alert-configuration.md (opens in a new tab)references/cli-inspect-commands.md (opens in a new tab)references/custom-metrics-and-health-checks.md (opens in a new tab)references/diagnostic-scripts.md (opens in a new tab)references/errors.md (opens in a new tab)references/examples.md (opens in a new tab)references/metrics-collection.md (opens in a new tab)references/query-analytics-and-log-drains.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin supabase-pack30 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".
Other plugins' skills for the same job