@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,379 @@
1
+ ---
2
+ name: prisma-migration-assistant
3
+ description: Plans and executes safe Prisma schema migrations with data backfills, rollback strategies, and SQL preview. Handles complex schema changes including data transformations. Use for "Prisma migrations", "schema changes", "database migrations", or "data backfills".
4
+ ---
5
+
6
+ # Prisma Migration Assistant
7
+
8
+ Plan and execute safe Prisma migrations with confidence.
9
+
10
+ ## Migration Planning Workflow
11
+
12
+ ```typescript
13
+ // 1. Update schema.prisma
14
+ model User {
15
+ id Int @id @default(autoincrement())
16
+ email String @unique
17
+ // NEW: Split name into firstName and lastName
18
+ firstName String?
19
+ lastName String?
20
+ // OLD: name String // Will remove this
21
+ createdAt DateTime @default(now())
22
+ }
23
+
24
+ // 2. Create migration
25
+ // npx prisma migrate dev --name split_user_name --create-only
26
+
27
+ // 3. Review generated SQL
28
+ // 4. Add data migration
29
+ // 5. Test migration
30
+ // 6. Apply to production
31
+ ```
32
+
33
+ ## Migration Types
34
+
35
+ ### 1. Additive Migration (Safe)
36
+
37
+ ```prisma
38
+ // Adding new optional field - safe!
39
+ model Product {
40
+ id Int @id @default(autoincrement())
41
+ name String
42
+ description String?
43
+ price Float
44
+ newField String? // NEW - optional, no backfill needed
45
+ }
46
+ ```
47
+
48
+ ```bash
49
+ # Generate migration
50
+ npx prisma migrate dev --name add_product_new_field
51
+
52
+ # SQL generated:
53
+ # ALTER TABLE "Product" ADD COLUMN "newField" TEXT;
54
+ ```
55
+
56
+ ### 2. Column Rename (Needs Data Copy)
57
+
58
+ ```prisma
59
+ model User {
60
+ id Int @id @default(autoincrement())
61
+ emailAddr String @unique // Renamed from 'email'
62
+ }
63
+ ```
64
+
65
+ ```sql
66
+ -- migrations/20240115_rename_email/migration.sql
67
+
68
+ -- Step 1: Add new column
69
+ ALTER TABLE "User" ADD COLUMN "emailAddr" TEXT;
70
+
71
+ -- Step 2: Copy data
72
+ UPDATE "User" SET "emailAddr" = "email";
73
+
74
+ -- Step 3: Make new column required
75
+ ALTER TABLE "User" ALTER COLUMN "emailAddr" SET NOT NULL;
76
+
77
+ -- Step 4: Add unique constraint
78
+ CREATE UNIQUE INDEX "User_emailAddr_key" ON "User"("emailAddr");
79
+
80
+ -- Step 5: Drop old column
81
+ ALTER TABLE "User" DROP COLUMN "email";
82
+ ```
83
+
84
+ ### 3. Data Transformation (Complex)
85
+
86
+ ```prisma
87
+ // Before: Single name field
88
+ // After: First and last name
89
+ model User {
90
+ id Int @id @default(autoincrement())
91
+ firstName String
92
+ lastName String
93
+ // name String // Removed
94
+ }
95
+ ```
96
+
97
+ ```sql
98
+ -- migrations/20240115_split_name/migration.sql
99
+
100
+ -- Step 1: Add new columns
101
+ ALTER TABLE "User" ADD COLUMN "firstName" TEXT;
102
+ ALTER TABLE "User" ADD COLUMN "lastName" TEXT;
103
+
104
+ -- Step 2: Data migration (split name)
105
+ -- PostgreSQL
106
+ UPDATE "User"
107
+ SET
108
+ "firstName" = SPLIT_PART("name", ' ', 1),
109
+ "lastName" = CASE
110
+ WHEN array_length(string_to_array("name", ' '), 1) > 1
111
+ THEN array_to_string((string_to_array("name", ' '))[2:], ' ')
112
+ ELSE ''
113
+ END
114
+ WHERE "name" IS NOT NULL;
115
+
116
+ -- Step 3: Handle NULL values
117
+ UPDATE "User"
118
+ SET
119
+ "firstName" = COALESCE("firstName", ''),
120
+ "lastName" = COALESCE("lastName", '');
121
+
122
+ -- Step 4: Make columns required
123
+ ALTER TABLE "User" ALTER COLUMN "firstName" SET NOT NULL;
124
+ ALTER TABLE "User" ALTER COLUMN "lastName" SET NOT NULL;
125
+
126
+ -- Step 5: Drop old column
127
+ ALTER TABLE "User" DROP COLUMN "name";
128
+ ```
129
+
130
+ ### 4. Type Change (Risky)
131
+
132
+ ```prisma
133
+ model Product {
134
+ id Int @id @default(autoincrement())
135
+ price Decimal @db.Decimal(10, 2) // Changed from Float
136
+ }
137
+ ```
138
+
139
+ ```sql
140
+ -- migrations/20240115_price_to_decimal/migration.sql
141
+
142
+ -- Step 1: Add new column with correct type
143
+ ALTER TABLE "Product" ADD COLUMN "price_new" DECIMAL(10,2);
144
+
145
+ -- Step 2: Copy and convert data
146
+ UPDATE "Product"
147
+ SET "price_new" = CAST("price" AS DECIMAL(10,2));
148
+
149
+ -- Step 3: Drop old column
150
+ ALTER TABLE "Product" DROP COLUMN "price";
151
+
152
+ -- Step 4: Rename new column
153
+ ALTER TABLE "Product" RENAME COLUMN "price_new" TO "price";
154
+
155
+ -- Step 5: Make NOT NULL if required
156
+ ALTER TABLE "Product" ALTER COLUMN "price" SET NOT NULL;
157
+ ```
158
+
159
+ ## Migration Sequencing
160
+
161
+ ```markdown
162
+ # Migration Sequence: Add User Roles
163
+
164
+ ## Phase 1: Additive (Week 1)
165
+
166
+ 1. Add optional `role` field
167
+ 2. Deploy application code that handles NULL roles
168
+ 3. Backfill existing users with default role
169
+
170
+ ## Phase 2: Enforcement (Week 2)
171
+
172
+ 1. Make `role` field required
173
+ 2. Deploy code that requires role on creation
174
+ 3. Add database constraint
175
+
176
+ ## Phase 3: Cleanup (Week 3)
177
+
178
+ 1. Remove old permission checking code
179
+ 2. Verify all users have roles
180
+ ```
181
+
182
+ ## Backfill Strategies
183
+
184
+ ### Small Table (< 10k rows)
185
+
186
+ ```typescript
187
+ // scripts/backfill-user-roles.ts
188
+ import { PrismaClient } from "@prisma/client";
189
+
190
+ const prisma = new PrismaClient();
191
+
192
+ async function backfillUserRoles() {
193
+ const usersWithoutRoles = await prisma.user.findMany({
194
+ where: { role: null },
195
+ });
196
+
197
+ console.log(`Backfilling ${usersWithoutRoles.length} users...`);
198
+
199
+ // Single transaction for small dataset
200
+ await prisma.$transaction(
201
+ usersWithoutRoles.map((user) =>
202
+ prisma.user.update({
203
+ where: { id: user.id },
204
+ data: { role: "USER" }, // Default role
205
+ })
206
+ )
207
+ );
208
+
209
+ console.log("✅ Backfill complete");
210
+ }
211
+
212
+ backfillUserRoles();
213
+ ```
214
+
215
+ ### Large Table (> 10k rows)
216
+
217
+ ```typescript
218
+ // scripts/backfill-large-table.ts
219
+ async function backfillBatched() {
220
+ const batchSize = 1000;
221
+ let processed = 0;
222
+ let hasMore = true;
223
+
224
+ while (hasMore) {
225
+ const batch = await prisma.user.findMany({
226
+ where: { role: null },
227
+ take: batchSize,
228
+ select: { id: true },
229
+ });
230
+
231
+ if (batch.length === 0) {
232
+ hasMore = false;
233
+ break;
234
+ }
235
+
236
+ // Process batch
237
+ await prisma.$transaction(
238
+ batch.map((user) =>
239
+ prisma.user.update({
240
+ where: { id: user.id },
241
+ data: { role: "USER" },
242
+ })
243
+ )
244
+ );
245
+
246
+ processed += batch.length;
247
+ console.log(`Processed ${processed} users...`);
248
+
249
+ // Rate limiting
250
+ await new Promise((resolve) => setTimeout(resolve, 100));
251
+ }
252
+
253
+ console.log(`✅ Backfilled ${processed} users`);
254
+ }
255
+ ```
256
+
257
+ ## Rollback Guidance
258
+
259
+ ```sql
260
+ -- migrations/20240115_add_role/rollback.sql
261
+
262
+ -- Rollback Step 1: Add back old structure (if needed)
263
+ ALTER TABLE "User" DROP COLUMN "role";
264
+
265
+ -- Rollback Step 2: Restore old logic
266
+ -- (Deploy previous application version)
267
+
268
+ -- Note: Data loss consideration
269
+ -- If you backfilled data, document what was lost
270
+ ```
271
+
272
+ ## Migration Testing
273
+
274
+ ```typescript
275
+ // tests/migrations/split-name.test.ts
276
+ import { PrismaClient } from "@prisma/client";
277
+ import { execSync } from "child_process";
278
+
279
+ describe("Split name migration", () => {
280
+ let prisma: PrismaClient;
281
+
282
+ beforeAll(async () => {
283
+ // Setup test database
284
+ execSync("npx prisma migrate deploy", {
285
+ env: { DATABASE_URL: process.env.TEST_DATABASE_URL },
286
+ });
287
+ prisma = new PrismaClient();
288
+ });
289
+
290
+ it("should split name correctly", async () => {
291
+ // Create user with old schema
292
+ await prisma.$executeRaw`
293
+ INSERT INTO "User" (name) VALUES ('John Doe')
294
+ `;
295
+
296
+ // Run migration
297
+ execSync("npx prisma migrate deploy");
298
+
299
+ // Verify split
300
+ const user = await prisma.user.findFirst();
301
+ expect(user?.firstName).toBe("John");
302
+ expect(user?.lastName).toBe("Doe");
303
+ });
304
+
305
+ it("should handle single name", async () => {
306
+ await prisma.$executeRaw`
307
+ INSERT INTO "User" (name) VALUES ('Madonna')
308
+ `;
309
+
310
+ execSync("npx prisma migrate deploy");
311
+
312
+ const user = await prisma.user.findFirst({
313
+ where: { firstName: "Madonna" },
314
+ });
315
+ expect(user?.lastName).toBe("");
316
+ });
317
+ });
318
+ ```
319
+
320
+ ## Pre-Migration Checklist
321
+
322
+ ```markdown
323
+ - [ ] Backup database
324
+ - [ ] Test migration on staging
325
+ - [ ] Verify data transformation logic
326
+ - [ ] Check for referential integrity issues
327
+ - [ ] Estimate migration time
328
+ - [ ] Plan rollback strategy
329
+ - [ ] Schedule maintenance window (if needed)
330
+ - [ ] Notify team of deployment
331
+ ```
332
+
333
+ ## SQL Preview Script
334
+
335
+ ```bash
336
+ #!/bin/bash
337
+ # scripts/preview-migration.sh
338
+
339
+ echo "🔍 Previewing migration..."
340
+
341
+ # Create migration without applying
342
+ npx prisma migrate dev --name "$1" --create-only
343
+
344
+ # Show SQL
345
+ echo ""
346
+ echo "📄 Generated SQL:"
347
+ echo "=================="
348
+ cat prisma/migrations/*_$1/migration.sql
349
+
350
+ # Analyze impact
351
+ echo ""
352
+ echo "📊 Impact Analysis:"
353
+ echo "=================="
354
+ echo "Tables affected: $(cat prisma/migrations/*_$1/migration.sql | grep -c 'ALTER TABLE')"
355
+ echo "Rows to update: [Run COUNT query manually]"
356
+ echo "Estimated time: [Estimate based on table size]"
357
+ ```
358
+
359
+ ## Best Practices
360
+
361
+ 1. **Create migration, don't apply**: Use `--create-only` flag
362
+ 2. **Review SQL carefully**: Check generated migration
363
+ 3. **Test on staging**: Always test before production
364
+ 4. **Batch large updates**: Avoid locking tables
365
+ 5. **Add before removing**: Additive migrations first
366
+ 6. **Version application code**: Deploy code that handles both schemas
367
+ 7. **Monitor performance**: Watch query times during migration
368
+ 8. **Have rollback plan**: Document reversal steps
369
+
370
+ ## Output Checklist
371
+
372
+ - [ ] Migration SQL generated and reviewed
373
+ - [ ] Data backfill strategy planned
374
+ - [ ] Rollback procedure documented
375
+ - [ ] Migration sequencing defined
376
+ - [ ] Testing plan created
377
+ - [ ] Impact analysis completed
378
+ - [ ] Staging deployment successful
379
+ - [ ] Production deployment scheduled