omgkit 2.3.0 → 2.4.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.
- package/README.md +7 -4
- package/lib/cli.js +7 -2
- 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/supabase/SKILL.md +283 -0
- package/templates/devlogs/README.md +29 -0
- package/templates/stdrules/README.md +34 -0
- package/templates/stdrules/SKILL_STANDARDS.md +490 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: designing-database-schemas
|
|
3
|
+
description: AI agent designs production-grade database schemas with proper normalization, indexing strategies, and data modeling patterns. Use when creating new databases, designing tables, modeling relationships, or reviewing schema architecture.
|
|
4
|
+
category: databases
|
|
5
|
+
triggers:
|
|
6
|
+
- schema design
|
|
7
|
+
- database design
|
|
8
|
+
- data modeling
|
|
9
|
+
- ERD
|
|
10
|
+
- entity relationship
|
|
11
|
+
- table design
|
|
12
|
+
- normalization
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Designing Database Schemas
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
Design scalable, maintainable database schemas that balance normalization with query performance:
|
|
20
|
+
|
|
21
|
+
- Apply normalization principles (1NF-BCNF) appropriately
|
|
22
|
+
- Choose optimal data types and constraints
|
|
23
|
+
- Design efficient indexing strategies
|
|
24
|
+
- Implement common patterns (audit trails, soft deletes, multi-tenancy)
|
|
25
|
+
- Create clear entity relationships
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```sql
|
|
30
|
+
-- Well-designed table with proper constraints
|
|
31
|
+
CREATE TABLE users (
|
|
32
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
33
|
+
email VARCHAR(255) NOT NULL UNIQUE,
|
|
34
|
+
username VARCHAR(50) NOT NULL UNIQUE,
|
|
35
|
+
password_hash VARCHAR(255) NOT NULL,
|
|
36
|
+
status VARCHAR(20) NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'suspended', 'deleted')),
|
|
37
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
38
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
39
|
+
deleted_at TIMESTAMPTZ -- Soft delete
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
CREATE INDEX idx_users_email ON users(email);
|
|
43
|
+
CREATE INDEX idx_users_status ON users(status) WHERE deleted_at IS NULL;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
| Feature | Description | Pattern |
|
|
49
|
+
|---------|-------------|---------|
|
|
50
|
+
| Normalization | Eliminate redundancy while maintaining query efficiency | 3NF for OLTP, denormalize for read-heavy |
|
|
51
|
+
| Primary Keys | UUID vs serial, natural vs surrogate keys | UUID for distributed, serial for simple apps |
|
|
52
|
+
| Foreign Keys | Referential integrity with cascade options | CASCADE for owned data, RESTRICT for referenced |
|
|
53
|
+
| Indexes | Query optimization with minimal write overhead | B-tree default, GIN for JSONB/arrays |
|
|
54
|
+
| Constraints | Data integrity at database level | CHECK, UNIQUE, NOT NULL, EXCLUSION |
|
|
55
|
+
| Partitioning | Horizontal scaling for large tables | Range (time), List (category), Hash (even dist) |
|
|
56
|
+
|
|
57
|
+
## Common Patterns
|
|
58
|
+
|
|
59
|
+
### Audit Trail Pattern
|
|
60
|
+
|
|
61
|
+
```sql
|
|
62
|
+
-- Add to every auditable table
|
|
63
|
+
ALTER TABLE orders ADD COLUMN
|
|
64
|
+
created_by UUID REFERENCES users(id),
|
|
65
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
66
|
+
updated_by UUID REFERENCES users(id),
|
|
67
|
+
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW();
|
|
68
|
+
|
|
69
|
+
-- Automatic updated_at trigger
|
|
70
|
+
CREATE OR REPLACE FUNCTION update_updated_at()
|
|
71
|
+
RETURNS TRIGGER AS $$
|
|
72
|
+
BEGIN
|
|
73
|
+
NEW.updated_at = NOW();
|
|
74
|
+
RETURN NEW;
|
|
75
|
+
END;
|
|
76
|
+
$$ LANGUAGE plpgsql;
|
|
77
|
+
|
|
78
|
+
CREATE TRIGGER orders_updated_at
|
|
79
|
+
BEFORE UPDATE ON orders
|
|
80
|
+
FOR EACH ROW EXECUTE FUNCTION update_updated_at();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Multi-Tenancy (Row-Level)
|
|
84
|
+
|
|
85
|
+
```sql
|
|
86
|
+
-- Tenant isolation with RLS
|
|
87
|
+
CREATE TABLE projects (
|
|
88
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
89
|
+
tenant_id UUID NOT NULL REFERENCES tenants(id),
|
|
90
|
+
name VARCHAR(255) NOT NULL,
|
|
91
|
+
-- Always include tenant_id in indexes
|
|
92
|
+
UNIQUE (tenant_id, name)
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
CREATE INDEX idx_projects_tenant ON projects(tenant_id);
|
|
96
|
+
|
|
97
|
+
-- Row Level Security
|
|
98
|
+
ALTER TABLE projects ENABLE ROW LEVEL SECURITY;
|
|
99
|
+
CREATE POLICY tenant_isolation ON projects
|
|
100
|
+
USING (tenant_id = current_setting('app.tenant_id')::uuid);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Polymorphic Associations
|
|
104
|
+
|
|
105
|
+
```sql
|
|
106
|
+
-- Option 1: Separate junction tables (recommended)
|
|
107
|
+
CREATE TABLE comments (
|
|
108
|
+
id UUID PRIMARY KEY,
|
|
109
|
+
body TEXT NOT NULL,
|
|
110
|
+
author_id UUID REFERENCES users(id)
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
CREATE TABLE post_comments (
|
|
114
|
+
comment_id UUID PRIMARY KEY REFERENCES comments(id),
|
|
115
|
+
post_id UUID NOT NULL REFERENCES posts(id)
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
CREATE TABLE task_comments (
|
|
119
|
+
comment_id UUID PRIMARY KEY REFERENCES comments(id),
|
|
120
|
+
task_id UUID NOT NULL REFERENCES tasks(id)
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
-- Option 2: JSONB for flexible relations (when schema varies)
|
|
124
|
+
CREATE TABLE activities (
|
|
125
|
+
id UUID PRIMARY KEY,
|
|
126
|
+
subject_type VARCHAR(50) NOT NULL,
|
|
127
|
+
subject_id UUID NOT NULL,
|
|
128
|
+
metadata JSONB DEFAULT '{}',
|
|
129
|
+
CHECK (subject_type IN ('post', 'task', 'comment'))
|
|
130
|
+
);
|
|
131
|
+
CREATE INDEX idx_activities_subject ON activities(subject_type, subject_id);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### JSONB for Semi-Structured Data
|
|
135
|
+
|
|
136
|
+
```sql
|
|
137
|
+
-- Good: Configuration, metadata, varying attributes
|
|
138
|
+
CREATE TABLE products (
|
|
139
|
+
id UUID PRIMARY KEY,
|
|
140
|
+
name VARCHAR(255) NOT NULL,
|
|
141
|
+
base_price DECIMAL(10,2) NOT NULL,
|
|
142
|
+
attributes JSONB DEFAULT '{}' -- Color, size, custom fields
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
CREATE INDEX idx_products_attrs ON products USING GIN (attributes);
|
|
146
|
+
|
|
147
|
+
-- Query JSONB
|
|
148
|
+
SELECT * FROM products
|
|
149
|
+
WHERE attributes @> '{"color": "red"}'
|
|
150
|
+
AND (attributes->>'size')::int > 10;
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Use Cases
|
|
154
|
+
|
|
155
|
+
- Greenfield database design for new applications
|
|
156
|
+
- Schema reviews and optimization recommendations
|
|
157
|
+
- Migration from NoSQL to relational or vice versa
|
|
158
|
+
- Multi-tenant SaaS database architecture
|
|
159
|
+
- Audit and compliance requirements implementation
|
|
160
|
+
|
|
161
|
+
## Best Practices
|
|
162
|
+
|
|
163
|
+
| Do | Avoid |
|
|
164
|
+
|----|-------|
|
|
165
|
+
| Use UUID for distributed systems, serial for simple apps | Auto-incrementing IDs exposed to users (enumeration risk) |
|
|
166
|
+
| Apply 3NF for OLTP, denormalize strategically for reads | Over-normalizing lookup tables (country codes, etc.) |
|
|
167
|
+
| Create indexes matching query WHERE/ORDER BY patterns | Indexing every column (write performance penalty) |
|
|
168
|
+
| Use CHECK constraints for enum-like values | Storing booleans as strings or integers |
|
|
169
|
+
| Add NOT NULL unless truly optional | Nullable columns without clear semantics |
|
|
170
|
+
| Prefix indexes with table name: `idx_users_email` | Generic index names like `index1` |
|
|
171
|
+
| Use TIMESTAMPTZ for all timestamps | Storing timestamps without timezone |
|
|
172
|
+
| Design for the 80% use case first | Premature optimization for edge cases |
|
|
173
|
+
|
|
174
|
+
## Schema Review Checklist
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
[ ] All tables have primary keys
|
|
178
|
+
[ ] Foreign keys have appropriate ON DELETE actions
|
|
179
|
+
[ ] Indexes exist for all foreign keys
|
|
180
|
+
[ ] Indexes match common query patterns
|
|
181
|
+
[ ] No nullable columns without clear use case
|
|
182
|
+
[ ] Timestamps use TIMESTAMPTZ
|
|
183
|
+
[ ] Audit columns (created_at, updated_at) present
|
|
184
|
+
[ ] Naming follows consistent convention
|
|
185
|
+
[ ] JSONB used only for truly variable schema
|
|
186
|
+
[ ] Partitioning considered for tables > 10M rows
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Related Skills
|
|
190
|
+
|
|
191
|
+
See also these related skill documents:
|
|
192
|
+
|
|
193
|
+
- **managing-database-migrations** - Safe schema evolution patterns
|
|
194
|
+
- **optimizing-databases** - Query and index optimization
|
|
195
|
+
- **building-with-supabase** - PostgreSQL with RLS patterns
|
|
@@ -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
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Development Logs
|
|
2
|
+
|
|
3
|
+
This folder contains development artifacts that are **NOT committed to git**.
|
|
4
|
+
|
|
5
|
+
## What Goes Here
|
|
6
|
+
|
|
7
|
+
- **Plans**: Implementation plans, upgrade plans, migration plans
|
|
8
|
+
- **Ideas**: Brainstorming notes, feature ideas, improvement proposals
|
|
9
|
+
- **Logs**: Development session logs, debug logs, experiment notes
|
|
10
|
+
- **Tracking**: Project status, task breakdowns, progress notes
|
|
11
|
+
- **Management**: Sprint notes, retrospectives, decision logs
|
|
12
|
+
|
|
13
|
+
## Why Separate?
|
|
14
|
+
|
|
15
|
+
- Keep repository clean from temporary development artifacts
|
|
16
|
+
- Allow free-form planning without polluting git history
|
|
17
|
+
- Separate internal notes from public documentation
|
|
18
|
+
- Enable AI agents to maintain persistent context
|
|
19
|
+
|
|
20
|
+
## Best Practices
|
|
21
|
+
|
|
22
|
+
1. Use descriptive filenames: `plan-auth-refactor-v2.md`
|
|
23
|
+
2. Date prefix for logs: `2024-12-31-session-notes.md`
|
|
24
|
+
3. Clean up completed plans periodically
|
|
25
|
+
4. Move finalized decisions to `docs/` when ready for sharing
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
*This folder is git-ignored by default.*
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Standards & Rules
|
|
2
|
+
|
|
3
|
+
This folder contains standards and rules that govern project development.
|
|
4
|
+
|
|
5
|
+
## What Goes Here
|
|
6
|
+
|
|
7
|
+
- **Coding Standards**: Code style, naming conventions, patterns
|
|
8
|
+
- **Architecture Rules**: System design constraints, technology choices
|
|
9
|
+
- **Quality Gates**: Testing requirements, coverage thresholds
|
|
10
|
+
- **Security Policies**: Authentication, authorization, data handling
|
|
11
|
+
- **Documentation Standards**: API docs, README templates, comments
|
|
12
|
+
|
|
13
|
+
## Included Files
|
|
14
|
+
|
|
15
|
+
- `SKILL_STANDARDS.md` - Standards for creating AI agent skills
|
|
16
|
+
|
|
17
|
+
## How AI Agents Use This
|
|
18
|
+
|
|
19
|
+
AI agents in OMGKIT read from this folder to:
|
|
20
|
+
1. Understand project-specific conventions
|
|
21
|
+
2. Generate code that follows your standards
|
|
22
|
+
3. Review code against established rules
|
|
23
|
+
4. Propose improvements aligned with constraints
|
|
24
|
+
|
|
25
|
+
## Adding New Standards
|
|
26
|
+
|
|
27
|
+
1. Create a descriptive filename: `API_STANDARDS.md`, `TESTING_RULES.md`
|
|
28
|
+
2. Use clear, actionable language
|
|
29
|
+
3. Include examples of good and bad practices
|
|
30
|
+
4. Reference from your `OMEGA.md` if needed
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
*Think Omega. Build Omega. Be Omega.*
|