omgkit 2.24.0 → 2.24.2

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.
@@ -0,0 +1,369 @@
1
+ ---
2
+ name: Test Task Generation
3
+ description: The agent automatically generates comprehensive test tasks from feature requirements, ensuring every implementation task has corresponding test coverage with proper acceptance criteria.
4
+ category: methodology
5
+ related_skills:
6
+ - methodology/test-enforcement
7
+ - methodology/test-driven-development
8
+ - methodology/verification-before-completion
9
+ - testing/comprehensive-testing
10
+ related_commands:
11
+ - /dev:feature-tested
12
+ - /quality:test-plan
13
+ - /dev:test
14
+ ---
15
+
16
+ # Test Task Generation
17
+
18
+ ## Overview
19
+
20
+ This skill enables automatic generation of test tasks whenever implementation tasks are created. It ensures comprehensive test coverage by mapping feature types to required test categories and generating acceptance criteria for each test.
21
+
22
+ ## Core Principle
23
+
24
+ **Every implementation task must have a corresponding test task.**
25
+
26
+ ```
27
+ Implementation Task → Test Task(s)
28
+ ├── Unit Test Task
29
+ ├── Integration Test Task (if applicable)
30
+ ├── E2E Test Task (if applicable)
31
+ └── Specialized Test Tasks (security, performance, etc.)
32
+ ```
33
+
34
+ ## Test Task Generation Rules
35
+
36
+ ### 1. Feature Type to Test Type Mapping
37
+
38
+ | Feature Type | Required Tests | Optional Tests |
39
+ |-------------|----------------|----------------|
40
+ | API Endpoint | Unit, Integration, Contract | Performance, Security |
41
+ | UI Component | Unit, Snapshot, A11y | E2E, Visual Regression |
42
+ | Business Logic | Unit, Property-based | Mutation |
43
+ | Database Operation | Integration, Migration | Performance |
44
+ | Authentication | Unit, Integration, Security | Penetration |
45
+ | File Processing | Unit, Integration | Performance, Fuzzing |
46
+ | External Integration | Unit, Contract, Integration | Chaos |
47
+ | Real-time Feature | Unit, Integration, E2E | Load, Stress |
48
+
49
+ ### 2. Test Task Template
50
+
51
+ ```markdown
52
+ ## Test Task: [TEST-{ID}] {Test Type} for {Feature}
53
+
54
+ **Parent Task:** TASK-{PARENT_ID}
55
+ **Type:** {Unit|Integration|E2E|Security|Performance|Contract|Property}
56
+ **Priority:** {P0|P1|P2}
57
+
58
+ ### Acceptance Criteria
59
+ - [ ] All happy path scenarios covered
60
+ - [ ] Edge cases tested: {list}
61
+ - [ ] Error scenarios tested: {list}
62
+ - [ ] Coverage target met: {percentage}%
63
+
64
+ ### Test Cases
65
+ 1. **{test_name}**: {description}
66
+ - Given: {precondition}
67
+ - When: {action}
68
+ - Then: {expected_result}
69
+
70
+ ### Files to Create/Modify
71
+ - `{test_file_path}`
72
+
73
+ ### Dependencies
74
+ - Requires: TASK-{PARENT_ID} implementation complete
75
+ - Blocked by: {dependencies}
76
+ ```
77
+
78
+ ### 3. Auto-Generation Algorithm
79
+
80
+ ```
81
+ FUNCTION generate_test_tasks(implementation_task):
82
+ feature_type = classify_feature(implementation_task)
83
+ required_tests = TEST_TYPE_MAP[feature_type].required
84
+ optional_tests = TEST_TYPE_MAP[feature_type].optional
85
+
86
+ test_tasks = []
87
+
88
+ FOR test_type IN required_tests:
89
+ test_task = create_test_task(
90
+ parent: implementation_task,
91
+ type: test_type,
92
+ priority: P1,
93
+ acceptance_criteria: generate_criteria(test_type, implementation_task)
94
+ )
95
+ test_tasks.append(test_task)
96
+
97
+ FOR test_type IN optional_tests:
98
+ IF should_include_optional(implementation_task, test_type):
99
+ test_task = create_test_task(
100
+ parent: implementation_task,
101
+ type: test_type,
102
+ priority: P2,
103
+ acceptance_criteria: generate_criteria(test_type, implementation_task)
104
+ )
105
+ test_tasks.append(test_task)
106
+
107
+ RETURN test_tasks
108
+ ```
109
+
110
+ ## Feature Classification
111
+
112
+ ### API Endpoint Detection
113
+ ```
114
+ Indicators:
115
+ - Route/endpoint definition
116
+ - HTTP method handling
117
+ - Request/response processing
118
+ - Controller/handler creation
119
+
120
+ Required Tests:
121
+ - Unit: Handler logic
122
+ - Integration: Full request cycle
123
+ - Contract: API schema validation
124
+ ```
125
+
126
+ ### UI Component Detection
127
+ ```
128
+ Indicators:
129
+ - React/Vue/Angular component
130
+ - JSX/TSX files
131
+ - Props interface
132
+ - Event handlers
133
+
134
+ Required Tests:
135
+ - Unit: Component logic
136
+ - Snapshot: Render output
137
+ - Accessibility: ARIA, keyboard nav
138
+ ```
139
+
140
+ ### Business Logic Detection
141
+ ```
142
+ Indicators:
143
+ - Pure functions
144
+ - Domain models
145
+ - Calculations
146
+ - State transformations
147
+
148
+ Required Tests:
149
+ - Unit: All branches
150
+ - Property-based: Invariants
151
+ ```
152
+
153
+ ### Database Operation Detection
154
+ ```
155
+ Indicators:
156
+ - ORM/Query builder usage
157
+ - Schema changes
158
+ - Migration files
159
+ - Repository patterns
160
+
161
+ Required Tests:
162
+ - Integration: Database operations
163
+ - Migration: Up/down paths
164
+ ```
165
+
166
+ ## Coverage Requirements by Test Type
167
+
168
+ | Test Type | Minimum Coverage | Target Coverage |
169
+ |-----------|-----------------|-----------------|
170
+ | Unit | 80% | 95% |
171
+ | Integration | 60% | 80% |
172
+ | E2E | Critical paths | Happy paths |
173
+ | Contract | All endpoints | All schemas |
174
+ | Property | Core invariants | All pure functions |
175
+
176
+ ## Test Naming Conventions
177
+
178
+ ```
179
+ Unit Tests:
180
+ {module}.test.ts
181
+ {module}.spec.ts
182
+
183
+ Integration Tests:
184
+ {module}.integration.test.ts
185
+ {feature}.int.spec.ts
186
+
187
+ E2E Tests:
188
+ {feature}.e2e.test.ts
189
+ {flow}.e2e.spec.ts
190
+
191
+ Contract Tests:
192
+ {api}.contract.test.ts
193
+
194
+ Property Tests:
195
+ {module}.property.test.ts
196
+ ```
197
+
198
+ ## Acceptance Criteria Generation
199
+
200
+ ### For Unit Tests
201
+ ```markdown
202
+ - [ ] All public methods tested
203
+ - [ ] All branches covered (if/else, switch)
204
+ - [ ] Edge cases: null, undefined, empty, boundary values
205
+ - [ ] Error cases: invalid input, exceptions
206
+ - [ ] Mocks properly isolated
207
+ - [ ] No external dependencies
208
+ ```
209
+
210
+ ### For Integration Tests
211
+ ```markdown
212
+ - [ ] Full flow from entry to exit
213
+ - [ ] Database interactions verified
214
+ - [ ] External service mocks configured
215
+ - [ ] Transaction handling tested
216
+ - [ ] Cleanup after tests
217
+ ```
218
+
219
+ ### For E2E Tests
220
+ ```markdown
221
+ - [ ] User journey complete
222
+ - [ ] All UI interactions work
223
+ - [ ] Data persists correctly
224
+ - [ ] Error states handled
225
+ - [ ] Performance acceptable
226
+ ```
227
+
228
+ ### For Security Tests
229
+ ```markdown
230
+ - [ ] Authentication required
231
+ - [ ] Authorization enforced
232
+ - [ ] Input validation works
233
+ - [ ] No injection vulnerabilities
234
+ - [ ] Sensitive data protected
235
+ ```
236
+
237
+ ## Integration with Development Workflow
238
+
239
+ ### 1. Feature Creation
240
+ ```
241
+ /dev:feature-tested "Add user profile API"
242
+
243
+ Generated Tasks:
244
+ ├── TASK-001: Implement user profile endpoint (P1)
245
+ ├── TEST-001: Unit tests for profile handler (P1)
246
+ ├── TEST-002: Integration tests for profile API (P1)
247
+ ├── TEST-003: Contract tests for profile schema (P1)
248
+ └── TEST-004: Security tests for profile access (P2)
249
+ ```
250
+
251
+ ### 2. Task Tracking
252
+ ```
253
+ Todo List:
254
+ ✅ TASK-001: Implement user profile endpoint
255
+ ⏳ TEST-001: Unit tests for profile handler
256
+ ⏳ TEST-002: Integration tests for profile API
257
+ ⏳ TEST-003: Contract tests for profile schema
258
+ ⏳ TEST-004: Security tests for profile access
259
+
260
+ Status: Implementation complete, tests pending
261
+ Blocking: Cannot mark feature as "done" until all tests pass
262
+ ```
263
+
264
+ ### 3. Completion Verification
265
+ ```
266
+ /quality:verify-done
267
+
268
+ Checking feature completion...
269
+ ├── Implementation: ✅ Complete
270
+ ├── Unit Tests: ✅ 95% coverage
271
+ ├── Integration Tests: ✅ 78% coverage
272
+ ├── Contract Tests: ✅ All schemas valid
273
+ ├── Security Tests: ✅ No vulnerabilities
274
+ └── Status: ✅ DONE - All criteria met
275
+ ```
276
+
277
+ ## Examples
278
+
279
+ ### Example 1: REST API Endpoint
280
+
281
+ **Implementation Task:**
282
+ ```markdown
283
+ TASK-042: Create POST /api/users endpoint
284
+ - Validate request body
285
+ - Create user in database
286
+ - Return created user
287
+ ```
288
+
289
+ **Generated Test Tasks:**
290
+ ```markdown
291
+ TEST-042-A: Unit tests for user creation handler
292
+ - Test input validation
293
+ - Test user model creation
294
+ - Test error handling
295
+ - Coverage target: 90%
296
+
297
+ TEST-042-B: Integration tests for POST /api/users
298
+ - Test full request/response cycle
299
+ - Test database persistence
300
+ - Test duplicate handling
301
+ - Test transaction rollback
302
+
303
+ TEST-042-C: Contract tests for user API
304
+ - Validate request schema
305
+ - Validate response schema
306
+ - Test error response formats
307
+ ```
308
+
309
+ ### Example 2: React Component
310
+
311
+ **Implementation Task:**
312
+ ```markdown
313
+ TASK-087: Create UserCard component
314
+ - Display user avatar and name
315
+ - Show user status badge
316
+ - Handle click to view profile
317
+ ```
318
+
319
+ **Generated Test Tasks:**
320
+ ```markdown
321
+ TEST-087-A: Unit tests for UserCard component
322
+ - Test rendering with props
323
+ - Test click handler
324
+ - Test status badge variants
325
+ - Coverage target: 95%
326
+
327
+ TEST-087-B: Snapshot tests for UserCard
328
+ - Capture default state
329
+ - Capture each status variant
330
+ - Capture loading state
331
+
332
+ TEST-087-C: Accessibility tests for UserCard
333
+ - Test keyboard navigation
334
+ - Test screen reader labels
335
+ - Test focus management
336
+ ```
337
+
338
+ ## Best Practices
339
+
340
+ ### DO
341
+ - Generate test tasks immediately after implementation tasks
342
+ - Include specific acceptance criteria
343
+ - Map test files to implementation files
344
+ - Set realistic coverage targets
345
+ - Include edge cases in criteria
346
+
347
+ ### DON'T
348
+ - Skip test task generation for "simple" features
349
+ - Generate vague acceptance criteria
350
+ - Ignore optional test types for critical features
351
+ - Set coverage targets below minimums
352
+ - Create test tasks without parent reference
353
+
354
+ ## Quality Gates
355
+
356
+ Before a feature can be marked as "done":
357
+
358
+ 1. **All test tasks completed** - Every generated test task must be done
359
+ 2. **Coverage met** - Each test type meets minimum coverage
360
+ 3. **Tests passing** - All tests in CI pipeline pass
361
+ 4. **No regressions** - Existing tests still pass
362
+ 5. **Evidence provided** - Test reports attached
363
+
364
+ ## Related Documentation
365
+
366
+ - [Test Enforcement](../test-enforcement/SKILL.md)
367
+ - [TDD Methodology](../test-driven-development/SKILL.md)
368
+ - [Comprehensive Testing](../../testing/comprehensive-testing/SKILL.md)
369
+ - [Verification Before Completion](../verification-before-completion/SKILL.md)