speccrew 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 (153) hide show
  1. package/.speccrew/agents/speccrew-feature-designer.md +142 -0
  2. package/.speccrew/agents/speccrew-product-manager.md +61 -0
  3. package/.speccrew/agents/speccrew-system-designer.md +200 -0
  4. package/.speccrew/agents/speccrew-system-developer.md +238 -0
  5. package/.speccrew/agents/speccrew-task-worker.md +80 -0
  6. package/.speccrew/agents/speccrew-team-leader.md +92 -0
  7. package/.speccrew/agents/speccrew-test-manager.md +313 -0
  8. package/.speccrew/skills/speccrew-create-agents/SKILL.md +98 -0
  9. package/.speccrew/skills/speccrew-create-agents/templates/agents/designer-agent.md +54 -0
  10. package/.speccrew/skills/speccrew-create-agents/templates/agents/dev-agent.md +79 -0
  11. package/.speccrew/skills/speccrew-create-agents/templates/agents/test-agent.md +80 -0
  12. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +205 -0
  13. package/.speccrew/skills/speccrew-dev-backend/templates/TASK-RECORD-TEMPLATE.md +118 -0
  14. package/.speccrew/skills/speccrew-dev-desktop/SKILL.md +258 -0
  15. package/.speccrew/skills/speccrew-dev-desktop/templates/TASK-RECORD-TEMPLATE.md +161 -0
  16. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +202 -0
  17. package/.speccrew/skills/speccrew-dev-frontend/templates/TASK-RECORD-TEMPLATE.md +115 -0
  18. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +200 -0
  19. package/.speccrew/skills/speccrew-dev-mobile/templates/TASK-RECORD-TEMPLATE.md +125 -0
  20. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +73 -0
  21. package/.speccrew/skills/speccrew-fd-api-contract/templates/API-CONTRACT-TEMPLATE.md +96 -0
  22. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +395 -0
  23. package/.speccrew/skills/speccrew-fd-feature-design/templates/FEATURE-SPEC-TEMPLATE.md +387 -0
  24. package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +80 -0
  25. package/.speccrew/skills/speccrew-get-timestamp/scripts/get-timestamp.js +35 -0
  26. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +1116 -0
  27. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/FEATURE-DETAIL-TEMPLATE-FASTAPI.md +462 -0
  28. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/FEATURE-DETAIL-TEMPLATE-JAVA.md +480 -0
  29. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/FEATURE-DETAIL-TEMPLATE-NET.md +464 -0
  30. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/FEATURE-DETAIL-TEMPLATE.md +480 -0
  31. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/templates/MODULE-OVERVIEW-TEMPLATE.md +367 -0
  32. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +667 -0
  33. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +74 -0
  34. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +176 -0
  35. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +150 -0
  36. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +106 -0
  37. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +249 -0
  38. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +848 -0
  39. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +226 -0
  40. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +264 -0
  41. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +34 -0
  42. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +867 -0
  43. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +26 -0
  44. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +165 -0
  45. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/scripts/apply-module-mapping.js +208 -0
  46. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/scripts/extract-module-summary.js +180 -0
  47. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/scripts/reindex-modules.js +358 -0
  48. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +1055 -0
  49. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-DESKTOP.md +303 -0
  50. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-ELECTRON.md +327 -0
  51. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-MINIAPP.md +292 -0
  52. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-MOBILE.md +281 -0
  53. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI.md +324 -0
  54. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +270 -0
  55. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/templates/COMPONENT-PATTERN-TEMPLATE.md +33 -0
  56. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/templates/LAYOUT-PATTERN-TEMPLATE.md +33 -0
  57. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/templates/PAGE-TYPE-TEMPLATE.md +33 -0
  58. package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +229 -0
  59. package/.speccrew/skills/speccrew-knowledge-graph-query/scripts/graph-query.js +549 -0
  60. package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +181 -0
  61. package/.speccrew/skills/speccrew-knowledge-graph-write/scripts/graph-write.js +651 -0
  62. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +305 -0
  63. package/.speccrew/skills/speccrew-knowledge-module-summarize/templates/MODULE-OVERVIEW-TEMPLATE.md +400 -0
  64. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +351 -0
  65. package/.speccrew/skills/speccrew-knowledge-system-summarize/templates/SYSTEM-OVERVIEW-TEMPLATE.md +294 -0
  66. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +683 -0
  67. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +550 -0
  68. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/templates/techs-manifest-EXAMPLE.json +35 -0
  69. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +1087 -0
  70. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/ARCHITECTURE-TEMPLATE.md +240 -0
  71. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/COLOR-SYSTEM-TEMPLATE.md +68 -0
  72. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/COMPONENT-LIBRARY-TEMPLATE.md +86 -0
  73. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-BUILD-TEMPLATE.md +466 -0
  74. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-DATA-TEMPLATE.md +432 -0
  75. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-DESIGN-TEMPLATE.md +1209 -0
  76. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-DEV-TEMPLATE.md +1433 -0
  77. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-SYSTEM-TEST-TEMPLATE.md +1052 -0
  78. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/CONVENTIONS-UNIT-TEST-TEMPLATE.md +946 -0
  79. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/INDEX-TEMPLATE.md +29 -0
  80. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/PAGE-LAYOUTS-TEMPLATE.md +69 -0
  81. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/PAGE-TYPE-SUMMARY-TEMPLATE.md +74 -0
  82. package/.speccrew/skills/speccrew-knowledge-techs-generate/templates/TECH-STACK-TEMPLATE.md +232 -0
  83. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +628 -0
  84. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +392 -0
  85. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +489 -0
  86. package/.speccrew/skills/speccrew-knowledge-techs-index/templates/INDEX-TEMPLATE.md +243 -0
  87. package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +269 -0
  88. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +562 -0
  89. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/BUSINESS-COMPONENTS-TEMPLATE.md +171 -0
  90. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/COMMON-COMPONENTS-TEMPLATE.md +177 -0
  91. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/COMPONENT-INDIVIDUAL-TEMPLATE.md +80 -0
  92. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/COMPONENT-LIBRARY-TEMPLATE.md +118 -0
  93. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/LAYOUT-INDIVIDUAL-TEMPLATE.md +97 -0
  94. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/LAYOUT-PATTERNS-TEMPLATE.md +208 -0
  95. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/NAVIGATION-PATTERNS-TEMPLATE.md +157 -0
  96. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/PAGE-TYPE-INDIVIDUAL-TEMPLATE.md +123 -0
  97. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/PAGE-TYPE-SUMMARY-TEMPLATE.md +58 -0
  98. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/SPACING-TEMPLATE.md +119 -0
  99. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/STYLE-SYSTEM-TEMPLATE.md +117 -0
  100. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/TYPOGRAPHY-TEMPLATE.md +107 -0
  101. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/templates/UI-STYLE-GUIDE-TEMPLATE.md +171 -0
  102. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +434 -0
  103. package/.speccrew/skills/speccrew-pm-requirement-analysis/templates/BIZS-MODELING-TEMPLATE.md +332 -0
  104. package/.speccrew/skills/speccrew-pm-requirement-analysis/templates/PRD-TEMPLATE.md +200 -0
  105. package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +195 -0
  106. package/.speccrew/skills/speccrew-project-diagnosis/SKILL.md +208 -0
  107. package/.speccrew/skills/speccrew-project-diagnosis/templates/DIAGNOSIS-REPORT-TEMPLATE.md +202 -0
  108. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +188 -0
  109. package/.speccrew/skills/speccrew-sd-backend/templates/INDEX-TEMPLATE.md +85 -0
  110. package/.speccrew/skills/speccrew-sd-backend/templates/SD-BACKEND-TEMPLATE.md +269 -0
  111. package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +192 -0
  112. package/.speccrew/skills/speccrew-sd-desktop/templates/INDEX-TEMPLATE.md +271 -0
  113. package/.speccrew/skills/speccrew-sd-desktop/templates/SD-DESKTOP-TEMPLATE.md +673 -0
  114. package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +176 -0
  115. package/.speccrew/skills/speccrew-sd-frontend/templates/INDEX-TEMPLATE.md +184 -0
  116. package/.speccrew/skills/speccrew-sd-frontend/templates/SD-FRONTEND-TEMPLATE.md +382 -0
  117. package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +189 -0
  118. package/.speccrew/skills/speccrew-sd-mobile/templates/INDEX-TEMPLATE.md +219 -0
  119. package/.speccrew/skills/speccrew-sd-mobile/templates/SD-MOBILE-TEMPLATE.md +534 -0
  120. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +284 -0
  121. package/.speccrew/skills/speccrew-test-case-design/templates/TEST-CASE-DESIGN-TEMPLATE.md +263 -0
  122. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +313 -0
  123. package/.speccrew/skills/speccrew-test-code-gen/templates/TEST-CODE-PLAN-TEMPLATE.md +180 -0
  124. package/.speccrew/skills/speccrew-test-execute/SKILL.md +283 -0
  125. package/.speccrew/skills/speccrew-test-execute/templates/BUG-REPORT-TEMPLATE.md +50 -0
  126. package/.speccrew/skills/speccrew-test-execute/templates/TEST-REPORT-TEMPLATE.md +57 -0
  127. package/.speccrew/skills/speccrew-workflow-diagnose/SKILL.md +155 -0
  128. package/LICENSE +21 -0
  129. package/README.ar.md +318 -0
  130. package/README.en.md +318 -0
  131. package/README.es.md +318 -0
  132. package/README.md +340 -0
  133. package/bin/cli.js +62 -0
  134. package/lib/commands/doctor.js +138 -0
  135. package/lib/commands/init.js +231 -0
  136. package/lib/commands/list.js +114 -0
  137. package/lib/commands/uninstall.js +117 -0
  138. package/lib/commands/update.js +351 -0
  139. package/lib/ide-adapters.js +73 -0
  140. package/lib/utils.js +104 -0
  141. package/package.json +28 -0
  142. package/workspace-template/docs/configs/document-templates.json +667 -0
  143. package/workspace-template/docs/configs/platform-mapping.json +194 -0
  144. package/workspace-template/docs/configs/tech-stack-mappings.json +313 -0
  145. package/workspace-template/docs/configs/validation-rules.json +87 -0
  146. package/workspace-template/docs/rules/mermaid-rule.md +114 -0
  147. package/workspace-template/docs/solutions/Agent/346/212/200/350/203/275/345/256/232/344/271/211+/351/234/200/346/261/202/346/226/207/346/241/243+UML/344/275/277/347/224/250/346/250/241/346/235/277/357/274/210ISA-95/345/205/255/346/256/265/345/274/217/350/236/215/345/220/210/347/211/210/357/274/211.md +586 -0
  148. package/workspace-template/docs/solutions/agent-knowledge-map.md +238 -0
  149. package/workspace-template/docs/solutions/bizs-knowledge-pipeline.md +678 -0
  150. package/workspace-template/docs/solutions/harness.md +410 -0
  151. package/workspace-template/docs/solutions/knowledge-incremental-sync-spec.md +943 -0
  152. package/workspace-template/docs/solutions/techs-knowledge-pipeline.md +803 -0
  153. package/workspace-template/docs/solutions/workspace-structure.md +318 -0
@@ -0,0 +1,313 @@
1
+ ---
2
+ name: speccrew-test-code-gen
3
+ description: Generates executable test code from confirmed test case documents. Reads test case matrix, platform technical conventions, and system design to produce well-structured test files with full traceability to test case IDs.
4
+ tools: Read, Write, Glob, Grep
5
+ ---
6
+
7
+ # Trigger Scenarios
8
+
9
+ - When speccrew-test-manager dispatches test code generation after test cases are confirmed
10
+ - When user explicitly requests test code generation from confirmed test cases
11
+ - When user asks "Generate test code", "Create test files from test cases"
12
+
13
+ # Workflow
14
+
15
+ ## Step 1: Read Test Cases
16
+
17
+ Read the confirmed test case document specified by `test_cases_path`:
18
+
19
+ 1. **Parse Test Case Matrix**: Extract TC ID, test steps, inputs, expected results
20
+ 2. **Statistics**: Count total test cases and distribution by dimension (module, priority, type)
21
+ 3. **Extract Test Data**: Identify test data definitions and fixtures required
22
+
23
+ ### Test Case Document Structure Expected
24
+
25
+ | Section | Content to Extract |
26
+ |---------|-------------------|
27
+ | Test Case Matrix | TC ID, Description, Steps, Input, Expected Result |
28
+ | Test Data | Fixture definitions, test data sets |
29
+ | Preconditions | Setup requirements, mock data needs |
30
+
31
+ ## Step 2: Read Technical Conventions
32
+
33
+ Load platform testing conventions to understand the target test framework:
34
+
35
+ ### 2.1 Primary Convention Path
36
+
37
+ ```
38
+ speccrew-workspace/knowledges/techs/{platform_id}/conventions-system-test.md
39
+ ```
40
+
41
+ ### 2.2 Secondary Convention Path (Fallback for Unit Testing)
42
+
43
+ If `conventions-system-test.md` does not exist or for unit test specifics, read:
44
+
45
+ ```
46
+ speccrew-workspace/knowledges/techs/{platform_id}/conventions-unit-test.md
47
+ ```
48
+
49
+ ### 2.3 Fallback Convention Path (Last Resort)
50
+
51
+ If neither conventions file exists, read `conventions-dev.md` and infer:
52
+
53
+ | Convention File | Inference Strategy |
54
+ |-----------------|-------------------|
55
+ | conventions-dev.md | Extract framework from tech stack, infer unit test framework |
56
+
57
+ ### 2.3 Information to Extract
58
+
59
+ | Item | Purpose |
60
+ |------|---------|
61
+ | Test Framework | Jest, JUnit, pytest, Mocha, Go test, etc. |
62
+ | Test Directory | Where test files should be placed |
63
+ | File Naming | Test file naming conventions |
64
+ | Mock Strategy | How mocking is handled (jest.mock, unittest.mock, etc.) |
65
+ | Assertion Style | expect, assert, should, etc. |
66
+ | Fixture Location | Where to place shared fixtures |
67
+ | Helper Location | Where to place test helpers |
68
+
69
+ ## Step 3: Read System Design
70
+
71
+ Read the system design document specified by `system_design_path`:
72
+
73
+ ### 3.1 Understand Module Structure
74
+
75
+ - Identify module boundaries and responsibilities
76
+ - Map test cases to corresponding modules
77
+
78
+ ### 3.2 Identify External Dependencies
79
+
80
+ For mocking strategy planning:
81
+
82
+ | Dependency Type | Mock Approach |
83
+ |-----------------|---------------|
84
+ | Database | Mock repository/DAO or use test database |
85
+ | External API | Mock HTTP client or use stub server |
86
+ | File System | Mock file operations or use temp directory |
87
+ | Message Queue | Mock producer/consumer |
88
+ | Cache | Mock cache client or use in-memory cache |
89
+
90
+ ### 3.3 Confirm Interface Signatures
91
+
92
+ - Extract function/method signatures from design
93
+ - Identify parameter types and return types
94
+ - Note any complex data models that need test fixtures
95
+
96
+ ## Step 4: Generate Code Plan
97
+
98
+ Create a comprehensive test code generation plan:
99
+
100
+ ### 4.1 Test File Structure Planning
101
+
102
+ Determine how test files are organized:
103
+
104
+ | Decision | Consideration |
105
+ |----------|---------------|
106
+ | Files per Module | Group tests by module or by feature |
107
+ | Single vs Multiple | One test file per source file, or split by test type |
108
+ | Integration Tests | Separate integration test files if needed |
109
+
110
+ ### 4.2 Shared Resources Planning
111
+
112
+ | Resource Type | Decision Points |
113
+ |---------------|-----------------|
114
+ | Fixtures | Common test data (users, products, etc.) |
115
+ | Helpers | Reusable test utilities (setup, teardown, assertions) |
116
+ | Mocks | Shared mock definitions |
117
+
118
+ ### 4.3 Mock/Stub Strategy
119
+
120
+ For each external dependency:
121
+
122
+ | Dependency | Mock Type | Implementation Approach |
123
+ |-----------|-----------|------------------------|
124
+ | {dependency_name} | mock/stub/spy | {how to implement} |
125
+
126
+ ### 4.4 File-to-TestCase Mapping Table
127
+
128
+ | Test File | Test Cases Covered | Description |
129
+ |-----------|-------------------|-------------|
130
+ | {file_path} | TC-{MOD}-001, TC-{MOD}-002 | {brief description} |
131
+
132
+ ## Step 5: Checkpoint - Present Code Plan for Confirmation
133
+
134
+ Present the code generation plan to user before generating actual code:
135
+
136
+ ### Plan Summary Structure
137
+
138
+ ```
139
+ Test Code Plan Summary: {feature_name}
140
+
141
+ Platform: {platform_id}
142
+ Test Framework: {framework}
143
+
144
+ Test Cases: {count} total
145
+ ├── Module A: {count} cases
146
+ ├── Module B: {count} cases
147
+ └── Module C: {count} cases
148
+
149
+ Test Files: {file_count} files
150
+ ├── {file_1}: {case_count} cases
151
+ ├── {file_2}: {case_count} cases
152
+ └── ...
153
+
154
+ Shared Resources:
155
+ ├── Fixtures: {count} files
156
+ ├── Helpers: {count} files
157
+ └── Mocks: {count} modules
158
+
159
+ Mock Strategy:
160
+ ├── {dependency_1}: {mock_type}
161
+ ├── {dependency_2}: {mock_type}
162
+ └── ...
163
+ ```
164
+
165
+ ### Confirmation Questions
166
+
167
+ Ask user to confirm:
168
+
169
+ 1. Is the test file grouping appropriate?
170
+ 2. Is the mock strategy correct for your environment?
171
+ 3. Are there any additional shared resources needed?
172
+ 4. Should I proceed with code generation?
173
+
174
+ **Wait for user confirmation before proceeding to Step 6.**
175
+
176
+ ## Step 6: Generate Test Code
177
+
178
+ Execute the code plan, generating test files one by one:
179
+
180
+ ### 6.1 TC ID Annotation Format
181
+
182
+ Every test function/method MUST have a TC ID comment:
183
+
184
+ ```javascript
185
+ // TC-{MOD}-{SEQ}: {test case description}
186
+ test('should validate user input', () => {
187
+ // test implementation
188
+ });
189
+ ```
190
+
191
+ **Format Pattern**: `// TC-{MODULE}-{SEQUENCE}: {description}`
192
+
193
+ | Component | Format | Example |
194
+ |-----------|--------|---------|
195
+ | MODULE | 2-4 character module code | USR, ORD, PAY |
196
+ | SEQUENCE | 3-digit zero-padded number | 001, 002, 003 |
197
+ | description | Brief test case description | User login with valid credentials |
198
+
199
+ ### 6.2 Test Code Structure (Arrange-Act-Assert)
200
+
201
+ Each test should follow clear structure:
202
+
203
+ ```
204
+ // TC-{MOD}-{SEQ}: {description}
205
+ test('{test name}', () => {
206
+ // Arrange - Setup test data and mocks
207
+ const input = { ... };
208
+ mockDependency.method.mockReturnValue(expectedValue);
209
+
210
+ // Act - Execute the function under test
211
+ const result = functionUnderTest(input);
212
+
213
+ // Assert - Verify the outcome
214
+ expect(result).toEqual(expectedOutput);
215
+ expect(mockDependency.method).toHaveBeenCalledWith(expectedParams);
216
+ });
217
+ ```
218
+
219
+ ### 6.3 Platform-Specific Conventions
220
+
221
+ Follow conventions from `conventions-unit-test.md`:
222
+
223
+ | Platform | Convention Examples |
224
+ |----------|---------------------|
225
+ | Node.js/Jest | `describe`/`test`/`expect`, `jest.mock()` |
226
+ | Java/JUnit | `@Test`, `@Mock`, `when().thenReturn()` |
227
+ | Python/pytest | `def test_`, `@pytest.fixture`, `mocker.patch` |
228
+ | Go | `func TestXxx(t *testing.T)`, `gomock` |
229
+
230
+ ### 6.4 Generate Shared Resources
231
+
232
+ Create fixtures and helpers:
233
+
234
+ **Fixtures** (`__fixtures__` or `fixtures/`):
235
+ ```javascript
236
+ // users.fixture.js
237
+ module.exports = {
238
+ validUser: {
239
+ id: 'user-001',
240
+ username: 'testuser',
241
+ email: 'test@example.com'
242
+ },
243
+ adminUser: {
244
+ id: 'admin-001',
245
+ username: 'admin',
246
+ role: 'ADMIN'
247
+ }
248
+ };
249
+ ```
250
+
251
+ **Helpers** (`__helpers__` or `helpers/`):
252
+ ```javascript
253
+ // test.helpers.js
254
+ function createMockResponse(data) {
255
+ return {
256
+ json: jest.fn().mockReturnValue(data),
257
+ status: jest.fn().mockReturnThis()
258
+ };
259
+ }
260
+ module.exports = { createMockResponse };
261
+ ```
262
+
263
+ ### 6.5 Generation Order
264
+
265
+ Generate files in dependency order:
266
+
267
+ 1. **Fixtures** - Test data definitions
268
+ 2. **Helpers** - Test utilities
269
+ 3. **Mocks** - Mock definitions (if separate files)
270
+ 4. **Test Files** - Actual test code
271
+
272
+ ## Step 7: Write Code Plan Document
273
+
274
+ Output the code plan document for traceability:
275
+
276
+ **Path**: `speccrew-workspace/iterations/{number}-{type}-{name}/05.system-test/code/{platform_id}/[feature]-test-code-plan.md`
277
+
278
+ ### Document Purpose
279
+
280
+ - Records file-to-test-case mapping
281
+ - Documents mock strategy decisions
282
+ - Provides reference for future test maintenance
283
+ - Enables traceability from test code to test cases
284
+
285
+ ### Template Reference
286
+
287
+ Use: `speccrew-test-code-gen/templates/TEST-CODE-PLAN-TEMPLATE.md`
288
+
289
+ # Key Rules
290
+
291
+ | Rule | Description |
292
+ |------|-------------|
293
+ | **TC ID Traceability** | Every test function MUST have a TC ID comment |
294
+ | **Checkpoint Required** | Must confirm code plan with user before generating |
295
+ | Convention Compliance | Follow platform-specific conventions-unit-test.md |
296
+ | **Arrange-Act-Assert** | Maintain clear test structure |
297
+ | **Mock Strategy Documented** | All mocks documented in code plan |
298
+ | **No Test Execution** | This skill only generates code, does not run tests |
299
+
300
+ # Checklist
301
+
302
+ - [ ] Test case document read, all cases parsed
303
+ - [ ] Technical conventions loaded (conventions-unit-test.md or inferred)
304
+ - [ ] System design read, dependencies identified
305
+ - [ ] Code plan generated with file-to-case mapping
306
+ - [ ] Checkpoint passed: code plan confirmed with user
307
+ - [ ] Every test case ID has a corresponding test function
308
+ - [ ] Each test function has a TC ID annotation comment
309
+ - [ ] Mock/stub strategy covers all external dependencies
310
+ - [ ] Test code follows platform conventions-unit-test.md style
311
+ - [ ] Shared fixtures and helpers are extracted properly
312
+ - [ ] Arrange-Act-Assert structure maintained in tests
313
+ - [ ] Code plan document written to correct path
@@ -0,0 +1,180 @@
1
+ # Test Code Plan: {Feature Name}
2
+
3
+ ## 1. Plan Overview
4
+
5
+ | Item | Value |
6
+ |------|-------|
7
+ | Feature Name | {feature_name} |
8
+ | Platform | {platform_id} |
9
+ | Test Framework | {framework} |
10
+ | Test Cases Source | {test_cases_path} |
11
+ | System Design Source | {system_design_path} |
12
+ | Total Test Cases | {total_count} |
13
+ | Total Test Files | {file_count} |
14
+ | Created Date | {date} |
15
+
16
+ ## 2. Test Framework & Tools
17
+
18
+ | Tool | Version | Purpose |
19
+ |------|---------|---------|
20
+ | {framework} | {version} | Test runner |
21
+ | {mock_lib} | {version} | Mocking |
22
+ | {assertion_lib} | {version} | Assertions |
23
+ | {coverage_tool} | {version} | Coverage |
24
+
25
+ ## 3. Test File Structure
26
+
27
+ ```
28
+ {project_test_dir}/
29
+ ├── __fixtures__/
30
+ │ ├── {fixture_file_1}
31
+ │ └── {fixture_file_2}
32
+ ├── __helpers__/
33
+ │ ├── {helper_file_1}
34
+ │ └── {helper_file_2}
35
+ ├── __mocks__/
36
+ │ └── {mock_file}
37
+ ├── {module_1}/
38
+ │ ├── {test_file_1}.test.{ext}
39
+ │ └── {test_file_2}.test.{ext}
40
+ ├── {module_2}/
41
+ │ └── {test_file_3}.test.{ext}
42
+ └── ...
43
+ ```
44
+
45
+ ## 4. File-to-TestCase Mapping
46
+
47
+ | Test File | Test Cases Covered | Count | Description |
48
+ |-----------|-------------------|-------|-------------|
49
+ | {file_path_1} | TC-{MOD}-001, TC-{MOD}-002, TC-{MOD}-003 | 3 | {brief description} |
50
+ | {file_path_2} | TC-{MOD}-004, TC-{MOD}-005 | 2 | {brief description} |
51
+ | {file_path_3} | TC-{MOD}-006, TC-{MOD}-007, TC-{MOD}-008 | 3 | {brief description} |
52
+
53
+ ### Detailed Mapping
54
+
55
+ #### {test_file_1}
56
+
57
+ | TC ID | Test Function Name | Description |
58
+ |-------|-------------------|-------------|
59
+ | TC-{MOD}-001 | `test_{function_name}_success` | {description} |
60
+ | TC-{MOD}-002 | `test_{function_name}_validation_error` | {description} |
61
+ | TC-{MOD}-003 | `test_{function_name}_not_found` | {description} |
62
+
63
+ #### {test_file_2}
64
+
65
+ | TC ID | Test Function Name | Description |
66
+ |-------|-------------------|-------------|
67
+ | TC-{MOD}-004 | `test_{function_name}_creates_resource` | {description} |
68
+ | TC-{MOD}-005 | `test_{function_name}_handles_duplicate` | {description} |
69
+
70
+ ## 5. Mock/Stub Strategy
71
+
72
+ ### External Dependencies
73
+
74
+ | Dependency | Type | Mock Approach | Notes |
75
+ |-----------|------|---------------|-------|
76
+ | {dependency_1} | Database | Mock repository layer | Use in-memory alternative |
77
+ | {dependency_2} | External API | Mock HTTP client | Return predefined responses |
78
+ | {dependency_3} | File System | Mock fs module | Use temp directory |
79
+ | {dependency_4} | Cache | Mock cache client | Return null for cache misses |
80
+
81
+ ### Mock Implementation Details
82
+
83
+ #### {dependency_1} Mock
84
+
85
+ ```javascript
86
+ // Mock setup example
87
+ jest.mock('{module_path}', () => ({
88
+ {method_name}: jest.fn()
89
+ }));
90
+ ```
91
+
92
+ #### {dependency_2} Mock
93
+
94
+ ```javascript
95
+ // Mock setup example
96
+ const mockClient = {
97
+ get: jest.fn(),
98
+ post: jest.fn(),
99
+ put: jest.fn(),
100
+ delete: jest.fn()
101
+ };
102
+ ```
103
+
104
+ ## 6. Shared Fixtures & Helpers
105
+
106
+ ### Fixtures
107
+
108
+ | File | Type | Description | Used By |
109
+ |------|------|-------------|---------|
110
+ | `{fixture_file_1}` | Data | {description} | {test_files} |
111
+ | `{fixture_file_2}` | Data | {description} | {test_files} |
112
+
113
+ ### Helpers
114
+
115
+ | File | Functions | Description |
116
+ |------|-----------|-------------|
117
+ | `{helper_file_1}` | `{function_1}`, `{function_2}` | {description} |
118
+ | `{helper_file_2}` | `{function_3}` | {description} |
119
+
120
+ ### Fixture Examples
121
+
122
+ #### {fixture_file_1}
123
+
124
+ ```javascript
125
+ module.exports = {
126
+ validItem: {
127
+ id: '{id}',
128
+ name: '{name}',
129
+ // ... other fields
130
+ },
131
+ invalidItem: {
132
+ // ... missing required fields
133
+ }
134
+ };
135
+ ```
136
+
137
+ ## 7. Test Case Distribution
138
+
139
+ ### By Module
140
+
141
+ | Module | Test Cases | Test Files |
142
+ |--------|------------|------------|
143
+ | {module_1} | {count} | {file_count} |
144
+ | {module_2} | {count} | {file_count} |
145
+ | **Total** | **{total}** | **{total_files}** |
146
+
147
+ ### By Priority
148
+
149
+ | Priority | Count | Percentage |
150
+ |----------|-------|------------|
151
+ | P0 (Critical) | {count} | {percentage}% |
152
+ | P1 (High) | {count} | {percentage}% |
153
+ | P2 (Medium) | {count} | {percentage}% |
154
+ | P3 (Low) | {count} | {percentage}% |
155
+
156
+ ### By Type
157
+
158
+ | Type | Count | Description |
159
+ |------|-------|-------------|
160
+ | Positive | {count} | Happy path tests |
161
+ | Negative | {count} | Error handling tests |
162
+ | Edge Case | {count} | Boundary conditions |
163
+
164
+ ## 8. Notes
165
+
166
+ ### Implementation Notes
167
+
168
+ - {note_1}
169
+ - {note_2}
170
+ - {note_3}
171
+
172
+ ### Known Limitations
173
+
174
+ - {limitation_1}
175
+ - {limitation_2}
176
+
177
+ ### Follow-up Tasks
178
+
179
+ - [ ] {follow_up_task_1}
180
+ - [ ] {follow_up_task_2}