@patricio0312rev/skillset 0.1.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 (115) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +21 -0
  3. package/README.md +176 -0
  4. package/bin/cli.js +37 -0
  5. package/package.json +55 -0
  6. package/src/commands/init.js +301 -0
  7. package/src/index.js +168 -0
  8. package/src/lib/config.js +200 -0
  9. package/src/lib/generator.js +166 -0
  10. package/src/utils/display.js +95 -0
  11. package/src/utils/readme.js +196 -0
  12. package/src/utils/tool-specific.js +233 -0
  13. package/templates/ai-engineering/agent-orchestration-planner/ SKILL.md +266 -0
  14. package/templates/ai-engineering/cost-latency-optimizer/ SKILL.md +270 -0
  15. package/templates/ai-engineering/doc-to-vector-dataset-generator/ SKILL.md +239 -0
  16. package/templates/ai-engineering/evaluation-harness/ SKILL.md +219 -0
  17. package/templates/ai-engineering/guardrails-safety-filter-builder/ SKILL.md +226 -0
  18. package/templates/ai-engineering/llm-debugger/ SKILL.md +283 -0
  19. package/templates/ai-engineering/prompt-regression-tester/ SKILL.md +216 -0
  20. package/templates/ai-engineering/prompt-template-builder/ SKILL.md +393 -0
  21. package/templates/ai-engineering/rag-pipeline-builder/ SKILL.md +244 -0
  22. package/templates/ai-engineering/tool-function-schema-designer/ SKILL.md +219 -0
  23. package/templates/architecture/adr-writer/ SKILL.md +250 -0
  24. package/templates/architecture/api-versioning-deprecation-planner/ SKILL.md +331 -0
  25. package/templates/architecture/domain-model-boundaries-mapper/ SKILL.md +300 -0
  26. package/templates/architecture/migration-planner/ SKILL.md +376 -0
  27. package/templates/architecture/performance-budget-setter/ SKILL.md +318 -0
  28. package/templates/architecture/reliability-strategy-builder/ SKILL.md +286 -0
  29. package/templates/architecture/rfc-generator/ SKILL.md +362 -0
  30. package/templates/architecture/scalability-playbook/ SKILL.md +279 -0
  31. package/templates/architecture/system-design-generator/ SKILL.md +339 -0
  32. package/templates/architecture/tech-debt-prioritizer/ SKILL.md +329 -0
  33. package/templates/backend/api-contract-normalizer/ SKILL.md +487 -0
  34. package/templates/backend/api-endpoint-generator/ SKILL.md +415 -0
  35. package/templates/backend/auth-module-builder/ SKILL.md +99 -0
  36. package/templates/backend/background-jobs-designer/ SKILL.md +166 -0
  37. package/templates/backend/caching-strategist/ SKILL.md +190 -0
  38. package/templates/backend/error-handling-standardizer/ SKILL.md +174 -0
  39. package/templates/backend/rate-limiting-abuse-protection/ SKILL.md +147 -0
  40. package/templates/backend/rbac-permissions-builder/ SKILL.md +158 -0
  41. package/templates/backend/service-layer-extractor/ SKILL.md +269 -0
  42. package/templates/backend/webhook-receiver-hardener/ SKILL.md +211 -0
  43. package/templates/ci-cd/artifact-sbom-publisher/ SKILL.md +236 -0
  44. package/templates/ci-cd/caching-strategy-optimizer/ SKILL.md +195 -0
  45. package/templates/ci-cd/deployment-checklist-generator/ SKILL.md +381 -0
  46. package/templates/ci-cd/github-actions-pipeline-creator/ SKILL.md +348 -0
  47. package/templates/ci-cd/monorepo-ci-optimizer/ SKILL.md +298 -0
  48. package/templates/ci-cd/preview-environments-builder/ SKILL.md +187 -0
  49. package/templates/ci-cd/quality-gates-enforcer/ SKILL.md +342 -0
  50. package/templates/ci-cd/release-automation-builder/ SKILL.md +281 -0
  51. package/templates/ci-cd/rollback-workflow-builder/ SKILL.md +372 -0
  52. package/templates/ci-cd/secrets-env-manager/ SKILL.md +242 -0
  53. package/templates/db-management/backup-restore-runbook-generator/ SKILL.md +505 -0
  54. package/templates/db-management/data-integrity-auditor/ SKILL.md +505 -0
  55. package/templates/db-management/data-retention-archiving-planner/ SKILL.md +430 -0
  56. package/templates/db-management/data-seeding-fixtures-builder/ SKILL.md +375 -0
  57. package/templates/db-management/db-performance-watchlist/ SKILL.md +425 -0
  58. package/templates/db-management/etl-sync-job-builder/ SKILL.md +457 -0
  59. package/templates/db-management/multi-tenant-safety-checker/ SKILL.md +398 -0
  60. package/templates/db-management/prisma-migration-assistant/ SKILL.md +379 -0
  61. package/templates/db-management/schema-consistency-checker/ SKILL.md +440 -0
  62. package/templates/db-management/sql-query-optimizer/ SKILL.md +324 -0
  63. package/templates/foundation/changelog-writer/ SKILL.md +431 -0
  64. package/templates/foundation/code-formatter-installer/ SKILL.md +320 -0
  65. package/templates/foundation/codebase-summarizer/ SKILL.md +360 -0
  66. package/templates/foundation/dependency-doctor/ SKILL.md +163 -0
  67. package/templates/foundation/dev-environment-bootstrapper/ SKILL.md +259 -0
  68. package/templates/foundation/dev-onboarding-builder/ SKILL.md +556 -0
  69. package/templates/foundation/docs-starter-kit/ SKILL.md +574 -0
  70. package/templates/foundation/explaining-code/SKILL.md +13 -0
  71. package/templates/foundation/git-hygiene-enforcer/ SKILL.md +455 -0
  72. package/templates/foundation/project-scaffolder/ SKILL.md +65 -0
  73. package/templates/foundation/project-scaffolder/references/templates.md +126 -0
  74. package/templates/foundation/repo-structure-linter/ SKILL.md +0 -0
  75. package/templates/foundation/repo-structure-linter/references/conventions.md +98 -0
  76. package/templates/frontend/animation-micro-interaction-pack/ SKILL.md +41 -0
  77. package/templates/frontend/component-scaffold-generator/ SKILL.md +562 -0
  78. package/templates/frontend/design-to-component-translator/ SKILL.md +547 -0
  79. package/templates/frontend/form-wizard-builder/ SKILL.md +553 -0
  80. package/templates/frontend/frontend-refactor-planner/ SKILL.md +37 -0
  81. package/templates/frontend/i18n-frontend-implementer/ SKILL.md +44 -0
  82. package/templates/frontend/modal-drawer-system/ SKILL.md +377 -0
  83. package/templates/frontend/page-layout-builder/ SKILL.md +630 -0
  84. package/templates/frontend/state-ux-flow-builder/ SKILL.md +23 -0
  85. package/templates/frontend/table-builder/ SKILL.md +350 -0
  86. package/templates/performance/alerting-dashboard-builder/ SKILL.md +162 -0
  87. package/templates/performance/backend-latency-profiler-helper/ SKILL.md +108 -0
  88. package/templates/performance/caching-cdn-strategy-planner/ SKILL.md +150 -0
  89. package/templates/performance/capacity-planning-helper/ SKILL.md +242 -0
  90. package/templates/performance/core-web-vitals-tuner/ SKILL.md +126 -0
  91. package/templates/performance/incident-runbook-generator/ SKILL.md +162 -0
  92. package/templates/performance/load-test-scenario-builder/ SKILL.md +256 -0
  93. package/templates/performance/observability-setup/ SKILL.md +232 -0
  94. package/templates/performance/postmortem-writer/ SKILL.md +203 -0
  95. package/templates/performance/structured-logging-standardizer/ SKILL.md +122 -0
  96. package/templates/security/auth-security-reviewer/ SKILL.md +428 -0
  97. package/templates/security/dependency-vulnerability-triage/ SKILL.md +495 -0
  98. package/templates/security/input-validation-sanitization-auditor/ SKILL.md +76 -0
  99. package/templates/security/pii-redaction-logging-policy-builder/ SKILL.md +65 -0
  100. package/templates/security/rbac-policy-tester/ SKILL.md +80 -0
  101. package/templates/security/secrets-scanner/ SKILL.md +462 -0
  102. package/templates/security/secure-headers-csp-builder/ SKILL.md +404 -0
  103. package/templates/security/security-incident-playbook-generator/ SKILL.md +76 -0
  104. package/templates/security/security-pr-checklist-skill/ SKILL.md +62 -0
  105. package/templates/security/threat-model-generator/ SKILL.md +394 -0
  106. package/templates/testing/contract-testing-builder/ SKILL.md +492 -0
  107. package/templates/testing/coverage-strategist/ SKILL.md +436 -0
  108. package/templates/testing/e2e-test-builder/ SKILL.md +382 -0
  109. package/templates/testing/flaky-test-detective/ SKILL.md +416 -0
  110. package/templates/testing/integration-test-builder/ SKILL.md +525 -0
  111. package/templates/testing/mocking-assistant/ SKILL.md +383 -0
  112. package/templates/testing/snapshot-test-refactorer/ SKILL.md +375 -0
  113. package/templates/testing/test-data-factory-builder/ SKILL.md +449 -0
  114. package/templates/testing/test-reporting-triage-skill/ SKILL.md +469 -0
  115. package/templates/testing/unit-test-generator/ SKILL.md +548 -0
@@ -0,0 +1,430 @@
1
+ ---
2
+ name: data-retention-archiving-planner
3
+ description: Plans and implements data retention policies with archival strategies, compliance requirements, automated cleanup jobs, and cold storage migration. Use for "data retention", "data archival", "GDPR compliance", or "storage optimization".
4
+ ---
5
+
6
+ # Data Retention & Archiving Planner
7
+
8
+ Manage data lifecycle with automated retention and archiving.
9
+
10
+ ## Retention Policy Document
11
+
12
+ ```markdown
13
+ # Data Retention Policy
14
+
15
+ ## Retention Periods
16
+
17
+ | Data Type | Hot Storage | Cold Storage | Total Retention | Reason |
18
+ | --------------------- | ----------- | ------------ | --------------- | ----------------- |
19
+ | User accounts | Active | N/A | Indefinite | Business need |
20
+ | Order history | 2 years | 5 years | 7 years | Tax compliance |
21
+ | Logs | 30 days | 90 days | 120 days | Operational |
22
+ | Analytics events | 90 days | 1 year | 15 months | Business insights |
23
+ | Audit trails | 1 year | 6 years | 7 years | Legal compliance |
24
+ | User sessions | 30 days | None | 30 days | Security |
25
+ | Failed login attempts | 90 days | None | 90 days | Security |
26
+
27
+ ## Compliance Requirements
28
+
29
+ ### GDPR (EU)
30
+
31
+ - Right to erasure (right to be forgotten)
32
+ - Data minimization
33
+ - Storage limitation
34
+
35
+ ### HIPAA (Healthcare)
36
+
37
+ - Minimum 6 years retention
38
+ - Secure archival required
39
+
40
+ ### SOX (Financial)
41
+
42
+ - 7 years retention for financial records
43
+ - Immutable audit trails
44
+
45
+ ### PCI DSS (Payments)
46
+
47
+ - 1 year minimum for audit logs
48
+ - 3 months minimum for transaction logs
49
+ ```
50
+
51
+ ## Archive Schema Design
52
+
53
+ ```sql
54
+ -- Hot database: Current active data
55
+ CREATE TABLE orders (
56
+ id BIGSERIAL PRIMARY KEY,
57
+ user_id BIGINT NOT NULL,
58
+ total DECIMAL(10,2) NOT NULL,
59
+ status TEXT NOT NULL,
60
+ created_at TIMESTAMP NOT NULL DEFAULT NOW(),
61
+ updated_at TIMESTAMP NOT NULL DEFAULT NOW()
62
+ );
63
+
64
+ -- Cold database: Archived historical data
65
+ CREATE TABLE orders_archive (
66
+ id BIGINT PRIMARY KEY,
67
+ user_id BIGINT NOT NULL,
68
+ total DECIMAL(10,2) NOT NULL,
69
+ status TEXT NOT NULL,
70
+ created_at TIMESTAMP NOT NULL,
71
+ updated_at TIMESTAMP NOT NULL,
72
+ archived_at TIMESTAMP NOT NULL DEFAULT NOW()
73
+ );
74
+
75
+ -- Create partition for time-based archival
76
+ CREATE TABLE orders_2024_q1 PARTITION OF orders
77
+ FOR VALUES FROM ('2024-01-01') TO ('2024-04-01');
78
+
79
+ CREATE TABLE orders_2024_q2 PARTITION OF orders
80
+ FOR VALUES FROM ('2024-04-01') TO ('2024-07-01');
81
+ ```
82
+
83
+ ## Archival Job Implementation
84
+
85
+ ```typescript
86
+ // jobs/archive-orders.ts
87
+ import { PrismaClient } from "@prisma/client";
88
+
89
+ const prisma = new PrismaClient();
90
+ const archivePrisma = new PrismaClient({
91
+ datasources: {
92
+ db: {
93
+ url: process.env.ARCHIVE_DATABASE_URL,
94
+ },
95
+ },
96
+ });
97
+
98
+ interface ArchivalJob {
99
+ table: string;
100
+ retentionDays: number;
101
+ batchSize: number;
102
+ }
103
+
104
+ async function archiveOrders() {
105
+ const cutoffDate = new Date();
106
+ cutoffDate.setDate(cutoffDate.getDate() - 730); // 2 years
107
+
108
+ console.log(`📦 Archiving orders older than ${cutoffDate.toISOString()}`);
109
+
110
+ let archived = 0;
111
+ let hasMore = true;
112
+
113
+ while (hasMore) {
114
+ await prisma.$transaction(async (tx) => {
115
+ // Find orders to archive
116
+ const ordersToArchive = await tx.order.findMany({
117
+ where: {
118
+ created_at: { lt: cutoffDate },
119
+ status: { in: ["delivered", "cancelled"] },
120
+ },
121
+ take: 1000,
122
+ });
123
+
124
+ if (ordersToArchive.length === 0) {
125
+ hasMore = false;
126
+ return;
127
+ }
128
+
129
+ // Copy to archive database
130
+ await archivePrisma.order.createMany({
131
+ data: ordersToArchive.map((order) => ({
132
+ ...order,
133
+ archived_at: new Date(),
134
+ })),
135
+ skipDuplicates: true,
136
+ });
137
+
138
+ // Delete from hot database
139
+ await tx.order.deleteMany({
140
+ where: {
141
+ id: { in: ordersToArchive.map((o) => o.id) },
142
+ },
143
+ });
144
+
145
+ archived += ordersToArchive.length;
146
+ console.log(` Archived ${archived} orders...`);
147
+ });
148
+
149
+ // Rate limiting
150
+ await new Promise((resolve) => setTimeout(resolve, 100));
151
+ }
152
+
153
+ console.log(`✅ Archived ${archived} orders total`);
154
+ }
155
+
156
+ // Schedule: Run nightly
157
+ archiveOrders();
158
+ ```
159
+
160
+ ## Automated Cleanup Jobs
161
+
162
+ ```typescript
163
+ // jobs/cleanup-old-data.ts
164
+ interface CleanupJob {
165
+ table: string;
166
+ column: string;
167
+ retentionDays: number;
168
+ }
169
+
170
+ const CLEANUP_JOBS: CleanupJob[] = [
171
+ {
172
+ table: "sessions",
173
+ column: "created_at",
174
+ retentionDays: 30,
175
+ },
176
+ {
177
+ table: "password_reset_tokens",
178
+ column: "created_at",
179
+ retentionDays: 1,
180
+ },
181
+ {
182
+ table: "failed_login_attempts",
183
+ column: "attempted_at",
184
+ retentionDays: 90,
185
+ },
186
+ {
187
+ table: "analytics_events",
188
+ column: "created_at",
189
+ retentionDays: 90,
190
+ },
191
+ ];
192
+
193
+ async function runCleanupJobs() {
194
+ console.log("🗑️ Running cleanup jobs...\n");
195
+
196
+ for (const job of CLEANUP_JOBS) {
197
+ const cutoffDate = new Date();
198
+ cutoffDate.setDate(cutoffDate.getDate() - job.retentionDays);
199
+
200
+ const result = await prisma.$executeRawUnsafe(
201
+ `
202
+ DELETE FROM "${job.table}"
203
+ WHERE "${job.column}" < $1
204
+ `,
205
+ cutoffDate
206
+ );
207
+
208
+ console.log(
209
+ `✅ ${job.table}: Deleted ${result} rows older than ${job.retentionDays} days`
210
+ );
211
+ }
212
+
213
+ console.log("\n✅ Cleanup complete!");
214
+ }
215
+ ```
216
+
217
+ ## Soft Delete Pattern
218
+
219
+ ```typescript
220
+ // Soft delete for GDPR compliance
221
+ model User {
222
+ id Int @id @default(autoincrement())
223
+ email String @unique
224
+ name String
225
+ deletedAt DateTime? // NULL = active, NOT NULL = deleted
226
+ createdAt DateTime @default(now())
227
+ updatedAt DateTime @updatedAt
228
+
229
+ @@index([deletedAt])
230
+ }
231
+
232
+ // Middleware to filter soft-deleted records
233
+ prisma.$use(async (params, next) => {
234
+ if (params.action === 'findMany' || params.action === 'findFirst') {
235
+ params.args.where = {
236
+ ...params.args.where,
237
+ deletedAt: null, // Only show non-deleted
238
+ };
239
+ }
240
+ return next(params);
241
+ });
242
+
243
+ // Hard delete after retention period
244
+ async function purgeDeletedUsers() {
245
+ const cutoffDate = new Date();
246
+ cutoffDate.setDate(cutoffDate.getDate() - 90); // 90 days retention
247
+
248
+ const result = await prisma.user.deleteMany({
249
+ where: {
250
+ deletedAt: { lt: cutoffDate },
251
+ },
252
+ });
253
+
254
+ console.log(`🗑️ Purged ${result.count} deleted users`);
255
+ }
256
+ ```
257
+
258
+ ## Cold Storage Migration
259
+
260
+ ```bash
261
+ #!/bin/bash
262
+ # scripts/migrate-to-s3.sh
263
+
264
+ # Dump old orders to S3 for cold storage
265
+ CUTOFF_DATE="2022-01-01"
266
+
267
+ echo "📦 Migrating orders to S3..."
268
+
269
+ # 1. Export to CSV
270
+ psql $DATABASE_URL -c "\COPY (
271
+ SELECT * FROM orders WHERE created_at < '$CUTOFF_DATE'
272
+ ) TO STDOUT WITH CSV HEADER" | gzip > orders_archive.csv.gz
273
+
274
+ # 2. Upload to S3
275
+ aws s3 cp orders_archive.csv.gz s3://my-cold-storage/orders/
276
+
277
+ # 3. Verify upload
278
+ if aws s3 ls s3://my-cold-storage/orders/orders_archive.csv.gz; then
279
+ echo "✅ Uploaded to S3"
280
+
281
+ # 4. Delete from database
282
+ psql $DATABASE_URL -c "DELETE FROM orders WHERE created_at < '$CUTOFF_DATE'"
283
+
284
+ echo "✅ Deleted from database"
285
+ else
286
+ echo "❌ S3 upload failed, skipping deletion"
287
+ exit 1
288
+ fi
289
+ ```
290
+
291
+ ## Compliance Automation
292
+
293
+ ```typescript
294
+ // Right to be forgotten (GDPR)
295
+ async function deleteUserData(userId: number) {
296
+ console.log(`🗑️ Deleting user data for user ${userId}...`);
297
+
298
+ await prisma.$transaction(async (tx) => {
299
+ // 1. Anonymize orders (keep for business records)
300
+ await tx.order.updateMany({
301
+ where: { userId },
302
+ data: {
303
+ userId: null,
304
+ shippingAddress: "[DELETED]",
305
+ billingAddress: "[DELETED]",
306
+ },
307
+ });
308
+
309
+ // 2. Delete personal data
310
+ await tx.userProfile.delete({ where: { userId } });
311
+ await tx.paymentMethod.deleteMany({ where: { userId } });
312
+ await tx.address.deleteMany({ where: { userId } });
313
+
314
+ // 3. Soft delete user account
315
+ await tx.user.update({
316
+ where: { id: userId },
317
+ data: {
318
+ email: `deleted-${userId}@example.com`,
319
+ name: "[DELETED]",
320
+ deletedAt: new Date(),
321
+ },
322
+ });
323
+ });
324
+
325
+ console.log(`✅ User data deleted`);
326
+ }
327
+ ```
328
+
329
+ ## Monitoring & Alerting
330
+
331
+ ```typescript
332
+ // Monitor archive job health
333
+ async function checkArchivalHealth() {
334
+ // Check oldest active order
335
+ const oldestOrder = await prisma.order.findFirst({
336
+ orderBy: { created_at: "asc" },
337
+ });
338
+
339
+ const age = Date.now() - oldestOrder.created_at.getTime();
340
+ const ageDays = age / (1000 * 60 * 60 * 24);
341
+
342
+ if (ageDays > 750) {
343
+ // > 2 years + buffer
344
+ console.error("⚠️ Orders older than retention period found!");
345
+ await sendAlert({
346
+ title: "Archive job failing",
347
+ message: `Oldest order is ${ageDays.toFixed(0)} days old`,
348
+ });
349
+ }
350
+
351
+ // Check archive database size
352
+ const archiveCount = await archivePrisma.order.count();
353
+ console.log(`📊 Archive database: ${archiveCount} orders`);
354
+
355
+ // Check hot database size
356
+ const hotCount = await prisma.order.count();
357
+ console.log(`📊 Hot database: ${hotCount} orders`);
358
+ }
359
+ ```
360
+
361
+ ## Restore from Archive
362
+
363
+ ```typescript
364
+ // Restore archived order (e.g., for audit)
365
+ async function restoreArchivedOrder(orderId: number) {
366
+ // Find in archive
367
+ const archivedOrder = await archivePrisma.order.findUnique({
368
+ where: { id: orderId },
369
+ });
370
+
371
+ if (!archivedOrder) {
372
+ throw new Error("Order not found in archive");
373
+ }
374
+
375
+ // Copy to hot database
376
+ await prisma.order.create({
377
+ data: {
378
+ ...archivedOrder,
379
+ archived_at: undefined,
380
+ },
381
+ });
382
+
383
+ console.log(`✅ Restored order ${orderId} from archive`);
384
+ }
385
+ ```
386
+
387
+ ## Schedule Configuration
388
+
389
+ ```yaml
390
+ # cron schedule for archival jobs
391
+ jobs:
392
+ archive-orders:
393
+ schedule: "0 2 * * *" # 2 AM daily
394
+ command: "npm run job:archive-orders"
395
+
396
+ cleanup-sessions:
397
+ schedule: "0 3 * * *" # 3 AM daily
398
+ command: "npm run job:cleanup-sessions"
399
+
400
+ purge-deleted-users:
401
+ schedule: "0 4 * * 0" # 4 AM Sunday
402
+ command: "npm run job:purge-deleted"
403
+
404
+ health-check:
405
+ schedule: "0 */6 * * *" # Every 6 hours
406
+ command: "npm run job:check-archival-health"
407
+ ```
408
+
409
+ ## Best Practices
410
+
411
+ 1. **Define clear policies**: Document retention periods
412
+ 2. **Automate everything**: Manual cleanup is unreliable
413
+ 3. **Test restore**: Regularly test archive restoration
414
+ 4. **Monitor job health**: Alert on failures
415
+ 5. **Compliance first**: Meet legal requirements
416
+ 6. **Soft delete**: Before hard delete
417
+ 7. **Batch operations**: Avoid locking tables
418
+
419
+ ## Output Checklist
420
+
421
+ - [ ] Retention policy documented
422
+ - [ ] Archive schema designed
423
+ - [ ] Archival jobs implemented
424
+ - [ ] Cleanup jobs automated
425
+ - [ ] Soft delete pattern (if applicable)
426
+ - [ ] Cold storage migration
427
+ - [ ] GDPR compliance (right to be forgotten)
428
+ - [ ] Job scheduling configured
429
+ - [ ] Monitoring and alerting
430
+ - [ ] Restore procedure tested