@cloudstreamsoftware/claude-tools 1.0.0 → 1.2.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 (190) hide show
  1. package/README.md +152 -37
  2. package/agents/INDEX.md +183 -0
  3. package/agents/architect.md +247 -0
  4. package/agents/build-error-resolver.md +555 -0
  5. package/agents/catalyst-deployer.md +132 -0
  6. package/agents/code-reviewer.md +121 -0
  7. package/agents/compliance-auditor.md +148 -0
  8. package/agents/creator-architect.md +395 -0
  9. package/agents/deluge-reviewer.md +98 -0
  10. package/agents/doc-updater.md +471 -0
  11. package/agents/e2e-runner.md +711 -0
  12. package/agents/planner.md +122 -0
  13. package/agents/refactor-cleaner.md +309 -0
  14. package/agents/security-reviewer.md +582 -0
  15. package/agents/tdd-guide.md +302 -0
  16. package/bin/cloudstream-setup.js +16 -6
  17. package/config/versions.json +63 -0
  18. package/dist/hooks/hooks.json +209 -0
  19. package/dist/index.js +47 -0
  20. package/dist/lib/asset-value.js +609 -0
  21. package/dist/lib/client-manager.js +300 -0
  22. package/dist/lib/command-matcher.js +242 -0
  23. package/dist/lib/cross-session-patterns.js +754 -0
  24. package/dist/lib/intent-classifier.js +1075 -0
  25. package/dist/lib/package-manager.js +374 -0
  26. package/dist/lib/recommendation-engine.js +597 -0
  27. package/dist/lib/session-memory.js +489 -0
  28. package/dist/lib/skill-effectiveness.js +486 -0
  29. package/dist/lib/skill-matcher.js +595 -0
  30. package/dist/lib/tutorial-metrics.js +242 -0
  31. package/dist/lib/tutorial-progress.js +209 -0
  32. package/dist/lib/tutorial-renderer.js +431 -0
  33. package/dist/lib/utils.js +380 -0
  34. package/dist/lib/verify-formatter.js +143 -0
  35. package/dist/lib/workflow-state.js +249 -0
  36. package/hooks/hooks.json +209 -0
  37. package/package.json +5 -1
  38. package/scripts/aggregate-sessions.js +290 -0
  39. package/scripts/branch-name-validator.js +291 -0
  40. package/scripts/build.js +101 -0
  41. package/scripts/commands/client-switch.js +231 -0
  42. package/scripts/deprecate-skill.js +610 -0
  43. package/scripts/diagnose.js +324 -0
  44. package/scripts/doc-freshness.js +168 -0
  45. package/scripts/generate-weekly-digest.js +393 -0
  46. package/scripts/health-check.js +270 -0
  47. package/scripts/hooks/credential-check.js +101 -0
  48. package/scripts/hooks/evaluate-session.js +81 -0
  49. package/scripts/hooks/pre-compact.js +66 -0
  50. package/scripts/hooks/prompt-analyzer.js +276 -0
  51. package/scripts/hooks/prompt-router.js +422 -0
  52. package/scripts/hooks/quality-gate-enforcer.js +371 -0
  53. package/scripts/hooks/session-end.js +156 -0
  54. package/scripts/hooks/session-start.js +195 -0
  55. package/scripts/hooks/skill-injector.js +333 -0
  56. package/scripts/hooks/suggest-compact.js +58 -0
  57. package/scripts/lib/asset-value.js +609 -0
  58. package/scripts/lib/client-manager.js +300 -0
  59. package/scripts/lib/command-matcher.js +242 -0
  60. package/scripts/lib/cross-session-patterns.js +754 -0
  61. package/scripts/lib/intent-classifier.js +1075 -0
  62. package/scripts/lib/package-manager.js +374 -0
  63. package/scripts/lib/recommendation-engine.js +597 -0
  64. package/scripts/lib/session-memory.js +489 -0
  65. package/scripts/lib/skill-effectiveness.js +486 -0
  66. package/scripts/lib/skill-matcher.js +595 -0
  67. package/scripts/lib/tutorial-metrics.js +242 -0
  68. package/scripts/lib/tutorial-progress.js +209 -0
  69. package/scripts/lib/tutorial-renderer.js +431 -0
  70. package/scripts/lib/utils.js +380 -0
  71. package/scripts/lib/verify-formatter.js +143 -0
  72. package/scripts/lib/workflow-state.js +249 -0
  73. package/scripts/onboard.js +363 -0
  74. package/scripts/quarterly-report.js +692 -0
  75. package/scripts/setup-package-manager.js +204 -0
  76. package/scripts/sync-upstream.js +391 -0
  77. package/scripts/test.js +108 -0
  78. package/scripts/tutorial-runner.js +351 -0
  79. package/scripts/validate-all.js +201 -0
  80. package/scripts/verifiers/agents.js +245 -0
  81. package/scripts/verifiers/config.js +186 -0
  82. package/scripts/verifiers/environment.js +123 -0
  83. package/scripts/verifiers/hooks.js +188 -0
  84. package/scripts/verifiers/index.js +38 -0
  85. package/scripts/verifiers/persistence.js +140 -0
  86. package/scripts/verifiers/plugin.js +215 -0
  87. package/scripts/verifiers/skills.js +209 -0
  88. package/scripts/verify-setup.js +164 -0
  89. package/skills/INDEX.md +157 -0
  90. package/skills/backend-patterns/SKILL.md +586 -0
  91. package/skills/backend-patterns/catalyst-patterns.md +128 -0
  92. package/skills/bigquery-patterns/SKILL.md +27 -0
  93. package/skills/bigquery-patterns/performance-optimization.md +518 -0
  94. package/skills/bigquery-patterns/query-patterns.md +372 -0
  95. package/skills/bigquery-patterns/schema-design.md +78 -0
  96. package/skills/cloudstream-project-template/SKILL.md +20 -0
  97. package/skills/cloudstream-project-template/structure.md +65 -0
  98. package/skills/coding-standards/SKILL.md +524 -0
  99. package/skills/coding-standards/deluge-standards.md +83 -0
  100. package/skills/compliance-patterns/SKILL.md +28 -0
  101. package/skills/compliance-patterns/hipaa/audit-requirements.md +251 -0
  102. package/skills/compliance-patterns/hipaa/baa-process.md +298 -0
  103. package/skills/compliance-patterns/hipaa/data-archival-strategy.md +387 -0
  104. package/skills/compliance-patterns/hipaa/phi-handling.md +52 -0
  105. package/skills/compliance-patterns/pci-dss/saq-a-requirements.md +307 -0
  106. package/skills/compliance-patterns/pci-dss/tokenization-patterns.md +382 -0
  107. package/skills/compliance-patterns/pci-dss/zoho-checkout-patterns.md +56 -0
  108. package/skills/compliance-patterns/soc2/access-controls.md +344 -0
  109. package/skills/compliance-patterns/soc2/audit-logging.md +458 -0
  110. package/skills/compliance-patterns/soc2/change-management.md +403 -0
  111. package/skills/compliance-patterns/soc2/deluge-execution-logging.md +407 -0
  112. package/skills/consultancy-workflows/SKILL.md +19 -0
  113. package/skills/consultancy-workflows/client-isolation.md +21 -0
  114. package/skills/consultancy-workflows/documentation-automation.md +454 -0
  115. package/skills/consultancy-workflows/handoff-procedures.md +257 -0
  116. package/skills/consultancy-workflows/knowledge-capture.md +513 -0
  117. package/skills/consultancy-workflows/time-tracking.md +26 -0
  118. package/skills/continuous-learning/SKILL.md +84 -0
  119. package/skills/continuous-learning/config.json +18 -0
  120. package/skills/continuous-learning/evaluate-session.sh +60 -0
  121. package/skills/continuous-learning-v2/SKILL.md +126 -0
  122. package/skills/continuous-learning-v2/config.json +61 -0
  123. package/skills/frontend-patterns/SKILL.md +635 -0
  124. package/skills/frontend-patterns/zoho-widget-patterns.md +103 -0
  125. package/skills/gcp-data-engineering/SKILL.md +36 -0
  126. package/skills/gcp-data-engineering/bigquery/performance-optimization.md +337 -0
  127. package/skills/gcp-data-engineering/dataflow/error-handling.md +496 -0
  128. package/skills/gcp-data-engineering/dataflow/pipeline-patterns.md +444 -0
  129. package/skills/gcp-data-engineering/dbt/model-organization.md +63 -0
  130. package/skills/gcp-data-engineering/dbt/testing-patterns.md +503 -0
  131. package/skills/gcp-data-engineering/medallion-architecture/bronze-layer.md +60 -0
  132. package/skills/gcp-data-engineering/medallion-architecture/gold-layer.md +311 -0
  133. package/skills/gcp-data-engineering/medallion-architecture/layer-transitions.md +517 -0
  134. package/skills/gcp-data-engineering/medallion-architecture/silver-layer.md +305 -0
  135. package/skills/gcp-data-engineering/zoho-to-gcp/data-extraction.md +543 -0
  136. package/skills/gcp-data-engineering/zoho-to-gcp/real-time-vs-batch.md +337 -0
  137. package/skills/security-review/SKILL.md +498 -0
  138. package/skills/security-review/compliance-checklist.md +53 -0
  139. package/skills/strategic-compact/SKILL.md +67 -0
  140. package/skills/tdd-workflow/SKILL.md +413 -0
  141. package/skills/tdd-workflow/zoho-testing.md +124 -0
  142. package/skills/tutorial/SKILL.md +249 -0
  143. package/skills/tutorial/docs/ACCESSIBILITY.md +169 -0
  144. package/skills/tutorial/lessons/00-philosophy-and-workflow.md +198 -0
  145. package/skills/tutorial/lessons/01-basics.md +81 -0
  146. package/skills/tutorial/lessons/02-training.md +86 -0
  147. package/skills/tutorial/lessons/03-commands.md +109 -0
  148. package/skills/tutorial/lessons/04-workflows.md +115 -0
  149. package/skills/tutorial/lessons/05-compliance.md +116 -0
  150. package/skills/tutorial/lessons/06-zoho.md +121 -0
  151. package/skills/tutorial/lessons/07-hooks-system.md +277 -0
  152. package/skills/tutorial/lessons/08-mcp-servers.md +316 -0
  153. package/skills/tutorial/lessons/09-client-management.md +215 -0
  154. package/skills/tutorial/lessons/10-testing-e2e.md +260 -0
  155. package/skills/tutorial/lessons/11-skills-deep-dive.md +272 -0
  156. package/skills/tutorial/lessons/12-rules-system.md +326 -0
  157. package/skills/tutorial/lessons/13-golden-standard-graduation.md +213 -0
  158. package/skills/tutorial/lessons/14-fork-setup-and-sync.md +312 -0
  159. package/skills/tutorial/lessons/15-living-examples-system.md +221 -0
  160. package/skills/tutorial/tracks/accelerated/README.md +134 -0
  161. package/skills/tutorial/tracks/accelerated/assessment/checkpoint-1.md +161 -0
  162. package/skills/tutorial/tracks/accelerated/assessment/checkpoint-2.md +175 -0
  163. package/skills/tutorial/tracks/accelerated/day-1-core-concepts.md +234 -0
  164. package/skills/tutorial/tracks/accelerated/day-2-essential-commands.md +270 -0
  165. package/skills/tutorial/tracks/accelerated/day-3-workflow-mastery.md +305 -0
  166. package/skills/tutorial/tracks/accelerated/day-4-compliance-zoho.md +304 -0
  167. package/skills/tutorial/tracks/accelerated/day-5-hooks-skills.md +344 -0
  168. package/skills/tutorial/tracks/accelerated/day-6-client-testing.md +386 -0
  169. package/skills/tutorial/tracks/accelerated/day-7-graduation.md +369 -0
  170. package/skills/zoho-patterns/CHANGELOG.md +108 -0
  171. package/skills/zoho-patterns/SKILL.md +446 -0
  172. package/skills/zoho-patterns/analytics/dashboard-patterns.md +352 -0
  173. package/skills/zoho-patterns/analytics/zoho-to-bigquery-pipeline.md +427 -0
  174. package/skills/zoho-patterns/catalyst/appsail-deployment.md +349 -0
  175. package/skills/zoho-patterns/catalyst/context-close-patterns.md +354 -0
  176. package/skills/zoho-patterns/catalyst/cron-batch-processing.md +374 -0
  177. package/skills/zoho-patterns/catalyst/function-patterns.md +439 -0
  178. package/skills/zoho-patterns/creator/form-design.md +304 -0
  179. package/skills/zoho-patterns/creator/publish-api-patterns.md +313 -0
  180. package/skills/zoho-patterns/creator/widget-integration.md +306 -0
  181. package/skills/zoho-patterns/creator/workflow-automation.md +253 -0
  182. package/skills/zoho-patterns/deluge/api-patterns.md +468 -0
  183. package/skills/zoho-patterns/deluge/batch-processing.md +403 -0
  184. package/skills/zoho-patterns/deluge/cross-app-integration.md +356 -0
  185. package/skills/zoho-patterns/deluge/error-handling.md +423 -0
  186. package/skills/zoho-patterns/deluge/syntax-reference.md +65 -0
  187. package/skills/zoho-patterns/integration/cors-proxy-architecture.md +426 -0
  188. package/skills/zoho-patterns/integration/crm-books-native-sync.md +277 -0
  189. package/skills/zoho-patterns/integration/oauth-token-management.md +461 -0
  190. package/skills/zoho-patterns/integration/zoho-flow-patterns.md +334 -0
@@ -0,0 +1,498 @@
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
+ version: 1.0.0
5
+ status: active
6
+ introduced: 1.0.0
7
+ lastUpdated: 2026-01-25
8
+ ---
9
+
10
+ # Security Review Skill
11
+
12
+ This skill ensures all code follows security best practices and identifies potential vulnerabilities.
13
+
14
+ ## When to Activate
15
+
16
+ - Implementing authentication or authorization
17
+ - Handling user input or file uploads
18
+ - Creating new API endpoints
19
+ - Working with secrets or credentials
20
+ - Implementing payment features
21
+ - Storing or transmitting sensitive data
22
+ - Integrating third-party APIs
23
+
24
+ ## Security Checklist
25
+
26
+ ### 1. Secrets Management
27
+
28
+ #### ❌ NEVER Do This
29
+ ```typescript
30
+ const apiKey = "sk-proj-xxxxx" // Hardcoded secret
31
+ const dbPassword = "password123" // In source code
32
+ ```
33
+
34
+ #### ✅ ALWAYS Do This
35
+ ```typescript
36
+ const apiKey = process.env.OPENAI_API_KEY
37
+ const dbUrl = process.env.DATABASE_URL
38
+
39
+ // Verify secrets exist
40
+ if (!apiKey) {
41
+ throw new Error('OPENAI_API_KEY not configured')
42
+ }
43
+ ```
44
+
45
+ #### Verification Steps
46
+ - [ ] No hardcoded API keys, tokens, or passwords
47
+ - [ ] All secrets in environment variables
48
+ - [ ] `.env.local` in .gitignore
49
+ - [ ] No secrets in git history
50
+ - [ ] Production secrets in hosting platform (Vercel, Railway)
51
+
52
+ ### 2. Input Validation
53
+
54
+ #### Always Validate User Input
55
+ ```typescript
56
+ import { z } from 'zod'
57
+
58
+ // Define validation schema
59
+ const CreateUserSchema = z.object({
60
+ email: z.string().email(),
61
+ name: z.string().min(1).max(100),
62
+ age: z.number().int().min(0).max(150)
63
+ })
64
+
65
+ // Validate before processing
66
+ export async function createUser(input: unknown) {
67
+ try {
68
+ const validated = CreateUserSchema.parse(input)
69
+ return await db.users.create(validated)
70
+ } catch (error) {
71
+ if (error instanceof z.ZodError) {
72
+ return { success: false, errors: error.errors }
73
+ }
74
+ throw error
75
+ }
76
+ }
77
+ ```
78
+
79
+ #### File Upload Validation
80
+ ```typescript
81
+ function validateFileUpload(file: File) {
82
+ // Size check (5MB max)
83
+ const maxSize = 5 * 1024 * 1024
84
+ if (file.size > maxSize) {
85
+ throw new Error('File too large (max 5MB)')
86
+ }
87
+
88
+ // Type check
89
+ const allowedTypes = ['image/jpeg', 'image/png', 'image/gif']
90
+ if (!allowedTypes.includes(file.type)) {
91
+ throw new Error('Invalid file type')
92
+ }
93
+
94
+ // Extension check
95
+ const allowedExtensions = ['.jpg', '.jpeg', '.png', '.gif']
96
+ const extension = file.name.toLowerCase().match(/\.[^.]+$/)?.[0]
97
+ if (!extension || !allowedExtensions.includes(extension)) {
98
+ throw new Error('Invalid file extension')
99
+ }
100
+
101
+ return true
102
+ }
103
+ ```
104
+
105
+ #### Verification Steps
106
+ - [ ] All user inputs validated with schemas
107
+ - [ ] File uploads restricted (size, type, extension)
108
+ - [ ] No direct use of user input in queries
109
+ - [ ] Whitelist validation (not blacklist)
110
+ - [ ] Error messages don't leak sensitive info
111
+
112
+ ### 3. SQL Injection Prevention
113
+
114
+ #### ❌ NEVER Concatenate SQL
115
+ ```typescript
116
+ // DANGEROUS - SQL Injection vulnerability
117
+ const query = `SELECT * FROM users WHERE email = '${userEmail}'`
118
+ await db.query(query)
119
+ ```
120
+
121
+ #### ✅ ALWAYS Use Parameterized Queries
122
+ ```typescript
123
+ // Safe - parameterized query
124
+ const { data } = await supabase
125
+ .from('users')
126
+ .select('*')
127
+ .eq('email', userEmail)
128
+
129
+ // Or with raw SQL
130
+ await db.query(
131
+ 'SELECT * FROM users WHERE email = $1',
132
+ [userEmail]
133
+ )
134
+ ```
135
+
136
+ #### Verification Steps
137
+ - [ ] All database queries use parameterized queries
138
+ - [ ] No string concatenation in SQL
139
+ - [ ] ORM/query builder used correctly
140
+ - [ ] Supabase queries properly sanitized
141
+
142
+ ### 4. Authentication & Authorization
143
+
144
+ #### JWT Token Handling
145
+ ```typescript
146
+ // ❌ WRONG: localStorage (vulnerable to XSS)
147
+ localStorage.setItem('token', token)
148
+
149
+ // ✅ CORRECT: httpOnly cookies
150
+ res.setHeader('Set-Cookie',
151
+ `token=${token}; HttpOnly; Secure; SameSite=Strict; Max-Age=3600`)
152
+ ```
153
+
154
+ #### Authorization Checks
155
+ ```typescript
156
+ export async function deleteUser(userId: string, requesterId: string) {
157
+ // ALWAYS verify authorization first
158
+ const requester = await db.users.findUnique({
159
+ where: { id: requesterId }
160
+ })
161
+
162
+ if (requester.role !== 'admin') {
163
+ return NextResponse.json(
164
+ { error: 'Unauthorized' },
165
+ { status: 403 }
166
+ )
167
+ }
168
+
169
+ // Proceed with deletion
170
+ await db.users.delete({ where: { id: userId } })
171
+ }
172
+ ```
173
+
174
+ #### Row Level Security (Supabase)
175
+ ```sql
176
+ -- Enable RLS on all tables
177
+ ALTER TABLE users ENABLE ROW LEVEL SECURITY;
178
+
179
+ -- Users can only view their own data
180
+ CREATE POLICY "Users view own data"
181
+ ON users FOR SELECT
182
+ USING (auth.uid() = id);
183
+
184
+ -- Users can only update their own data
185
+ CREATE POLICY "Users update own data"
186
+ ON users FOR UPDATE
187
+ USING (auth.uid() = id);
188
+ ```
189
+
190
+ #### Verification Steps
191
+ - [ ] Tokens stored in httpOnly cookies (not localStorage)
192
+ - [ ] Authorization checks before sensitive operations
193
+ - [ ] Row Level Security enabled in Supabase
194
+ - [ ] Role-based access control implemented
195
+ - [ ] Session management secure
196
+
197
+ ### 5. XSS Prevention
198
+
199
+ #### Sanitize HTML
200
+ ```typescript
201
+ import DOMPurify from 'isomorphic-dompurify'
202
+
203
+ // ALWAYS sanitize user-provided HTML
204
+ function renderUserContent(html: string) {
205
+ const clean = DOMPurify.sanitize(html, {
206
+ ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'p'],
207
+ ALLOWED_ATTR: []
208
+ })
209
+ return <div dangerouslySetInnerHTML={{ __html: clean }} />
210
+ }
211
+ ```
212
+
213
+ #### Content Security Policy
214
+ ```typescript
215
+ // next.config.js
216
+ const securityHeaders = [
217
+ {
218
+ key: 'Content-Security-Policy',
219
+ value: `
220
+ default-src 'self';
221
+ script-src 'self' 'unsafe-eval' 'unsafe-inline';
222
+ style-src 'self' 'unsafe-inline';
223
+ img-src 'self' data: https:;
224
+ font-src 'self';
225
+ connect-src 'self' https://api.example.com;
226
+ `.replace(/\s{2,}/g, ' ').trim()
227
+ }
228
+ ]
229
+ ```
230
+
231
+ #### Verification Steps
232
+ - [ ] User-provided HTML sanitized
233
+ - [ ] CSP headers configured
234
+ - [ ] No unvalidated dynamic content rendering
235
+ - [ ] React's built-in XSS protection used
236
+
237
+ ### 6. CSRF Protection
238
+
239
+ #### CSRF Tokens
240
+ ```typescript
241
+ import { csrf } from '@/lib/csrf'
242
+
243
+ export async function POST(request: Request) {
244
+ const token = request.headers.get('X-CSRF-Token')
245
+
246
+ if (!csrf.verify(token)) {
247
+ return NextResponse.json(
248
+ { error: 'Invalid CSRF token' },
249
+ { status: 403 }
250
+ )
251
+ }
252
+
253
+ // Process request
254
+ }
255
+ ```
256
+
257
+ #### SameSite Cookies
258
+ ```typescript
259
+ res.setHeader('Set-Cookie',
260
+ `session=${sessionId}; HttpOnly; Secure; SameSite=Strict`)
261
+ ```
262
+
263
+ #### Verification Steps
264
+ - [ ] CSRF tokens on state-changing operations
265
+ - [ ] SameSite=Strict on all cookies
266
+ - [ ] Double-submit cookie pattern implemented
267
+
268
+ ### 7. Rate Limiting
269
+
270
+ #### API Rate Limiting
271
+ ```typescript
272
+ import rateLimit from 'express-rate-limit'
273
+
274
+ const limiter = rateLimit({
275
+ windowMs: 15 * 60 * 1000, // 15 minutes
276
+ max: 100, // 100 requests per window
277
+ message: 'Too many requests'
278
+ })
279
+
280
+ // Apply to routes
281
+ app.use('/api/', limiter)
282
+ ```
283
+
284
+ #### Expensive Operations
285
+ ```typescript
286
+ // Aggressive rate limiting for searches
287
+ const searchLimiter = rateLimit({
288
+ windowMs: 60 * 1000, // 1 minute
289
+ max: 10, // 10 requests per minute
290
+ message: 'Too many search requests'
291
+ })
292
+
293
+ app.use('/api/search', searchLimiter)
294
+ ```
295
+
296
+ #### Verification Steps
297
+ - [ ] Rate limiting on all API endpoints
298
+ - [ ] Stricter limits on expensive operations
299
+ - [ ] IP-based rate limiting
300
+ - [ ] User-based rate limiting (authenticated)
301
+
302
+ ### 8. Sensitive Data Exposure
303
+
304
+ #### Logging
305
+ ```typescript
306
+ // ❌ WRONG: Logging sensitive data
307
+ console.log('User login:', { email, password })
308
+ console.log('Payment:', { cardNumber, cvv })
309
+
310
+ // ✅ CORRECT: Redact sensitive data
311
+ console.log('User login:', { email, userId })
312
+ console.log('Payment:', { last4: card.last4, userId })
313
+ ```
314
+
315
+ #### Error Messages
316
+ ```typescript
317
+ // ❌ WRONG: Exposing internal details
318
+ catch (error) {
319
+ return NextResponse.json(
320
+ { error: error.message, stack: error.stack },
321
+ { status: 500 }
322
+ )
323
+ }
324
+
325
+ // ✅ CORRECT: Generic error messages
326
+ catch (error) {
327
+ console.error('Internal error:', error)
328
+ return NextResponse.json(
329
+ { error: 'An error occurred. Please try again.' },
330
+ { status: 500 }
331
+ )
332
+ }
333
+ ```
334
+
335
+ #### Verification Steps
336
+ - [ ] No passwords, tokens, or secrets in logs
337
+ - [ ] Error messages generic for users
338
+ - [ ] Detailed errors only in server logs
339
+ - [ ] No stack traces exposed to users
340
+
341
+ ### 9. Blockchain Security (Solana)
342
+
343
+ #### Wallet Verification
344
+ ```typescript
345
+ import { verify } from '@solana/web3.js'
346
+
347
+ async function verifyWalletOwnership(
348
+ publicKey: string,
349
+ signature: string,
350
+ message: string
351
+ ) {
352
+ try {
353
+ const isValid = verify(
354
+ Buffer.from(message),
355
+ Buffer.from(signature, 'base64'),
356
+ Buffer.from(publicKey, 'base64')
357
+ )
358
+ return isValid
359
+ } catch (error) {
360
+ return false
361
+ }
362
+ }
363
+ ```
364
+
365
+ #### Transaction Verification
366
+ ```typescript
367
+ async function verifyTransaction(transaction: Transaction) {
368
+ // Verify recipient
369
+ if (transaction.to !== expectedRecipient) {
370
+ throw new Error('Invalid recipient')
371
+ }
372
+
373
+ // Verify amount
374
+ if (transaction.amount > maxAmount) {
375
+ throw new Error('Amount exceeds limit')
376
+ }
377
+
378
+ // Verify user has sufficient balance
379
+ const balance = await getBalance(transaction.from)
380
+ if (balance < transaction.amount) {
381
+ throw new Error('Insufficient balance')
382
+ }
383
+
384
+ return true
385
+ }
386
+ ```
387
+
388
+ #### Verification Steps
389
+ - [ ] Wallet signatures verified
390
+ - [ ] Transaction details validated
391
+ - [ ] Balance checks before transactions
392
+ - [ ] No blind transaction signing
393
+
394
+ ### 10. Dependency Security
395
+
396
+ #### Regular Updates
397
+ ```bash
398
+ # Check for vulnerabilities
399
+ npm audit
400
+
401
+ # Fix automatically fixable issues
402
+ npm audit fix
403
+
404
+ # Update dependencies
405
+ npm update
406
+
407
+ # Check for outdated packages
408
+ npm outdated
409
+ ```
410
+
411
+ #### Lock Files
412
+ ```bash
413
+ # ALWAYS commit lock files
414
+ git add package-lock.json
415
+
416
+ # Use in CI/CD for reproducible builds
417
+ npm ci # Instead of npm install
418
+ ```
419
+
420
+ #### Verification Steps
421
+ - [ ] Dependencies up to date
422
+ - [ ] No known vulnerabilities (npm audit clean)
423
+ - [ ] Lock files committed
424
+ - [ ] Dependabot enabled on GitHub
425
+ - [ ] Regular security updates
426
+
427
+ ## Security Testing
428
+
429
+ ### Automated Security Tests
430
+ ```typescript
431
+ // Test authentication
432
+ test('requires authentication', async () => {
433
+ const response = await fetch('/api/protected')
434
+ expect(response.status).toBe(401)
435
+ })
436
+
437
+ // Test authorization
438
+ test('requires admin role', async () => {
439
+ const response = await fetch('/api/admin', {
440
+ headers: { Authorization: `Bearer ${userToken}` }
441
+ })
442
+ expect(response.status).toBe(403)
443
+ })
444
+
445
+ // Test input validation
446
+ test('rejects invalid input', async () => {
447
+ const response = await fetch('/api/users', {
448
+ method: 'POST',
449
+ body: JSON.stringify({ email: 'not-an-email' })
450
+ })
451
+ expect(response.status).toBe(400)
452
+ })
453
+
454
+ // Test rate limiting
455
+ test('enforces rate limits', async () => {
456
+ const requests = Array(101).fill(null).map(() =>
457
+ fetch('/api/endpoint')
458
+ )
459
+
460
+ const responses = await Promise.all(requests)
461
+ const tooManyRequests = responses.filter(r => r.status === 429)
462
+
463
+ expect(tooManyRequests.length).toBeGreaterThan(0)
464
+ })
465
+ ```
466
+
467
+ ## Pre-Deployment Security Checklist
468
+
469
+ Before ANY production deployment:
470
+
471
+ - [ ] **Secrets**: No hardcoded secrets, all in env vars
472
+ - [ ] **Input Validation**: All user inputs validated
473
+ - [ ] **SQL Injection**: All queries parameterized
474
+ - [ ] **XSS**: User content sanitized
475
+ - [ ] **CSRF**: Protection enabled
476
+ - [ ] **Authentication**: Proper token handling
477
+ - [ ] **Authorization**: Role checks in place
478
+ - [ ] **Rate Limiting**: Enabled on all endpoints
479
+ - [ ] **HTTPS**: Enforced in production
480
+ - [ ] **Security Headers**: CSP, X-Frame-Options configured
481
+ - [ ] **Error Handling**: No sensitive data in errors
482
+ - [ ] **Logging**: No sensitive data logged
483
+ - [ ] **Dependencies**: Up to date, no vulnerabilities
484
+ - [ ] **Row Level Security**: Enabled in Supabase
485
+ - [ ] **CORS**: Properly configured
486
+ - [ ] **File Uploads**: Validated (size, type)
487
+ - [ ] **Wallet Signatures**: Verified (if blockchain)
488
+
489
+ ## Resources
490
+
491
+ - [OWASP Top 10](https://owasp.org/www-project-top-ten/)
492
+ - [Next.js Security](https://nextjs.org/docs/security)
493
+ - [Supabase Security](https://supabase.com/docs/guides/auth)
494
+ - [Web Security Academy](https://portswigger.net/web-security)
495
+
496
+ ---
497
+
498
+ **Remember**: Security is not optional. One vulnerability can compromise the entire platform. When in doubt, err on the side of caution.
@@ -0,0 +1,53 @@
1
+ # Compliance Security Checklists
2
+
3
+ ## HIPAA Security Checklist
4
+ - [ ] ePHI fields identified and encrypted (Creator field encryption enabled)
5
+ - [ ] Access controls: Role-based per form/field
6
+ - [ ] Audit logging: All PHI access logged to dedicated form
7
+ - [ ] BAA: Zoho BAA on file (legal@zohocorp.com)
8
+ - [ ] Breach notification: Procedures documented
9
+ - [ ] Data retention: Archival before Creator's 1-year auto-delete
10
+ - [ ] Minimum necessary: Only required PHI fields exposed
11
+ - [ ] Transmission security: HTTPS enforced (Zoho default)
12
+ - [ ] Workstation security: Session timeout configured
13
+
14
+ ## SOC2 Security Checklist
15
+ - [ ] Access controls: Documented, reviewed quarterly
16
+ - [ ] Audit logging: Custom Deluge logging (NOT automatic in Creator)
17
+ - [ ] Change management: Custom workflow (NOT native in Creator)
18
+ - [ ] Data classification: All fields categorized
19
+ - [ ] Encryption: At rest and in transit
20
+ - [ ] Incident response: Plan documented and tested
21
+ - [ ] Vendor management: Third-party integrations assessed
22
+ - [ ] Backup: Regular exports configured
23
+ - [ ] Monitoring: Alert on unusual access patterns
24
+
25
+ ## PCI-DSS Security Checklist
26
+ - [ ] No PAN storage: Verify no credit card numbers stored anywhere
27
+ - [ ] Zoho Checkout: Hosted payment pages ONLY
28
+ - [ ] Tokenization: Via Zoho Payments for recurring
29
+ - [ ] SAQ-A: Self-assessment completed annually
30
+ - [ ] Network: No direct database access from internet
31
+ - [ ] Access: Limited to need-to-know basis
32
+ - [ ] Logging: All payment-related operations logged
33
+ - [ ] Testing: Quarterly internal vulnerability review
34
+
35
+ ## Zoho-Specific Security Checks
36
+ - [ ] OAuth tokens: Using Connections (not hardcoded)
37
+ - [ ] Token refresh: 1-hour expiry handled
38
+ - [ ] Webhook validation: X-Zoho-Webhook-Signature checked
39
+ - [ ] API rate limits: Handled gracefully
40
+ - [ ] Catalyst secrets: Using Segments, not env files
41
+ - [ ] Widget sandboxing: No eval() or innerHTML
42
+ - [ ] CORS: Server-side proxy for external API calls
43
+ - [ ] Credentials: Not in Deluge code, Creator fields, or git
44
+
45
+ ## GCP Security Checks
46
+ - [ ] Service accounts: Least privilege per function
47
+ - [ ] BigQuery: Row-level security for sensitive data
48
+ - [ ] Cloud Storage: No public buckets, signed URLs for temp access
49
+ - [ ] Cloud Functions: VPC Service Controls for sensitive data
50
+ - [ ] IAM: Regular permission audits
51
+ - [ ] Logging: Cloud Audit Logs enabled
52
+ - [ ] Encryption: Customer-managed keys for sensitive data
53
+ - [ ] Network: VPC firewall rules reviewed
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: strategic-compact
3
+ description: Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
4
+ version: 1.0.0
5
+ status: active
6
+ introduced: 1.0.0
7
+ lastUpdated: 2026-01-25
8
+ ---
9
+
10
+ # Strategic Compact Skill
11
+
12
+ Suggests manual `/compact` at strategic points in your workflow rather than relying on arbitrary auto-compaction.
13
+
14
+ ## Why Strategic Compaction?
15
+
16
+ Auto-compaction triggers at arbitrary points:
17
+ - Often mid-task, losing important context
18
+ - No awareness of logical task boundaries
19
+ - Can interrupt complex multi-step operations
20
+
21
+ Strategic compaction at logical boundaries:
22
+ - **After exploration, before execution** - Compact research context, keep implementation plan
23
+ - **After completing a milestone** - Fresh start for next phase
24
+ - **Before major context shifts** - Clear exploration context before different task
25
+
26
+ ## How It Works
27
+
28
+ The `suggest-compact.sh` script runs on PreToolUse (Edit/Write) and:
29
+
30
+ 1. **Tracks tool calls** - Counts tool invocations in session
31
+ 2. **Threshold detection** - Suggests at configurable threshold (default: 50 calls)
32
+ 3. **Periodic reminders** - Reminds every 25 calls after threshold
33
+
34
+ ## Hook Setup
35
+
36
+ Add to your `~/.claude/settings.json`:
37
+
38
+ ```json
39
+ {
40
+ "hooks": {
41
+ "PreToolUse": [{
42
+ "matcher": "tool == \"Edit\" || tool == \"Write\"",
43
+ "hooks": [{
44
+ "type": "command",
45
+ "command": "~/.claude/skills/strategic-compact/suggest-compact.sh"
46
+ }]
47
+ }]
48
+ }
49
+ }
50
+ ```
51
+
52
+ ## Configuration
53
+
54
+ Environment variables:
55
+ - `COMPACT_THRESHOLD` - Tool calls before first suggestion (default: 50)
56
+
57
+ ## Best Practices
58
+
59
+ 1. **Compact after planning** - Once plan is finalized, compact to start fresh
60
+ 2. **Compact after debugging** - Clear error-resolution context before continuing
61
+ 3. **Don't compact mid-implementation** - Preserve context for related changes
62
+ 4. **Read the suggestion** - The hook tells you *when*, you decide *if*
63
+
64
+ ## Related
65
+
66
+ - Memory persistence hooks - For state that survives compaction
67
+ - Continuous learning skill - For extracting patterns from sessions