@intentsolutionsio/supabase-pack 1.0.0

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 (35) hide show
  1. package/.claude-plugin/plugin.json +17 -0
  2. package/000-docs/001-BL-LICN-license.txt +3 -0
  3. package/LICENSE +21 -0
  4. package/README.md +69 -0
  5. package/package.json +43 -0
  6. package/skills/supabase-advanced-troubleshooting/SKILL.md +261 -0
  7. package/skills/supabase-architecture-variants/SKILL.md +284 -0
  8. package/skills/supabase-auth-storage-realtime-core/SKILL.md +73 -0
  9. package/skills/supabase-ci-integration/SKILL.md +124 -0
  10. package/skills/supabase-common-errors/SKILL.md +109 -0
  11. package/skills/supabase-cost-tuning/SKILL.md +201 -0
  12. package/skills/supabase-data-handling/SKILL.md +220 -0
  13. package/skills/supabase-debug-bundle/SKILL.md +111 -0
  14. package/skills/supabase-deploy-integration/SKILL.md +209 -0
  15. package/skills/supabase-enterprise-rbac/SKILL.md +222 -0
  16. package/skills/supabase-hello-world/SKILL.md +96 -0
  17. package/skills/supabase-incident-runbook/SKILL.md +203 -0
  18. package/skills/supabase-install-auth/SKILL.md +90 -0
  19. package/skills/supabase-known-pitfalls/SKILL.md +334 -0
  20. package/skills/supabase-load-scale/SKILL.md +274 -0
  21. package/skills/supabase-local-dev-loop/SKILL.md +117 -0
  22. package/skills/supabase-migration-deep-dive/SKILL.md +244 -0
  23. package/skills/supabase-multi-env-setup/SKILL.md +222 -0
  24. package/skills/supabase-observability/SKILL.md +250 -0
  25. package/skills/supabase-performance-tuning/SKILL.md +214 -0
  26. package/skills/supabase-policy-guardrails/SKILL.md +257 -0
  27. package/skills/supabase-prod-checklist/SKILL.md +119 -0
  28. package/skills/supabase-rate-limits/SKILL.md +149 -0
  29. package/skills/supabase-reference-architecture/SKILL.md +238 -0
  30. package/skills/supabase-reliability-patterns/SKILL.md +290 -0
  31. package/skills/supabase-schema-from-requirements/SKILL.md +71 -0
  32. package/skills/supabase-sdk-patterns/SKILL.md +147 -0
  33. package/skills/supabase-security-basics/SKILL.md +140 -0
  34. package/skills/supabase-upgrade-migration/SKILL.md +112 -0
  35. package/skills/supabase-webhooks-events/SKILL.md +199 -0
@@ -0,0 +1,222 @@
1
+ ---
2
+ name: supabase-enterprise-rbac
3
+ description: |
4
+ Configure Supabase enterprise SSO, role-based access control, and organization management.
5
+ Use when implementing SSO integration, configuring role-based permissions,
6
+ or setting up organization-level controls for Supabase.
7
+ Trigger with phrases like "supabase SSO", "supabase RBAC",
8
+ "supabase enterprise", "supabase roles", "supabase permissions", "supabase SAML".
9
+ allowed-tools: Read, Write, Edit
10
+ version: 1.0.0
11
+ license: MIT
12
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
13
+ ---
14
+
15
+ # Supabase Enterprise RBAC
16
+
17
+ ## Overview
18
+ Configure enterprise-grade access control for Supabase integrations.
19
+
20
+ ## Prerequisites
21
+ - Supabase Enterprise tier subscription
22
+ - Identity Provider (IdP) with SAML/OIDC support
23
+ - Understanding of role-based access patterns
24
+ - Audit logging infrastructure
25
+
26
+ ## Role Definitions
27
+
28
+ | Role | Permissions | Use Case |
29
+ |------|-------------|----------|
30
+ | Admin | Full access | Platform administrators |
31
+ | Developer | Read/write, no delete | Active development |
32
+ | Viewer | Read-only | Stakeholders, auditors |
33
+ | Service | API access only | Automated systems |
34
+
35
+ ## Role Implementation
36
+
37
+ ```typescript
38
+ enum SupabaseRole {
39
+ Admin = 'admin',
40
+ Developer = 'developer',
41
+ Viewer = 'viewer',
42
+ Service = 'service',
43
+ }
44
+
45
+ interface SupabasePermissions {
46
+ read: boolean;
47
+ write: boolean;
48
+ delete: boolean;
49
+ admin: boolean;
50
+ }
51
+
52
+ const ROLE_PERMISSIONS: Record<SupabaseRole, SupabasePermissions> = {
53
+ admin: { read: true, write: true, delete: true, admin: true },
54
+ developer: { read: true, write: true, delete: false, admin: false },
55
+ viewer: { read: true, write: false, delete: false, admin: false },
56
+ service: { read: true, write: true, delete: false, admin: false },
57
+ };
58
+
59
+ function checkPermission(
60
+ role: SupabaseRole,
61
+ action: keyof SupabasePermissions
62
+ ): boolean {
63
+ return ROLE_PERMISSIONS[role][action];
64
+ }
65
+ ```
66
+
67
+ ## SSO Integration
68
+
69
+ ### SAML Configuration
70
+
71
+ ```typescript
72
+ // Supabase SAML setup
73
+ const samlConfig = {
74
+ entryPoint: 'https://idp.company.com/saml/sso',
75
+ issuer: 'https://supabase.com/saml/metadata',
76
+ cert: process.env.SAML_CERT,
77
+ callbackUrl: 'https://app.yourcompany.com/auth/supabase/callback',
78
+ };
79
+
80
+ // Map IdP groups to Supabase roles
81
+ const groupRoleMapping: Record<string, SupabaseRole> = {
82
+ 'Engineering': SupabaseRole.Developer,
83
+ 'Platform-Admins': SupabaseRole.Admin,
84
+ 'Data-Team': SupabaseRole.Viewer,
85
+ };
86
+ ```
87
+
88
+ ### OAuth2/OIDC Integration
89
+
90
+ ```typescript
91
+ import { OAuth2Client } from '@supabase/supabase-js';
92
+
93
+ const oauthClient = new OAuth2Client({
94
+ clientId: process.env.SUPABASE_OAUTH_CLIENT_ID!,
95
+ clientSecret: process.env.SUPABASE_OAUTH_CLIENT_SECRET!,
96
+ redirectUri: 'https://app.yourcompany.com/auth/supabase/callback',
97
+ scopes: read, write, realtime,
98
+ });
99
+ ```
100
+
101
+ ## Organization Management
102
+
103
+ ```typescript
104
+ interface SupabaseOrganization {
105
+ id: string;
106
+ name: string;
107
+ ssoEnabled: boolean;
108
+ enforceSso: boolean;
109
+ allowedDomains: string[];
110
+ defaultRole: SupabaseRole;
111
+ }
112
+
113
+ async function createOrganization(
114
+ config: SupabaseOrganization
115
+ ): Promise<void> {
116
+ await supabaseClient.organizations.create({
117
+ ...config,
118
+ settings: {
119
+ sso: {
120
+ enabled: config.ssoEnabled,
121
+ enforced: config.enforceSso,
122
+ domains: config.allowedDomains,
123
+ },
124
+ },
125
+ });
126
+ }
127
+ ```
128
+
129
+ ## Access Control Middleware
130
+
131
+ ```typescript
132
+ function requireSupabasePermission(
133
+ requiredPermission: keyof SupabasePermissions
134
+ ) {
135
+ return async (req: Request, res: Response, next: NextFunction) => {
136
+ const user = req.user as { supabaseRole: SupabaseRole };
137
+
138
+ if (!checkPermission(user.supabaseRole, requiredPermission)) {
139
+ return res.status(403).json({
140
+ error: 'Forbidden',
141
+ message: `Missing permission: ${requiredPermission}`,
142
+ });
143
+ }
144
+
145
+ next();
146
+ };
147
+ }
148
+
149
+ // Usage
150
+ app.delete('/supabase/resource/:id',
151
+ requireSupabasePermission('delete'),
152
+ deleteResourceHandler
153
+ );
154
+ ```
155
+
156
+ ## Audit Trail
157
+
158
+ ```typescript
159
+ interface SupabaseAuditEntry {
160
+ timestamp: Date;
161
+ userId: string;
162
+ role: SupabaseRole;
163
+ action: string;
164
+ resource: string;
165
+ success: boolean;
166
+ ipAddress: string;
167
+ }
168
+
169
+ async function logSupabaseAccess(entry: SupabaseAuditEntry): Promise<void> {
170
+ await auditDb.insert(entry);
171
+
172
+ // Alert on suspicious activity
173
+ if (entry.action === 'delete' && !entry.success) {
174
+ await alertOnSuspiciousActivity(entry);
175
+ }
176
+ }
177
+ ```
178
+
179
+ ## Instructions
180
+
181
+ ### Step 1: Define Roles
182
+ Map organizational roles to Supabase permissions.
183
+
184
+ ### Step 2: Configure SSO
185
+ Set up SAML or OIDC integration with your IdP.
186
+
187
+ ### Step 3: Implement Middleware
188
+ Add permission checks to API endpoints.
189
+
190
+ ### Step 4: Enable Audit Logging
191
+ Track all access for compliance.
192
+
193
+ ## Output
194
+ - Role definitions implemented
195
+ - SSO integration configured
196
+ - Permission middleware active
197
+ - Audit trail enabled
198
+
199
+ ## Error Handling
200
+ | Issue | Cause | Solution |
201
+ |-------|-------|----------|
202
+ | SSO login fails | Wrong callback URL | Verify IdP config |
203
+ | Permission denied | Missing role mapping | Update group mappings |
204
+ | Token expired | Short TTL | Refresh token logic |
205
+ | Audit gaps | Async logging failed | Check log pipeline |
206
+
207
+ ## Examples
208
+
209
+ ### Quick Permission Check
210
+ ```typescript
211
+ if (!checkPermission(user.role, 'write')) {
212
+ throw new ForbiddenError('Write permission required');
213
+ }
214
+ ```
215
+
216
+ ## Resources
217
+ - [Supabase Enterprise Guide](https://supabase.com/docs/enterprise)
218
+ - [SAML 2.0 Specification](https://wiki.oasis-open.org/security/FrontPage)
219
+ - [OpenID Connect Spec](https://openid.net/specs/openid-connect-core-1_0.html)
220
+
221
+ ## Next Steps
222
+ For major migrations, see `supabase-migration-deep-dive`.
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: supabase-hello-world
3
+ description: |
4
+ Create a minimal working Supabase example.
5
+ Use when starting a new Supabase integration, testing your setup,
6
+ or learning basic Supabase API patterns.
7
+ Trigger with phrases like "supabase hello world", "supabase example",
8
+ "supabase quick start", "simple supabase code".
9
+ allowed-tools: Read, Write, Edit
10
+ version: 1.0.0
11
+ license: MIT
12
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
13
+ ---
14
+
15
+ # Supabase Hello World
16
+
17
+ ## Overview
18
+ Minimal working example demonstrating core Supabase functionality.
19
+
20
+ ## Prerequisites
21
+ - Completed `supabase-install-auth` setup
22
+ - Valid API credentials configured
23
+ - Development environment ready
24
+
25
+ ## Instructions
26
+
27
+ ### Step 1: Create Entry File
28
+ Create a new file for your hello world example.
29
+
30
+ ### Step 2: Import and Initialize Client
31
+ ```typescript
32
+ import { SupabaseClient } from '@supabase/supabase-js';
33
+
34
+ const client = new SupabaseClient({
35
+ apiKey: process.env.SUPABASE_API_KEY,
36
+ });
37
+ ```
38
+
39
+ ### Step 3: Make Your First API Call
40
+ ```typescript
41
+ async function main() {
42
+ const result = await supabase.from('todos').insert({ task: 'Hello!' }).select(); console.log(result.data);
43
+ }
44
+
45
+ main().catch(console.error);
46
+ ```
47
+
48
+ ## Output
49
+ - Working code file with Supabase client initialization
50
+ - Successful API response confirming connection
51
+ - Console output showing:
52
+ ```
53
+ Success! Your Supabase connection is working.
54
+ ```
55
+
56
+ ## Error Handling
57
+ | Error | Cause | Solution |
58
+ |-------|-------|----------|
59
+ | Import Error | SDK not installed | Verify with `npm list` or `pip show` |
60
+ | Auth Error | Invalid credentials | Check environment variable is set |
61
+ | Timeout | Network issues | Increase timeout or check connectivity |
62
+ | Rate Limit | Too many requests | Wait and retry with exponential backoff |
63
+
64
+ ## Examples
65
+
66
+ ### TypeScript Example
67
+ ```typescript
68
+ import { SupabaseClient } from '@supabase/supabase-js';
69
+
70
+ const client = new SupabaseClient({
71
+ apiKey: process.env.SUPABASE_API_KEY,
72
+ });
73
+
74
+ async function main() {
75
+ const result = await supabase.from('todos').insert({ task: 'Hello!' }).select(); console.log(result.data);
76
+ }
77
+
78
+ main().catch(console.error);
79
+ ```
80
+
81
+ ### Python Example
82
+ ```python
83
+ from supabase import SupabaseClient
84
+
85
+ client = SupabaseClient()
86
+
87
+ response = supabase.table('todos').insert({'task': 'Hello!'}).execute(); print(response.data)
88
+ ```
89
+
90
+ ## Resources
91
+ - [Supabase Getting Started](https://supabase.com/docs/getting-started)
92
+ - [Supabase API Reference](https://supabase.com/docs/api)
93
+ - [Supabase Examples](https://supabase.com/docs/examples)
94
+
95
+ ## Next Steps
96
+ Proceed to `supabase-local-dev-loop` for development workflow setup.
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: supabase-incident-runbook
3
+ description: |
4
+ Execute Supabase incident response procedures with triage, mitigation, and postmortem.
5
+ Use when responding to Supabase-related outages, investigating errors,
6
+ or running post-incident reviews for Supabase integration failures.
7
+ Trigger with phrases like "supabase incident", "supabase outage",
8
+ "supabase down", "supabase on-call", "supabase emergency", "supabase broken".
9
+ allowed-tools: Read, Grep, Bash(kubectl:*), Bash(curl:*)
10
+ version: 1.0.0
11
+ license: MIT
12
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
13
+ ---
14
+
15
+ # Supabase Incident Runbook
16
+
17
+ ## Overview
18
+ Rapid incident response procedures for Supabase-related outages.
19
+
20
+ ## Prerequisites
21
+ - Access to Supabase dashboard and status page
22
+ - kubectl access to production cluster
23
+ - Prometheus/Grafana access
24
+ - Communication channels (Slack, PagerDuty)
25
+
26
+ ## Severity Levels
27
+
28
+ | Level | Definition | Response Time | Examples |
29
+ |-------|------------|---------------|----------|
30
+ | P1 | Complete outage | < 15 min | Supabase API unreachable |
31
+ | P2 | Degraded service | < 1 hour | High latency, partial failures |
32
+ | P3 | Minor impact | < 4 hours | Webhook delays, non-critical errors |
33
+ | P4 | No user impact | Next business day | Monitoring gaps |
34
+
35
+ ## Quick Triage
36
+
37
+ ```bash
38
+ # 1. Check Supabase status
39
+ curl -s https://status.supabase.com | jq
40
+
41
+ # 2. Check our integration health
42
+ curl -s https://api.yourapp.com/health | jq '.services.supabase'
43
+
44
+ # 3. Check error rate (last 5 min)
45
+ curl -s localhost:9090/api/v1/query?query=rate(supabase_errors_total[5m])
46
+
47
+ # 4. Recent error logs
48
+ kubectl logs -l app=supabase-integration --since=5m | grep -i error | tail -20
49
+ ```
50
+
51
+ ## Decision Tree
52
+
53
+ ```
54
+ Supabase API returning errors?
55
+ ├─ YES: Is status.supabase.com showing incident?
56
+ │ ├─ YES → Wait for Supabase to resolve. Enable fallback.
57
+ │ └─ NO → Our integration issue. Check credentials, config.
58
+ └─ NO: Is our service healthy?
59
+ ├─ YES → Likely resolved or intermittent. Monitor.
60
+ └─ NO → Our infrastructure issue. Check pods, memory, network.
61
+ ```
62
+
63
+ ## Immediate Actions by Error Type
64
+
65
+ ### 401/403 - Authentication
66
+ ```bash
67
+ # Verify API key is set
68
+ kubectl get secret supabase-secrets -o jsonpath='{.data.api-key}' | base64 -d
69
+
70
+ # Check if key was rotated
71
+ # → Verify in Supabase dashboard
72
+
73
+ # Remediation: Update secret and restart pods
74
+ kubectl create secret generic supabase-secrets --from-literal=api-key=NEW_KEY --dry-run=client -o yaml | kubectl apply -f -
75
+ kubectl rollout restart deployment/supabase-integration
76
+ ```
77
+
78
+ ### 429 - Rate Limited
79
+ ```bash
80
+ # Check rate limit headers
81
+ curl -v https://api.supabase.com 2>&1 | grep -i rate
82
+
83
+ # Enable request queuing
84
+ kubectl set env deployment/supabase-integration RATE_LIMIT_MODE=queue
85
+
86
+ # Long-term: Contact Supabase for limit increase
87
+ ```
88
+
89
+ ### 500/503 - Supabase Errors
90
+ ```bash
91
+ # Enable graceful degradation
92
+ kubectl set env deployment/supabase-integration SUPABASE_FALLBACK=true
93
+
94
+ # Notify users of degraded service
95
+ # Update status page
96
+
97
+ # Monitor Supabase status for resolution
98
+ ```
99
+
100
+ ## Communication Templates
101
+
102
+ ### Internal (Slack)
103
+ ```
104
+ 🔴 P1 INCIDENT: Supabase Integration
105
+ Status: INVESTIGATING
106
+ Impact: [Describe user impact]
107
+ Current action: [What you're doing]
108
+ Next update: [Time]
109
+ Incident commander: @[name]
110
+ ```
111
+
112
+ ### External (Status Page)
113
+ ```
114
+ Supabase Integration Issue
115
+
116
+ We're experiencing issues with our Supabase integration.
117
+ Some users may experience [specific impact].
118
+
119
+ We're actively investigating and will provide updates.
120
+
121
+ Last updated: [timestamp]
122
+ ```
123
+
124
+ ## Post-Incident
125
+
126
+ ### Evidence Collection
127
+ ```bash
128
+ # Generate debug bundle
129
+ ./scripts/supabase-debug-bundle.sh
130
+
131
+ # Export relevant logs
132
+ kubectl logs -l app=supabase-integration --since=1h > incident-logs.txt
133
+
134
+ # Capture metrics
135
+ curl "localhost:9090/api/v1/query_range?query=supabase_errors_total&start=2h" > metrics.json
136
+ ```
137
+
138
+ ### Postmortem Template
139
+ ```markdown
140
+ ## Incident: Supabase [Error Type]
141
+ **Date:** YYYY-MM-DD
142
+ **Duration:** X hours Y minutes
143
+ **Severity:** P[1-4]
144
+
145
+ ### Summary
146
+ [1-2 sentence description]
147
+
148
+ ### Timeline
149
+ - HH:MM - [Event]
150
+ - HH:MM - [Event]
151
+
152
+ ### Root Cause
153
+ [Technical explanation]
154
+
155
+ ### Impact
156
+ - Users affected: N
157
+ - Revenue impact: $X
158
+
159
+ ### Action Items
160
+ - [ ] [Preventive measure] - Owner - Due date
161
+ ```
162
+
163
+ ## Instructions
164
+
165
+ ### Step 1: Quick Triage
166
+ Run the triage commands to identify the issue source.
167
+
168
+ ### Step 2: Follow Decision Tree
169
+ Determine if the issue is Supabase-side or internal.
170
+
171
+ ### Step 3: Execute Immediate Actions
172
+ Apply the appropriate remediation for the error type.
173
+
174
+ ### Step 4: Communicate Status
175
+ Update internal and external stakeholders.
176
+
177
+ ## Output
178
+ - Issue identified and categorized
179
+ - Remediation applied
180
+ - Stakeholders notified
181
+ - Evidence collected for postmortem
182
+
183
+ ## Error Handling
184
+ | Issue | Cause | Solution |
185
+ |-------|-------|----------|
186
+ | Can't reach status page | Network issue | Use mobile or VPN |
187
+ | kubectl fails | Auth expired | Re-authenticate |
188
+ | Metrics unavailable | Prometheus down | Check backup metrics |
189
+ | Secret rotation fails | Permission denied | Escalate to admin |
190
+
191
+ ## Examples
192
+
193
+ ### One-Line Health Check
194
+ ```bash
195
+ curl -sf https://api.yourapp.com/health | jq '.services.supabase.status' || echo "UNHEALTHY"
196
+ ```
197
+
198
+ ## Resources
199
+ - [Supabase Status Page](https://status.supabase.com)
200
+ - [Supabase Support](https://support.supabase.com)
201
+
202
+ ## Next Steps
203
+ For data handling, see `supabase-data-handling`.
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: supabase-install-auth
3
+ description: |
4
+ Install and configure Supabase SDK/CLI authentication.
5
+ Use when setting up a new Supabase integration, configuring API keys,
6
+ or initializing Supabase in your project.
7
+ Trigger with phrases like "install supabase", "setup supabase",
8
+ "supabase auth", "configure supabase API key".
9
+ allowed-tools: Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep
10
+ version: 1.0.0
11
+ license: MIT
12
+ author: Jeremy Longshore <jeremy@intentsolutions.io>
13
+ ---
14
+
15
+ # Supabase Install & Auth
16
+
17
+ ## Overview
18
+ Set up Supabase SDK/CLI and configure authentication credentials.
19
+
20
+ ## Prerequisites
21
+ - Node.js 18+ or Python 3.10+
22
+ - Package manager (npm, pnpm, or pip)
23
+ - Supabase account with API access
24
+ - API key from Supabase dashboard
25
+
26
+ ## Instructions
27
+
28
+ ### Step 1: Install SDK
29
+ ```bash
30
+ # Node.js
31
+ npm install @supabase/supabase-js
32
+
33
+ # Python
34
+ pip install supabase
35
+ ```
36
+
37
+ ### Step 2: Configure Authentication
38
+ ```bash
39
+ # Set environment variable
40
+ export SUPABASE_API_KEY="your-api-key"
41
+
42
+ # Or create .env file
43
+ echo 'SUPABASE_API_KEY=your-api-key' >> .env
44
+ ```
45
+
46
+ ### Step 3: Verify Connection
47
+ ```typescript
48
+ const result = await supabase.from('_test').select('*').limit(1); console.log(result.error ? 'Failed' : 'OK');
49
+ ```
50
+
51
+ ## Output
52
+ - Installed SDK package in node_modules or site-packages
53
+ - Environment variable or .env file with API key
54
+ - Successful connection verification output
55
+
56
+ ## Error Handling
57
+ | Error | Cause | Solution |
58
+ |-------|-------|----------|
59
+ | Invalid API Key | Incorrect or expired key | Verify key in Supabase dashboard |
60
+ | Rate Limited | Exceeded quota | Check quota at https://supabase.com/docs |
61
+ | Network Error | Firewall blocking | Ensure outbound HTTPS allowed |
62
+ | Module Not Found | Installation failed | Run `npm install` or `pip install` again |
63
+
64
+ ## Examples
65
+
66
+ ### TypeScript Setup
67
+ ```typescript
68
+ import { SupabaseClient } from '@supabase/supabase-js';
69
+
70
+ const client = new SupabaseClient({
71
+ apiKey: process.env.SUPABASE_API_KEY,
72
+ });
73
+ ```
74
+
75
+ ### Python Setup
76
+ ```python
77
+ from supabase import SupabaseClient
78
+
79
+ client = SupabaseClient(
80
+ api_key=os.environ.get('SUPABASE_API_KEY')
81
+ )
82
+ ```
83
+
84
+ ## Resources
85
+ - [Supabase Documentation](https://supabase.com/docs)
86
+ - [Supabase Dashboard](https://api.supabase.com)
87
+ - [Supabase Status](https://status.supabase.com)
88
+
89
+ ## Next Steps
90
+ After successful auth, proceed to `supabase-hello-world` for your first API call.