agent-configs 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 (85) hide show
  1. package/README.md +223 -0
  2. package/agents/architect.md +211 -0
  3. package/agents/code-reviewer.md +104 -0
  4. package/agents/planner.md +119 -0
  5. package/agents/refactor-cleaner.md +306 -0
  6. package/agents/security-reviewer.md +545 -0
  7. package/agents/tdd-guide.md +280 -0
  8. package/bundles/bk-chat-bundle/README.md +48 -0
  9. package/bundles/bk-chat-bundle/manifest.json +10 -0
  10. package/bundles/continuous-learning/.claude/commands/evolve.md +190 -0
  11. package/bundles/continuous-learning/.claude/commands/instinct-status.md +64 -0
  12. package/bundles/continuous-learning/.claude/commands/learn.md +83 -0
  13. package/bundles/continuous-learning/.claude/hooks/learning-end.js +85 -0
  14. package/bundles/continuous-learning/.claude/hooks/observe.js +131 -0
  15. package/bundles/continuous-learning/.claude/lib/learning.js +559 -0
  16. package/bundles/continuous-learning/.claude/lib/utils.js +312 -0
  17. package/bundles/continuous-learning/.claude/skills/continuous-learning/SKILL.md +200 -0
  18. package/bundles/continuous-learning/.cursor/hooks/learning-end.js +102 -0
  19. package/bundles/continuous-learning/.cursor/rules/continuous-learning.mdc +34 -0
  20. package/bundles/continuous-learning/.cursor/skills/continuous-learning/SKILL.md +77 -0
  21. package/bundles/continuous-learning/README.md +159 -0
  22. package/bundles/continuous-learning/manifest.json +51 -0
  23. package/bundles/planning-bundle/README.md +34 -0
  24. package/bundles/planning-bundle/manifest.json +10 -0
  25. package/bundles/review-bundle/README.md +43 -0
  26. package/bundles/review-bundle/manifest.json +11 -0
  27. package/bundles/shared-memory/.claude/commands/list-sessions.md +124 -0
  28. package/bundles/shared-memory/.claude/commands/load-session.md +169 -0
  29. package/bundles/shared-memory/.claude/commands/save-session.md +137 -0
  30. package/bundles/shared-memory/.claude/hooks/memory-compact.js +43 -0
  31. package/bundles/shared-memory/.claude/hooks/memory-end.js +42 -0
  32. package/bundles/shared-memory/.claude/hooks/memory-start.js +59 -0
  33. package/bundles/shared-memory/.claude/lib/memory.js +416 -0
  34. package/bundles/shared-memory/.claude/lib/utils.js +209 -0
  35. package/bundles/shared-memory/.claude/skills/shared-memory/SKILL.md +183 -0
  36. package/bundles/shared-memory/.cursor/hooks/memory-start.js +42 -0
  37. package/bundles/shared-memory/.cursor/rules/shared-memory.mdc +37 -0
  38. package/bundles/shared-memory/.cursor/skills/shared-memory/SKILL.md +183 -0
  39. package/bundles/tdd-bundle/README.md +33 -0
  40. package/bundles/tdd-bundle/manifest.json +10 -0
  41. package/cli.js +978 -0
  42. package/commands/build-fix.md +29 -0
  43. package/commands/code-review.md +40 -0
  44. package/commands/e2e.md +363 -0
  45. package/commands/learn.md +114 -0
  46. package/commands/plan.md +113 -0
  47. package/commands/refactor-clean.md +28 -0
  48. package/commands/tdd.md +326 -0
  49. package/commands/test-coverage.md +27 -0
  50. package/commands/update-codemaps.md +17 -0
  51. package/commands/update-docs.md +31 -0
  52. package/configs.json +158 -0
  53. package/hooks/hooks.json +101 -0
  54. package/package.json +58 -0
  55. package/rules/agents.md +49 -0
  56. package/rules/coding-style.md +70 -0
  57. package/rules/git-workflow.md +45 -0
  58. package/rules/hooks.md +46 -0
  59. package/rules/patterns.md +55 -0
  60. package/rules/performance.md +47 -0
  61. package/rules/security.md +36 -0
  62. package/rules/testing.md +30 -0
  63. package/skills/ai-config-architect/SKILL.md +59 -0
  64. package/skills/ai-config-architect/references/agents.md +77 -0
  65. package/skills/ai-config-architect/references/commands.md +66 -0
  66. package/skills/ai-config-architect/references/hooks.md +70 -0
  67. package/skills/ai-config-architect/references/patterns.md +66 -0
  68. package/skills/ai-config-architect/references/platforms.md +82 -0
  69. package/skills/ai-config-architect/references/rules.md +66 -0
  70. package/skills/ai-config-architect/references/skills.md +67 -0
  71. package/skills/bk-chat-helper/SKILL.md +398 -0
  72. package/skills/bk-chat-helper/references/api-reference.md +606 -0
  73. package/skills/bk-chat-helper/references/examples.md +789 -0
  74. package/skills/bk-chat-helper/references/integration-guide.md +583 -0
  75. package/skills/bk-chat-x/SKILL.md +400 -0
  76. package/skills/bk-chat-x/references/components-api.md +340 -0
  77. package/skills/bk-chat-x/references/examples.md +386 -0
  78. package/skills/bk-chat-x/references/shortcuts-guide.md +375 -0
  79. package/skills/coding-standards/SKILL.md +523 -0
  80. package/skills/security-review/SKILL.md +497 -0
  81. package/skills/security-review/references/cloud-infrastructure-security.md +361 -0
  82. package/skills/strategic-compact/SKILL.md +66 -0
  83. package/skills/strategic-compact/scripts/suggest-compact.sh +52 -0
  84. package/skills/tdd-workflow/SKILL.md +412 -0
  85. package/skills/verification-loop/SKILL.md +128 -0
@@ -0,0 +1,497 @@
1
+ ---
2
+ name: security-review
3
+ description: Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provides comprehensive security checklist and patterns.
4
+ metadata:
5
+ author: everything-claude-code
6
+ version: "1.0"
7
+ ---
8
+
9
+ # Security Review Skill
10
+
11
+ This skill ensures all code follows security best practices and identifies potential vulnerabilities.
12
+
13
+ ## When to Activate
14
+
15
+ - Implementing authentication or authorization
16
+ - Handling user input or file uploads
17
+ - Creating new API endpoints
18
+ - Working with secrets or credentials
19
+ - Implementing payment features
20
+ - Storing or transmitting sensitive data
21
+ - Integrating third-party APIs
22
+
23
+ ## Security Checklist
24
+
25
+ ### 1. Secrets Management
26
+
27
+ #### ❌ NEVER Do This
28
+ ```typescript
29
+ const apiKey = "sk-proj-xxxxx" // Hardcoded secret
30
+ const dbPassword = "password123" // In source code
31
+ ```
32
+
33
+ #### ✅ ALWAYS Do This
34
+ ```typescript
35
+ const apiKey = process.env.OPENAI_API_KEY
36
+ const dbUrl = process.env.DATABASE_URL
37
+
38
+ // Verify secrets exist
39
+ if (!apiKey) {
40
+ throw new Error('OPENAI_API_KEY not configured')
41
+ }
42
+ ```
43
+
44
+ #### Verification Steps
45
+ - [ ] No hardcoded API keys, tokens, or passwords
46
+ - [ ] All secrets in environment variables
47
+ - [ ] `.env.local` in .gitignore
48
+ - [ ] No secrets in git history
49
+ - [ ] Production secrets in hosting platform (Vercel, Railway)
50
+
51
+ ### 2. Input Validation
52
+
53
+ #### Always Validate User Input
54
+ ```typescript
55
+ import { z } from 'zod'
56
+
57
+ // Define validation schema
58
+ const CreateUserSchema = z.object({
59
+ email: z.string().email(),
60
+ name: z.string().min(1).max(100),
61
+ age: z.number().int().min(0).max(150)
62
+ })
63
+
64
+ // Validate before processing
65
+ export async function createUser(input: unknown) {
66
+ try {
67
+ const validated = CreateUserSchema.parse(input)
68
+ return await db.users.create(validated)
69
+ } catch (error) {
70
+ if (error instanceof z.ZodError) {
71
+ return { success: false, errors: error.errors }
72
+ }
73
+ throw error
74
+ }
75
+ }
76
+ ```
77
+
78
+ #### File Upload Validation
79
+ ```typescript
80
+ function validateFileUpload(file: File) {
81
+ // Size check (5MB max)
82
+ const maxSize = 5 * 1024 * 1024
83
+ if (file.size > maxSize) {
84
+ throw new Error('File too large (max 5MB)')
85
+ }
86
+
87
+ // Type check
88
+ const allowedTypes = ['image/jpeg', 'image/png', 'image/gif']
89
+ if (!allowedTypes.includes(file.type)) {
90
+ throw new Error('Invalid file type')
91
+ }
92
+
93
+ // Extension check
94
+ const allowedExtensions = ['.jpg', '.jpeg', '.png', '.gif']
95
+ const extension = file.name.toLowerCase().match(/\.[^.]+$/)?.[0]
96
+ if (!extension || !allowedExtensions.includes(extension)) {
97
+ throw new Error('Invalid file extension')
98
+ }
99
+
100
+ return true
101
+ }
102
+ ```
103
+
104
+ #### Verification Steps
105
+ - [ ] All user inputs validated with schemas
106
+ - [ ] File uploads restricted (size, type, extension)
107
+ - [ ] No direct use of user input in queries
108
+ - [ ] Whitelist validation (not blacklist)
109
+ - [ ] Error messages don't leak sensitive info
110
+
111
+ ### 3. SQL Injection Prevention
112
+
113
+ #### ❌ NEVER Concatenate SQL
114
+ ```typescript
115
+ // DANGEROUS - SQL Injection vulnerability
116
+ const query = `SELECT * FROM users WHERE email = '${userEmail}'`
117
+ await db.query(query)
118
+ ```
119
+
120
+ #### ✅ ALWAYS Use Parameterized Queries
121
+ ```typescript
122
+ // Safe - parameterized query
123
+ const { data } = await supabase
124
+ .from('users')
125
+ .select('*')
126
+ .eq('email', userEmail)
127
+
128
+ // Or with raw SQL
129
+ await db.query(
130
+ 'SELECT * FROM users WHERE email = $1',
131
+ [userEmail]
132
+ )
133
+ ```
134
+
135
+ #### Verification Steps
136
+ - [ ] All database queries use parameterized queries
137
+ - [ ] No string concatenation in SQL
138
+ - [ ] ORM/query builder used correctly
139
+ - [ ] Supabase queries properly sanitized
140
+
141
+ ### 4. Authentication & Authorization
142
+
143
+ #### JWT Token Handling
144
+ ```typescript
145
+ // ❌ WRONG: localStorage (vulnerable to XSS)
146
+ localStorage.setItem('token', token)
147
+
148
+ // ✅ CORRECT: httpOnly cookies
149
+ res.setHeader('Set-Cookie',
150
+ `token=${token}; HttpOnly; Secure; SameSite=Strict; Max-Age=3600`)
151
+ ```
152
+
153
+ #### Authorization Checks
154
+ ```typescript
155
+ export async function deleteUser(userId: string, requesterId: string) {
156
+ // ALWAYS verify authorization first
157
+ const requester = await db.users.findUnique({
158
+ where: { id: requesterId }
159
+ })
160
+
161
+ if (requester.role !== 'admin') {
162
+ return NextResponse.json(
163
+ { error: 'Unauthorized' },
164
+ { status: 403 }
165
+ )
166
+ }
167
+
168
+ // Proceed with deletion
169
+ await db.users.delete({ where: { id: userId } })
170
+ }
171
+ ```
172
+
173
+ #### Row Level Security (Supabase)
174
+ ```sql
175
+ -- Enable RLS on all tables
176
+ ALTER TABLE users ENABLE ROW LEVEL SECURITY;
177
+
178
+ -- Users can only view their own data
179
+ CREATE POLICY "Users view own data"
180
+ ON users FOR SELECT
181
+ USING (auth.uid() = id);
182
+
183
+ -- Users can only update their own data
184
+ CREATE POLICY "Users update own data"
185
+ ON users FOR UPDATE
186
+ USING (auth.uid() = id);
187
+ ```
188
+
189
+ #### Verification Steps
190
+ - [ ] Tokens stored in httpOnly cookies (not localStorage)
191
+ - [ ] Authorization checks before sensitive operations
192
+ - [ ] Row Level Security enabled in Supabase
193
+ - [ ] Role-based access control implemented
194
+ - [ ] Session management secure
195
+
196
+ ### 5. XSS Prevention
197
+
198
+ #### Sanitize HTML
199
+ ```typescript
200
+ import DOMPurify from 'isomorphic-dompurify'
201
+
202
+ // ALWAYS sanitize user-provided HTML
203
+ function renderUserContent(html: string) {
204
+ const clean = DOMPurify.sanitize(html, {
205
+ ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'p'],
206
+ ALLOWED_ATTR: []
207
+ })
208
+ return <div dangerouslySetInnerHTML={{ __html: clean }} />
209
+ }
210
+ ```
211
+
212
+ #### Content Security Policy
213
+ ```typescript
214
+ // next.config.js
215
+ const securityHeaders = [
216
+ {
217
+ key: 'Content-Security-Policy',
218
+ value: `
219
+ default-src 'self';
220
+ script-src 'self' 'unsafe-eval' 'unsafe-inline';
221
+ style-src 'self' 'unsafe-inline';
222
+ img-src 'self' data: https:;
223
+ font-src 'self';
224
+ connect-src 'self' https://api.example.com;
225
+ `.replace(/\s{2,}/g, ' ').trim()
226
+ }
227
+ ]
228
+ ```
229
+
230
+ #### Verification Steps
231
+ - [ ] User-provided HTML sanitized
232
+ - [ ] CSP headers configured
233
+ - [ ] No unvalidated dynamic content rendering
234
+ - [ ] React's built-in XSS protection used
235
+
236
+ ### 6. CSRF Protection
237
+
238
+ #### CSRF Tokens
239
+ ```typescript
240
+ import { csrf } from '@/lib/csrf'
241
+
242
+ export async function POST(request: Request) {
243
+ const token = request.headers.get('X-CSRF-Token')
244
+
245
+ if (!csrf.verify(token)) {
246
+ return NextResponse.json(
247
+ { error: 'Invalid CSRF token' },
248
+ { status: 403 }
249
+ )
250
+ }
251
+
252
+ // Process request
253
+ }
254
+ ```
255
+
256
+ #### SameSite Cookies
257
+ ```typescript
258
+ res.setHeader('Set-Cookie',
259
+ `session=${sessionId}; HttpOnly; Secure; SameSite=Strict`)
260
+ ```
261
+
262
+ #### Verification Steps
263
+ - [ ] CSRF tokens on state-changing operations
264
+ - [ ] SameSite=Strict on all cookies
265
+ - [ ] Double-submit cookie pattern implemented
266
+
267
+ ### 7. Rate Limiting
268
+
269
+ #### API Rate Limiting
270
+ ```typescript
271
+ import rateLimit from 'express-rate-limit'
272
+
273
+ const limiter = rateLimit({
274
+ windowMs: 15 * 60 * 1000, // 15 minutes
275
+ max: 100, // 100 requests per window
276
+ message: 'Too many requests'
277
+ })
278
+
279
+ // Apply to routes
280
+ app.use('/api/', limiter)
281
+ ```
282
+
283
+ #### Expensive Operations
284
+ ```typescript
285
+ // Aggressive rate limiting for searches
286
+ const searchLimiter = rateLimit({
287
+ windowMs: 60 * 1000, // 1 minute
288
+ max: 10, // 10 requests per minute
289
+ message: 'Too many search requests'
290
+ })
291
+
292
+ app.use('/api/search', searchLimiter)
293
+ ```
294
+
295
+ #### Verification Steps
296
+ - [ ] Rate limiting on all API endpoints
297
+ - [ ] Stricter limits on expensive operations
298
+ - [ ] IP-based rate limiting
299
+ - [ ] User-based rate limiting (authenticated)
300
+
301
+ ### 8. Sensitive Data Exposure
302
+
303
+ #### Logging
304
+ ```typescript
305
+ // ❌ WRONG: Logging sensitive data
306
+ console.log('User login:', { email, password })
307
+ console.log('Payment:', { cardNumber, cvv })
308
+
309
+ // ✅ CORRECT: Redact sensitive data
310
+ console.log('User login:', { email, userId })
311
+ console.log('Payment:', { last4: card.last4, userId })
312
+ ```
313
+
314
+ #### Error Messages
315
+ ```typescript
316
+ // ❌ WRONG: Exposing internal details
317
+ catch (error) {
318
+ return NextResponse.json(
319
+ { error: error.message, stack: error.stack },
320
+ { status: 500 }
321
+ )
322
+ }
323
+
324
+ // ✅ CORRECT: Generic error messages
325
+ catch (error) {
326
+ console.error('Internal error:', error)
327
+ return NextResponse.json(
328
+ { error: 'An error occurred. Please try again.' },
329
+ { status: 500 }
330
+ )
331
+ }
332
+ ```
333
+
334
+ #### Verification Steps
335
+ - [ ] No passwords, tokens, or secrets in logs
336
+ - [ ] Error messages generic for users
337
+ - [ ] Detailed errors only in server logs
338
+ - [ ] No stack traces exposed to users
339
+
340
+ ### 9. Blockchain Security (Solana)
341
+
342
+ #### Wallet Verification
343
+ ```typescript
344
+ import { verify } from '@solana/web3.js'
345
+
346
+ async function verifyWalletOwnership(
347
+ publicKey: string,
348
+ signature: string,
349
+ message: string
350
+ ) {
351
+ try {
352
+ const isValid = verify(
353
+ Buffer.from(message),
354
+ Buffer.from(signature, 'base64'),
355
+ Buffer.from(publicKey, 'base64')
356
+ )
357
+ return isValid
358
+ } catch (error) {
359
+ return false
360
+ }
361
+ }
362
+ ```
363
+
364
+ #### Transaction Verification
365
+ ```typescript
366
+ async function verifyTransaction(transaction: Transaction) {
367
+ // Verify recipient
368
+ if (transaction.to !== expectedRecipient) {
369
+ throw new Error('Invalid recipient')
370
+ }
371
+
372
+ // Verify amount
373
+ if (transaction.amount > maxAmount) {
374
+ throw new Error('Amount exceeds limit')
375
+ }
376
+
377
+ // Verify user has sufficient balance
378
+ const balance = await getBalance(transaction.from)
379
+ if (balance < transaction.amount) {
380
+ throw new Error('Insufficient balance')
381
+ }
382
+
383
+ return true
384
+ }
385
+ ```
386
+
387
+ #### Verification Steps
388
+ - [ ] Wallet signatures verified
389
+ - [ ] Transaction details validated
390
+ - [ ] Balance checks before transactions
391
+ - [ ] No blind transaction signing
392
+
393
+ ### 10. Dependency Security
394
+
395
+ #### Regular Updates
396
+ ```bash
397
+ # Check for vulnerabilities
398
+ npm audit
399
+
400
+ # Fix automatically fixable issues
401
+ npm audit fix
402
+
403
+ # Update dependencies
404
+ npm update
405
+
406
+ # Check for outdated packages
407
+ npm outdated
408
+ ```
409
+
410
+ #### Lock Files
411
+ ```bash
412
+ # ALWAYS commit lock files
413
+ git add package-lock.json
414
+
415
+ # Use in CI/CD for reproducible builds
416
+ npm ci # Instead of npm install
417
+ ```
418
+
419
+ #### Verification Steps
420
+ - [ ] Dependencies up to date
421
+ - [ ] No known vulnerabilities (npm audit clean)
422
+ - [ ] Lock files committed
423
+ - [ ] Dependabot enabled on GitHub
424
+ - [ ] Regular security updates
425
+
426
+ ## Security Testing
427
+
428
+ ### Automated Security Tests
429
+ ```typescript
430
+ // Test authentication
431
+ test('requires authentication', async () => {
432
+ const response = await fetch('/api/protected')
433
+ expect(response.status).toBe(401)
434
+ })
435
+
436
+ // Test authorization
437
+ test('requires admin role', async () => {
438
+ const response = await fetch('/api/admin', {
439
+ headers: { Authorization: `Bearer ${userToken}` }
440
+ })
441
+ expect(response.status).toBe(403)
442
+ })
443
+
444
+ // Test input validation
445
+ test('rejects invalid input', async () => {
446
+ const response = await fetch('/api/users', {
447
+ method: 'POST',
448
+ body: JSON.stringify({ email: 'not-an-email' })
449
+ })
450
+ expect(response.status).toBe(400)
451
+ })
452
+
453
+ // Test rate limiting
454
+ test('enforces rate limits', async () => {
455
+ const requests = Array(101).fill(null).map(() =>
456
+ fetch('/api/endpoint')
457
+ )
458
+
459
+ const responses = await Promise.all(requests)
460
+ const tooManyRequests = responses.filter(r => r.status === 429)
461
+
462
+ expect(tooManyRequests.length).toBeGreaterThan(0)
463
+ })
464
+ ```
465
+
466
+ ## Pre-Deployment Security Checklist
467
+
468
+ Before ANY production deployment:
469
+
470
+ - [ ] **Secrets**: No hardcoded secrets, all in env vars
471
+ - [ ] **Input Validation**: All user inputs validated
472
+ - [ ] **SQL Injection**: All queries parameterized
473
+ - [ ] **XSS**: User content sanitized
474
+ - [ ] **CSRF**: Protection enabled
475
+ - [ ] **Authentication**: Proper token handling
476
+ - [ ] **Authorization**: Role checks in place
477
+ - [ ] **Rate Limiting**: Enabled on all endpoints
478
+ - [ ] **HTTPS**: Enforced in production
479
+ - [ ] **Security Headers**: CSP, X-Frame-Options configured
480
+ - [ ] **Error Handling**: No sensitive data in errors
481
+ - [ ] **Logging**: No sensitive data logged
482
+ - [ ] **Dependencies**: Up to date, no vulnerabilities
483
+ - [ ] **Row Level Security**: Enabled in Supabase
484
+ - [ ] **CORS**: Properly configured
485
+ - [ ] **File Uploads**: Validated (size, type)
486
+ - [ ] **Wallet Signatures**: Verified (if blockchain)
487
+
488
+ ## Resources
489
+
490
+ - [OWASP Top 10](https://owasp.org/www-project-top-ten/)
491
+ - [Next.js Security](https://nextjs.org/docs/security)
492
+ - [Supabase Security](https://supabase.com/docs/guides/auth)
493
+ - [Web Security Academy](https://portswigger.net/web-security)
494
+
495
+ ---
496
+
497
+ **Remember**: Security is not optional. One vulnerability can compromise the entire platform. When in doubt, err on the side of caution.