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