@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,375 @@
1
+ ---
2
+ name: snapshot-test-refactorer
3
+ description: Refactors brittle snapshot tests into resilient, focused assertions. Provides strategies for reducing snapshot size, extracting meaningful assertions, and maintaining snapshots. Use for "snapshot testing", "snapshot refactoring", "brittle tests", or "assertion improvement".
4
+ ---
5
+
6
+ # Snapshot Test Refactorer
7
+
8
+ Replace brittle snapshots with meaningful, maintainable assertions.
9
+
10
+ ## Problems with Snapshot Tests
11
+
12
+ ```typescript
13
+ // ❌ Bad: Full component snapshot
14
+ test("renders UserProfile", () => {
15
+ const { container } = render(<UserProfile user={mockUser} />);
16
+ expect(container).toMatchSnapshot();
17
+ });
18
+
19
+ // Problems:
20
+ // 1. Fails on any change (even whitespace)
21
+ // 2. No clear intent
22
+ // 3. Hard to review diffs
23
+ // 4. Doesn't test behavior
24
+ // 5. Implementation coupled
25
+ ```
26
+
27
+ ## Refactoring Strategy
28
+
29
+ ```typescript
30
+ // ✅ Good: Specific assertions
31
+ test("renders UserProfile with user data", () => {
32
+ render(<UserProfile user={mockUser} />);
33
+
34
+ // Test what matters
35
+ expect(screen.getByText(mockUser.name)).toBeInTheDocument();
36
+ expect(screen.getByText(mockUser.email)).toBeInTheDocument();
37
+ expect(screen.getByRole("img")).toHaveAttribute("src", mockUser.avatar);
38
+ });
39
+
40
+ test("shows edit button for own profile", () => {
41
+ render(<UserProfile user={mockUser} isOwnProfile={true} />);
42
+
43
+ expect(
44
+ screen.getByRole("button", { name: "Edit Profile" })
45
+ ).toBeInTheDocument();
46
+ });
47
+
48
+ test("hides edit button for other profiles", () => {
49
+ render(<UserProfile user={mockUser} isOwnProfile={false} />);
50
+
51
+ expect(
52
+ screen.queryByRole("button", { name: "Edit Profile" })
53
+ ).not.toBeInTheDocument();
54
+ });
55
+ ```
56
+
57
+ ## Inline Snapshots for Data
58
+
59
+ ```typescript
60
+ // ❌ Bad: External snapshot file
61
+ test("formats user data", () => {
62
+ const result = formatUser(mockUser);
63
+ expect(result).toMatchSnapshot();
64
+ });
65
+
66
+ // ✅ Good: Inline snapshot (visible in code)
67
+ test("formats user data", () => {
68
+ const result = formatUser(mockUser);
69
+ expect(result).toMatchInlineSnapshot(`
70
+ {
71
+ "displayName": "John Doe",
72
+ "initials": "JD",
73
+ "memberSince": "2020-01-01",
74
+ }
75
+ `);
76
+ });
77
+ ```
78
+
79
+ ## Partial Snapshots
80
+
81
+ ```typescript
82
+ // ❌ Bad: Snapshot entire API response
83
+ test("fetches user", async () => {
84
+ const response = await api.getUser("123");
85
+ expect(response).toMatchSnapshot();
86
+ });
87
+
88
+ // ✅ Good: Test important parts
89
+ test("fetches user with required fields", async () => {
90
+ const response = await api.getUser("123");
91
+
92
+ expect(response).toMatchObject({
93
+ id: "123",
94
+ email: expect.stringContaining("@"),
95
+ role: expect.any(String),
96
+ });
97
+
98
+ // Snapshot only stable, important data
99
+ expect({
100
+ name: response.name,
101
+ role: response.role,
102
+ }).toMatchInlineSnapshot(`
103
+ {
104
+ "name": "John Doe",
105
+ "role": "USER",
106
+ }
107
+ `);
108
+ });
109
+ ```
110
+
111
+ ## Serializer for Unstable Data
112
+
113
+ ```typescript
114
+ // Remove unstable fields before snapshot
115
+ expect.addSnapshotSerializer({
116
+ test: (val) => val && typeof val === "object" && "createdAt" in val,
117
+ serialize: (val) => {
118
+ const { createdAt, updatedAt, ...rest } = val;
119
+ return JSON.stringify(rest, null, 2);
120
+ },
121
+ });
122
+
123
+ // Now timestamps won't break tests
124
+ test("creates user", async () => {
125
+ const user = await createUser({ name: "Test" });
126
+
127
+ expect(user).toMatchInlineSnapshot(`
128
+ {
129
+ "id": "123",
130
+ "name": "Test",
131
+ "role": "USER"
132
+ }
133
+ `);
134
+ // createdAt automatically removed
135
+ });
136
+ ```
137
+
138
+ ## Snapshot Trimming Strategy
139
+
140
+ ```typescript
141
+ // Before: 500 line snapshot
142
+ expect(component).toMatchSnapshot();
143
+
144
+ // After: Focus on critical parts
145
+ const criticalElements = {
146
+ header: screen.getByRole("banner").textContent,
147
+ mainAction: screen.getByRole("button", { name: /submit/i }).textContent,
148
+ errorMessage: screen.queryByRole("alert")?.textContent,
149
+ };
150
+
151
+ expect(criticalElements).toMatchInlineSnapshot(`
152
+ {
153
+ "errorMessage": null,
154
+ "header": "Welcome",
155
+ "mainAction": "Submit",
156
+ }
157
+ `);
158
+ ```
159
+
160
+ ## Visual Regression Alternative
161
+
162
+ ```typescript
163
+ // Instead of DOM snapshot, use visual regression
164
+ test("Profile component appearance", async ({ page }) => {
165
+ await page.goto("/profile");
166
+
167
+ // Visual snapshot (Playwright)
168
+ await expect(page).toHaveScreenshot("profile.png", {
169
+ maxDiffPixels: 100,
170
+ });
171
+ });
172
+ ```
173
+
174
+ ## When Snapshots Are Acceptable
175
+
176
+ ```typescript
177
+ // ✅ OK: Error messages (rarely change)
178
+ test("validates email format", () => {
179
+ const errors = validateEmail("invalid");
180
+ expect(errors).toMatchInlineSnapshot(`
181
+ [
182
+ "Email must contain @",
183
+ "Email must contain domain",
184
+ ]
185
+ `);
186
+ });
187
+
188
+ // ✅ OK: API response structure (stable contract)
189
+ test("user API response structure", async () => {
190
+ const response = await api.getUser("123");
191
+
192
+ expect(Object.keys(response).sort()).toMatchInlineSnapshot(`
193
+ [
194
+ "createdAt",
195
+ "email",
196
+ "id",
197
+ "name",
198
+ "role",
199
+ "updatedAt",
200
+ ]
201
+ `);
202
+ });
203
+
204
+ // ✅ OK: Serialized data format
205
+ test("exports user to JSON", () => {
206
+ const json = exportUserToJSON(user);
207
+ expect(json).toMatchInlineSnapshot(`
208
+ {
209
+ "email": "john@example.com",
210
+ "name": "John Doe",
211
+ "version": "1.0",
212
+ }
213
+ `);
214
+ });
215
+ ```
216
+
217
+ ## Refactoring Process
218
+
219
+ ```markdown
220
+ # Snapshot Refactoring Checklist
221
+
222
+ For each snapshot test, ask:
223
+
224
+ 1. **What is being tested?**
225
+
226
+ - If unclear → Replace with specific assertions
227
+
228
+ 2. **Does it test behavior or implementation?**
229
+
230
+ - Implementation → Refactor to behavior test
231
+
232
+ 3. **How often does this change?**
233
+
234
+ - Frequently → Use targeted assertions
235
+ - Rarely → Snapshot OK
236
+
237
+ 4. **Can I describe what should pass/fail?**
238
+
239
+ - No → Snapshot is too broad
240
+
241
+ 5. **Would a visual test be better?**
242
+ - UI appearance → Use screenshot testing
243
+
244
+ ## Refactoring Steps
245
+
246
+ 1. Run snapshot test, let it fail
247
+ 2. Look at the diff
248
+ 3. Extract what actually matters
249
+ 4. Write assertion for that specific thing
250
+ 5. Delete snapshot
251
+ 6. Repeat for next snapshot
252
+ ```
253
+
254
+ ## Example Refactoring
255
+
256
+ ```typescript
257
+ // ❌ Before: Brittle 200-line snapshot
258
+ test("renders dashboard", () => {
259
+ const { container } = render(<Dashboard user={user} />);
260
+ expect(container).toMatchSnapshot();
261
+ });
262
+
263
+ // ✅ After: Multiple focused tests
264
+ describe("Dashboard", () => {
265
+ test("displays welcome message with user name", () => {
266
+ render(<Dashboard user={user} />);
267
+ expect(screen.getByText(`Welcome back, ${user.name}!`)).toBeInTheDocument();
268
+ });
269
+
270
+ test("shows user stats", () => {
271
+ render(<Dashboard user={user} stats={mockStats} />);
272
+
273
+ expect(screen.getByText(`${mockStats.orders} orders`)).toBeInTheDocument();
274
+ expect(screen.getByText(`$${mockStats.revenue}`)).toBeInTheDocument();
275
+ });
276
+
277
+ test("displays quick actions", () => {
278
+ render(<Dashboard user={user} />);
279
+
280
+ expect(
281
+ screen.getByRole("button", { name: "New Order" })
282
+ ).toBeInTheDocument();
283
+ expect(
284
+ screen.getByRole("button", { name: "View Reports" })
285
+ ).toBeInTheDocument();
286
+ });
287
+
288
+ test("shows empty state when no recent activity", () => {
289
+ render(<Dashboard user={user} recentActivity={[]} />);
290
+
291
+ expect(screen.getByText("No recent activity")).toBeInTheDocument();
292
+ });
293
+ });
294
+ ```
295
+
296
+ ## Automated Conversion Script
297
+
298
+ ```typescript
299
+ // scripts/convert-snapshots.ts
300
+ import * as fs from "fs";
301
+ import * as path from "path";
302
+
303
+ function convertSnapshotToAssertions(testFile: string): string {
304
+ let content = fs.readFileSync(testFile, "utf-8");
305
+
306
+ // Replace toMatchSnapshot() with specific assertions
307
+ content = content.replace(
308
+ /expect\((.+?)\)\.toMatchSnapshot\(\)/g,
309
+ (match, element) => {
310
+ return `// TODO: Replace with specific assertions
311
+ // expect(${element}).to... `;
312
+ }
313
+ );
314
+
315
+ return content;
316
+ }
317
+ ```
318
+
319
+ ## Maintenance Strategy
320
+
321
+ ```markdown
322
+ # Snapshot Maintenance Guidelines
323
+
324
+ ## When to Update Snapshots
325
+
326
+ ✅ **Update when:**
327
+
328
+ - Intentional design change
329
+ - New feature added
330
+ - Bug fix that changes output
331
+ - Refactoring that changes structure
332
+
333
+ ❌ **Don't update when:**
334
+
335
+ - "Jest said to update"
336
+ - Test is failing
337
+ - Don't understand the change
338
+ - Too lazy to investigate
339
+
340
+ ## Review Process
341
+
342
+ 1. Run `jest -u` to update
343
+ 2. Review EVERY changed snapshot
344
+ 3. Verify change is intentional
345
+ 4. If unsure, ask for review
346
+ 5. Consider if assertion would be better
347
+
348
+ ## Reduce Snapshot Size
349
+
350
+ - Use `.toMatchObject()` for partial matches
351
+ - Extract only relevant data
352
+ - Use serializers to remove noise
353
+ - Consider inline snapshots
354
+ ```
355
+
356
+ ## Best Practices
357
+
358
+ 1. **Inline snapshots**: More visible and reviewable
359
+ 2. **Small snapshots**: Snapshot only what matters
360
+ 3. **Stable data**: Remove timestamps, IDs
361
+ 4. **Clear intent**: Test name explains what's captured
362
+ 5. **Visual regression**: For UI appearance
363
+ 6. **Regular review**: Quarterly snapshot audit
364
+ 7. **Specific assertions**: Prefer over snapshots
365
+
366
+ ## Output Checklist
367
+
368
+ - [ ] Brittle snapshots identified
369
+ - [ ] Refactored to specific assertions
370
+ - [ ] Inline snapshots where appropriate
371
+ - [ ] Unstable data removed (serializers)
372
+ - [ ] Partial snapshots for data structures
373
+ - [ ] Visual regression for UI
374
+ - [ ] Maintenance guidelines documented
375
+ - [ ] Review process established