@iamnishankhan/opencode-kit-grok 1.0.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 (198) hide show
  1. package/bin/cli.js +46 -0
  2. package/kit/.opencode/AGENTS.md +392 -0
  3. package/kit/.opencode/README.md +71 -0
  4. package/kit/.opencode/USAGE.md +405 -0
  5. package/kit/.opencode/agents/backend-specialist.md +278 -0
  6. package/kit/.opencode/agents/code-archaeologist.md +114 -0
  7. package/kit/.opencode/agents/database-architect.md +233 -0
  8. package/kit/.opencode/agents/debugger.md +234 -0
  9. package/kit/.opencode/agents/devops-engineer.md +252 -0
  10. package/kit/.opencode/agents/documentation-writer.md +111 -0
  11. package/kit/.opencode/agents/explorer-agent.md +83 -0
  12. package/kit/.opencode/agents/frontend-specialist.md +606 -0
  13. package/kit/.opencode/agents/game-developer.md +169 -0
  14. package/kit/.opencode/agents/mobile-developer.md +385 -0
  15. package/kit/.opencode/agents/orchestrator.md +213 -0
  16. package/kit/.opencode/agents/penetration-tester.md +197 -0
  17. package/kit/.opencode/agents/performance-optimizer.md +194 -0
  18. package/kit/.opencode/agents/product-manager.md +120 -0
  19. package/kit/.opencode/agents/product-owner.md +103 -0
  20. package/kit/.opencode/agents/project-planner.md +418 -0
  21. package/kit/.opencode/agents/qa-automation-engineer.md +113 -0
  22. package/kit/.opencode/agents/security-auditor.md +179 -0
  23. package/kit/.opencode/agents/seo-specialist.md +119 -0
  24. package/kit/.opencode/agents/test-engineer.md +169 -0
  25. package/kit/.opencode/commands/brainstorm.md +113 -0
  26. package/kit/.opencode/commands/coordinate.md +72 -0
  27. package/kit/.opencode/commands/create.md +63 -0
  28. package/kit/.opencode/commands/debug.md +102 -0
  29. package/kit/.opencode/commands/deploy.md +175 -0
  30. package/kit/.opencode/commands/enhance.md +62 -0
  31. package/kit/.opencode/commands/orchestrate.md +241 -0
  32. package/kit/.opencode/commands/plan.md +89 -0
  33. package/kit/.opencode/commands/preview.md +80 -0
  34. package/kit/.opencode/commands/remember.md +67 -0
  35. package/kit/.opencode/commands/status.md +86 -0
  36. package/kit/.opencode/commands/test.md +143 -0
  37. package/kit/.opencode/commands/verify.md +71 -0
  38. package/kit/.opencode/memory/MEMORY.md +6 -0
  39. package/kit/.opencode/memory/feedback-history.md +9 -0
  40. package/kit/.opencode/memory/project-conventions.md +16 -0
  41. package/kit/.opencode/memory/tech-decisions.md +10 -0
  42. package/kit/.opencode/memory/user-preferences.md +9 -0
  43. package/kit/.opencode/opencode.json +15 -0
  44. package/kit/.opencode/scripts/README.md +95 -0
  45. package/kit/.opencode/scripts/auto_preview.py +149 -0
  46. package/kit/.opencode/scripts/checklist.py +75 -0
  47. package/kit/.opencode/scripts/component_registry.py +238 -0
  48. package/kit/.opencode/scripts/dependency_graph.py +73 -0
  49. package/kit/.opencode/scripts/generate_manifest.py +44 -0
  50. package/kit/.opencode/scripts/session_manager.py +120 -0
  51. package/kit/.opencode/scripts/tests/test_toolkit.py +238 -0
  52. package/kit/.opencode/scripts/validate_kit.py +397 -0
  53. package/kit/.opencode/scripts/validation_runner.py +216 -0
  54. package/kit/.opencode/scripts/verify_all.py +85 -0
  55. package/kit/.opencode/skills/api-patterns/SKILL.md +83 -0
  56. package/kit/.opencode/skills/api-patterns/api-style.md +42 -0
  57. package/kit/.opencode/skills/api-patterns/auth.md +24 -0
  58. package/kit/.opencode/skills/api-patterns/documentation.md +26 -0
  59. package/kit/.opencode/skills/api-patterns/graphql.md +41 -0
  60. package/kit/.opencode/skills/api-patterns/rate-limiting.md +31 -0
  61. package/kit/.opencode/skills/api-patterns/response.md +37 -0
  62. package/kit/.opencode/skills/api-patterns/rest.md +40 -0
  63. package/kit/.opencode/skills/api-patterns/scripts/api_validator.py +211 -0
  64. package/kit/.opencode/skills/api-patterns/security-testing.md +122 -0
  65. package/kit/.opencode/skills/api-patterns/trpc.md +41 -0
  66. package/kit/.opencode/skills/api-patterns/versioning.md +22 -0
  67. package/kit/.opencode/skills/app-builder/SKILL.md +78 -0
  68. package/kit/.opencode/skills/app-builder/agent-coordination.md +71 -0
  69. package/kit/.opencode/skills/app-builder/feature-building.md +53 -0
  70. package/kit/.opencode/skills/app-builder/project-detection.md +45 -0
  71. package/kit/.opencode/skills/app-builder/scaffolding.md +110 -0
  72. package/kit/.opencode/skills/app-builder/tech-stack.md +41 -0
  73. package/kit/.opencode/skills/app-builder/templates/SKILL.md +39 -0
  74. package/kit/.opencode/skills/app-builder/templates/astro-static/TEMPLATE.md +78 -0
  75. package/kit/.opencode/skills/app-builder/templates/chrome-extension/TEMPLATE.md +96 -0
  76. package/kit/.opencode/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  77. package/kit/.opencode/skills/app-builder/templates/electron-desktop/TEMPLATE.md +97 -0
  78. package/kit/.opencode/skills/app-builder/templates/express-api/TEMPLATE.md +89 -0
  79. package/kit/.opencode/skills/app-builder/templates/flutter-app/TEMPLATE.md +93 -0
  80. package/kit/.opencode/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +97 -0
  81. package/kit/.opencode/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +126 -0
  82. package/kit/.opencode/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +125 -0
  83. package/kit/.opencode/skills/app-builder/templates/nextjs-static/TEMPLATE.md +174 -0
  84. package/kit/.opencode/skills/app-builder/templates/nuxt-app/TEMPLATE.md +127 -0
  85. package/kit/.opencode/skills/app-builder/templates/python-fastapi/TEMPLATE.md +94 -0
  86. package/kit/.opencode/skills/app-builder/templates/react-native-app/TEMPLATE.md +121 -0
  87. package/kit/.opencode/skills/architecture/SKILL.md +57 -0
  88. package/kit/.opencode/skills/architecture/context-discovery.md +43 -0
  89. package/kit/.opencode/skills/architecture/examples.md +94 -0
  90. package/kit/.opencode/skills/architecture/pattern-selection.md +68 -0
  91. package/kit/.opencode/skills/architecture/patterns-reference.md +50 -0
  92. package/kit/.opencode/skills/architecture/trade-off-analysis.md +77 -0
  93. package/kit/.opencode/skills/bash-linux/SKILL.md +201 -0
  94. package/kit/.opencode/skills/batch-operations/SKILL.md +105 -0
  95. package/kit/.opencode/skills/behavioral-modes/SKILL.md +253 -0
  96. package/kit/.opencode/skills/brainstorming/SKILL.md +178 -0
  97. package/kit/.opencode/skills/brainstorming/dynamic-questioning.md +350 -0
  98. package/kit/.opencode/skills/clean-code/SKILL.md +201 -0
  99. package/kit/.opencode/skills/code-review-checklist/SKILL.md +111 -0
  100. package/kit/.opencode/skills/code-review-graph/SKILL.md +305 -0
  101. package/kit/.opencode/skills/context-compression/SKILL.md +145 -0
  102. package/kit/.opencode/skills/coordinator-mode/SKILL.md +208 -0
  103. package/kit/.opencode/skills/database-design/SKILL.md +54 -0
  104. package/kit/.opencode/skills/database-design/database-selection.md +43 -0
  105. package/kit/.opencode/skills/database-design/indexing.md +39 -0
  106. package/kit/.opencode/skills/database-design/migrations.md +48 -0
  107. package/kit/.opencode/skills/database-design/optimization.md +36 -0
  108. package/kit/.opencode/skills/database-design/orm-selection.md +30 -0
  109. package/kit/.opencode/skills/database-design/schema-design.md +56 -0
  110. package/kit/.opencode/skills/database-design/scripts/schema_validator.py +172 -0
  111. package/kit/.opencode/skills/deployment-procedures/SKILL.md +243 -0
  112. package/kit/.opencode/skills/design-spec/SKILL.md +185 -0
  113. package/kit/.opencode/skills/design-spec/collection.md +106 -0
  114. package/kit/.opencode/skills/documentation-templates/SKILL.md +196 -0
  115. package/kit/.opencode/skills/frontend-architecture/SKILL.md +245 -0
  116. package/kit/.opencode/skills/frontend-design/SKILL.md +1222 -0
  117. package/kit/.opencode/skills/frontend-design/redesign.md +178 -0
  118. package/kit/.opencode/skills/frontend-design/scripts/accessibility_checker.py +145 -0
  119. package/kit/.opencode/skills/frontend-design/scripts/ux_audit.py +722 -0
  120. package/kit/.opencode/skills/frontend-design/style-brutalist.md +92 -0
  121. package/kit/.opencode/skills/frontend-design/style-minimalist.md +85 -0
  122. package/kit/.opencode/skills/game-development/2d-games/SKILL.md +118 -0
  123. package/kit/.opencode/skills/game-development/3d-games/SKILL.md +134 -0
  124. package/kit/.opencode/skills/game-development/SKILL.md +169 -0
  125. package/kit/.opencode/skills/game-development/game-art/SKILL.md +184 -0
  126. package/kit/.opencode/skills/game-development/game-audio/SKILL.md +189 -0
  127. package/kit/.opencode/skills/game-development/game-design/SKILL.md +128 -0
  128. package/kit/.opencode/skills/game-development/mobile-games/SKILL.md +107 -0
  129. package/kit/.opencode/skills/game-development/multiplayer/SKILL.md +131 -0
  130. package/kit/.opencode/skills/game-development/pc-games/SKILL.md +143 -0
  131. package/kit/.opencode/skills/game-development/vr-ar/SKILL.md +122 -0
  132. package/kit/.opencode/skills/game-development/web-games/SKILL.md +149 -0
  133. package/kit/.opencode/skills/geo-fundamentals/SKILL.md +158 -0
  134. package/kit/.opencode/skills/geo-fundamentals/scripts/geo_checker.py +273 -0
  135. package/kit/.opencode/skills/i18n-localization/SKILL.md +156 -0
  136. package/kit/.opencode/skills/i18n-localization/scripts/i18n_checker.py +223 -0
  137. package/kit/.opencode/skills/intelligent-routing/SKILL.md +337 -0
  138. package/kit/.opencode/skills/lint-and-validate/SKILL.md +47 -0
  139. package/kit/.opencode/skills/lint-and-validate/scripts/lint_runner.py +184 -0
  140. package/kit/.opencode/skills/lint-and-validate/scripts/type_coverage.py +245 -0
  141. package/kit/.opencode/skills/mcp-builder/SKILL.md +205 -0
  142. package/kit/.opencode/skills/memory-system/SKILL.md +181 -0
  143. package/kit/.opencode/skills/mobile-design/SKILL.md +396 -0
  144. package/kit/.opencode/skills/mobile-design/decision-trees.md +516 -0
  145. package/kit/.opencode/skills/mobile-design/mobile-backend.md +491 -0
  146. package/kit/.opencode/skills/mobile-design/mobile-color-system.md +420 -0
  147. package/kit/.opencode/skills/mobile-design/mobile-debugging.md +122 -0
  148. package/kit/.opencode/skills/mobile-design/mobile-design-thinking.md +357 -0
  149. package/kit/.opencode/skills/mobile-design/mobile-navigation.md +458 -0
  150. package/kit/.opencode/skills/mobile-design/mobile-performance.md +767 -0
  151. package/kit/.opencode/skills/mobile-design/mobile-testing.md +356 -0
  152. package/kit/.opencode/skills/mobile-design/mobile-typography.md +433 -0
  153. package/kit/.opencode/skills/mobile-design/platform-android.md +666 -0
  154. package/kit/.opencode/skills/mobile-design/platform-ios.md +561 -0
  155. package/kit/.opencode/skills/mobile-design/scripts/mobile_audit.py +670 -0
  156. package/kit/.opencode/skills/mobile-design/touch-psychology.md +537 -0
  157. package/kit/.opencode/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
  158. package/kit/.opencode/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
  159. package/kit/.opencode/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
  160. package/kit/.opencode/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
  161. package/kit/.opencode/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
  162. package/kit/.opencode/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
  163. package/kit/.opencode/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
  164. package/kit/.opencode/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
  165. package/kit/.opencode/skills/nextjs-react-expert/9-cache-components.md +103 -0
  166. package/kit/.opencode/skills/nextjs-react-expert/SKILL.md +293 -0
  167. package/kit/.opencode/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
  168. package/kit/.opencode/skills/nextjs-react-expert/scripts/react_performance_checker.py +281 -0
  169. package/kit/.opencode/skills/nodejs-best-practices/SKILL.md +336 -0
  170. package/kit/.opencode/skills/parallel-agents/SKILL.md +192 -0
  171. package/kit/.opencode/skills/performance-profiling/SKILL.md +145 -0
  172. package/kit/.opencode/skills/performance-profiling/scripts/bundle_analyzer.py +120 -0
  173. package/kit/.opencode/skills/performance-profiling/scripts/lighthouse_audit.py +108 -0
  174. package/kit/.opencode/skills/plan-writing/SKILL.md +153 -0
  175. package/kit/.opencode/skills/powershell-windows/SKILL.md +169 -0
  176. package/kit/.opencode/skills/python-patterns/SKILL.md +443 -0
  177. package/kit/.opencode/skills/red-team-tactics/SKILL.md +201 -0
  178. package/kit/.opencode/skills/rust-pro/SKILL.md +177 -0
  179. package/kit/.opencode/skills/seo-fundamentals/SKILL.md +131 -0
  180. package/kit/.opencode/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
  181. package/kit/.opencode/skills/server-management/SKILL.md +163 -0
  182. package/kit/.opencode/skills/simplify-code/SKILL.md +131 -0
  183. package/kit/.opencode/skills/skillify/SKILL.md +115 -0
  184. package/kit/.opencode/skills/systematic-debugging/SKILL.md +111 -0
  185. package/kit/.opencode/skills/tailwind-patterns/SKILL.md +271 -0
  186. package/kit/.opencode/skills/tdd-workflow/SKILL.md +151 -0
  187. package/kit/.opencode/skills/testing-patterns/SKILL.md +180 -0
  188. package/kit/.opencode/skills/testing-patterns/scripts/test_runner.py +219 -0
  189. package/kit/.opencode/skills/verify-changes/SKILL.md +127 -0
  190. package/kit/.opencode/skills/vulnerability-scanner/SKILL.md +278 -0
  191. package/kit/.opencode/skills/vulnerability-scanner/checklists.md +124 -0
  192. package/kit/.opencode/skills/vulnerability-scanner/scripts/dependency_analyzer.py +144 -0
  193. package/kit/.opencode/skills/vulnerability-scanner/scripts/security_scan.py +410 -0
  194. package/kit/.opencode/skills/web-design-guidelines/SKILL.md +56 -0
  195. package/kit/.opencode/skills/webapp-testing/SKILL.md +189 -0
  196. package/kit/.opencode/skills/webapp-testing/scripts/playwright_runner.py +123 -0
  197. package/lib/init.js +61 -0
  198. package/package.json +21 -0
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: tdd-workflow
3
+ description: Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.
4
+ compatibility: opencode
5
+ metadata:
6
+ when_to_use: "\"When practicing Test-Driven Development, following RED-GREEN-REFACTOR cycle, or writing tests before implementation.\""
7
+ version: "1.0.0"
8
+ ---
9
+ # TDD Workflow
10
+
11
+ > Write tests first, code second.
12
+
13
+ ---
14
+
15
+ ## 1. The TDD Cycle
16
+
17
+ ```
18
+ 🔴 RED → Write failing test
19
+
20
+ 🟢 GREEN → Write minimal code to pass
21
+
22
+ 🔵 REFACTOR → Improve code quality
23
+
24
+ Repeat...
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 2. The Three Laws of TDD
30
+
31
+ 1. Write production code only to make a failing test pass
32
+ 2. Write only enough test to demonstrate failure
33
+ 3. Write only enough code to make the test pass
34
+
35
+ ---
36
+
37
+ ## 3. RED Phase Principles
38
+
39
+ ### What to Write
40
+
41
+ | Focus | Example |
42
+ |-------|---------|
43
+ | Behavior | "should add two numbers" |
44
+ | Edge cases | "should handle empty input" |
45
+ | Error states | "should throw for invalid data" |
46
+
47
+ ### RED Phase Rules
48
+
49
+ - Test must fail first
50
+ - Test name describes expected behavior
51
+ - One assertion per test (ideally)
52
+
53
+ ---
54
+
55
+ ## 4. GREEN Phase Principles
56
+
57
+ ### Minimum Code
58
+
59
+ | Principle | Meaning |
60
+ |-----------|---------|
61
+ | **YAGNI** | You Aren't Gonna Need It |
62
+ | **Simplest thing** | Write the minimum to pass |
63
+ | **No optimization** | Just make it work |
64
+
65
+ ### GREEN Phase Rules
66
+
67
+ - Don't write unneeded code
68
+ - Don't optimize yet
69
+ - Pass the test, nothing more
70
+
71
+ ---
72
+
73
+ ## 5. REFACTOR Phase Principles
74
+
75
+ ### What to Improve
76
+
77
+ | Area | Action |
78
+ |------|--------|
79
+ | Duplication | Extract common code |
80
+ | Naming | Make intent clear |
81
+ | Structure | Improve organization |
82
+ | Complexity | Simplify logic |
83
+
84
+ ### REFACTOR Rules
85
+
86
+ - All tests must stay green
87
+ - Small incremental changes
88
+ - Commit after each refactor
89
+
90
+ ---
91
+
92
+ ## 6. AAA Pattern
93
+
94
+ Every test follows:
95
+
96
+ | Step | Purpose |
97
+ |------|---------|
98
+ | **Arrange** | Set up test data |
99
+ | **Act** | Execute code under test |
100
+ | **Assert** | Verify expected outcome |
101
+
102
+ ---
103
+
104
+ ## 7. When to Use TDD
105
+
106
+ | Scenario | TDD Value |
107
+ |----------|-----------|
108
+ | New feature | High |
109
+ | Bug fix | High (write test first) |
110
+ | Complex logic | High |
111
+ | Exploratory | Low (spike, then TDD) |
112
+ | UI layout | Low |
113
+
114
+ ---
115
+
116
+ ## 8. Test Prioritization
117
+
118
+ | Priority | Test Type |
119
+ |----------|-----------|
120
+ | 1 | Happy path |
121
+ | 2 | Error cases |
122
+ | 3 | Edge cases |
123
+ | 4 | Performance |
124
+
125
+ ---
126
+
127
+ ## 9. Anti-Patterns
128
+
129
+ | ❌ Don't | ✅ Do |
130
+ |----------|-------|
131
+ | Skip the RED phase | Watch test fail first |
132
+ | Write tests after | Write tests before |
133
+ | Over-engineer initial | Keep it simple |
134
+ | Multiple asserts | One behavior per test |
135
+ | Test implementation | Test behavior |
136
+
137
+ ---
138
+
139
+ ## 10. AI-Augmented TDD
140
+
141
+ ### Multi-Agent Pattern
142
+
143
+ | Agent | Role |
144
+ |-------|------|
145
+ | Agent A | Write failing tests (RED) |
146
+ | Agent B | Implement to pass (GREEN) |
147
+ | Agent C | Optimize (REFACTOR) |
148
+
149
+ ---
150
+
151
+ > **Remember:** The test is the specification. If you can't write a test, you don't understand the requirement.
@@ -0,0 +1,180 @@
1
+ ---
2
+ name: testing-patterns
3
+ description: Testing patterns and principles. Unit, integration, mocking strategies.
4
+ compatibility: opencode
5
+ metadata:
6
+ when_to_use: "\"When writing unit tests, integration tests, choosing testing frameworks, or implementing mocking strategies.\""
7
+ version: "1.0.0"
8
+ ---
9
+ # Testing Patterns
10
+
11
+ > Principles for reliable test suites.
12
+
13
+ ---
14
+
15
+ ## 1. Testing Pyramid
16
+
17
+ ```
18
+ /\ E2E (Few)
19
+ / \ Critical flows
20
+ /----\
21
+ / \ Integration (Some)
22
+ /--------\ API, DB queries
23
+ / \
24
+ /------------\ Unit (Many)
25
+ Functions, classes
26
+ ```
27
+
28
+ ---
29
+
30
+ ## 2. AAA Pattern
31
+
32
+ | Step | Purpose |
33
+ |------|---------|
34
+ | **Arrange** | Set up test data |
35
+ | **Act** | Execute code under test |
36
+ | **Assert** | Verify outcome |
37
+
38
+ ---
39
+
40
+ ## 3. Test Type Selection
41
+
42
+ ### When to Use Each
43
+
44
+ | Type | Best For | Speed |
45
+ |------|----------|-------|
46
+ | **Unit** | Pure functions, logic | Fast (<100ms) |
47
+ | **Integration** | API, DB, services | Medium |
48
+ | **E2E** | Critical user flows | Slow |
49
+
50
+ ---
51
+
52
+ ## 4. Unit Test Principles
53
+
54
+ ### Good Unit Tests
55
+
56
+ | Principle | Meaning |
57
+ |-----------|---------|
58
+ | Fast | < 100ms each |
59
+ | Isolated | No external deps |
60
+ | Repeatable | Same result always |
61
+ | Self-checking | No manual verification |
62
+ | Timely | Written with code |
63
+
64
+ ### What to Unit Test
65
+
66
+ | Test | Don't Test |
67
+ |------|------------|
68
+ | Business logic | Framework code |
69
+ | Edge cases | Third-party libs |
70
+ | Error handling | Simple getters |
71
+
72
+ ---
73
+
74
+ ## 5. Integration Test Principles
75
+
76
+ ### What to Test
77
+
78
+ | Area | Focus |
79
+ |------|-------|
80
+ | API endpoints | Request/response |
81
+ | Database | Queries, transactions |
82
+ | External services | Contracts |
83
+
84
+ ### Setup/Teardown
85
+
86
+ | Phase | Action |
87
+ |-------|--------|
88
+ | Before All | Connect resources |
89
+ | Before Each | Reset state |
90
+ | After Each | Clean up |
91
+ | After All | Disconnect |
92
+
93
+ ---
94
+
95
+ ## 6. Mocking Principles
96
+
97
+ ### When to Mock
98
+
99
+ | Mock | Don't Mock |
100
+ |------|------------|
101
+ | External APIs | The code under test |
102
+ | Database (unit) | Simple dependencies |
103
+ | Time/random | Pure functions |
104
+ | Network | In-memory stores |
105
+
106
+ ### Mock Types
107
+
108
+ | Type | Use |
109
+ |------|-----|
110
+ | Stub | Return fixed values |
111
+ | Spy | Track calls |
112
+ | Mock | Set expectations |
113
+ | Fake | Simplified implementation |
114
+
115
+ ---
116
+
117
+ ## 7. Test Organization
118
+
119
+ ### Naming
120
+
121
+ | Pattern | Example |
122
+ |---------|---------|
123
+ | Should behavior | "should return error when..." |
124
+ | When condition | "when user not found..." |
125
+ | Given-when-then | "given X, when Y, then Z" |
126
+
127
+ ### Grouping
128
+
129
+ | Level | Use |
130
+ |-------|-----|
131
+ | describe | Group related tests |
132
+ | it/test | Individual case |
133
+ | beforeEach | Common setup |
134
+
135
+ ---
136
+
137
+ ## 8. Test Data
138
+
139
+ ### Strategies
140
+
141
+ | Approach | Use |
142
+ |----------|-----|
143
+ | Factories | Generate test data |
144
+ | Fixtures | Predefined datasets |
145
+ | Builders | Fluent object creation |
146
+
147
+ ### Principles
148
+
149
+ - Use realistic data
150
+ - Randomize non-essential values (faker)
151
+ - Share common fixtures
152
+ - Keep data minimal
153
+
154
+ ---
155
+
156
+ ## 9. Best Practices
157
+
158
+ | Practice | Why |
159
+ |----------|-----|
160
+ | One assert per test | Clear failure reason |
161
+ | Independent tests | No order dependency |
162
+ | Fast tests | Run frequently |
163
+ | Descriptive names | Self-documenting |
164
+ | Clean up | Avoid side effects |
165
+
166
+ ---
167
+
168
+ ## 10. Anti-Patterns
169
+
170
+ | ❌ Don't | ✅ Do |
171
+ |----------|-------|
172
+ | Test implementation | Test behavior |
173
+ | Duplicate test code | Use factories |
174
+ | Complex test setup | Simplify or split |
175
+ | Ignore flaky tests | Fix root cause |
176
+ | Skip cleanup | Reset state |
177
+
178
+ ---
179
+
180
+ > **Remember:** Tests are documentation. If someone can't understand what the code does from the tests, rewrite them.
@@ -0,0 +1,219 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test Runner - Unified test execution and coverage reporting
4
+ Runs tests and generates coverage report based on project type.
5
+
6
+ Usage:
7
+ python test_runner.py <project_path> [--coverage]
8
+
9
+ Supports:
10
+ - Node.js: npm test, jest, vitest
11
+ - Python: pytest, unittest
12
+ """
13
+
14
+ import subprocess
15
+ import sys
16
+ import json
17
+ from pathlib import Path
18
+ from datetime import datetime
19
+
20
+ # Fix Windows console encoding
21
+ try:
22
+ sys.stdout.reconfigure(encoding='utf-8', errors='replace')
23
+ except:
24
+ pass
25
+
26
+
27
+ def detect_test_framework(project_path: Path) -> dict:
28
+ """Detect test framework and commands."""
29
+ result = {
30
+ "type": "unknown",
31
+ "framework": None,
32
+ "cmd": None,
33
+ "coverage_cmd": None
34
+ }
35
+
36
+ # Node.js project
37
+ package_json = project_path / "package.json"
38
+ if package_json.exists():
39
+ result["type"] = "node"
40
+ try:
41
+ pkg = json.loads(package_json.read_text(encoding='utf-8'))
42
+ scripts = pkg.get("scripts", {})
43
+ deps = {**pkg.get("dependencies", {}), **pkg.get("devDependencies", {})}
44
+
45
+ # Check for test script
46
+ if "test" in scripts:
47
+ result["framework"] = "npm test"
48
+ result["cmd"] = ["npm", "test"]
49
+
50
+ # Try to detect specific framework for coverage
51
+ if "vitest" in deps:
52
+ result["framework"] = "vitest"
53
+ result["coverage_cmd"] = ["npx", "vitest", "run", "--coverage"]
54
+ elif "jest" in deps:
55
+ result["framework"] = "jest"
56
+ result["coverage_cmd"] = ["npx", "jest", "--coverage"]
57
+ elif "vitest" in deps:
58
+ result["framework"] = "vitest"
59
+ result["cmd"] = ["npx", "vitest", "run"]
60
+ result["coverage_cmd"] = ["npx", "vitest", "run", "--coverage"]
61
+ elif "jest" in deps:
62
+ result["framework"] = "jest"
63
+ result["cmd"] = ["npx", "jest"]
64
+ result["coverage_cmd"] = ["npx", "jest", "--coverage"]
65
+
66
+ except:
67
+ pass
68
+
69
+ # Python project
70
+ if (project_path / "pyproject.toml").exists() or (project_path / "requirements.txt").exists():
71
+ result["type"] = "python"
72
+ result["framework"] = "pytest"
73
+ result["cmd"] = ["python", "-m", "pytest", "-v"]
74
+ result["coverage_cmd"] = ["python", "-m", "pytest", "--cov", "--cov-report=term-missing"]
75
+
76
+ return result
77
+
78
+
79
+ def run_tests(cmd: list, cwd: Path) -> dict:
80
+ """Run tests and return results."""
81
+ result = {
82
+ "passed": False,
83
+ "output": "",
84
+ "error": "",
85
+ "tests_run": 0,
86
+ "tests_passed": 0,
87
+ "tests_failed": 0
88
+ }
89
+
90
+ try:
91
+ proc = subprocess.run(
92
+ cmd,
93
+ cwd=str(cwd),
94
+ capture_output=True,
95
+ text=True,
96
+ encoding='utf-8',
97
+ errors='replace',
98
+ timeout=300 # 5 min timeout for tests
99
+ )
100
+
101
+ result["output"] = proc.stdout[:3000] if proc.stdout else ""
102
+ result["error"] = proc.stderr[:500] if proc.stderr else ""
103
+ result["passed"] = proc.returncode == 0
104
+
105
+ # Try to parse test counts from output
106
+ output = proc.stdout or ""
107
+
108
+ # Jest/Vitest pattern: "Tests: X passed, Y failed, Z total"
109
+ if "passed" in output.lower() and "failed" in output.lower():
110
+ import re
111
+ match = re.search(r'(\d+)\s+passed', output, re.IGNORECASE)
112
+ if match:
113
+ result["tests_passed"] = int(match.group(1))
114
+ match = re.search(r'(\d+)\s+failed', output, re.IGNORECASE)
115
+ if match:
116
+ result["tests_failed"] = int(match.group(1))
117
+ result["tests_run"] = result["tests_passed"] + result["tests_failed"]
118
+
119
+ # Pytest pattern: "X passed, Y failed"
120
+ if "pytest" in str(cmd):
121
+ import re
122
+ match = re.search(r'(\d+)\s+passed', output)
123
+ if match:
124
+ result["tests_passed"] = int(match.group(1))
125
+ match = re.search(r'(\d+)\s+failed', output)
126
+ if match:
127
+ result["tests_failed"] = int(match.group(1))
128
+ result["tests_run"] = result["tests_passed"] + result["tests_failed"]
129
+
130
+ except FileNotFoundError:
131
+ result["error"] = f"Command not found: {cmd[0]}"
132
+ except subprocess.TimeoutExpired:
133
+ result["error"] = "Timeout after 300s"
134
+ except Exception as e:
135
+ result["error"] = str(e)
136
+
137
+ return result
138
+
139
+
140
+ def main():
141
+ project_path = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
142
+ with_coverage = "--coverage" in sys.argv
143
+
144
+ print(f"\n{'='*60}")
145
+ print(f"[TEST RUNNER] Unified Test Execution")
146
+ print(f"{'='*60}")
147
+ print(f"Project: {project_path}")
148
+ print(f"Coverage: {'enabled' if with_coverage else 'disabled'}")
149
+ print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
150
+
151
+ # Detect test framework
152
+ test_info = detect_test_framework(project_path)
153
+ print(f"Type: {test_info['type']}")
154
+ print(f"Framework: {test_info['framework']}")
155
+ print("-"*60)
156
+
157
+ if not test_info["cmd"]:
158
+ print("No test framework found for this project.")
159
+ output = {
160
+ "script": "test_runner",
161
+ "project": str(project_path),
162
+ "type": test_info["type"],
163
+ "framework": None,
164
+ "passed": True,
165
+ "message": "No tests configured"
166
+ }
167
+ print(json.dumps(output, indent=2))
168
+ sys.exit(0)
169
+
170
+ # Choose command
171
+ cmd = test_info["coverage_cmd"] if with_coverage and test_info["coverage_cmd"] else test_info["cmd"]
172
+
173
+ print(f"Running: {' '.join(cmd)}")
174
+ print("-"*60)
175
+
176
+ # Run tests
177
+ result = run_tests(cmd, project_path)
178
+
179
+ # Print output (truncated)
180
+ if result["output"]:
181
+ lines = result["output"].split("\n")
182
+ for line in lines[:30]:
183
+ print(line)
184
+ if len(lines) > 30:
185
+ print(f"... ({len(lines) - 30} more lines)")
186
+
187
+ # Summary
188
+ print("\n" + "="*60)
189
+ print("SUMMARY")
190
+ print("="*60)
191
+
192
+ if result["passed"]:
193
+ print("[PASS] All tests passed")
194
+ else:
195
+ print("[FAIL] Some tests failed")
196
+ if result["error"]:
197
+ print(f"Error: {result['error'][:200]}")
198
+
199
+ if result["tests_run"] > 0:
200
+ print(f"Tests: {result['tests_run']} total, {result['tests_passed']} passed, {result['tests_failed']} failed")
201
+
202
+ output = {
203
+ "script": "test_runner",
204
+ "project": str(project_path),
205
+ "type": test_info["type"],
206
+ "framework": test_info["framework"],
207
+ "tests_run": result["tests_run"],
208
+ "tests_passed": result["tests_passed"],
209
+ "tests_failed": result["tests_failed"],
210
+ "passed": result["passed"]
211
+ }
212
+
213
+ print("\n" + json.dumps(output, indent=2))
214
+
215
+ sys.exit(0 if result["passed"] else 1)
216
+
217
+
218
+ if __name__ == "__main__":
219
+ main()
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: verify-changes
3
+ description: Prove code works by running it, not just checking it exists. Verification through execution rather than inspection. Use after writing or modifying code to ensure it actually functions correctly.
4
+ compatibility: opencode
5
+ metadata:
6
+ when_to_use: "\"After writing code, completing a feature, or fixing a bug. When the user says 'does this work?', 'test this', 'verify', or when /verify workflow is invoked. NOT for writing new code — for proving exi"
7
+ version: "1.0.0"
8
+ ---
9
+ # Verify Changes — Prove Code Works
10
+
11
+ > "Code that exists" ≠ "Code that works." This skill ensures changes are verified through execution.
12
+
13
+ ## Core Principle
14
+
15
+ ```
16
+ ❌ Verification by inspection: "I can see the function exists, it should work"
17
+ ❌ Verification by assumption: "The types check out, so it's correct"
18
+ ✅ Verification by execution: "I ran it, here's the output, it works because [evidence]"
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Verification Protocol
24
+
25
+ ### Step 1: Identify What Changed
26
+ ```
27
+ - Which files were modified?
28
+ - What behavior should be different now?
29
+ - What was the original bug/requirement?
30
+ ```
31
+
32
+ ### Step 2: Determine Verification Method
33
+
34
+ | Change Type | Verification Method |
35
+ |---|---|
36
+ | **Bug fix** | Reproduce the original bug scenario → confirm it no longer occurs |
37
+ | **New feature** | Run the feature → confirm expected output |
38
+ | **Refactor** | Run existing tests → confirm nothing broke |
39
+ | **API change** | Call the endpoint → confirm response shape |
40
+ | **UI change** | Render the component → confirm visual output |
41
+ | **Config change** | Load the config → confirm values applied |
42
+ | **Build/infra** | Run build command → confirm success |
43
+
44
+ ### Step 3: Execute Verification
45
+
46
+ ```bash
47
+ # For Node.js projects
48
+ npm run build # Does it compile?
49
+ npm run test # Do tests pass?
50
+ npm run dev # Does it start?
51
+
52
+ # For specific files
53
+ node -e "require('./path/to/module'); console.log('✅ Loads correctly')"
54
+
55
+ # For API endpoints
56
+ curl http://localhost:3000/api/endpoint
57
+
58
+ # For scripts
59
+ python script.py --test
60
+ ```
61
+
62
+ ### Step 4: Report Evidence
63
+
64
+ ```markdown
65
+ ## Verification Report
66
+
67
+ ### What was changed
68
+ - [File list and summary]
69
+
70
+ ### How it was verified
71
+ - [Exact commands run]
72
+
73
+ ### Evidence
74
+ - Build: ✅ Compiled without errors
75
+ - Tests: ✅ 42/42 passing
76
+ - Runtime: ✅ Server starts, endpoint returns expected JSON
77
+ - Edge case: ✅ Empty input handled correctly
78
+
79
+ ### Not yet verified
80
+ - [Anything that couldn't be tested automatically]
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Verification Checklist by Project Type
86
+
87
+ ### Web Application
88
+ - [ ] `npm run build` — compiles without errors
89
+ - [ ] `npm run lint` — no linting errors
90
+ - [ ] `npm run test` — all tests pass
91
+ - [ ] Dev server starts successfully
92
+ - [ ] Changed pages render correctly
93
+ - [ ] No console errors in browser
94
+
95
+ ### API / Backend
96
+ - [ ] Server starts without errors
97
+ - [ ] Changed endpoints respond correctly
98
+ - [ ] Error cases return appropriate status codes
99
+ - [ ] Database queries execute successfully
100
+
101
+ ### CLI / Script
102
+ - [ ] Script runs without errors
103
+ - [ ] Expected output matches actual output
104
+ - [ ] Error handling works (bad input test)
105
+ - [ ] Help/usage text is correct
106
+
107
+ ---
108
+
109
+ ## Anti-Patterns
110
+
111
+ | Anti-Pattern | Why It's Bad | Fix |
112
+ |---|---|---|
113
+ | "It should work" | No evidence | Run it and show output |
114
+ | Only checking happy path | Bugs hide in edge cases | Test error paths too |
115
+ | Verifying only compilation | Compiles ≠ correct | Test runtime behavior |
116
+ | Skipping verification for "trivial" changes | Trivial changes cause real bugs | Verify everything |
117
+
118
+ ---
119
+
120
+ ## Integration with Other Skills
121
+
122
+ | After Using | Verify With |
123
+ |---|---|
124
+ | `frontend-design` → UI changes | Render in browser, check console |
125
+ | `backend-specialist` → API changes | curl endpoints, check responses |
126
+ | `database-design` → Schema changes | Run migrations, query data |
127
+ | `testing-patterns` → New tests | Run test suite, check coverage |