@musashishao/agent-kit 1.8.2 → 1.9.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/.agent/agents/ai-architect.md +39 -0
- package/.agent/agents/cloud-engineer.md +39 -0
- package/.agent/agents/game-asset-curator.md +317 -0
- package/.agent/agents/game-developer.md +190 -89
- package/.agent/agents/game-narrative-designer.md +310 -0
- package/.agent/agents/game-qa-agent.md +441 -0
- package/.agent/agents/marketing-specialist.md +41 -0
- package/.agent/agents/penetration-tester.md +15 -1
- package/.agent/rules/CODEX.md +26 -2
- package/.agent/rules/GEMINI.md +1 -1
- package/.agent/rules/REFERENCE.md +92 -2
- package/.agent/skills/3d-web-experience/SKILL.md +386 -0
- package/.agent/skills/DEPENDENCIES.md +54 -0
- package/.agent/skills/ab-test-setup/SKILL.md +77 -0
- package/.agent/skills/active-directory-attacks/SKILL.md +59 -0
- package/.agent/skills/agent-evaluation/SKILL.md +430 -0
- package/.agent/skills/agent-memory-systems/SKILL.md +426 -0
- package/.agent/skills/agent-tool-builder/SKILL.md +139 -0
- package/.agent/skills/ai-agents-architect/SKILL.md +115 -0
- package/.agent/skills/ai-product/SKILL.md +86 -0
- package/.agent/skills/ai-wrapper-product/SKILL.md +90 -0
- package/.agent/skills/analytics-tracking/SKILL.md +88 -0
- package/.agent/skills/api-fuzzing-bug-bounty/SKILL.md +66 -0
- package/.agent/skills/app-store-optimization/SKILL.md +66 -0
- package/.agent/skills/autonomous-agent-patterns/SKILL.md +414 -0
- package/.agent/skills/aws-penetration-testing/SKILL.md +50 -0
- package/.agent/skills/aws-serverless/SKILL.md +327 -0
- package/.agent/skills/azure-functions/SKILL.md +340 -0
- package/.agent/skills/broken-authentication/SKILL.md +53 -0
- package/.agent/skills/browser-automation/SKILL.md +408 -0
- package/.agent/skills/browser-extension-builder/SKILL.md +422 -0
- package/.agent/skills/bullmq-specialist/SKILL.md +424 -0
- package/.agent/skills/bun-development/SKILL.md +386 -0
- package/.agent/skills/burp-suite-testing/SKILL.md +60 -0
- package/.agent/skills/clerk-auth/SKILL.md +432 -0
- package/.agent/skills/cloud-penetration-testing/SKILL.md +51 -0
- package/.agent/skills/copywriting/SKILL.md +66 -0
- package/.agent/skills/crewai/SKILL.md +470 -0
- package/.agent/skills/discord-bot-architect/SKILL.md +447 -0
- package/.agent/skills/email-sequence/SKILL.md +73 -0
- package/.agent/skills/ethical-hacking-methodology/SKILL.md +67 -0
- package/.agent/skills/firebase/SKILL.md +377 -0
- package/.agent/skills/game-development/godot-expert/SKILL.md +462 -0
- package/.agent/skills/game-development/npc-ai-integration/SKILL.md +110 -0
- package/.agent/skills/game-development/procedural-generation/SKILL.md +168 -0
- package/.agent/skills/game-development/unity-integration/SKILL.md +358 -0
- package/.agent/skills/game-development/webgpu-shading/SKILL.md +209 -0
- package/.agent/skills/gcp-cloud-run/SKILL.md +358 -0
- package/.agent/skills/graphql/SKILL.md +492 -0
- package/.agent/skills/idor-testing/SKILL.md +64 -0
- package/.agent/skills/inngest/SKILL.md +128 -0
- package/.agent/skills/langfuse/SKILL.md +415 -0
- package/.agent/skills/langgraph/SKILL.md +360 -0
- package/.agent/skills/launch-strategy/SKILL.md +68 -0
- package/.agent/skills/linux-privilege-escalation/SKILL.md +62 -0
- package/.agent/skills/llm-app-patterns/SKILL.md +367 -0
- package/.agent/skills/marketing-ideas/SKILL.md +66 -0
- package/.agent/skills/metasploit-framework/SKILL.md +60 -0
- package/.agent/skills/micro-saas-launcher/SKILL.md +93 -0
- package/.agent/skills/neon-postgres/SKILL.md +339 -0
- package/.agent/skills/paid-ads/SKILL.md +64 -0
- package/.agent/skills/supabase-integration/SKILL.md +411 -0
- package/.agent/workflows/ai-agent.md +36 -0
- package/.agent/workflows/game-prototype.md +154 -0
- package/.agent/workflows/marketing.md +37 -0
- package/.agent/workflows/pentest.md +37 -0
- package/.agent/workflows/saas.md +36 -0
- package/README.md +4 -4
- package/docs/CHANGELOG_AI_INFRA.md +30 -0
- package/docs/MIGRATION_GUIDE_V1.9.md +55 -0
- package/package.json +1 -1
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: firebase
|
|
3
|
+
description: "Firebase gives you a complete backend in minutes - auth, database, storage, functions, hosting. Covers Security Rules, Firestore patterns, Auth flows, and cost optimization."
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
source: "antigravity-awesome-skills (adapted)"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 🔥 Firebase
|
|
9
|
+
|
|
10
|
+
You're a developer who has shipped dozens of Firebase projects. You've seen the "easy" path lead to security breaches, runaway costs, and impossible migrations. You know Firebase is powerful, but you also know its sharp edges.
|
|
11
|
+
|
|
12
|
+
**Key insight**: Firebase is optimized for read-heavy, denormalized data. If you design Firestore like SQL, you'll have a bad time.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## When to Use This Skill
|
|
17
|
+
|
|
18
|
+
- Rapid prototyping with full backend
|
|
19
|
+
- Real-time applications (chat, collaboration)
|
|
20
|
+
- Mobile/web apps needing auth + database
|
|
21
|
+
- Serverless functions with Cloud Functions
|
|
22
|
+
- Static hosting with global CDN
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Capabilities
|
|
27
|
+
|
|
28
|
+
- `firebase-auth`
|
|
29
|
+
- `firestore`
|
|
30
|
+
- `firebase-realtime-database`
|
|
31
|
+
- `firebase-cloud-functions`
|
|
32
|
+
- `firebase-storage`
|
|
33
|
+
- `firebase-hosting`
|
|
34
|
+
- `firebase-security-rules`
|
|
35
|
+
- `firebase-emulators`
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 1. Modular SDK Setup
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
// lib/firebase.js
|
|
43
|
+
import { initializeApp } from 'firebase/app';
|
|
44
|
+
import { getAuth, connectAuthEmulator } from 'firebase/auth';
|
|
45
|
+
import { getFirestore, connectFirestoreEmulator } from 'firebase/firestore';
|
|
46
|
+
|
|
47
|
+
const firebaseConfig = {
|
|
48
|
+
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
|
|
49
|
+
authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
|
|
50
|
+
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
|
|
51
|
+
storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,
|
|
52
|
+
messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,
|
|
53
|
+
appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const app = initializeApp(firebaseConfig);
|
|
57
|
+
export const auth = getAuth(app);
|
|
58
|
+
export const db = getFirestore(app);
|
|
59
|
+
|
|
60
|
+
// Connect to emulators in development
|
|
61
|
+
if (process.env.NODE_ENV === 'development') {
|
|
62
|
+
connectAuthEmulator(auth, 'http://localhost:9099');
|
|
63
|
+
connectFirestoreEmulator(db, 'localhost', 8080);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 2. Authentication Patterns
|
|
70
|
+
|
|
71
|
+
### Email/Password Auth
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
import {
|
|
75
|
+
createUserWithEmailAndPassword,
|
|
76
|
+
signInWithEmailAndPassword,
|
|
77
|
+
signOut,
|
|
78
|
+
onAuthStateChanged
|
|
79
|
+
} from 'firebase/auth';
|
|
80
|
+
import { auth } from './firebase';
|
|
81
|
+
|
|
82
|
+
// Sign up
|
|
83
|
+
export async function signUp(email, password) {
|
|
84
|
+
const userCredential = await createUserWithEmailAndPassword(auth, email, password);
|
|
85
|
+
return userCredential.user;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Sign in
|
|
89
|
+
export async function signIn(email, password) {
|
|
90
|
+
const userCredential = await signInWithEmailAndPassword(auth, email, password);
|
|
91
|
+
return userCredential.user;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Auth state listener
|
|
95
|
+
export function subscribeToAuth(callback) {
|
|
96
|
+
return onAuthStateChanged(auth, (user) => {
|
|
97
|
+
callback(user);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### OAuth Provider
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
import { GoogleAuthProvider, signInWithPopup } from 'firebase/auth';
|
|
106
|
+
|
|
107
|
+
export async function signInWithGoogle() {
|
|
108
|
+
const provider = new GoogleAuthProvider();
|
|
109
|
+
provider.addScope('email');
|
|
110
|
+
provider.addScope('profile');
|
|
111
|
+
|
|
112
|
+
const result = await signInWithPopup(auth, provider);
|
|
113
|
+
|
|
114
|
+
// Access token for Google APIs
|
|
115
|
+
const credential = GoogleAuthProvider.credentialFromResult(result);
|
|
116
|
+
const token = credential.accessToken;
|
|
117
|
+
|
|
118
|
+
return result.user;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 3. Firestore Patterns
|
|
125
|
+
|
|
126
|
+
### Data Modeling for Queries
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
// Design around your query patterns!
|
|
130
|
+
// Example: Messages in a chat room
|
|
131
|
+
|
|
132
|
+
// DON'T: Nest deeply
|
|
133
|
+
// /chats/{chatId}/messages/{messageId}/reactions/{reactionId}
|
|
134
|
+
|
|
135
|
+
// DO: Flatten for query flexibility
|
|
136
|
+
// /messages (with chatId field for filtering)
|
|
137
|
+
|
|
138
|
+
// Collection structure
|
|
139
|
+
const messageRef = {
|
|
140
|
+
id: 'msg123',
|
|
141
|
+
chatId: 'chat456',
|
|
142
|
+
userId: 'user789',
|
|
143
|
+
text: 'Hello world',
|
|
144
|
+
createdAt: serverTimestamp(),
|
|
145
|
+
// Denormalize for display without extra reads
|
|
146
|
+
userName: 'John Doe',
|
|
147
|
+
userAvatar: 'https://...'
|
|
148
|
+
};
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Real-time Subscription
|
|
152
|
+
|
|
153
|
+
```javascript
|
|
154
|
+
import {
|
|
155
|
+
collection,
|
|
156
|
+
query,
|
|
157
|
+
where,
|
|
158
|
+
orderBy,
|
|
159
|
+
limit,
|
|
160
|
+
onSnapshot
|
|
161
|
+
} from 'firebase/firestore';
|
|
162
|
+
|
|
163
|
+
export function subscribeToMessages(chatId, callback) {
|
|
164
|
+
const q = query(
|
|
165
|
+
collection(db, 'messages'),
|
|
166
|
+
where('chatId', '==', chatId),
|
|
167
|
+
orderBy('createdAt', 'desc'),
|
|
168
|
+
limit(50)
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
return onSnapshot(q, (snapshot) => {
|
|
172
|
+
const messages = snapshot.docs.map(doc => ({
|
|
173
|
+
id: doc.id,
|
|
174
|
+
...doc.data()
|
|
175
|
+
}));
|
|
176
|
+
callback(messages);
|
|
177
|
+
}, (error) => {
|
|
178
|
+
console.error('Subscription error:', error);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Batch Writes
|
|
184
|
+
|
|
185
|
+
```javascript
|
|
186
|
+
import { writeBatch, doc, serverTimestamp } from 'firebase/firestore';
|
|
187
|
+
|
|
188
|
+
export async function createOrderWithItems(order, items) {
|
|
189
|
+
const batch = writeBatch(db);
|
|
190
|
+
|
|
191
|
+
// Create order
|
|
192
|
+
const orderRef = doc(collection(db, 'orders'));
|
|
193
|
+
batch.set(orderRef, {
|
|
194
|
+
...order,
|
|
195
|
+
createdAt: serverTimestamp()
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Create items
|
|
199
|
+
items.forEach(item => {
|
|
200
|
+
const itemRef = doc(collection(db, 'orderItems'));
|
|
201
|
+
batch.set(itemRef, {
|
|
202
|
+
...item,
|
|
203
|
+
orderId: orderRef.id
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// Update inventory
|
|
208
|
+
items.forEach(item => {
|
|
209
|
+
const productRef = doc(db, 'products', item.productId);
|
|
210
|
+
batch.update(productRef, {
|
|
211
|
+
inventory: increment(-item.quantity)
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
await batch.commit();
|
|
216
|
+
return orderRef.id;
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 4. Security Rules
|
|
223
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
// firestore.rules
|
|
226
|
+
rules_version = '2';
|
|
227
|
+
service cloud.firestore {
|
|
228
|
+
match /databases/{database}/documents {
|
|
229
|
+
|
|
230
|
+
// Helper functions
|
|
231
|
+
function isSignedIn() {
|
|
232
|
+
return request.auth != null;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function isOwner(userId) {
|
|
236
|
+
return request.auth.uid == userId;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function isAdmin() {
|
|
240
|
+
return request.auth.token.admin == true;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Users collection
|
|
244
|
+
match /users/{userId} {
|
|
245
|
+
// Anyone signed in can read
|
|
246
|
+
allow read: if isSignedIn();
|
|
247
|
+
|
|
248
|
+
// Only owner can write their own doc
|
|
249
|
+
allow write: if isOwner(userId);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Messages collection
|
|
253
|
+
match /messages/{messageId} {
|
|
254
|
+
// Read if member of the chat
|
|
255
|
+
allow read: if isSignedIn() &&
|
|
256
|
+
exists(/databases/$(database)/documents/chatMembers/$(request.auth.uid + '_' + resource.data.chatId));
|
|
257
|
+
|
|
258
|
+
// Create with valid data
|
|
259
|
+
allow create: if isSignedIn() &&
|
|
260
|
+
request.resource.data.userId == request.auth.uid &&
|
|
261
|
+
request.resource.data.text is string &&
|
|
262
|
+
request.resource.data.text.size() <= 1000;
|
|
263
|
+
|
|
264
|
+
// Only owner can update/delete
|
|
265
|
+
allow update, delete: if isOwner(resource.data.userId);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Admin-only collection
|
|
269
|
+
match /admin/{document=**} {
|
|
270
|
+
allow read, write: if isAdmin();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## 5. Cloud Functions
|
|
279
|
+
|
|
280
|
+
```javascript
|
|
281
|
+
// functions/index.js
|
|
282
|
+
const functions = require('firebase-functions');
|
|
283
|
+
const admin = require('firebase-admin');
|
|
284
|
+
|
|
285
|
+
admin.initializeApp();
|
|
286
|
+
const db = admin.firestore();
|
|
287
|
+
|
|
288
|
+
// HTTP function
|
|
289
|
+
exports.createUser = functions.https.onCall(async (data, context) => {
|
|
290
|
+
// Verify auth
|
|
291
|
+
if (!context.auth) {
|
|
292
|
+
throw new functions.https.HttpsError('unauthenticated', 'Must be signed in');
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Create user document
|
|
296
|
+
await db.collection('users').doc(context.auth.uid).set({
|
|
297
|
+
name: data.name,
|
|
298
|
+
email: context.auth.token.email,
|
|
299
|
+
createdAt: admin.firestore.FieldValue.serverTimestamp()
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
return { success: true };
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
// Firestore trigger
|
|
306
|
+
exports.onUserCreate = functions.firestore
|
|
307
|
+
.document('users/{userId}')
|
|
308
|
+
.onCreate(async (snap, context) => {
|
|
309
|
+
const user = snap.data();
|
|
310
|
+
|
|
311
|
+
// Send welcome email
|
|
312
|
+
await sendWelcomeEmail(user.email);
|
|
313
|
+
|
|
314
|
+
// Initialize user settings
|
|
315
|
+
await db.collection('settings').doc(context.params.userId).set({
|
|
316
|
+
notifications: true,
|
|
317
|
+
theme: 'light'
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## 6. Anti-Patterns
|
|
325
|
+
|
|
326
|
+
### ❌ No Security Rules
|
|
327
|
+
|
|
328
|
+
```javascript
|
|
329
|
+
// WRONG: Open database
|
|
330
|
+
rules_version = '2';
|
|
331
|
+
service cloud.firestore {
|
|
332
|
+
match /{document=**} {
|
|
333
|
+
allow read, write: if true; // ANYONE CAN READ/WRITE!
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// CORRECT: Lock down by default
|
|
338
|
+
match /{document=**} {
|
|
339
|
+
allow read, write: if false;
|
|
340
|
+
}
|
|
341
|
+
// Then allow specific access
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### ❌ Listener on Large Collections
|
|
345
|
+
|
|
346
|
+
```javascript
|
|
347
|
+
// WRONG: Subscribe to ALL users
|
|
348
|
+
const unsubscribe = onSnapshot(collection(db, 'users'), (snapshot) => {
|
|
349
|
+
// 1 million docs = $1000+ in reads!
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
// CORRECT: Always use query limits
|
|
353
|
+
const q = query(
|
|
354
|
+
collection(db, 'users'),
|
|
355
|
+
where('active', '==', true),
|
|
356
|
+
limit(50)
|
|
357
|
+
);
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### ❌ Client-Side Admin Operations
|
|
361
|
+
|
|
362
|
+
```javascript
|
|
363
|
+
// WRONG: Delete in client
|
|
364
|
+
await deleteDoc(doc(db, 'users', userId)); // Relies on client-side rules!
|
|
365
|
+
|
|
366
|
+
// CORRECT: Use Cloud Function for sensitive ops
|
|
367
|
+
const deleteUser = httpsCallable(functions, 'deleteUser');
|
|
368
|
+
await deleteUser({ userId });
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Related Skills
|
|
374
|
+
|
|
375
|
+
- `nextjs-supabase-auth` - Supabase alternative
|
|
376
|
+
- `api-patterns` - API design
|
|
377
|
+
- `database-design` - Data modeling
|