omgkit 2.2.0 → 2.3.1
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.
- package/README.md +3 -3
- package/package.json +1 -1
- package/plugin/skills/databases/database-management/SKILL.md +288 -0
- package/plugin/skills/databases/database-migration/SKILL.md +285 -0
- package/plugin/skills/databases/database-schema-design/SKILL.md +195 -0
- package/plugin/skills/databases/mongodb/SKILL.md +60 -776
- package/plugin/skills/databases/prisma/SKILL.md +53 -744
- package/plugin/skills/databases/redis/SKILL.md +53 -860
- package/plugin/skills/databases/supabase/SKILL.md +283 -0
- package/plugin/skills/devops/aws/SKILL.md +68 -672
- package/plugin/skills/devops/github-actions/SKILL.md +54 -657
- package/plugin/skills/devops/kubernetes/SKILL.md +67 -602
- package/plugin/skills/devops/performance-profiling/SKILL.md +59 -863
- package/plugin/skills/frameworks/django/SKILL.md +87 -853
- package/plugin/skills/frameworks/express/SKILL.md +95 -1301
- package/plugin/skills/frameworks/fastapi/SKILL.md +90 -1198
- package/plugin/skills/frameworks/laravel/SKILL.md +87 -1187
- package/plugin/skills/frameworks/nestjs/SKILL.md +106 -973
- package/plugin/skills/frameworks/react/SKILL.md +94 -962
- package/plugin/skills/frameworks/vue/SKILL.md +95 -1242
- package/plugin/skills/frontend/accessibility/SKILL.md +91 -1056
- package/plugin/skills/frontend/frontend-design/SKILL.md +69 -1262
- package/plugin/skills/frontend/responsive/SKILL.md +76 -799
- package/plugin/skills/frontend/shadcn-ui/SKILL.md +73 -921
- package/plugin/skills/frontend/tailwindcss/SKILL.md +60 -788
- package/plugin/skills/frontend/threejs/SKILL.md +72 -1266
- package/plugin/skills/languages/javascript/SKILL.md +106 -849
- package/plugin/skills/methodology/brainstorming/SKILL.md +70 -576
- package/plugin/skills/methodology/defense-in-depth/SKILL.md +79 -831
- package/plugin/skills/methodology/dispatching-parallel-agents/SKILL.md +81 -654
- package/plugin/skills/methodology/executing-plans/SKILL.md +86 -529
- package/plugin/skills/methodology/finishing-development-branch/SKILL.md +95 -586
- package/plugin/skills/methodology/problem-solving/SKILL.md +67 -681
- package/plugin/skills/methodology/receiving-code-review/SKILL.md +70 -533
- package/plugin/skills/methodology/requesting-code-review/SKILL.md +70 -610
- package/plugin/skills/methodology/root-cause-tracing/SKILL.md +70 -646
- package/plugin/skills/methodology/sequential-thinking/SKILL.md +70 -478
- package/plugin/skills/methodology/systematic-debugging/SKILL.md +66 -559
- package/plugin/skills/methodology/test-driven-development/SKILL.md +91 -752
- package/plugin/skills/methodology/testing-anti-patterns/SKILL.md +78 -687
- package/plugin/skills/methodology/token-optimization/SKILL.md +72 -602
- package/plugin/skills/methodology/verification-before-completion/SKILL.md +108 -529
- package/plugin/skills/methodology/writing-plans/SKILL.md +79 -566
- package/plugin/skills/omega/omega-architecture/SKILL.md +91 -752
- package/plugin/skills/omega/omega-coding/SKILL.md +161 -552
- package/plugin/skills/omega/omega-sprint/SKILL.md +132 -777
- package/plugin/skills/omega/omega-testing/SKILL.md +157 -845
- package/plugin/skills/omega/omega-thinking/SKILL.md +165 -606
- package/plugin/skills/security/better-auth/SKILL.md +46 -1034
- package/plugin/skills/security/oauth/SKILL.md +80 -934
- package/plugin/skills/security/owasp/SKILL.md +78 -862
- package/plugin/skills/testing/playwright/SKILL.md +77 -700
- package/plugin/skills/testing/pytest/SKILL.md +73 -811
- package/plugin/skills/testing/vitest/SKILL.md +60 -920
- package/plugin/skills/tools/document-processing/SKILL.md +111 -838
- package/plugin/skills/tools/image-processing/SKILL.md +126 -659
- package/plugin/skills/tools/mcp-development/SKILL.md +85 -758
- package/plugin/skills/tools/media-processing/SKILL.md +118 -735
- package/plugin/stdrules/SKILL_STANDARDS.md +490 -0
- package/plugin/skills/SKILL_STANDARDS.md +0 -743
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: building-with-supabase
|
|
3
|
+
description: AI agent builds full-stack applications with Supabase PostgreSQL, authentication, Row Level Security, Edge Functions, and real-time subscriptions. Use when building apps with Supabase, implementing RLS policies, or setting up Supabase Auth.
|
|
4
|
+
category: databases
|
|
5
|
+
triggers:
|
|
6
|
+
- supabase
|
|
7
|
+
- RLS
|
|
8
|
+
- row level security
|
|
9
|
+
- supabase auth
|
|
10
|
+
- edge functions
|
|
11
|
+
- real-time
|
|
12
|
+
- supabase storage
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Building with Supabase
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
Build secure, scalable applications using Supabase's PostgreSQL platform:
|
|
20
|
+
|
|
21
|
+
- Design tables with proper Row Level Security (RLS)
|
|
22
|
+
- Implement authentication flows (email, OAuth, magic link)
|
|
23
|
+
- Create real-time subscriptions for live updates
|
|
24
|
+
- Build Edge Functions for serverless logic
|
|
25
|
+
- Manage file storage with security policies
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// Initialize Supabase client
|
|
31
|
+
import { createClient } from '@supabase/supabase-js';
|
|
32
|
+
import { Database } from './types/supabase';
|
|
33
|
+
|
|
34
|
+
export const supabase = createClient<Database>(
|
|
35
|
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
|
36
|
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// Server-side with service role (bypasses RLS)
|
|
40
|
+
import { createClient } from '@supabase/supabase-js';
|
|
41
|
+
export const supabaseAdmin = createClient<Database>(
|
|
42
|
+
process.env.SUPABASE_URL!,
|
|
43
|
+
process.env.SUPABASE_SERVICE_ROLE_KEY!
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
| Feature | Description | Guide |
|
|
50
|
+
|---------|-------------|-------|
|
|
51
|
+
| PostgreSQL | Full Postgres with extensions (pgvector, PostGIS) | Direct SQL or Supabase client |
|
|
52
|
+
| Row Level Security | Per-row access control policies | Enable RLS + create policies |
|
|
53
|
+
| Authentication | Email, OAuth, magic link, phone OTP | Built-in auth.users table |
|
|
54
|
+
| Real-time | Live database change subscriptions | Channel subscriptions |
|
|
55
|
+
| Edge Functions | Deno serverless functions | TypeScript at edge |
|
|
56
|
+
| Storage | S3-compatible file storage | Buckets with RLS policies |
|
|
57
|
+
|
|
58
|
+
## Common Patterns
|
|
59
|
+
|
|
60
|
+
### RLS Policy Patterns
|
|
61
|
+
|
|
62
|
+
```sql
|
|
63
|
+
-- Enable RLS on table
|
|
64
|
+
ALTER TABLE posts ENABLE ROW LEVEL SECURITY;
|
|
65
|
+
|
|
66
|
+
-- Owner-based access
|
|
67
|
+
CREATE POLICY "Users can CRUD own posts" ON posts
|
|
68
|
+
FOR ALL
|
|
69
|
+
USING (auth.uid() = user_id)
|
|
70
|
+
WITH CHECK (auth.uid() = user_id);
|
|
71
|
+
|
|
72
|
+
-- Public read, authenticated write
|
|
73
|
+
CREATE POLICY "Anyone can read posts" ON posts
|
|
74
|
+
FOR SELECT USING (published = true);
|
|
75
|
+
|
|
76
|
+
CREATE POLICY "Authenticated users can create" ON posts
|
|
77
|
+
FOR INSERT
|
|
78
|
+
WITH CHECK (auth.uid() IS NOT NULL);
|
|
79
|
+
|
|
80
|
+
-- Team-based access
|
|
81
|
+
CREATE POLICY "Team members can access" ON documents
|
|
82
|
+
FOR ALL
|
|
83
|
+
USING (
|
|
84
|
+
team_id IN (
|
|
85
|
+
SELECT team_id FROM team_members
|
|
86
|
+
WHERE user_id = auth.uid()
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
-- Role-based access using JWT claims
|
|
91
|
+
CREATE POLICY "Admins can do anything" ON users
|
|
92
|
+
FOR ALL
|
|
93
|
+
USING (auth.jwt() ->> 'role' = 'admin');
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Authentication Flow
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
// Sign up with email
|
|
100
|
+
const { data, error } = await supabase.auth.signUp({
|
|
101
|
+
email: 'user@example.com',
|
|
102
|
+
password: 'secure-password',
|
|
103
|
+
options: {
|
|
104
|
+
data: { full_name: 'John Doe' }, // Custom user metadata
|
|
105
|
+
emailRedirectTo: 'https://app.com/auth/callback',
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// OAuth sign in
|
|
110
|
+
const { data, error } = await supabase.auth.signInWithOAuth({
|
|
111
|
+
provider: 'google',
|
|
112
|
+
options: {
|
|
113
|
+
redirectTo: 'https://app.com/auth/callback',
|
|
114
|
+
scopes: 'email profile',
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Magic link
|
|
119
|
+
const { error } = await supabase.auth.signInWithOtp({
|
|
120
|
+
email: 'user@example.com',
|
|
121
|
+
options: { emailRedirectTo: 'https://app.com/auth/callback' },
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Get current user
|
|
125
|
+
const { data: { user } } = await supabase.auth.getUser();
|
|
126
|
+
|
|
127
|
+
// Sign out
|
|
128
|
+
await supabase.auth.signOut();
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Real-time Subscriptions
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// Subscribe to table changes
|
|
135
|
+
const channel = supabase
|
|
136
|
+
.channel('posts-changes')
|
|
137
|
+
.on(
|
|
138
|
+
'postgres_changes',
|
|
139
|
+
{
|
|
140
|
+
event: '*', // INSERT, UPDATE, DELETE, or *
|
|
141
|
+
schema: 'public',
|
|
142
|
+
table: 'posts',
|
|
143
|
+
filter: 'user_id=eq.' + userId, // Optional filter
|
|
144
|
+
},
|
|
145
|
+
(payload) => {
|
|
146
|
+
console.log('Change:', payload.eventType, payload.new);
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
.subscribe();
|
|
150
|
+
|
|
151
|
+
// Cleanup
|
|
152
|
+
channel.unsubscribe();
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Edge Functions
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
// supabase/functions/process-webhook/index.ts
|
|
159
|
+
import { serve } from 'https://deno.land/std@0.168.0/http/server.ts';
|
|
160
|
+
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2';
|
|
161
|
+
|
|
162
|
+
serve(async (req) => {
|
|
163
|
+
const supabase = createClient(
|
|
164
|
+
Deno.env.get('SUPABASE_URL')!,
|
|
165
|
+
Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')!
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
const { record } = await req.json();
|
|
169
|
+
|
|
170
|
+
// Process webhook...
|
|
171
|
+
await supabase.from('processed').insert({ data: record });
|
|
172
|
+
|
|
173
|
+
return new Response(JSON.stringify({ success: true }), {
|
|
174
|
+
headers: { 'Content-Type': 'application/json' },
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Storage with Policies
|
|
180
|
+
|
|
181
|
+
```sql
|
|
182
|
+
-- Create bucket
|
|
183
|
+
INSERT INTO storage.buckets (id, name, public)
|
|
184
|
+
VALUES ('avatars', 'avatars', true);
|
|
185
|
+
|
|
186
|
+
-- Storage policies
|
|
187
|
+
CREATE POLICY "Users can upload own avatar" ON storage.objects
|
|
188
|
+
FOR INSERT WITH CHECK (
|
|
189
|
+
bucket_id = 'avatars' AND
|
|
190
|
+
auth.uid()::text = (storage.foldername(name))[1]
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
CREATE POLICY "Anyone can view avatars" ON storage.objects
|
|
194
|
+
FOR SELECT USING (bucket_id = 'avatars');
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
// Upload file
|
|
199
|
+
const { data, error } = await supabase.storage
|
|
200
|
+
.from('avatars')
|
|
201
|
+
.upload(`${userId}/avatar.png`, file, {
|
|
202
|
+
cacheControl: '3600',
|
|
203
|
+
upsert: true,
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// Get public URL
|
|
207
|
+
const { data: { publicUrl } } = supabase.storage
|
|
208
|
+
.from('avatars')
|
|
209
|
+
.getPublicUrl(`${userId}/avatar.png`);
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Next.js Server Components
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
// app/api/posts/route.ts
|
|
216
|
+
import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs';
|
|
217
|
+
import { cookies } from 'next/headers';
|
|
218
|
+
|
|
219
|
+
export async function GET() {
|
|
220
|
+
const supabase = createRouteHandlerClient({ cookies });
|
|
221
|
+
const { data: posts } = await supabase.from('posts').select('*');
|
|
222
|
+
return Response.json(posts);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Server Component
|
|
226
|
+
import { createServerComponentClient } from '@supabase/auth-helpers-nextjs';
|
|
227
|
+
import { cookies } from 'next/headers';
|
|
228
|
+
|
|
229
|
+
export default async function Page() {
|
|
230
|
+
const supabase = createServerComponentClient({ cookies });
|
|
231
|
+
const { data: posts } = await supabase.from('posts').select('*');
|
|
232
|
+
return <PostList posts={posts} />;
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Use Cases
|
|
237
|
+
|
|
238
|
+
- Building SaaS applications with multi-tenant RLS
|
|
239
|
+
- Real-time collaborative applications
|
|
240
|
+
- Mobile app backends with authentication
|
|
241
|
+
- Serverless APIs with Edge Functions
|
|
242
|
+
- File upload systems with access control
|
|
243
|
+
|
|
244
|
+
## Best Practices
|
|
245
|
+
|
|
246
|
+
| Do | Avoid |
|
|
247
|
+
|----|-------|
|
|
248
|
+
| Enable RLS on all tables | Disabling RLS "temporarily" in production |
|
|
249
|
+
| Use `auth.uid()` in policies, not session data | Trusting client-side user ID |
|
|
250
|
+
| Create service role client only server-side | Exposing service role key to client |
|
|
251
|
+
| Use TypeScript types from `supabase gen types` | Manual type definitions |
|
|
252
|
+
| Filter subscriptions to reduce bandwidth | Subscribing to entire tables |
|
|
253
|
+
| Use `supabase db push` for dev, migrations for prod | Pushing directly to production |
|
|
254
|
+
| Set up proper bucket policies | Public buckets for sensitive files |
|
|
255
|
+
| Use `signInWithOAuth` for social auth | Custom OAuth implementations |
|
|
256
|
+
|
|
257
|
+
## CLI Commands
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Local development
|
|
261
|
+
supabase start # Start local Supabase
|
|
262
|
+
supabase db reset # Reset with migrations + seed
|
|
263
|
+
|
|
264
|
+
# Migrations
|
|
265
|
+
supabase migration new add_posts # Create migration
|
|
266
|
+
supabase db push # Push to linked project (dev only)
|
|
267
|
+
supabase db diff --use-migra # Generate migration from diff
|
|
268
|
+
|
|
269
|
+
# Type generation
|
|
270
|
+
supabase gen types typescript --local > types/supabase.ts
|
|
271
|
+
|
|
272
|
+
# Edge Functions
|
|
273
|
+
supabase functions serve # Local development
|
|
274
|
+
supabase functions deploy my-func # Deploy to production
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Related Skills
|
|
278
|
+
|
|
279
|
+
See also these related skill documents:
|
|
280
|
+
|
|
281
|
+
- **designing-database-schemas** - Schema design patterns
|
|
282
|
+
- **managing-database-migrations** - Migration strategies
|
|
283
|
+
- **implementing-oauth** - OAuth flow details
|