@intentsolutionsio/supabase-pack 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +73 -47
  3. package/package.json +4 -4
  4. package/skills/supabase-advanced-troubleshooting/SKILL.md +404 -200
  5. package/skills/supabase-advanced-troubleshooting/references/errors.md +11 -0
  6. package/skills/supabase-advanced-troubleshooting/references/evidence-collection-framework.md +34 -0
  7. package/skills/supabase-advanced-troubleshooting/references/examples.md +11 -0
  8. package/skills/supabase-advanced-troubleshooting/references/rls-edge-functions-realtime.md +363 -0
  9. package/skills/supabase-advanced-troubleshooting/references/systematic-isolation.md +56 -0
  10. package/skills/supabase-advanced-troubleshooting/references/timing-analysis.md +35 -0
  11. package/skills/supabase-architecture-variants/SKILL.md +395 -216
  12. package/skills/supabase-architecture-variants/references/errors.md +11 -0
  13. package/skills/supabase-architecture-variants/references/examples.md +12 -0
  14. package/skills/supabase-architecture-variants/references/serverless-and-multi-tenant.md +251 -0
  15. package/skills/supabase-architecture-variants/references/variant-a-monolith-(simple).md +44 -0
  16. package/skills/supabase-architecture-variants/references/variant-b-service-layer-(moderate).md +72 -0
  17. package/skills/supabase-architecture-variants/references/variant-c-microservice-(complex).md +81 -0
  18. package/skills/supabase-auth-storage-realtime-core/SKILL.md +471 -37
  19. package/skills/supabase-ci-integration/SKILL.md +315 -67
  20. package/skills/supabase-ci-integration/references/errors.md +10 -0
  21. package/skills/supabase-ci-integration/references/examples.md +36 -0
  22. package/skills/supabase-ci-integration/references/implementation.md +54 -0
  23. package/skills/supabase-common-errors/SKILL.md +320 -62
  24. package/skills/supabase-common-errors/references/errors.md +53 -0
  25. package/skills/supabase-common-errors/references/examples.md +23 -0
  26. package/skills/supabase-cost-tuning/SKILL.md +365 -131
  27. package/skills/supabase-cost-tuning/references/cost-estimation.md +34 -0
  28. package/skills/supabase-cost-tuning/references/cost-reduction-strategies.md +40 -0
  29. package/skills/supabase-cost-tuning/references/errors.md +11 -0
  30. package/skills/supabase-cost-tuning/references/examples.md +15 -0
  31. package/skills/supabase-data-handling/SKILL.md +378 -145
  32. package/skills/supabase-data-handling/references/errors.md +11 -0
  33. package/skills/supabase-data-handling/references/examples.md +27 -0
  34. package/skills/supabase-data-handling/references/implementation.md +223 -0
  35. package/skills/supabase-data-handling/references/retention-and-backup.md +221 -0
  36. package/skills/supabase-debug-bundle/SKILL.md +267 -73
  37. package/skills/supabase-debug-bundle/references/errors.md +12 -0
  38. package/skills/supabase-debug-bundle/references/examples.md +24 -0
  39. package/skills/supabase-debug-bundle/references/implementation.md +54 -0
  40. package/skills/supabase-deploy-integration/SKILL.md +258 -147
  41. package/skills/supabase-deploy-integration/references/errors.md +11 -0
  42. package/skills/supabase-deploy-integration/references/examples.md +21 -0
  43. package/skills/supabase-deploy-integration/references/google-cloud-run.md +36 -0
  44. package/skills/supabase-deploy-integration/references/vercel-deployment.md +35 -0
  45. package/skills/supabase-enterprise-rbac/SKILL.md +327 -160
  46. package/skills/supabase-enterprise-rbac/references/api-scoping-and-enforcement.md +255 -0
  47. package/skills/supabase-enterprise-rbac/references/errors.md +11 -0
  48. package/skills/supabase-enterprise-rbac/references/examples.md +12 -0
  49. package/skills/supabase-enterprise-rbac/references/role-implementation.md +33 -0
  50. package/skills/supabase-enterprise-rbac/references/sso-integration.md +35 -0
  51. package/skills/supabase-hello-world/SKILL.md +160 -54
  52. package/skills/supabase-incident-runbook/SKILL.md +453 -131
  53. package/skills/supabase-incident-runbook/references/errors.md +11 -0
  54. package/skills/supabase-incident-runbook/references/examples.md +10 -0
  55. package/skills/supabase-incident-runbook/references/immediate-actions-by-error-type.md +41 -0
  56. package/skills/supabase-install-auth/SKILL.md +186 -50
  57. package/skills/supabase-install-auth/references/examples.md +102 -0
  58. package/skills/supabase-known-pitfalls/SKILL.md +411 -241
  59. package/skills/supabase-known-pitfalls/references/errors.md +11 -0
  60. package/skills/supabase-known-pitfalls/references/examples.md +12 -0
  61. package/skills/supabase-load-scale/SKILL.md +346 -217
  62. package/skills/supabase-load-scale/references/capacity-planning.md +47 -0
  63. package/skills/supabase-load-scale/references/errors.md +11 -0
  64. package/skills/supabase-load-scale/references/examples.md +26 -0
  65. package/skills/supabase-load-scale/references/load-testing-with-k6.md +59 -0
  66. package/skills/supabase-load-scale/references/scaling-patterns.md +65 -0
  67. package/skills/supabase-load-scale/references/table-partitioning.md +263 -0
  68. package/skills/supabase-local-dev-loop/SKILL.md +272 -73
  69. package/skills/supabase-local-dev-loop/references/errors.md +11 -0
  70. package/skills/supabase-local-dev-loop/references/examples.md +21 -0
  71. package/skills/supabase-local-dev-loop/references/implementation.md +60 -0
  72. package/skills/supabase-migration-deep-dive/SKILL.md +338 -177
  73. package/skills/supabase-migration-deep-dive/references/backfill-versioning-rollback.md +258 -0
  74. package/skills/supabase-migration-deep-dive/references/errors.md +11 -0
  75. package/skills/supabase-migration-deep-dive/references/examples.md +12 -0
  76. package/skills/supabase-migration-deep-dive/references/implementation-plan.md +80 -0
  77. package/skills/supabase-migration-deep-dive/references/pre-migration-assessment.md +39 -0
  78. package/skills/supabase-multi-env-setup/SKILL.md +393 -152
  79. package/skills/supabase-multi-env-setup/references/configuration-structure.md +59 -0
  80. package/skills/supabase-multi-env-setup/references/errors.md +11 -0
  81. package/skills/supabase-multi-env-setup/references/examples.md +11 -0
  82. package/skills/supabase-observability/SKILL.md +318 -196
  83. package/skills/supabase-observability/references/alert-configuration.md +40 -0
  84. package/skills/supabase-observability/references/errors.md +11 -0
  85. package/skills/supabase-observability/references/examples.md +13 -0
  86. package/skills/supabase-observability/references/metrics-collection.md +65 -0
  87. package/skills/supabase-performance-tuning/SKILL.md +304 -160
  88. package/skills/supabase-performance-tuning/references/caching-strategy.md +49 -0
  89. package/skills/supabase-performance-tuning/references/errors.md +11 -0
  90. package/skills/supabase-performance-tuning/references/examples.md +13 -0
  91. package/skills/supabase-policy-guardrails/SKILL.md +248 -221
  92. package/skills/supabase-policy-guardrails/references/ci-cost-security.md +484 -0
  93. package/skills/supabase-policy-guardrails/references/errors.md +11 -0
  94. package/skills/supabase-policy-guardrails/references/eslint-rules.md +46 -0
  95. package/skills/supabase-policy-guardrails/references/examples.md +10 -0
  96. package/skills/supabase-prod-checklist/SKILL.md +474 -84
  97. package/skills/supabase-prod-checklist/references/errors.md +63 -0
  98. package/skills/supabase-prod-checklist/references/examples.md +153 -0
  99. package/skills/supabase-prod-checklist/references/implementation.md +113 -0
  100. package/skills/supabase-rate-limits/SKILL.md +311 -98
  101. package/skills/supabase-rate-limits/references/errors.md +11 -0
  102. package/skills/supabase-rate-limits/references/examples.md +46 -0
  103. package/skills/supabase-rate-limits/references/implementation.md +66 -0
  104. package/skills/supabase-reference-architecture/SKILL.md +249 -182
  105. package/skills/supabase-reference-architecture/references/errors.md +29 -0
  106. package/skills/supabase-reference-architecture/references/examples.md +116 -0
  107. package/skills/supabase-reference-architecture/references/key-components.md +244 -0
  108. package/skills/supabase-reference-architecture/references/project-structure.md +109 -0
  109. package/skills/supabase-reliability-patterns/SKILL.md +229 -234
  110. package/skills/supabase-reliability-patterns/references/circuit-breaker.md +36 -0
  111. package/skills/supabase-reliability-patterns/references/dead-letter-queue.md +48 -0
  112. package/skills/supabase-reliability-patterns/references/errors.md +11 -0
  113. package/skills/supabase-reliability-patterns/references/examples.md +11 -0
  114. package/skills/supabase-reliability-patterns/references/idempotency-keys.md +36 -0
  115. package/skills/supabase-reliability-patterns/references/offline-degradation-health-dualwrite.md +489 -0
  116. package/skills/supabase-schema-from-requirements/SKILL.md +373 -34
  117. package/skills/supabase-sdk-patterns/SKILL.md +388 -99
  118. package/skills/supabase-sdk-patterns/references/errors.md +11 -0
  119. package/skills/supabase-sdk-patterns/references/examples.md +45 -0
  120. package/skills/supabase-sdk-patterns/references/implementation.md +67 -0
  121. package/skills/supabase-security-basics/SKILL.md +282 -102
  122. package/skills/supabase-security-basics/references/errors.md +10 -0
  123. package/skills/supabase-security-basics/references/examples.md +70 -0
  124. package/skills/supabase-security-basics/references/implementation.md +39 -0
  125. package/skills/supabase-upgrade-migration/SKILL.md +248 -66
  126. package/skills/supabase-upgrade-migration/references/errors.md +10 -0
  127. package/skills/supabase-upgrade-migration/references/examples.md +51 -0
  128. package/skills/supabase-upgrade-migration/references/implementation.md +29 -0
  129. package/skills/supabase-webhooks-events/SKILL.md +412 -138
  130. package/skills/supabase-webhooks-events/references/errors.md +55 -0
  131. package/skills/supabase-webhooks-events/references/event-handler-pattern.md +106 -0
  132. package/skills/supabase-webhooks-events/references/examples.md +133 -0
  133. package/skills/supabase-webhooks-events/references/signature-verification.md +165 -0
@@ -1,111 +1,305 @@
1
1
  ---
2
2
  name: supabase-debug-bundle
3
- description: |
4
- Collect Supabase debug evidence for support tickets and troubleshooting.
5
- Use when encountering persistent issues, preparing support tickets,
6
- or collecting diagnostic information for Supabase problems.
7
- Trigger with phrases like "supabase debug", "supabase support bundle",
8
- "collect supabase logs", "supabase diagnostic".
9
- allowed-tools: Read, Bash(grep:*), Bash(curl:*), Bash(tar:*), Grep
3
+ description: 'Collect Supabase diagnostic info for troubleshooting and support tickets.
4
+
5
+ Use when debugging connection failures, auth issues, Realtime drops, Storage
6
+
7
+ errors, RLS misconfigurations, or preparing a support escalation.
8
+
9
+ Trigger: "supabase debug", "supabase diagnostics", "supabase support bundle",
10
+
11
+ "collect supabase logs", "debug supabase connection".
12
+
13
+ '
14
+ allowed-tools: Read, Bash(npx:*), Bash(node:*), Bash(curl:*), Bash(supabase:*), Bash(tar:*),
15
+ Grep, Glob
10
16
  version: 1.0.0
11
17
  license: MIT
12
18
  author: Jeremy Longshore <jeremy@intentsolutions.io>
19
+ tags:
20
+ - saas
21
+ - supabase
22
+ - debugging
23
+ - support
24
+ - diagnostics
25
+ compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
13
26
  ---
14
-
15
27
  # Supabase Debug Bundle
16
28
 
17
- ## Overview
18
- Collect all necessary diagnostic information for Supabase support tickets.
29
+ Collect a comprehensive, redacted diagnostic bundle from a Supabase project. Tests connectivity, auth, Realtime, Storage, RLS policy behavior, and database health — then packages everything into a single archive safe for sharing with Supabase support.
30
+
31
+ ## Current State
32
+
33
+ !`node --version 2>/dev/null || echo 'Node.js not found'`
34
+ !`npx supabase --version 2>/dev/null || echo 'Supabase CLI not found'`
35
+ !`npm list @supabase/supabase-js 2>/dev/null | grep supabase || echo '@supabase/supabase-js not installed'`
19
36
 
20
37
  ## Prerequisites
21
- - Supabase SDK installed
22
- - Access to application logs
23
- - Permission to collect environment info
38
+
39
+ - **Node.js 18+** with `@supabase/supabase-js` v2 installed in the project
40
+ - **Supabase CLI** installed (`npm i -g supabase` or `npx supabase`)
41
+ - **Environment variables** set: `SUPABASE_URL` and `SUPABASE_ANON_KEY` (minimum); `SUPABASE_SERVICE_ROLE_KEY` for full diagnostics
42
+ - Project linked via `supabase link --project-ref <ref>` (for CLI commands)
24
43
 
25
44
  ## Instructions
26
45
 
27
- ### Step 1: Create Debug Bundle Script
28
- ```bash
29
- #!/bin/bash
30
- # supabase-debug-bundle.sh
46
+ ### Step 1: Gather Environment and Connectivity
31
47
 
32
- BUNDLE_DIR="supabase-debug-$(date +%Y%m%d-%H%M%S)"
33
- mkdir -p "$BUNDLE_DIR"
48
+ Collect SDK version, project URL, key type, and test basic connectivity against the REST and Auth endpoints.
34
49
 
35
- echo "=== Supabase Debug Bundle ===" > "$BUNDLE_DIR/summary.txt"
36
- echo "Generated: $(date)" >> "$BUNDLE_DIR/summary.txt"
37
- ```
50
+ ```typescript
51
+ import { createClient } from '@supabase/supabase-js'
38
52
 
39
- ### Step 2: Collect Environment Info
40
- ```bash
41
- # Environment info
42
- echo "--- Environment ---" >> "$BUNDLE_DIR/summary.txt"
43
- node --version >> "$BUNDLE_DIR/summary.txt" 2>&1
44
- npm --version >> "$BUNDLE_DIR/summary.txt" 2>&1
45
- echo "SUPABASE_API_KEY: ${SUPABASE_API_KEY:+[SET]}" >> "$BUNDLE_DIR/summary.txt"
53
+ const url = process.env.SUPABASE_URL!
54
+ const anonKey = process.env.SUPABASE_ANON_KEY!
55
+ const serviceKey = process.env.SUPABASE_SERVICE_ROLE_KEY
56
+
57
+ // Identify which key is in use
58
+ const keyType = serviceKey ? 'service_role' : 'anon'
59
+ const supabase = createClient(url, serviceKey ?? anonKey, {
60
+ auth: { autoRefreshToken: false, persistSession: false }
61
+ })
62
+
63
+ const diagnostics: Record<string, unknown> = {}
64
+
65
+ // 1a — SDK + environment
66
+ diagnostics.environment = {
67
+ supabase_js_version: require('@supabase/supabase-js/package.json').version,
68
+ node_version: process.version,
69
+ project_url: url.replace(/https:\/\/([^.]+)\..*/, 'https://$1.***'),
70
+ key_type: keyType,
71
+ timestamp: new Date().toISOString(),
72
+ }
73
+
74
+ // 1b — REST API connectivity
75
+ const restStart = Date.now()
76
+ const restRes = await fetch(`${url}/rest/v1/`, {
77
+ headers: { apikey: anonKey, Authorization: `Bearer ${anonKey}` },
78
+ })
79
+ diagnostics.rest_api = {
80
+ status: restRes.status,
81
+ latency_ms: Date.now() - restStart,
82
+ ok: restRes.ok,
83
+ }
84
+
85
+ // 1c — Auth health
86
+ const authStart = Date.now()
87
+ const { data: sessionData, error: sessionErr } = await supabase.auth.getSession()
88
+ diagnostics.auth = {
89
+ status: sessionErr ? `error: ${sessionErr.message}` : 'ok',
90
+ has_session: !!sessionData?.session,
91
+ latency_ms: Date.now() - authStart,
92
+ }
93
+
94
+ // 1d — Database connectivity probe
95
+ const dbStart = Date.now()
96
+ const { error: dbErr } = await supabase.from('_test_ping').select('*').limit(1)
97
+ diagnostics.database = {
98
+ // 42P01 = table doesn't exist, which proves the connection works
99
+ status: (!dbErr || dbErr.code === '42P01') ? 'connected' : `error: ${dbErr.code}`,
100
+ latency_ms: Date.now() - dbStart,
101
+ }
102
+
103
+ console.log(JSON.stringify(diagnostics, null, 2))
46
104
  ```
47
105
 
48
- ### Step 3: Gather SDK and Logs
49
- ```bash
50
- # SDK version
51
- npm list @supabase/supabase-js 2>/dev/null >> "$BUNDLE_DIR/summary.txt"
106
+ **What to check:** REST API should return `200`. Auth should return `ok`. Database probe returning `42P01` (relation not found) is normal — it confirms the PostgREST connection works.
107
+
108
+ ### Step 2: Test Realtime, Storage, and RLS
109
+
110
+ Probe the three subsystems that cause the most support tickets.
52
111
 
53
- # Recent logs (redacted)
54
- grep -i "supabase" ~/.npm/_logs/*.log 2>/dev/null | tail -50 >> "$BUNDLE_DIR/logs.txt"
112
+ ```typescript
113
+ // 2a Realtime subscription test
114
+ const realtimeResult = await new Promise<Record<string, unknown>>((resolve) => {
115
+ const timeout = setTimeout(() => {
116
+ resolve({ status: 'timeout', detail: 'No SUBSCRIBED event within 5s' })
117
+ }, 5000)
55
118
 
56
- # Configuration (redacted - secrets masked)
57
- echo "--- Config (redacted) ---" >> "$BUNDLE_DIR/summary.txt"
58
- cat .env 2>/dev/null | sed 's/=.*/=***REDACTED***/' >> "$BUNDLE_DIR/config-redacted.txt"
119
+ const channel = supabase.channel('debug-probe')
120
+ channel.subscribe((status) => {
121
+ if (status === 'SUBSCRIBED') {
122
+ clearTimeout(timeout)
123
+ channel.unsubscribe()
124
+ resolve({ status: 'ok', detail: 'Channel subscribed successfully' })
125
+ } else if (status === 'CHANNEL_ERROR') {
126
+ clearTimeout(timeout)
127
+ channel.unsubscribe()
128
+ resolve({ status: 'error', detail: 'CHANNEL_ERROR on subscribe' })
129
+ }
130
+ })
131
+ })
132
+ diagnostics.realtime = realtimeResult
59
133
 
60
- # Network connectivity test
61
- echo "--- Network Test ---" >> "$BUNDLE_DIR/summary.txt"
62
- echo -n "API Health: " >> "$BUNDLE_DIR/summary.txt"
63
- curl -s -o /dev/null -w "%{http_code}" https://api.supabase.com/health >> "$BUNDLE_DIR/summary.txt"
64
- echo "" >> "$BUNDLE_DIR/summary.txt"
134
+ // 2b Storage bucket listing
135
+ const { data: buckets, error: storageErr } = await supabase.storage.listBuckets()
136
+ diagnostics.storage = {
137
+ status: storageErr ? `error: ${storageErr.message}` : 'ok',
138
+ bucket_count: buckets?.length ?? 0,
139
+ buckets: buckets?.map((b) => ({ name: b.name, public: b.public })) ?? [],
140
+ }
141
+
142
+ // 2c — RLS comparison: anon vs service_role
143
+ // Query the same table with both key types to detect RLS misconfiguration
144
+ if (serviceKey) {
145
+ const anonClient = createClient(url, anonKey, {
146
+ auth: { autoRefreshToken: false, persistSession: false },
147
+ })
148
+ // Pick the first public table from pg_tables (or fall back)
149
+ const { data: tables } = await supabase
150
+ .from('information_schema.tables' as any)
151
+ .select('table_name')
152
+ .eq('table_schema', 'public')
153
+ .limit(1)
154
+
155
+ const testTable = tables?.[0]?.table_name
156
+ if (testTable) {
157
+ const { count: anonCount } = await anonClient
158
+ .from(testTable)
159
+ .select('*', { count: 'exact', head: true })
160
+ const { count: serviceCount } = await supabase
161
+ .from(testTable)
162
+ .select('*', { count: 'exact', head: true })
163
+ diagnostics.rls = {
164
+ table: testTable,
165
+ anon_visible_rows: anonCount ?? 0,
166
+ service_role_visible_rows: serviceCount ?? 0,
167
+ rls_active: (anonCount ?? 0) !== (serviceCount ?? 0),
168
+ }
169
+ } else {
170
+ diagnostics.rls = { status: 'skipped', detail: 'No public tables found' }
171
+ }
172
+ } else {
173
+ diagnostics.rls = { status: 'skipped', detail: 'No service_role key — cannot compare' }
174
+ }
65
175
  ```
66
176
 
67
- ### Step 4: Package Bundle
177
+ **What to check:** Realtime should reach `SUBSCRIBED` within 5 seconds. Storage should list buckets without error. RLS comparison showing identical row counts for anon and service_role on a table you expect to be protected means RLS policies may be missing.
178
+
179
+ ### Step 3: Collect Database Health and Package the Bundle
180
+
181
+ Pull database statistics via the Supabase CLI inspect commands and the platform status page, then archive everything.
182
+
68
183
  ```bash
69
- tar -czf "$BUNDLE_DIR.tar.gz" "$BUNDLE_DIR"
70
- echo "Bundle created: $BUNDLE_DIR.tar.gz"
184
+ #!/bin/bash
185
+ set -euo pipefail
186
+
187
+ BUNDLE_DIR="supabase-debug-$(date +%Y%m%d-%H%M%S)"
188
+ mkdir -p "$BUNDLE_DIR"
189
+
190
+ # 3a — Supabase CLI status (local dev)
191
+ npx supabase status > "$BUNDLE_DIR/cli-status.txt" 2>&1 || echo "CLI status unavailable (not linked or no local dev)" > "$BUNDLE_DIR/cli-status.txt"
192
+
193
+ # 3b — Database inspection via CLI
194
+ npx supabase inspect db table-sizes > "$BUNDLE_DIR/table-sizes.txt" 2>&1 || true
195
+ npx supabase inspect db index-usage > "$BUNDLE_DIR/index-usage.txt" 2>&1 || true
196
+ npx supabase inspect db cache-hit > "$BUNDLE_DIR/cache-hit.txt" 2>&1 || true
197
+ npx supabase inspect db seq-scans > "$BUNDLE_DIR/seq-scans.txt" 2>&1 || true
198
+ npx supabase inspect db long-running-queries > "$BUNDLE_DIR/long-queries.txt" 2>&1 || true
199
+ npx supabase inspect db bloat > "$BUNDLE_DIR/bloat.txt" 2>&1 || true
200
+ npx supabase inspect db replication-slots > "$BUNDLE_DIR/replication.txt" 2>&1 || true
201
+
202
+ # 3c — Platform status page
203
+ curl -sf https://status.supabase.com/api/v2/status.json \
204
+ | python3 -m json.tool > "$BUNDLE_DIR/platform-status.json" 2>/dev/null \
205
+ || echo '{"error": "Could not reach status.supabase.com"}' > "$BUNDLE_DIR/platform-status.json"
206
+
207
+ # 3d — Redact secrets from all collected files
208
+ find "$BUNDLE_DIR" -type f -exec sed -i \
209
+ -e 's/eyJ[A-Za-z0-9_-]\{20,\}\(\.[A-Za-z0-9_-]*\)*/[JWT_REDACTED]/g' \
210
+ -e 's/sbp_[A-Za-z0-9]\{20,\}/[SBP_KEY_REDACTED]/g' \
211
+ -e 's/[A-Za-z0-9._%+-]\+@[A-Za-z0-9.-]\+\.[A-Za-z]\{2,\}/[EMAIL_REDACTED]/g' {} +
212
+
213
+ # 3e — Package
214
+ tar czf "${BUNDLE_DIR}.tar.gz" "$BUNDLE_DIR"
215
+ echo "Debug bundle created: ${BUNDLE_DIR}.tar.gz"
216
+ echo "Contents:"
217
+ ls -lh "$BUNDLE_DIR"/
71
218
  ```
72
219
 
220
+ **What to check:** Review `cache-hit.txt` — index and table hit rates below 99% indicate memory pressure. `bloat.txt` values above 50% on large tables warrant a `VACUUM`. `seq-scans.txt` highlights tables needing indexes.
221
+
73
222
  ## Output
74
- - `supabase-debug-YYYYMMDD-HHMMSS.tar.gz` archive containing:
75
- - `summary.txt` - Environment and SDK info
76
- - `logs.txt` - Recent redacted logs
77
- - `config-redacted.txt` - Configuration (secrets removed)
223
+
224
+ The skill produces `supabase-debug-YYYYMMDD-HHMMSS.tar.gz` containing:
225
+
226
+ | File | Contents |
227
+ |------|----------|
228
+ | `cli-status.txt` | Local Supabase stack status (services, ports, URLs) |
229
+ | `table-sizes.txt` | All tables with row counts and disk usage |
230
+ | `index-usage.txt` | Index scan frequency — unused indexes are candidates for removal |
231
+ | `cache-hit.txt` | Buffer cache and index cache hit ratios |
232
+ | `seq-scans.txt` | Tables with high sequential scan counts (missing indexes) |
233
+ | `long-queries.txt` | Currently running queries over the duration threshold |
234
+ | `bloat.txt` | Table and index bloat percentages |
235
+ | `replication.txt` | Replication slot status (relevant for Realtime) |
236
+ | `platform-status.json` | Supabase platform health from status.supabase.com |
237
+
238
+ Plus the TypeScript diagnostics output (connectivity, auth, Realtime, Storage, RLS) printed to stdout.
239
+
240
+ All JWT tokens, Supabase project keys (`sbp_*`), and email addresses are automatically redacted before archiving.
78
241
 
79
242
  ## Error Handling
80
- | Item | Purpose | Included |
81
- |------|---------|----------|
82
- | Environment versions | Compatibility check | ✓ |
83
- | SDK version | Version-specific bugs | |
84
- | Error logs (redacted) | Root cause analysis | |
85
- | Config (redacted) | Configuration issues | |
86
- | Network test | Connectivity issues | |
243
+
244
+ | Symptom | Cause | Fix |
245
+ |---------|-------|-----|
246
+ | REST API returns `401` | Invalid or expired `anon` key | Regenerate key in Dashboard > Settings > API |
247
+ | REST API returns `000` or times out | Wrong `SUPABASE_URL` or project paused | Verify URL; unpause project in Dashboard |
248
+ | Realtime returns `CHANNEL_ERROR` | WebSocket blocked by firewall/proxy | Check corporate proxy; try from a different network |
249
+ | Realtime times out (5s) | Realtime addon not enabled or quota hit | Enable Realtime on the table in Dashboard > Database > Replication |
250
+ | Storage `listBuckets` returns `403` | RLS enabled on storage without policy | Add a storage policy or use `service_role` key |
251
+ | `supabase inspect db` fails | CLI not linked to remote project | Run `supabase link --project-ref <ref>` first |
252
+ | `cache-hit` below 95% | Database instance too small for workload | Upgrade compute size or optimize queries |
253
+ | RLS shows identical counts | No RLS policies on the table | Add policies via `ALTER TABLE ... ENABLE ROW LEVEL SECURITY` |
254
+ | `pg_stat_statements` not available | Extension not enabled | Enable in Dashboard > Database > Extensions |
87
255
 
88
256
  ## Examples
89
257
 
90
- ### Sensitive Data Handling
91
- **ALWAYS REDACT:**
92
- - API keys and tokens
93
- - Passwords and secrets
94
- - PII (emails, names, IDs)
258
+ **Quick connectivity check (no service key needed):**
259
+
260
+ ```typescript
261
+ import { createClient } from '@supabase/supabase-js'
262
+
263
+ const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!)
264
+
265
+ const start = Date.now()
266
+ const { error } = await supabase.from('any_table').select('*').limit(1)
267
+ console.log({
268
+ connected: !error || error.code === '42P01',
269
+ latency_ms: Date.now() - start,
270
+ error: error?.message ?? null,
271
+ })
272
+ ```
273
+
274
+ **API endpoint test with curl:**
95
275
 
96
- **Safe to Include:**
97
- - Error messages
98
- - Stack traces (redacted)
99
- - SDK/runtime versions
276
+ ```bash
277
+ curl -s -o /dev/null -w "HTTP %{http_code} in %{time_total}s\n" \
278
+ "https://<project-ref>.supabase.co/rest/v1/" \
279
+ -H "apikey: $SUPABASE_ANON_KEY"
280
+ ```
100
281
 
101
- ### Submit to Support
102
- 1. Create bundle: `bash supabase-debug-bundle.sh`
103
- 2. Review for sensitive data
104
- 3. Upload to Supabase support portal
282
+ **Check auth session from a running app:**
283
+
284
+ ```typescript
285
+ const { data, error } = await supabase.auth.getSession()
286
+ if (error) console.error('Auth error:', error.message)
287
+ else if (!data.session) console.log('No active session (user not logged in)')
288
+ else console.log('Session valid, expires:', data.session.expires_at)
289
+ ```
105
290
 
106
291
  ## Resources
107
- - [Supabase Support](https://supabase.com/docs/support)
108
- - [Supabase Status](https://status.supabase.com)
292
+
293
+ - [Supabase Troubleshooting Guide](https://supabase.com/docs/guides/platform/troubleshooting) — official first-stop for common issues
294
+ - [Database Inspect (CLI)](https://supabase.com/docs/guides/database/inspect) — `supabase inspect db` command reference
295
+ - [Supabase Status Page](https://status.supabase.com) — live platform health
296
+ - [Supabase Support](https://supabase.com/support) — file a ticket with your debug bundle attached
297
+ - [RLS Guide](https://supabase.com/docs/guides/database/postgres/row-level-security) — row-level security policy authoring
298
+ - [Realtime Quotas](https://supabase.com/docs/guides/realtime/quotas) — connection and message limits
109
299
 
110
300
  ## Next Steps
111
- For rate limit issues, see `supabase-rate-limits`.
301
+
302
+ - Run `supabase-common-errors` to match diagnostic output against known issue patterns
303
+ - Run `supabase-rate-limits` if the bundle reveals 429 responses or throttled connections
304
+ - Run `supabase-performance-tuning` if cache hit ratios are below 99% or sequential scans are high
305
+ - Run `supabase-observability` to set up ongoing monitoring so issues surface before they become tickets
@@ -0,0 +1,12 @@
1
+ # Error Handling Reference
2
+
3
+ | Item | Purpose | Included |
4
+ |------|---------|----------|
5
+ | Environment versions | Compatibility check | ✓ |
6
+ | SDK version | Version-specific bugs | ✓ |
7
+ | Error logs (redacted) | Root cause analysis | ✓ |
8
+ | Config (redacted) | Configuration issues | ✓ |
9
+ | Network test | Connectivity issues | ✓ |
10
+
11
+ ---
12
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
@@ -0,0 +1,24 @@
1
+ ## Examples
2
+
3
+ ### Sensitive Data Handling
4
+
5
+ **ALWAYS REDACT:**
6
+
7
+ - API keys and tokens
8
+ - Passwords and secrets
9
+ - PII (emails, names, IDs)
10
+
11
+ **Safe to Include:**
12
+
13
+ - Error messages
14
+ - Stack traces (redacted)
15
+ - SDK/runtime versions
16
+
17
+ ### Submit to Support
18
+
19
+ 1. Create bundle: `bash supabase-debug-bundle.sh`
20
+ 2. Review for sensitive data
21
+ 3. Upload to Supabase support portal
22
+
23
+ ---
24
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
@@ -0,0 +1,54 @@
1
+ ## Implementation Guide
2
+
3
+ ### Step 1: Create Debug Bundle Script
4
+
5
+ ```bash
6
+ #!/bin/bash
7
+ # supabase-debug-bundle.sh
8
+
9
+ BUNDLE_DIR="supabase-debug-$(date +%Y%m%d-%H%M%S)"
10
+ mkdir -p "$BUNDLE_DIR"
11
+
12
+ echo "=== Supabase Debug Bundle ===" > "$BUNDLE_DIR/summary.txt"
13
+ echo "Generated: $(date)" >> "$BUNDLE_DIR/summary.txt"
14
+ ```
15
+
16
+ ### Step 2: Collect Environment Info
17
+
18
+ ```bash
19
+ # Environment info
20
+ echo "--- Environment ---" >> "$BUNDLE_DIR/summary.txt"
21
+ node --version >> "$BUNDLE_DIR/summary.txt" 2>&1
22
+ npm --version >> "$BUNDLE_DIR/summary.txt" 2>&1
23
+ echo "SUPABASE_API_KEY: ${SUPABASE_API_KEY:+[SET]}" >> "$BUNDLE_DIR/summary.txt"
24
+ ```
25
+
26
+ ### Step 3: Gather SDK and Logs
27
+
28
+ ```bash
29
+ # SDK version
30
+ npm list @supabase/supabase-js 2>/dev/null >> "$BUNDLE_DIR/summary.txt"
31
+
32
+ # Recent logs (redacted)
33
+ grep -i "supabase" ~/.npm/_logs/*.log 2>/dev/null | tail -50 >> "$BUNDLE_DIR/logs.txt"
34
+
35
+ # Configuration (redacted - secrets masked)
36
+ echo "--- Config (redacted) ---" >> "$BUNDLE_DIR/summary.txt"
37
+ cat .env 2>/dev/null | sed 's/=.*/=***REDACTED***/' >> "$BUNDLE_DIR/config-redacted.txt"
38
+
39
+ # Network connectivity test
40
+ echo "--- Network Test ---" >> "$BUNDLE_DIR/summary.txt"
41
+ echo -n "API Health: " >> "$BUNDLE_DIR/summary.txt"
42
+ curl -s -o /dev/null -w "%{http_code}" https://api.supabase.com/health >> "$BUNDLE_DIR/summary.txt"
43
+ echo "" >> "$BUNDLE_DIR/summary.txt"
44
+ ```
45
+
46
+ ### Step 4: Package Bundle
47
+
48
+ ```bash
49
+ tar -czf "$BUNDLE_DIR.tar.gz" "$BUNDLE_DIR"
50
+ echo "Bundle created: $BUNDLE_DIR.tar.gz"
51
+ ```
52
+
53
+ ---
54
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*