@geminix/gxpm 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 (299) hide show
  1. package/AGENTS.md +148 -0
  2. package/CANON.md +53 -0
  3. package/CLAUDE.md +60 -0
  4. package/CONTEXT.md +49 -0
  5. package/DEBUG.md +59 -0
  6. package/ISSUE_CONTEXT.md +25 -0
  7. package/README.md +143 -0
  8. package/VERSION +1 -0
  9. package/agents/cleanup-auditor/cleanup-auditor.md +56 -0
  10. package/agents/grill-master.md +26 -0
  11. package/agents/implementer.md +32 -0
  12. package/agents/review-army/accessibility-reviewer.md +54 -0
  13. package/agents/review-army/code-quality-reviewer.md +54 -0
  14. package/agents/review-army/security-reviewer.md +56 -0
  15. package/agents/review-army/spec-compliance-reviewer.md +51 -0
  16. package/agents/review-army/test-reviewer.md +55 -0
  17. package/agents/reviewer.md +59 -0
  18. package/agents/ship-audit-army/docs-auditor.md +53 -0
  19. package/agents/ship-audit-army/performance-auditor.md +52 -0
  20. package/agents/ship-audit-army/security-auditor.md +52 -0
  21. package/agents/specifier.md +55 -0
  22. package/agents/triage-officer.md +27 -0
  23. package/bin/gxpm +17 -0
  24. package/bin/gxpm-browser +17 -0
  25. package/bin/gxpm-config +15 -0
  26. package/bin/gxpm-eval +13 -0
  27. package/bin/gxpm-global-discover +15 -0
  28. package/bin/gxpm-init +38 -0
  29. package/bin/gxpm-investigate +194 -0
  30. package/bin/gxpm-uninstall +15 -0
  31. package/bin/gxpm-update-check +165 -0
  32. package/commands/build.md +40 -0
  33. package/commands/help.md +53 -0
  34. package/commands/plan.md +34 -0
  35. package/commands/refine.md +46 -0
  36. package/commands/review.md +34 -0
  37. package/commands/ship.md +37 -0
  38. package/core/ac-check.ts +20 -0
  39. package/core/agent-runtime.ts +363 -0
  40. package/core/artifact-validator.ts +151 -0
  41. package/core/artifacts.ts +313 -0
  42. package/core/autopilot.ts +250 -0
  43. package/core/capabilities.ts +779 -0
  44. package/core/checkpoint.ts +370 -0
  45. package/core/cleanup.ts +32 -0
  46. package/core/command-probe.ts +82 -0
  47. package/core/config.ts +533 -0
  48. package/core/contracts/behavior-spec.schema.ts +38 -0
  49. package/core/contracts/converter.ts +61 -0
  50. package/core/contracts/host.ts +43 -0
  51. package/core/converters/converter.ts +93 -0
  52. package/core/converters/index.ts +8 -0
  53. package/core/converters/managed-artifact.ts +119 -0
  54. package/core/converters/parser.ts +159 -0
  55. package/core/converters/template-renderer.ts +35 -0
  56. package/core/converters/writer.ts +61 -0
  57. package/core/dag-executor.ts +426 -0
  58. package/core/dag-loader.ts +292 -0
  59. package/core/dag-schemas.ts +150 -0
  60. package/core/dispatch.ts +125 -0
  61. package/core/evidence.ts +148 -0
  62. package/core/gate.ts +269 -0
  63. package/core/hook-engine.ts +566 -0
  64. package/core/host-probe.ts +64 -0
  65. package/core/implement.ts +16 -0
  66. package/core/isolation-errors.ts +174 -0
  67. package/core/isolation-resolver.ts +921 -0
  68. package/core/issue-context.ts +381 -0
  69. package/core/issue-readiness.ts +457 -0
  70. package/core/issue-sync.ts +427 -0
  71. package/core/issues.ts +132 -0
  72. package/core/land.ts +108 -0
  73. package/core/orchestrator.ts +54 -0
  74. package/core/phase-artifact.ts +32 -0
  75. package/core/phase-gates.ts +130 -0
  76. package/core/phase-rewind.ts +94 -0
  77. package/core/plan-lint.ts +61 -0
  78. package/core/plan.ts +77 -0
  79. package/core/port-allocation.ts +50 -0
  80. package/core/pr-check.ts +15 -0
  81. package/core/preset-system/preset-resolver.ts +221 -0
  82. package/core/project-init-status.ts +127 -0
  83. package/core/qa.ts +15 -0
  84. package/core/resilience.ts +165 -0
  85. package/core/runs.ts +288 -0
  86. package/core/safe-path.test.ts +80 -0
  87. package/core/safe-path.ts +60 -0
  88. package/core/sdd-gate.test.ts +98 -0
  89. package/core/sdd-gate.ts +134 -0
  90. package/core/self-review.ts +62 -0
  91. package/core/session.ts +70 -0
  92. package/core/ship.ts +86 -0
  93. package/core/specify.ts +173 -0
  94. package/core/state.ts +1002 -0
  95. package/core/template-engine.ts +152 -0
  96. package/core/template-resolver.test.ts +70 -0
  97. package/core/template-resolver.ts +156 -0
  98. package/core/triage.ts +26 -0
  99. package/core/verify.ts +15 -0
  100. package/core/wiki-native.ts +2423 -0
  101. package/core/wiki.ts +27 -0
  102. package/core/workflow-event-emitter.ts +163 -0
  103. package/core/workflows/engine.ts +273 -0
  104. package/core/workflows/expressions.ts +76 -0
  105. package/core/workflows/index.ts +38 -0
  106. package/core/workflows/steps/command.ts +43 -0
  107. package/core/workflows/steps/gate.ts +47 -0
  108. package/core/workflows/steps/gxpm.ts +44 -0
  109. package/core/workflows/steps/linear.ts +31 -0
  110. package/core/workflows/steps/shell.ts +65 -0
  111. package/core/workflows/types.ts +62 -0
  112. package/core/workspace-runtime.ts +227 -0
  113. package/core/worktree-init-steps.ts +647 -0
  114. package/core/worktree-init.ts +330 -0
  115. package/core/worktree-owner.ts +143 -0
  116. package/docs/GXPM_VERIFY.md +98 -0
  117. package/docs/INSTALL_FOR_AGENTS.md +113 -0
  118. package/docs/README.md +57 -0
  119. package/docs/adr/adr-005-multi-platform-skill-converter.md +72 -0
  120. package/docs/agents/domain.md +30 -0
  121. package/docs/agents/issue-tracker.md +30 -0
  122. package/docs/agents/triage-labels.md +32 -0
  123. package/docs/architecture/gxpm-architecture-diagram.md +265 -0
  124. package/docs/architecture/gxpm-current-architecture.md +175 -0
  125. package/docs/architecture/gxpm-current-flow.md +278 -0
  126. package/docs/architecture/gxpm-replacement-architecture.md +211 -0
  127. package/docs/architecture/gxpm-target-architecture.md +449 -0
  128. package/docs/architecture/gxpm-v0-contract.md +311 -0
  129. package/docs/architecture/layered-workflow-boundaries.md +193 -0
  130. package/docs/architecture/preset-system.md +126 -0
  131. package/docs/architecture/scaffold-northstar.md +23 -0
  132. package/docs/brainstorms/2026-05-14-bdd-then-tdd-design.md +320 -0
  133. package/docs/brainstorms/README.md +22 -0
  134. package/docs/brainstorms/docs-knowledge-system-requirements.md +29 -0
  135. package/docs/governance/beta-skill-promotion.md +39 -0
  136. package/docs/governance/development-contract.md +144 -0
  137. package/docs/governance/gherkin-style.md +90 -0
  138. package/docs/governance/host-adapter.md +56 -0
  139. package/docs/governance/skill-authoring.md +87 -0
  140. package/docs/governance/skill-testing.md +356 -0
  141. package/docs/governance/template-authoring.md +53 -0
  142. package/docs/migrations/v0.2.md +51 -0
  143. package/docs/plans/README.md +23 -0
  144. package/docs/plans/bdd-then-tdd-plan.md +1767 -0
  145. package/docs/plans/docs-knowledge-system-plan.md +31 -0
  146. package/docs/plans/spec-kit-sdd-adoption-plan.md +305 -0
  147. package/docs/research/agents-md-best-practices.md +207 -0
  148. package/docs/research/archon-study.md +351 -0
  149. package/docs/research/claude-hooks-study.md +440 -0
  150. package/docs/research/codex-hooks-study.md +624 -0
  151. package/docs/research/everything-claude-code-study.md +252 -0
  152. package/docs/research/from-skills-to-layered-workflow.md +322 -0
  153. package/docs/research/gsd-study.md +69 -0
  154. package/docs/research/kimi-hooks-study.md +274 -0
  155. package/docs/research/mattpocock-skills-comparison.md +429 -0
  156. package/docs/research/mattpocock-skills-study.md +275 -0
  157. package/docs/research/oh-my-codex-study.md +279 -0
  158. package/docs/research/perplexity-agent-skills-design.md +168 -0
  159. package/docs/research/pmc-gstack-skill-study.md +122 -0
  160. package/docs/research/spec-kit-study.md +224 -0
  161. package/docs/research/superpowers-study.md +209 -0
  162. package/docs/roadmap/initial-roadmap.md +53 -0
  163. package/docs/solutions/README.md +45 -0
  164. package/docs/solutions/artifact-nesting-recovery.md +58 -0
  165. package/docs/solutions/session-context-restore-practice.md +67 -0
  166. package/docs/solutions/workflow/version-drift-recovery.md +49 -0
  167. package/docs/solutions/worktree-gate-recovery.md +62 -0
  168. package/docs/specs/README.md +28 -0
  169. package/docs/specs/claude.md +45 -0
  170. package/docs/specs/codex.md +44 -0
  171. package/docs/specs/cursor.md +44 -0
  172. package/hosts/adapters/claude.ts +29 -0
  173. package/hosts/adapters/codex.ts +27 -0
  174. package/hosts/adapters/cursor.ts +27 -0
  175. package/hosts/adapters/kimi.ts +27 -0
  176. package/hosts/claude.ts +23 -0
  177. package/hosts/codex.ts +26 -0
  178. package/hosts/cursor.ts +19 -0
  179. package/hosts/index.ts +33 -0
  180. package/hosts/registry.test.ts +52 -0
  181. package/hosts/registry.ts +57 -0
  182. package/hosts/schema.ts +58 -0
  183. package/package.json +52 -0
  184. package/scripts/browser.ts +185 -0
  185. package/scripts/cleanup.ts +142 -0
  186. package/scripts/commands/artifact.ts +115 -0
  187. package/scripts/commands/autopilot.ts +143 -0
  188. package/scripts/commands/capability.ts +57 -0
  189. package/scripts/commands/config.ts +69 -0
  190. package/scripts/commands/dag.ts +126 -0
  191. package/scripts/commands/feedback.ts +123 -0
  192. package/scripts/commands/gate.ts +291 -0
  193. package/scripts/commands/helpers.ts +126 -0
  194. package/scripts/commands/hook.ts +66 -0
  195. package/scripts/commands/init.ts +515 -0
  196. package/scripts/commands/issue.ts +825 -0
  197. package/scripts/commands/phase.ts +61 -0
  198. package/scripts/commands/preset.ts +159 -0
  199. package/scripts/commands/runtime.ts +199 -0
  200. package/scripts/commands/specify.ts +71 -0
  201. package/scripts/commands/upgrade.ts +243 -0
  202. package/scripts/commands/verify.ts +183 -0
  203. package/scripts/commands/wiki.ts +242 -0
  204. package/scripts/commands/workflow.ts +131 -0
  205. package/scripts/dev-skill.ts +55 -0
  206. package/scripts/discover-skills.ts +116 -0
  207. package/scripts/doctor.ts +410 -0
  208. package/scripts/dogfood-check.ts +125 -0
  209. package/scripts/eval-functional.ts +218 -0
  210. package/scripts/eval.ts +246 -0
  211. package/scripts/gen-skill-docs.ts +201 -0
  212. package/scripts/global-discover.ts +217 -0
  213. package/scripts/governance-check.ts +75 -0
  214. package/scripts/gxpm-check.ts +12 -0
  215. package/scripts/gxpm.ts +216 -0
  216. package/scripts/host-config.ts +62 -0
  217. package/scripts/install-claude-hooks.ts +138 -0
  218. package/scripts/install-codex-hooks.ts +271 -0
  219. package/scripts/install-hooks.ts +128 -0
  220. package/scripts/install-kimi-hooks.ts +92 -0
  221. package/scripts/install-skill.ts +184 -0
  222. package/scripts/phase-artifact-commands.ts +100 -0
  223. package/scripts/post-land-sync.ts +46 -0
  224. package/scripts/scaffold-check.ts +85 -0
  225. package/scripts/skill-naming-check.ts +78 -0
  226. package/scripts/skill-structure-check.ts +157 -0
  227. package/scripts/skills-lock-check.ts +60 -0
  228. package/scripts/sync-markdown-artifacts.ts +172 -0
  229. package/scripts/uninstall.ts +162 -0
  230. package/scripts/version.ts +47 -0
  231. package/scripts/wait-pr-ready.ts +407 -0
  232. package/skills/gxpm/SKILL.md +485 -0
  233. package/skills/gxpm/SKILL.md.tmpl +422 -0
  234. package/skills/gxpm/references/CANON.md +53 -0
  235. package/skills/gxpm/references/key-rules.md +130 -0
  236. package/skills/gxpm-architecture/SKILL.md +106 -0
  237. package/skills/gxpm-architecture/references/DEEPENING.md +37 -0
  238. package/skills/gxpm-architecture/references/INTERFACE-DESIGN.md +44 -0
  239. package/skills/gxpm-autopilot/SKILL.md +116 -0
  240. package/skills/gxpm-autopilot/SKILL.md.tmpl +107 -0
  241. package/skills/gxpm-browser/SKILL.md +105 -0
  242. package/skills/gxpm-browser/SKILL.md.tmpl +41 -0
  243. package/skills/gxpm-browser/references/commands.md +43 -0
  244. package/skills/gxpm-browser/references/evidence-path.md +20 -0
  245. package/skills/gxpm-build/SKILL.md +78 -0
  246. package/skills/gxpm-cleanup/SKILL.md +76 -0
  247. package/skills/gxpm-debug-issue/SKILL.md +39 -0
  248. package/skills/gxpm-diagnose/SKILL.md +220 -0
  249. package/skills/gxpm-diagnose/SKILL.md.tmpl +31 -0
  250. package/skills/gxpm-diagnose/references/feedback-loop.md +34 -0
  251. package/skills/gxpm-diagnose/references/feedback-loops.md +43 -0
  252. package/skills/gxpm-diagnose/references/phases.md +60 -0
  253. package/skills/gxpm-eval/SKILL.md +78 -0
  254. package/skills/gxpm-explore-codebase/SKILL.md +36 -0
  255. package/skills/gxpm-explore-codebase/scripts/summarize-communities.ts +51 -0
  256. package/skills/gxpm-feedback/SKILL.md +122 -0
  257. package/skills/gxpm-grill/SKILL.md +159 -0
  258. package/skills/gxpm-grill/SKILL.md.tmpl +77 -0
  259. package/skills/gxpm-grill/references/documentation-templates.md +56 -0
  260. package/skills/gxpm-grill/references/process.md +25 -0
  261. package/skills/gxpm-handoff/SKILL.md +112 -0
  262. package/skills/gxpm-hygiene/SKILL.md +69 -0
  263. package/skills/gxpm-implementer/SKILL.md +142 -0
  264. package/skills/gxpm-implementer/SKILL.md.tmpl +141 -0
  265. package/skills/gxpm-linear/SKILL.md +282 -0
  266. package/skills/gxpm-linear/SKILL.md.tmpl +86 -0
  267. package/skills/gxpm-linear/references/commands.md +75 -0
  268. package/skills/gxpm-linear/references/workflows.md +120 -0
  269. package/skills/gxpm-planning/SKILL.md +134 -0
  270. package/skills/gxpm-prototype/SKILL.md +64 -0
  271. package/skills/gxpm-refactor-safely/SKILL.md +62 -0
  272. package/skills/gxpm-review-army/SKILL.md +117 -0
  273. package/skills/gxpm-review-changes/SKILL.md +36 -0
  274. package/skills/gxpm-setup/SKILL.md +101 -0
  275. package/skills/gxpm-specifier/SKILL.md +135 -0
  276. package/skills/gxpm-tdd/SKILL.md +187 -0
  277. package/skills/gxpm-tdd/references/interface-design.md +23 -0
  278. package/skills/gxpm-tdd/references/mocking.md +27 -0
  279. package/skills/gxpm-tdd/references/red-green-refactor.md +61 -0
  280. package/skills/gxpm-tdd/references/troubleshooting.md +28 -0
  281. package/skills/gxpm-tdd/references/workflow.md +50 -0
  282. package/skills/gxpm-tdd/testing-anti-patterns.tmpl +304 -0
  283. package/skills/gxpm-triage/SKILL.md +160 -0
  284. package/skills/gxpm-verify/SKILL.md +107 -0
  285. package/skills/gxpm-write-skill/SKILL.md +131 -0
  286. package/skills/gxpm-zoom-out/SKILL.md +69 -0
  287. package/skills/maintain-hygiene-skills-lock/SKILL.md +54 -0
  288. package/skills/maintain-hygiene-skills-lock/SKILL.md.tmpl +53 -0
  289. package/templates/constitution-template.md +63 -0
  290. package/templates/hooks/gxpm-commit-msg +16 -0
  291. package/templates/hooks/gxpm-post-checkout +19 -0
  292. package/templates/hooks/gxpm-post-commit +7 -0
  293. package/templates/hooks/gxpm-post-merge +29 -0
  294. package/templates/hooks/gxpm-pre-commit +39 -0
  295. package/templates/hooks/gxpm-pre-push +33 -0
  296. package/templates/plan-template.md.tmpl +46 -0
  297. package/templates/spec-template.md.tmpl +63 -0
  298. package/templates/specify-stub.tmpl +22 -0
  299. package/templates/tasks-template.md.tmpl +32 -0
@@ -0,0 +1,304 @@
1
+ ---
2
+ name: testing-anti-patterns
3
+ description: Reference for 5 common testing anti-patterns and their gate functions. Load when writing or changing tests, adding mocks, or tempted to add test-only methods to production code.
4
+ ---
5
+
6
+ # Testing Anti-Patterns
7
+
8
+ **Load this reference when:** writing or changing tests, adding mocks, or tempted to add test-only methods to production code.
9
+
10
+ ## Overview
11
+
12
+ Tests must verify real behavior, not mock behavior. Mocks are a means to isolate, not the thing being tested.
13
+
14
+ **Core principle:** Test what the code does, not what the mocks do.
15
+
16
+ **Following strict TDD prevents these anti-patterns.**
17
+
18
+ ## The Iron Laws
19
+
20
+ ```
21
+ 1. NEVER test mock behavior
22
+ 2. NEVER add test-only methods to production classes
23
+ 3. NEVER mock without understanding dependencies
24
+ ```
25
+
26
+ ## Anti-Pattern 1: Testing Mock Behavior
27
+
28
+ **The violation:**
29
+ ```typescript
30
+ // ❌ BAD: Testing that the mock exists
31
+ test('renders sidebar', () => {
32
+ render(<Page />);
33
+ expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
34
+ });
35
+ ```
36
+
37
+ **Why this is wrong:**
38
+ - You're verifying the mock works, not that the component works
39
+ - Test passes when mock is present, fails when it's not
40
+ - Tells you nothing about real behavior
41
+
42
+ **your human partner's correction:** "Are we testing the behavior of a mock?"
43
+
44
+ **The fix:**
45
+ ```typescript
46
+ // ✅ GOOD: Test real component or don't mock it
47
+ test('renders sidebar', () => {
48
+ render(<Page />); // Don't mock sidebar
49
+ expect(screen.getByRole('navigation')).toBeInTheDocument();
50
+ });
51
+
52
+ // OR if sidebar must be mocked for isolation:
53
+ // Don't assert on the mock - test Page's behavior with sidebar present
54
+ ```
55
+
56
+ ### Gate Function
57
+
58
+ ```
59
+ BEFORE asserting on any mock element:
60
+ Ask: "Am I testing real component behavior or just mock existence?"
61
+
62
+ IF testing mock existence:
63
+ STOP - Delete the assertion or unmock the component
64
+
65
+ Test real behavior instead
66
+ ```
67
+
68
+ ## Anti-Pattern 2: Test-Only Methods in Production
69
+
70
+ **The violation:**
71
+ ```typescript
72
+ // ❌ BAD: destroy() only used in tests
73
+ class Session {
74
+ async destroy() { // Looks like production API!
75
+ await this._workspaceManager?.destroyWorkspace(this.id);
76
+ // ... cleanup
77
+ }
78
+ }
79
+
80
+ // In tests
81
+ afterEach(() => session.destroy());
82
+ ```
83
+
84
+ **Why this is wrong:**
85
+ - Production class polluted with test-only code
86
+ - Dangerous if accidentally called in production
87
+ - Violates YAGNI and separation of concerns
88
+ - Confuses object lifecycle with entity lifecycle
89
+
90
+ **The fix:**
91
+ ```typescript
92
+ // ✅ GOOD: Test utilities handle test cleanup
93
+ // Session has no destroy() - it's stateless in production
94
+
95
+ // In test-utils/
96
+ export async function cleanupSession(session: Session) {
97
+ const workspace = session.getWorkspaceInfo();
98
+ if (workspace) {
99
+ await workspaceManager.destroyWorkspace(workspace.id);
100
+ }
101
+ }
102
+
103
+ // In tests
104
+ afterEach(() => cleanupSession(session));
105
+ ```
106
+
107
+ ### Gate Function
108
+
109
+ ```
110
+ BEFORE adding any method to production class:
111
+ Ask: "Is this only used by tests?"
112
+
113
+ IF yes:
114
+ STOP - Don't add it
115
+ Put it in test utilities instead
116
+
117
+ Ask: "Does this class own this resource's lifecycle?"
118
+
119
+ IF no:
120
+ STOP - Wrong class for this method
121
+ ```
122
+
123
+ ## Anti-Pattern 3: Mocking Without Understanding
124
+
125
+ **The violation:**
126
+ ```typescript
127
+ // ❌ BAD: Mock breaks test logic
128
+ test('detects duplicate server', () => {
129
+ // Mock prevents config write that test depends on!
130
+ vi.mock('ToolCatalog', () => ({
131
+ discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
132
+ }));
133
+
134
+ await addServer(config);
135
+ await addServer(config); // Should throw - but won't!
136
+ });
137
+ ```
138
+
139
+ **Why this is wrong:**
140
+ - Mocked method had side effect test depended on (writing config)
141
+ - Over-mocking to "be safe" breaks actual behavior
142
+ - Test passes for wrong reason or fails mysteriously
143
+
144
+ **The fix:**
145
+ ```typescript
146
+ // ✅ GOOD: Mock at correct level
147
+ test('detects duplicate server', () => {
148
+ // Mock the slow part, preserve behavior test needs
149
+ vi.mock('MCPServerManager'); // Just mock slow server startup
150
+
151
+ await addServer(config); // Config written
152
+ await addServer(config); // Duplicate detected ✓
153
+ });
154
+ ```
155
+
156
+ ### Gate Function
157
+
158
+ ```
159
+ BEFORE mocking any method:
160
+ STOP - Don't mock yet
161
+
162
+ 1. Ask: "What side effects does the real method have?"
163
+ 2. Ask: "Does this test depend on any of those side effects?"
164
+ 3. Ask: "Do I fully understand what this test needs?"
165
+
166
+ IF depends on side effects:
167
+ Mock at lower level (the actual slow/external operation)
168
+ OR use test doubles that preserve necessary behavior
169
+ NOT the high-level method the test depends on
170
+
171
+ IF unsure what test depends on:
172
+ Run test with real implementation FIRST
173
+ Observe what actually needs to happen
174
+ THEN add minimal mocking at the right level
175
+
176
+ Red flags:
177
+ - "I'll mock this to be safe"
178
+ - "This might be slow, better mock it"
179
+ - Mocking without understanding the dependency chain
180
+ ```
181
+
182
+ ## Anti-Pattern 4: Incomplete Mocks
183
+
184
+ **The violation:**
185
+ ```typescript
186
+ // ❌ BAD: Partial mock - only fields you think you need
187
+ const mockResponse = {
188
+ status: 'success',
189
+ data: { userId: '123', name: 'Alice' }
190
+ // Missing: metadata that downstream code uses
191
+ };
192
+
193
+ // Later: breaks when code accesses response.metadata.requestId
194
+ ```
195
+
196
+ **Why this is wrong:**
197
+ - **Partial mocks hide structural assumptions** - You only mocked fields you know about
198
+ - **Downstream code may depend on fields you didn't include** - Silent failures
199
+ - **Tests pass but integration fails** - Mock incomplete, real API complete
200
+ - **False confidence** - Test proves nothing about real behavior
201
+
202
+ **The Iron Rule:** Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses.
203
+
204
+ **The fix:**
205
+ ```typescript
206
+ // ✅ GOOD: Mirror real API completeness
207
+ const mockResponse = {
208
+ status: 'success',
209
+ data: { userId: '123', name: 'Alice' },
210
+ metadata: { requestId: 'req-789', timestamp: 1234567890 }
211
+ // All fields real API returns
212
+ };
213
+ ```
214
+
215
+ ### Gate Function
216
+
217
+ ```
218
+ BEFORE creating mock responses:
219
+ Check: "What fields does the real API response contain?"
220
+
221
+ Actions:
222
+ 1. Examine actual API response from docs/examples
223
+ 2. Include ALL fields system might consume downstream
224
+ 3. Verify mock matches real response schema completely
225
+
226
+ Critical:
227
+ If you're creating a mock, you must understand the ENTIRE structure
228
+ Partial mocks fail silently when code depends on omitted fields
229
+
230
+ If uncertain: Include all documented fields
231
+ ```
232
+
233
+ ## Anti-Pattern 5: Integration Tests as Afterthought
234
+
235
+ **The violation:**
236
+ ```
237
+ ✅ Implementation complete
238
+ ❌ No tests written
239
+ "Ready for testing"
240
+ ```
241
+
242
+ **Why this is wrong:**
243
+ - Testing is part of implementation, not optional follow-up
244
+ - TDD would have caught this
245
+ - Can't claim complete without tests
246
+
247
+ **The fix:**
248
+ ```
249
+ TDD cycle:
250
+ 1. Write failing test
251
+ 2. Implement to pass
252
+ 3. Refactor
253
+ 4. THEN claim complete
254
+ ```
255
+
256
+ ## When Mocks Become Too Complex
257
+
258
+ **Warning signs:**
259
+ - Mock setup longer than test logic
260
+ - Mocking everything to make test pass
261
+ - Mocks missing methods real components have
262
+ - Test breaks when mock changes
263
+
264
+ **your human partner's question:** "Do we need to be using a mock here?"
265
+
266
+ **Consider:** Integration tests with real components often simpler than complex mocks
267
+
268
+ ## TDD Prevents These Anti-Patterns
269
+
270
+ **Why TDD helps:**
271
+ 1. **Write test first** → Forces you to think about what you're actually testing
272
+ 2. **Watch it fail** → Confirms test tests real behavior, not mocks
273
+ 3. **Minimal implementation** → No test-only methods creep in
274
+ 4. **Real dependencies** → You see what the test actually needs before mocking
275
+
276
+ **If you're testing mock behavior, you violated TDD** - you added mocks without watching test fail against real code first.
277
+
278
+ ## Quick Reference
279
+
280
+ | Anti-Pattern | Fix |
281
+ |--------------|-----|
282
+ | Assert on mock elements | Test real component or unmock it |
283
+ | Test-only methods in production | Move to test utilities |
284
+ | Mock without understanding | Understand dependencies first, mock minimally |
285
+ | Incomplete mocks | Mirror real API completely |
286
+ | Tests as afterthought | TDD - tests first |
287
+ | Over-complex mocks | Consider integration tests |
288
+
289
+ ## Red Flags
290
+
291
+ - Assertion checks for `*-mock` test IDs
292
+ - Methods only called in test files
293
+ - Mock setup is >50% of test
294
+ - Test fails when you remove mock
295
+ - Can't explain why mock is needed
296
+ - Mocking "just to be safe"
297
+
298
+ ## The Bottom Line
299
+
300
+ **Mocks are tools to isolate, not things to test.**
301
+
302
+ If TDD reveals you're testing mock behavior, you've gone wrong.
303
+
304
+ Fix: Test real behavior or question why you're mocking at all.
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: gxpm-triage
3
+ description: Triage issues through a state machine of triage roles. Use when user wants to create an issue, review incoming bugs or feature requests, prepare issues for an AFK agent, or manage issue workflow.
4
+ ---
5
+
6
+ # Triage
7
+
8
+ Move issues through a small state machine of triage roles.
9
+
10
+ ## 入口条件
11
+
12
+ **何时触发**
13
+ - 用户想创建 issue。
14
+ - 用户要求 review incoming bugs 或 feature requests。
15
+ - 用户需要 prepare issues for an AFK agent。
16
+ - 用户需要 manage issue workflow(查看待分类、待处理的内容)。
17
+ - 从 `plan` 回退或新信息到达时,需要重新评估 issue 状态。
18
+
19
+ **前置条件**
20
+ - Issue body 或 bug report 已存在;或用户已提供足够信息创建新 issue。
21
+
22
+ **Skill 边界(什么情况下应该加载别的 skill)**
23
+ - 需求/范围需要深入对齐 → `/gxpm-grill`
24
+ - 需要代码调试定位根因 → `/gxpm-debug-issue`
25
+ - 需要产出实现计划或 PRD → `/gxpm-planning`
26
+ - 需要自动驾驶全流程 → `/gxpm-autopilot`
27
+
28
+ ## 可操作流程
29
+
30
+ ### 角色定义
31
+
32
+ Two **category** roles:
33
+ - `bug` — something is broken
34
+ - `enhancement` — new feature or improvement
35
+
36
+ Five **state** roles:
37
+ - `needs-triage` — maintainer needs to evaluate
38
+ - `needs-info` — waiting on reporter for more information
39
+ - `ready-for-agent` — fully specified, ready for an AFK agent
40
+ - `ready-for-human` — needs human implementation
41
+ - `wontfix` — will not be actioned
42
+
43
+ Every triaged issue should carry exactly one category role and one state role.
44
+
45
+ ### 1. Show what needs attention
46
+
47
+ Query the issue tracker and present three buckets, oldest first:
48
+
49
+ 1. **Unlabeled** — never triaged.
50
+ 2. **`needs-triage`** — evaluation in progress.
51
+ 3. **`needs-info` with reporter activity since last triage notes** — needs re-evaluation.
52
+
53
+ Show counts and a one-line summary per issue.
54
+
55
+ ### 2. Triage a specific issue
56
+
57
+ 1. **Gather context.** Read the full issue (body, comments, labels, reporter, dates). Parse prior triage notes. Explore the codebase. Read `.gxpm/out-of-scope/` (if exists) and surface any prior rejection that resembles this issue.
58
+
59
+ 2. **Recommend.** Tell the maintainer your category and state recommendation with reasoning, plus a brief codebase summary.
60
+
61
+ 3. **Reproduce (bugs only).** Before grilling, attempt reproduction. Report what happened — successful repro, failed repro, or insufficient detail (a strong `needs-info` signal).
62
+
63
+ 4. **Grill (if needed).** If the issue needs fleshing out, run `/gxpm-grill`.
64
+
65
+ 5. **Apply the outcome:**
66
+ - **No exceptions:** category + state must both be assigned. Never leave an issue with only one dimension filled.
67
+ - `ready-for-agent` — write an agent brief.
68
+ - `ready-for-human` — same structure as agent brief, but note why it can't be delegated.
69
+ - `needs-info` — post triage notes.
70
+ - `wontfix` (bug) — polite explanation, then close.
71
+ - `wontfix` (enhancement) — write to `.gxpm/out-of-scope/`, link from comment, then close.
72
+
73
+ #### Agent brief format
74
+
75
+ ```markdown
76
+ > *This was generated by AI during triage.*
77
+
78
+ ## What to build
79
+ Concise description.
80
+
81
+ ## Acceptance criteria
82
+ - [ ] Criterion 1
83
+ - [ ] Criterion 2
84
+
85
+ ## Key constraints
86
+ - Constraint 1
87
+ - Constraint 2
88
+
89
+ ## Relevant code areas
90
+ - File/path 1
91
+ - File/path 2
92
+ ```
93
+
94
+ #### Needs-info template
95
+
96
+ ```markdown
97
+ > *This was generated by AI during triage.*
98
+
99
+ ## Triage Notes
100
+
101
+ **What we've established so far:**
102
+ - point 1
103
+ - point 2
104
+
105
+ **What we still need from you (@reporter):**
106
+ - question 1
107
+ - question 2
108
+ ```
109
+
110
+ ### gxpm integration
111
+
112
+ - gxpm's `triage` phase initializes the `acceptance-contract` artifact.
113
+ - During triage, if the issue is a bug, the `acceptance-contract` must include a `reproduction` field:
114
+ - Test command that reproduces the bug, OR
115
+ - Steps to reproduce, OR
116
+ - "Could not reproduce — insufficient detail"
117
+ - The `acceptance-contract` should include a `triageRole` field:
118
+ - `needs-info` / `ready-for-agent` / `ready-for-human` / `wontfix`
119
+ - Use `gxpm issue create --auto-id` for new issues; use `gxpm issue transition` to move through phases.
120
+ - Out-of-scope knowledge lives under `.gxpm/out-of-scope/<topic>.md`.
121
+
122
+ ## 红旗清单 / 反模式
123
+
124
+ - **STOP:没有 reproduction,就没有 `ready-for-agent`。** A bug without a reproduction attempt or clear "could not reproduce — insufficient detail" note must NOT be marked `ready-for-agent`.
125
+ - **STOP:范围蔓延。** If the issue grows beyond its original description during triage, stop and ask the user to split it before assigning a state role.
126
+ - **STOP:冲突的 triage roles。** If an issue carries more than one category role or more than one state role, reset to `needs-triage` and fix immediately.
127
+ - **STOP:绕过 `needs-info`。** Never guess a category or state when information is insufficient. Default to `needs-info`.
128
+ - **STOP:绝不只分配一个维度。** category + state 必须同时分配;禁止只填其一。
129
+ - **危险信号:** "The bug is obvious, no need to reproduce." → Obvious bugs are the most dangerous to skip. Reproduction validates assumptions and provides the acceptance-contract entry.
130
+ - **危险信号:** "The reporter is trusted, mark it ready-for-agent." → **No exceptions.** Every bug needs reproduction or a clear `needs-info` path, regardless of who reported it.
131
+ - **危险信号:** "I'll just add both category roles to be safe." → Exactly one category role. Adding both destroys the state machine and makes routing impossible.
132
+ - **危险信号:** "The user seems impatient, I'll skip grilling." → Skipping grilling when scope is unclear produces `ready-for-agent` issues that fail at `ac-check`.
133
+
134
+ **Foundational Principle:** Violating the letter of the rules is violating the spirit of the rules. The triage state machine exists to protect downstream phases from garbage-in-garbage-out. Every shortcut at triage becomes a blocker at `implement`, `local-verify`, or `land`. Discipline here is kindness to the future agent.
135
+
136
+ ## 验证清单 / 出口条件
137
+
138
+ - [ ] 每个 issue 恰好一个 category role 和一个 state role。
139
+ - [ ] Bug 必须有 reproduction(test command / steps / "Could not reproduce — insufficient detail")。
140
+ - [ ] `acceptance-contract` artifact 已初始化,含 `triageRole` 字段。
141
+ - [ ] `ready-for-agent` 已输出 agent brief(What to build / Acceptance criteria / Key constraints / Relevant code areas)。
142
+ - [ ] `ready-for-human` 已说明为什么不能委托给 agent。
143
+ - [ ] `needs-info` 已输出 triage notes(已建立的事实 + 仍需 reporter 提供的信息)。
144
+ - [ ] `wontfix` (bug) 已有 polite explanation 并关闭。
145
+ - [ ] `wontfix` (enhancement) 已写入 `.gxpm/out-of-scope/` 并关闭。
146
+
147
+ **失败时路由**
148
+ - Scope 不清或术语漂移 → `/gxpm-grill`
149
+ - 需要代码定位或根因分析 → `/gxpm-debug-issue`
150
+ - 已 ready-for-agent 需要实现计划 → `/gxpm-planning`
151
+
152
+ ## 常见说辞表
153
+
154
+ | 用户 utterance / 借口 | 推荐回应 |
155
+ |-----------------------|----------|
156
+ | "这个 bug 很明显,不用复现。" | "明显的 bug 跳过复现最危险。复现能验证假设,也是验收契约的入口。请先尝试复现。" |
157
+ | "报告者很可信,直接 ready-for-agent 吧。" | "没有例外。每个 bug 都需要复现或清晰的 needs-info 路径,无论谁报告的。" |
158
+ | "我把两个 category 都加上以防万一。" | "只能选一个 category role。选两个会破坏状态机,导致路由失败。请根据问题本质选一个。" |
159
+ | "用户好像很急,我就不 grill 了。" | "scope 不清时跳过 grilling,会导致 ready-for-agent 的 issue 在 ac-check 阶段失败。建议先用 /gxpm-grill 对齐。" |
160
+ | "帮我看看有哪些 issue 需要处理。" | 展示 Unlabeled / needs-triage / needs-info with reporter activity 三个 bucket。 |
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: gxpm-verify
3
+ description: Local verification pipeline execution and evidence collection. Use when transitioning from implement to local-verify, or when running the full verification suite for an issue.
4
+ ---
5
+
6
+ # gxpm-verify
7
+
8
+ ## 入口条件
9
+
10
+ 在以下场景触发本 skill:
11
+
12
+ - `implement` 阶段完成,即将过渡到 `local-verify`
13
+ - 需要为某个 issue 运行完整验证套件
14
+ - 需要收集验证证据以推进工作流
15
+
16
+ `local-verify` artifact 不完整时禁止进入 `ac-check`。
17
+
18
+ ## 可操作流程
19
+
20
+ ### 验证流水线
21
+
22
+ 按成本升序执行。**遇到第一个失败即停止。**
23
+
24
+ ```
25
+ Step 1: git diff --check (free — whitespace violations)
26
+ Step 2: bun run check (fast — static analysis + typecheck)
27
+ Step 3: bun test (medium — unit + integration tests)
28
+ Step 4: bun run build (medium — compilation verification)
29
+ ```
30
+
31
+ 只运行与变更相关的步骤:
32
+ - Pure test changes: Steps 1–3 are sufficient.
33
+ - Build config or type changes: All 4 steps required.
34
+ - Documentation only: Step 1 only.
35
+
36
+ ### 证据收集
37
+
38
+ 每步完成后记录:
39
+
40
+ ```json
41
+ {
42
+ "verificationSteps": [
43
+ {
44
+ "step": "git-diff-check",
45
+ "command": "git diff --check",
46
+ "exitCode": 0,
47
+ "durationMs": 120,
48
+ "summary": "no whitespace errors"
49
+ },
50
+ {
51
+ "step": "typecheck",
52
+ "command": "bun run check",
53
+ "exitCode": 0,
54
+ "durationMs": 1200,
55
+ "summary": "42 files checked, 0 errors"
56
+ },
57
+ {
58
+ "step": "test",
59
+ "command": "bun test",
60
+ "exitCode": 0,
61
+ "durationMs": 4500,
62
+ "summary": "156 passed, 0 failed"
63
+ },
64
+ {
65
+ "step": "build",
66
+ "command": "bun run build",
67
+ "exitCode": 0,
68
+ "durationMs": 2800,
69
+ "summary": "build succeeded"
70
+ }
71
+ ]
72
+ }
73
+ ```
74
+
75
+ ### 失败时的 Skill 路由
76
+
77
+ 某一步失败时,加载对应 skill 修复,禁止盲目修复:
78
+
79
+ | Failed step | Root cause likely | Load this skill |
80
+ |-------------|-------------------|-----------------|
81
+ | `git diff --check` | Whitespace / trailing space | Fix directly, re-run from Step 1 |
82
+ | `bun run check` | Type error, syntax error, lint violation | `/gxpm-build` |
83
+ | `bun test` | Test failure, regression, missing coverage | `/gxpm-tdd` |
84
+ | `bun run build` | Build script error, dependency issue | `/gxpm-build` |
85
+
86
+ **Do not fix blindly.** Load the relevant skill, follow its discipline, then re-run the full pipeline from Step 1.
87
+
88
+ ## 红旗清单 / 反模式
89
+
90
+ - **No skips.** Every relevant step must execute and pass.
91
+ - **Evidence before transition.** `local-verify` artifact is incomplete without `verificationSteps`.
92
+ - **Re-run discipline:** Only re-run a step if the code has changed since the last run. Re-running on unchanged code adds no information.
93
+
94
+ ## 验证清单 / 出口条件
95
+
96
+ 完成 `local-verify` 必须满足:
97
+
98
+ - [ ] 所有相关步骤均已执行且通过(exit code 0)
99
+ - [ ] `local-verify` artifact 包含完整的 `verificationSteps` 数组
100
+ - [ ] 每步记录包含:step 名称、command、exitCode、durationMs、summary
101
+ - [ ] 如某步失败,已加载对应 skill 修复并重新运行完整流水线
102
+ - [ ] 代码自上次运行后如有变更,已重新执行全部相关步骤
103
+
104
+ 在 gxpm 工作流中:
105
+ - 在 `implement → local-verify` 过渡时加载本 skill
106
+ - `local-verify` artifact 必须包含 `verificationSteps` 后才能推进到 `ac-check`
107
+ - 任何步骤失败,修复后必须从 Step 1 重新运行完整流水线
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: gxpm-write-skill
3
+ description: Create new gxpm skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.
4
+ ---
5
+
6
+ # Write a Skill
7
+
8
+ Create new agent skills that follow gxpm conventions.
9
+
10
+ ## 入口条件
11
+
12
+ **何时触发**
13
+ - 用户说 "create a skill"、"write a skill"、"new skill"。
14
+ - 需要为 gxpm 生态添加新能力。
15
+ - 需要审核或改进现有 skill 的结构。
16
+
17
+ **Skill 边界**
18
+ - 需要 skill 质量评估 → `/gxpm-eval`
19
+ - 需要更新 skills-lock → `/maintain-hygiene-skills-lock`
20
+
21
+ ## 可操作流程
22
+
23
+ ### 1. Gather requirements
24
+
25
+ Ask the user:
26
+
27
+ - What task/domain does the skill cover?
28
+ - What specific use cases should it handle?
29
+ - Does it need executable scripts or just instructions?
30
+ - Any reference materials to include?
31
+
32
+ ### 2. Draft the skill
33
+
34
+ Create:
35
+
36
+ ```
37
+ skill-name/
38
+ ├── SKILL.md # Main instructions (required)
39
+ ├── references/ # Detailed docs (if needed)
40
+ │ └── topic.md
41
+ └── scripts/ # Utility scripts (if needed)
42
+ └── helper.ts
43
+ ```
44
+
45
+ ### 3. SKILL.md structure
46
+
47
+ ```md
48
+ ---
49
+ name: skill-name
50
+ description: Brief description. Use when [specific triggers].
51
+ ---
52
+
53
+ # Skill Name
54
+
55
+ ## 入口条件
56
+
57
+ **何时触发**
58
+ - ...
59
+
60
+ **Skill 边界(什么情况下应该加载别的 skill)**
61
+ - ...
62
+
63
+ ## 可操作流程
64
+
65
+ [Step-by-step processes]
66
+
67
+ ## 红旗清单 / 反模式
68
+
69
+ - **STOP:...**
70
+
71
+ ## 验证清单 / 出口条件
72
+
73
+ - [ ] ...
74
+
75
+ **失败时路由**
76
+ - ...
77
+ ```
78
+
79
+ ### Description rules
80
+
81
+ The description is **the only thing your agent sees** when deciding which skill to load.
82
+
83
+ - Max 1024 chars
84
+ - Third person
85
+ - First sentence: what it does
86
+ - Second sentence: "Use when [specific triggers]"
87
+
88
+ **Good:**
89
+ ```
90
+ Move issues through a state machine of triage roles. Use when user wants to create, review, or route issues.
91
+ ```
92
+
93
+ **Bad:**
94
+ ```
95
+ Helps with issues.
96
+ ```
97
+
98
+ ### When to split files
99
+
100
+ Split into `references/` when:
101
+
102
+ - SKILL.md exceeds 120 lines
103
+ - Content has distinct domains (finance vs sales schemas)
104
+ - Advanced features are rarely needed
105
+
106
+ ### When to add scripts
107
+
108
+ Add utility scripts when:
109
+
110
+ - Operation is deterministic (validation, formatting)
111
+ - Same code would be generated repeatedly
112
+ - Errors need explicit handling
113
+
114
+ ## 红旗清单 / 反模式
115
+
116
+ - **STOP:description 超过 1024 字符。** Agent 的上下文有限,过长的 description 降低匹配精度。
117
+ - **STOP:没有 "Use when" 触发句。** Agent 无法判断何时加载该 skill。
118
+ - **STOP:SKILL.md 超过 200 行还不拆分。** 使用 `references/` 子文件做渐进式披露。
119
+ - **STOP:缺少红旗清单或验证清单。** 每个 gxpm skill 必须包含这四个核心 section。
120
+
121
+ ## 验证清单 / 出口条件
122
+
123
+ - [ ] Description ≤ 1024 chars,包含 "Use when..." 触发句。
124
+ - [ ] SKILL.md 包含:入口条件、可操作流程、红旗清单、验证清单。
125
+ - [ ] 如超过 120 行,已拆分为 `references/` 子文件。
126
+ - [ ] 术语与 `CONTEXT.md` 一致。
127
+ - [ ] 运行 `bun run check` 通过(skills-lock hash 已更新)。
128
+
129
+ **失败时路由**
130
+ - Skill 质量评估 → `/gxpm-eval`
131
+ - 需要更新 skills-lock → `/maintain-hygiene-skills-lock`