zcode-expert-system 0.0.0-stage → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (457) hide show
  1. package/.zcode-plugin/plugin.json +25 -0
  2. package/LICENSE +30 -0
  3. package/README.md +680 -2
  4. package/README_CN.md +587 -0
  5. package/SKILL.md +357 -0
  6. package/agents/expert-academic-anthropologist.md +124 -0
  7. package/agents/expert-academic-geographer.md +126 -0
  8. package/agents/expert-academic-historian.md +122 -0
  9. package/agents/expert-academic-narratologist.md +117 -0
  10. package/agents/expert-academic-psychologist.md +117 -0
  11. package/agents/expert-academic-statistician.md +40 -0
  12. package/agents/expert-academic-study-planner.md +262 -0
  13. package/agents/expert-accounts-payable-agent.md +102 -0
  14. package/agents/expert-agentic-identity-trust.md +388 -0
  15. package/agents/expert-agents-orchestrator.md +366 -0
  16. package/agents/expert-authenticity-appraiser.md +38 -0
  17. package/agents/expert-automation-governance-architect.md +215 -0
  18. package/agents/expert-blender-addon-engineer.md +233 -0
  19. package/agents/expert-business-strategist.md +487 -0
  20. package/agents/expert-change-management-consultant.md +495 -0
  21. package/agents/expert-chief-executive-officer.md +104 -0
  22. package/agents/expert-chief-financial-officer.md +390 -0
  23. package/agents/expert-chief-marketing-officer.md +95 -0
  24. package/agents/expert-chief-of-staff.md +278 -0
  25. package/agents/expert-chief-operating-officer.md +88 -0
  26. package/agents/expert-chief-product-officer.md +91 -0
  27. package/agents/expert-chief-technology-officer.md +98 -0
  28. package/agents/expert-corporate-training-designer.md +191 -0
  29. package/agents/expert-customer-service.md +40 -0
  30. package/agents/expert-customer-success-manager.md +458 -0
  31. package/agents/expert-data-consolidation-agent.md +327 -0
  32. package/agents/expert-data-privacy-officer.md +411 -0
  33. package/agents/expert-design-brand-guardian.md +321 -0
  34. package/agents/expert-design-image-prompt-engineer.md +255 -0
  35. package/agents/expert-design-inclusive-visuals-specialist.md +177 -0
  36. package/agents/expert-design-persona-walkthrough.md +271 -0
  37. package/agents/expert-design-ui-designer.md +382 -0
  38. package/agents/expert-design-ui-finish-gate-reviewer.md +40 -0
  39. package/agents/expert-design-ux-architect.md +482 -0
  40. package/agents/expert-design-ux-researcher.md +328 -0
  41. package/agents/expert-design-video-prompt-engineer.md +110 -0
  42. package/agents/expert-design-visual-storyteller.md +159 -0
  43. package/agents/expert-design-whimsy-injector.md +453 -0
  44. package/agents/expert-economy-designer.md +40 -0
  45. package/agents/expert-engineering-ai-data-remediation-engineer.md +209 -0
  46. package/agents/expert-engineering-ai-engineer.md +161 -0
  47. package/agents/expert-engineering-api-platform-engineer.md +40 -0
  48. package/agents/expert-engineering-ats-validator-architect.md +38 -0
  49. package/agents/expert-engineering-autonomous-optimization-architect.md +115 -0
  50. package/agents/expert-engineering-backend-architect.md +234 -0
  51. package/agents/expert-engineering-china-network-engineer.md +33 -0
  52. package/agents/expert-engineering-cms-developer.md +534 -0
  53. package/agents/expert-engineering-code-reviewer.md +172 -0
  54. package/agents/expert-engineering-codebase-onboarding-engineer.md +172 -0
  55. package/agents/expert-engineering-data-engineer.md +324 -0
  56. package/agents/expert-engineering-data-visualization-engineer.md +40 -0
  57. package/agents/expert-engineering-database-optimizer.md +175 -0
  58. package/agents/expert-engineering-database-reliability-engineer.md +40 -0
  59. package/agents/expert-engineering-desktop-app-engineer.md +40 -0
  60. package/agents/expert-engineering-developer-tooling-engineer.md +40 -0
  61. package/agents/expert-engineering-devops-automator.md +375 -0
  62. package/agents/expert-engineering-dingtalk-integration-developer.md +574 -0
  63. package/agents/expert-engineering-drupal-performance.md +40 -0
  64. package/agents/expert-engineering-drupal-shopping-cart.md +359 -0
  65. package/agents/expert-engineering-email-intelligence-engineer.md +349 -0
  66. package/agents/expert-engineering-embedded-firmware-engineer.md +168 -0
  67. package/agents/expert-engineering-embedded-linux-driver-engineer.md +255 -0
  68. package/agents/expert-engineering-feishu-integration-developer.md +597 -0
  69. package/agents/expert-engineering-filament-optimization-specialist.md +283 -0
  70. package/agents/expert-engineering-finops-engineer.md +40 -0
  71. package/agents/expert-engineering-fpga-digital-design-engineer.md +227 -0
  72. package/agents/expert-engineering-frontend-developer.md +224 -0
  73. package/agents/expert-engineering-gaussdb-expert.md +40 -0
  74. package/agents/expert-engineering-git-workflow-master.md +220 -0
  75. package/agents/expert-engineering-i18n-engineer.md +40 -0
  76. package/agents/expert-engineering-identity-access-engineer.md +40 -0
  77. package/agents/expert-engineering-incident-response-commander.md +465 -0
  78. package/agents/expert-engineering-iot-fleet-engineer.md +40 -0
  79. package/agents/expert-engineering-iot-solution-architect.md +220 -0
  80. package/agents/expert-engineering-it-service-manager.md +560 -0
  81. package/agents/expert-engineering-knowledge-graph-engineer.md +40 -0
  82. package/agents/expert-engineering-llm-post-training-engineer.md +40 -0
  83. package/agents/expert-engineering-mechanical-design-engineer.md +311 -0
  84. package/agents/expert-engineering-minimal-change-engineer.md +206 -0
  85. package/agents/expert-engineering-mobile-app-builder.md +434 -0
  86. package/agents/expert-engineering-mobile-release-engineer.md +40 -0
  87. package/agents/expert-engineering-multi-agent-systems-architect.md +599 -0
  88. package/agents/expert-engineering-network-engineer-china.md +162 -0
  89. package/agents/expert-engineering-network-engineer.md +40 -0
  90. package/agents/expert-engineering-orgscript-engineer.md +112 -0
  91. package/agents/expert-engineering-payments-billing-engineer.md +40 -0
  92. package/agents/expert-engineering-pc-host-engineer.md +231 -0
  93. package/agents/expert-engineering-pdf-engine-architect.md +32 -0
  94. package/agents/expert-engineering-platform-engineer.md +32 -0
  95. package/agents/expert-engineering-privacy-engineer.md +40 -0
  96. package/agents/expert-engineering-prompt-engineer.md +203 -0
  97. package/agents/expert-engineering-rag-pipeline-engineer.md +40 -0
  98. package/agents/expert-engineering-rapid-prototyper.md +461 -0
  99. package/agents/expert-engineering-realtime-collaboration-engineer.md +40 -0
  100. package/agents/expert-engineering-rust-refactoring-specialist.md +40 -0
  101. package/agents/expert-engineering-search-relevance-engineer.md +40 -0
  102. package/agents/expert-engineering-section-508-specialist.md +40 -0
  103. package/agents/expert-engineering-security-engineer.md +303 -0
  104. package/agents/expert-engineering-senior-developer.md +177 -0
  105. package/agents/expert-engineering-servicenow-developer-mentor.md +32 -0
  106. package/agents/expert-engineering-software-architect.md +200 -0
  107. package/agents/expert-engineering-solidity-smart-contract-engineer.md +541 -0
  108. package/agents/expert-engineering-sre.md +233 -0
  109. package/agents/expert-engineering-technical-writer.md +409 -0
  110. package/agents/expert-engineering-threat-detection-engineer.md +553 -0
  111. package/agents/expert-engineering-universal-document-compiler.md +32 -0
  112. package/agents/expert-engineering-uswds-developer.md +40 -0
  113. package/agents/expert-engineering-video-streaming-engineer.md +40 -0
  114. package/agents/expert-engineering-voice-ai-integration-engineer.md +560 -0
  115. package/agents/expert-engineering-webassembly-engineer.md +40 -0
  116. package/agents/expert-engineering-wechat-mini-program-developer.md +288 -0
  117. package/agents/expert-engineering-wordpress-performance.md +40 -0
  118. package/agents/expert-engineering-wordpress-shopping-cart.md +345 -0
  119. package/agents/expert-esg-sustainability-officer.md +395 -0
  120. package/agents/expert-finance-bookkeeper-controller.md +271 -0
  121. package/agents/expert-finance-financial-analyst.md +244 -0
  122. package/agents/expert-finance-financial-forecaster.md +213 -0
  123. package/agents/expert-finance-fpa-analyst.md +272 -0
  124. package/agents/expert-finance-fraud-detector.md +241 -0
  125. package/agents/expert-finance-hk-stock-compliance-reviewer.md +316 -0
  126. package/agents/expert-finance-investment-researcher.md +283 -0
  127. package/agents/expert-finance-invoice-manager.md +242 -0
  128. package/agents/expert-finance-tax-strategist.md +250 -0
  129. package/agents/expert-game-audio-engineer.md +265 -0
  130. package/agents/expert-game-designer.md +168 -0
  131. package/agents/expert-gaokao-college-advisor.md +333 -0
  132. package/agents/expert-gis-3d-scene-developer.md +110 -0
  133. package/agents/expert-gis-analyst.md +90 -0
  134. package/agents/expert-gis-bim-specialist.md +107 -0
  135. package/agents/expert-gis-cartography-designer.md +149 -0
  136. package/agents/expert-gis-drone-reality-mapping.md +119 -0
  137. package/agents/expert-gis-geoai-ml-engineer.md +104 -0
  138. package/agents/expert-gis-geoprocessing-specialist.md +96 -0
  139. package/agents/expert-gis-qa-engineer.md +132 -0
  140. package/agents/expert-gis-solution-engineer.md +100 -0
  141. package/agents/expert-gis-spatial-data-engineer.md +96 -0
  142. package/agents/expert-gis-spatial-data-scientist.md +110 -0
  143. package/agents/expert-gis-technical-consultant.md +85 -0
  144. package/agents/expert-gis-web-gis-developer.md +107 -0
  145. package/agents/expert-godot-gameplay-scripter.md +335 -0
  146. package/agents/expert-godot-multiplayer-engineer.md +296 -0
  147. package/agents/expert-godot-shader-developer.md +267 -0
  148. package/agents/expert-government-digital-presales-consultant.md +362 -0
  149. package/agents/expert-grant-writer.md +510 -0
  150. package/agents/expert-healthcare-aging-parent-care-companion.md +40 -0
  151. package/agents/expert-healthcare-clinical-evidence-agent.md +40 -0
  152. package/agents/expert-healthcare-customer-service.md +388 -0
  153. package/agents/expert-healthcare-innovation-strategist.md +40 -0
  154. package/agents/expert-healthcare-marketing-compliance.md +394 -0
  155. package/agents/expert-healthcare-sovereign-health-systems-agent.md +40 -0
  156. package/agents/expert-hospitality-guest-services.md +597 -0
  157. package/agents/expert-hr-onboarding.md +450 -0
  158. package/agents/expert-hr-performance-reviewer.md +248 -0
  159. package/agents/expert-hr-recruiter.md +232 -0
  160. package/agents/expert-identity-graph-operator.md +270 -0
  161. package/agents/expert-language-translator.md +275 -0
  162. package/agents/expert-legal-billing-time-tracking.md +566 -0
  163. package/agents/expert-legal-client-intake.md +487 -0
  164. package/agents/expert-legal-contract-reviewer.md +240 -0
  165. package/agents/expert-legal-document-review.md +452 -0
  166. package/agents/expert-legal-policy-writer.md +308 -0
  167. package/agents/expert-level-designer.md +209 -0
  168. package/agents/expert-livestock-archive-auditor.md +135 -0
  169. package/agents/expert-loan-officer-assistant.md +549 -0
  170. package/agents/expert-lsp-index-engineer.md +334 -0
  171. package/agents/expert-ma-integration-manager.md +426 -0
  172. package/agents/expert-macos-spatial-metal-engineer.md +337 -0
  173. package/agents/expert-marketing-aeo-foundations.md +263 -0
  174. package/agents/expert-marketing-agentic-search-optimizer.md +312 -0
  175. package/agents/expert-marketing-ai-citation-strategist.md +169 -0
  176. package/agents/expert-marketing-app-store-optimizer.md +319 -0
  177. package/agents/expert-marketing-baidu-seo-specialist.md +220 -0
  178. package/agents/expert-marketing-bilibili-content-strategist.md +40 -0
  179. package/agents/expert-marketing-bilibili-strategist.md +194 -0
  180. package/agents/expert-marketing-book-co-author.md +109 -0
  181. package/agents/expert-marketing-carousel-growth-engine.md +215 -0
  182. package/agents/expert-marketing-china-ecommerce-operator.md +277 -0
  183. package/agents/expert-marketing-china-market-localization-strategist.md +282 -0
  184. package/agents/expert-marketing-content-creator.md +145 -0
  185. package/agents/expert-marketing-cross-border-ecommerce.md +260 -0
  186. package/agents/expert-marketing-daily-news-briefing.md +303 -0
  187. package/agents/expert-marketing-developer-community-builder.md +32 -0
  188. package/agents/expert-marketing-douyin-strategist.md +150 -0
  189. package/agents/expert-marketing-ecommerce-operator.md +216 -0
  190. package/agents/expert-marketing-email-strategist.md +248 -0
  191. package/agents/expert-marketing-global-podcast-strategist.md +204 -0
  192. package/agents/expert-marketing-growth-hacker.md +121 -0
  193. package/agents/expert-marketing-instagram-curator.md +179 -0
  194. package/agents/expert-marketing-knowledge-commerce-strategist.md +384 -0
  195. package/agents/expert-marketing-kuaishou-strategist.md +182 -0
  196. package/agents/expert-marketing-linkedin-content-creator.md +232 -0
  197. package/agents/expert-marketing-livestream-commerce-coach.md +303 -0
  198. package/agents/expert-marketing-multi-platform-publisher.md +216 -0
  199. package/agents/expert-marketing-podcast-strategist.md +278 -0
  200. package/agents/expert-marketing-pr-communications-manager.md +472 -0
  201. package/agents/expert-marketing-private-domain-operator.md +309 -0
  202. package/agents/expert-marketing-reddit-community-builder.md +127 -0
  203. package/agents/expert-marketing-search-growth-orchestrator.md +372 -0
  204. package/agents/expert-marketing-seo-specialist.md +298 -0
  205. package/agents/expert-marketing-short-video-editing-coach.md +413 -0
  206. package/agents/expert-marketing-social-media-strategist.md +118 -0
  207. package/agents/expert-marketing-tiktok-strategist.md +124 -0
  208. package/agents/expert-marketing-twitter-engager.md +132 -0
  209. package/agents/expert-marketing-video-optimization-specialist.md +128 -0
  210. package/agents/expert-marketing-wechat-official-account.md +158 -0
  211. package/agents/expert-marketing-wechat-operator.md +156 -0
  212. package/agents/expert-marketing-weibo-strategist.md +241 -0
  213. package/agents/expert-marketing-weixin-channels-strategist.md +297 -0
  214. package/agents/expert-marketing-x-twitter-intelligence-analyst.md +160 -0
  215. package/agents/expert-marketing-xiaohongshu-operator.md +139 -0
  216. package/agents/expert-marketing-xiaohongshu-specialist.md +151 -0
  217. package/agents/expert-marketing-zhihu-strategist.md +175 -0
  218. package/agents/expert-medical-billing-coding-specialist.md +489 -0
  219. package/agents/expert-narrative-designer.md +244 -0
  220. package/agents/expert-operations-manager.md +398 -0
  221. package/agents/expert-organizational-psychologist.md +390 -0
  222. package/agents/expert-paid-media-auditor.md +170 -0
  223. package/agents/expert-paid-media-creative-strategist.md +173 -0
  224. package/agents/expert-paid-media-paid-social-strategist.md +180 -0
  225. package/agents/expert-paid-media-ppc-strategist.md +180 -0
  226. package/agents/expert-paid-media-programmatic-buyer.md +177 -0
  227. package/agents/expert-paid-media-search-query-analyst.md +182 -0
  228. package/agents/expert-paid-media-tracking-specialist.md +199 -0
  229. package/agents/expert-personal-growth-mentor.md +158 -0
  230. package/agents/expert-product-behavioral-nudge-engine.md +246 -0
  231. package/agents/expert-product-dx-engineer.md +32 -0
  232. package/agents/expert-product-feedback-synthesizer.md +175 -0
  233. package/agents/expert-product-manager.md +474 -0
  234. package/agents/expert-product-sprint-prioritizer.md +133 -0
  235. package/agents/expert-product-trend-researcher.md +143 -0
  236. package/agents/expert-project-management-experiment-tracker.md +206 -0
  237. package/agents/expert-project-management-jira-workflow-steward.md +249 -0
  238. package/agents/expert-project-management-meeting-notes-specialist.md +94 -0
  239. package/agents/expert-project-management-project-shepherd.md +202 -0
  240. package/agents/expert-project-management-studio-operations.md +208 -0
  241. package/agents/expert-project-management-studio-producer.md +211 -0
  242. package/agents/expert-project-manager-senior.md +135 -0
  243. package/agents/expert-prompt-engineer.md +176 -0
  244. package/agents/expert-real-estate-buyer-seller.md +594 -0
  245. package/agents/expert-recruitment-specialist.md +49 -0
  246. package/agents/expert-report-distribution-agent.md +354 -0
  247. package/agents/expert-research-synthesist.md +40 -0
  248. package/agents/expert-resume-tailor.md +40 -0
  249. package/agents/expert-retail-customer-returns.md +564 -0
  250. package/agents/expert-roblox-avatar-creator.md +298 -0
  251. package/agents/expert-roblox-experience-designer.md +306 -0
  252. package/agents/expert-roblox-systems-scripter.md +325 -0
  253. package/agents/expert-sales-account-strategist.md +243 -0
  254. package/agents/expert-sales-coach.md +291 -0
  255. package/agents/expert-sales-data-extraction-agent.md +159 -0
  256. package/agents/expert-sales-deal-strategist.md +204 -0
  257. package/agents/expert-sales-discovery-coach.md +230 -0
  258. package/agents/expert-sales-engineer.md +200 -0
  259. package/agents/expert-sales-offer-lead-gen-strategist.md +256 -0
  260. package/agents/expert-sales-outbound-strategist.md +208 -0
  261. package/agents/expert-sales-outreach.md +40 -0
  262. package/agents/expert-sales-pipeline-analyst.md +284 -0
  263. package/agents/expert-sales-proposal-strategist.md +233 -0
  264. package/agents/expert-security-ai-generated-code-auditor.md +40 -0
  265. package/agents/expert-security-appsec-engineer.md +490 -0
  266. package/agents/expert-security-architect.md +303 -0
  267. package/agents/expert-security-blockchain-security-auditor.md +462 -0
  268. package/agents/expert-security-cloud-security-architect.md +522 -0
  269. package/agents/expert-security-compliance-auditor.md +157 -0
  270. package/agents/expert-security-incident-responder.md +436 -0
  271. package/agents/expert-security-penetration-tester.md +398 -0
  272. package/agents/expert-security-secrets-credential-engineer.md +40 -0
  273. package/agents/expert-security-senior-secops.md +751 -0
  274. package/agents/expert-security-threat-detection-engineer.md +533 -0
  275. package/agents/expert-security-threat-intelligence-analyst.md +643 -0
  276. package/agents/expert-specialized-ai-policy-writer.md +217 -0
  277. package/agents/expert-specialized-chief-of-staff.md +40 -0
  278. package/agents/expert-specialized-civil-engineer.md +355 -0
  279. package/agents/expert-specialized-codebase-archaeologist.md +40 -0
  280. package/agents/expert-specialized-cultural-intelligence-strategist.md +168 -0
  281. package/agents/expert-specialized-developer-advocate.md +334 -0
  282. package/agents/expert-specialized-document-generator.md +346 -0
  283. package/agents/expert-specialized-fedramp-rmf-compliance.md +40 -0
  284. package/agents/expert-specialized-focus-music-architect.md +32 -0
  285. package/agents/expert-specialized-french-consulting-market.md +46 -0
  286. package/agents/expert-specialized-korean-business-navigator.md +46 -0
  287. package/agents/expert-specialized-master-plan-architect.md +40 -0
  288. package/agents/expert-specialized-mcp-builder.md +351 -0
  289. package/agents/expert-specialized-meeting-assistant.md +236 -0
  290. package/agents/expert-specialized-model-qa.md +507 -0
  291. package/agents/expert-specialized-pricing-analyst.md +242 -0
  292. package/agents/expert-specialized-pricing-optimizer.md +254 -0
  293. package/agents/expert-specialized-risk-assessor.md +240 -0
  294. package/agents/expert-specialized-salesforce-architect.md +179 -0
  295. package/agents/expert-specialized-strategy-duel-agent.md +129 -0
  296. package/agents/expert-specialized-workflow-architect.md +596 -0
  297. package/agents/expert-study-abroad-advisor.md +281 -0
  298. package/agents/expert-supply-chain-garment-factory-planning-engineer.md +262 -0
  299. package/agents/expert-supply-chain-inventory-forecaster.md +212 -0
  300. package/agents/expert-supply-chain-route-optimizer.md +224 -0
  301. package/agents/expert-supply-chain-strategist.md +581 -0
  302. package/agents/expert-supply-chain-vendor-evaluator.md +232 -0
  303. package/agents/expert-support-analytics-reporter.md +364 -0
  304. package/agents/expert-support-executive-summary-generator.md +217 -0
  305. package/agents/expert-support-finance-tracker.md +447 -0
  306. package/agents/expert-support-infrastructure-maintainer.md +623 -0
  307. package/agents/expert-support-legal-compliance-checker.md +587 -0
  308. package/agents/expert-support-recruitment-specialist.md +508 -0
  309. package/agents/expert-support-support-responder.md +584 -0
  310. package/agents/expert-technical-artist.md +230 -0
  311. package/agents/expert-technical-translator-agent.md +167 -0
  312. package/agents/expert-terminal-integration-specialist.md +236 -0
  313. package/agents/expert-testing-accessibility-auditor.md +329 -0
  314. package/agents/expert-testing-api-tester.md +305 -0
  315. package/agents/expert-testing-embedded-qa-engineer.md +258 -0
  316. package/agents/expert-testing-evidence-collector.md +153 -0
  317. package/agents/expert-testing-performance-benchmarker.md +196 -0
  318. package/agents/expert-testing-reality-checker.md +235 -0
  319. package/agents/expert-testing-test-automation-engineer.md +40 -0
  320. package/agents/expert-testing-test-results-analyzer.md +313 -0
  321. package/agents/expert-testing-tool-evaluator.md +402 -0
  322. package/agents/expert-testing-workflow-optimizer.md +458 -0
  323. package/agents/expert-travel-planner.md +38 -0
  324. package/agents/expert-unity-architect.md +272 -0
  325. package/agents/expert-unity-editor-tool-developer.md +300 -0
  326. package/agents/expert-unity-multiplayer-engineer.md +238 -0
  327. package/agents/expert-unity-shader-graph-artist.md +270 -0
  328. package/agents/expert-unreal-multiplayer-architect.md +314 -0
  329. package/agents/expert-unreal-systems-engineer.md +311 -0
  330. package/agents/expert-unreal-technical-artist.md +256 -0
  331. package/agents/expert-unreal-world-builder.md +274 -0
  332. package/agents/expert-visionos-spatial-engineer.md +282 -0
  333. package/agents/expert-xr-cockpit-interaction-specialist.md +220 -0
  334. package/agents/expert-xr-immersive-developer.md +229 -0
  335. package/agents/expert-xr-interface-architect.md +253 -0
  336. package/agents/expert-zk-steward.md +228 -0
  337. package/agents/manager-academic-research.md +96 -0
  338. package/agents/manager-agent-governance.md +90 -0
  339. package/agents/manager-ai-llm.md +94 -0
  340. package/agents/manager-backend-architecture.md +106 -0
  341. package/agents/manager-business-strategy.md +102 -0
  342. package/agents/manager-business-support.md +96 -0
  343. package/agents/manager-customer-support.md +95 -0
  344. package/agents/manager-data-database.md +92 -0
  345. package/agents/manager-data-knowledge.md +88 -0
  346. package/agents/manager-data-testing.md +105 -0
  347. package/agents/manager-design-creative.md +103 -0
  348. package/agents/manager-devops-operations.md +92 -0
  349. package/agents/manager-embedded-iot.md +90 -0
  350. package/agents/manager-engineering-quality.md +94 -0
  351. package/agents/manager-finance-tax.md +99 -0
  352. package/agents/manager-frontend-client.md +116 -0
  353. package/agents/manager-game-dev.md +120 -0
  354. package/agents/manager-gis.md +104 -0
  355. package/agents/manager-government-public.md +84 -0
  356. package/agents/manager-healthcare.md +88 -0
  357. package/agents/manager-hr.md +87 -0
  358. package/agents/manager-language-translation.md +82 -0
  359. package/agents/manager-legal-compliance.md +86 -0
  360. package/agents/manager-marketing-growth.md +138 -0
  361. package/agents/manager-network-engineering.md +83 -0
  362. package/agents/manager-paid-media.md +92 -0
  363. package/agents/manager-product-management.md +90 -0
  364. package/agents/manager-project-management.md +94 -0
  365. package/agents/manager-sales-customer.md +97 -0
  366. package/agents/manager-security-compliance.md +109 -0
  367. package/agents/manager-spatial-computing.md +90 -0
  368. package/agents/manager-supply-chain.md +87 -0
  369. package/bin/cli.js +84 -0
  370. package/commands/wf/archive.md +111 -0
  371. package/commands/wf/check.md +68 -0
  372. package/commands/wf/deliver.md +76 -0
  373. package/commands/wf/design.md +56 -0
  374. package/commands/wf/dispatch.md +90 -0
  375. package/commands/wf/env.md +81 -0
  376. package/commands/wf/implement.md +96 -0
  377. package/commands/wf/plan.md +78 -0
  378. package/commands/wf/resume.md +59 -0
  379. package/commands/wf/spec.md +88 -0
  380. package/commands/wf/triage.md +50 -0
  381. package/commands/wf/verify.md +93 -0
  382. package/config/categories.json +557 -0
  383. package/config/experts.json +3318 -0
  384. package/config/workflow.json +848 -0
  385. package/context/context-manager.py +339 -0
  386. package/docs/workflow-fusion-design.md +239 -0
  387. package/hooks/claude-hooks.json +16 -0
  388. package/hooks/hooks.json +20 -0
  389. package/hooks/prepend-global-rules-reminder.mjs +342 -0
  390. package/icon.png +0 -0
  391. package/package.json +61 -3
  392. package/references/openspec-manual-mode.md +97 -0
  393. package/references/roles/analyst.md +62 -0
  394. package/references/roles/implementer.md +67 -0
  395. package/references/roles/investigator.md +88 -0
  396. package/references/roles/orchestrator.md +66 -0
  397. package/references/roles/reviewer.md +103 -0
  398. package/references/stage-S0-triage.md +68 -0
  399. package/references/stage-S1-design.md +53 -0
  400. package/references/stage-S2-spec.md +135 -0
  401. package/references/stage-S3-plan.md +84 -0
  402. package/references/stage-S4-env-baseline.md +81 -0
  403. package/references/stage-S5-implement.md +139 -0
  404. package/references/stage-S6-verify-review.md +80 -0
  405. package/references/stage-S7-deliver.md +81 -0
  406. package/references/stage-S8-sync-archive.md +168 -0
  407. package/references/workflow-tree.md +98 -0
  408. package/scripts/cc-uninstall.js +123 -0
  409. package/scripts/embedding_client.py +44 -0
  410. package/scripts/install-claude-code.js +477 -0
  411. package/scripts/install.js +1592 -0
  412. package/scripts/llm_client.py +202 -0
  413. package/scripts/openspec_engine.py +707 -0
  414. package/scripts/sdd/review-package +65 -0
  415. package/scripts/sdd/sdd-workspace +108 -0
  416. package/scripts/sdd/task-brief +49 -0
  417. package/scripts/target-menu.js +125 -0
  418. package/scripts/workflow_check.py +1955 -0
  419. package/skill_entry.py +193 -0
  420. package/templates/bug-report.md +86 -0
  421. package/templates/minimal-contract.md +54 -0
  422. package/templates/plan-sections.md +190 -0
  423. package/templates/progress.md +89 -0
  424. package/templates/review-report.md +51 -0
  425. package/templates/task-report.md +84 -0
  426. package/vendor/skills/LICENSE +21 -0
  427. package/vendor/skills/PROVENANCE.md +79 -0
  428. package/vendor/skills/zes-brainstorming/SKILL.md +302 -0
  429. package/vendor/skills/zes-brainstorming/builder-check-prompt.md +23 -0
  430. package/vendor/skills/zes-code-review/SKILL.md +103 -0
  431. package/vendor/skills/zes-finishing/SKILL.md +233 -0
  432. package/vendor/skills/zes-openspec-apply-change/SKILL.md +206 -0
  433. package/vendor/skills/zes-openspec-archive-change/SKILL.md +221 -0
  434. package/vendor/skills/zes-openspec-explore/SKILL.md +356 -0
  435. package/vendor/skills/zes-openspec-propose/SKILL.md +175 -0
  436. package/vendor/skills/zes-openspec-sync-specs/SKILL.md +290 -0
  437. package/vendor/skills/zes-openspec-update-change/SKILL.md +109 -0
  438. package/vendor/skills/zes-receiving-review/SKILL.md +213 -0
  439. package/vendor/skills/zes-sdd/SKILL.md +345 -0
  440. package/vendor/skills/zes-sdd/references/batching.md +11 -0
  441. package/vendor/skills/zes-sdd/references/cannot-verify.md +10 -0
  442. package/vendor/skills/zes-sdd/references/final-review.md +47 -0
  443. package/vendor/skills/zes-sdd/references/fix-loop.md +77 -0
  444. package/vendor/skills/zes-sdd/references/handling-reports.md +15 -0
  445. package/vendor/skills/zes-sdd/references/preflight.md +26 -0
  446. package/vendor/skills/zes-sdd/references/resuming.md +12 -0
  447. package/vendor/skills/zes-systematic-debugging/SKILL.md +291 -0
  448. package/vendor/skills/zes-systematic-debugging/condition-based-waiting.md +115 -0
  449. package/vendor/skills/zes-systematic-debugging/defense-in-depth.md +122 -0
  450. package/vendor/skills/zes-systematic-debugging/find-polluter.sh +72 -0
  451. package/vendor/skills/zes-systematic-debugging/root-cause-tracing.md +169 -0
  452. package/vendor/skills/zes-tdd/SKILL.md +338 -0
  453. package/vendor/skills/zes-tdd/writing-good-tests.md +198 -0
  454. package/vendor/skills/zes-verification/SKILL.md +128 -0
  455. package/vendor/skills/zes-writing-plans/SKILL.md +212 -0
  456. package/zcode_dev_workflow.py +1343 -0
  457. package/zcode_expert_system.py +1115 -0
@@ -0,0 +1,169 @@
1
+ # Root Cause Tracing
2
+
3
+ ## Overview
4
+
5
+ Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
6
+
7
+ **Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
8
+
9
+ ## When to Use
10
+
11
+ ```dot
12
+ digraph when_to_use {
13
+ "Bug appears deep in stack?" [shape=diamond];
14
+ "Can trace backwards?" [shape=diamond];
15
+ "Fix at symptom point" [shape=box];
16
+ "Trace to original trigger" [shape=box];
17
+ "BETTER: Also add defense-in-depth" [shape=box];
18
+
19
+ "Bug appears deep in stack?" -> "Can trace backwards?" [label="yes"];
20
+ "Can trace backwards?" -> "Trace to original trigger" [label="yes"];
21
+ "Can trace backwards?" -> "Fix at symptom point" [label="no - dead end"];
22
+ "Trace to original trigger" -> "BETTER: Also add defense-in-depth";
23
+ }
24
+ ```
25
+
26
+ **Use when:**
27
+ - Error happens deep in execution (not at entry point)
28
+ - Stack trace shows long call chain
29
+ - Unclear where invalid data originated
30
+ - Need to find which test/code triggers the problem
31
+
32
+ ## The Tracing Process
33
+
34
+ ### 1. Observe the Symptom
35
+ ```
36
+ Error: git init failed in ~/project/packages/core
37
+ ```
38
+
39
+ ### 2. Find Immediate Cause
40
+ **What code directly causes this?**
41
+ ```typescript
42
+ await execFileAsync('git', ['init'], { cwd: projectDir });
43
+ ```
44
+
45
+ ### 3. Ask: What Called This?
46
+ ```typescript
47
+ WorktreeManager.createSessionWorktree(projectDir, sessionId)
48
+ → called by Session.initializeWorkspace()
49
+ → called by Session.create()
50
+ → called by test at Project.create()
51
+ ```
52
+
53
+ ### 4. Keep Tracing Up
54
+ **What value was passed?**
55
+ - `projectDir = ''` (empty string!)
56
+ - Empty string as `cwd` resolves to `process.cwd()`
57
+ - That's the source code directory!
58
+
59
+ ### 5. Find Original Trigger
60
+ **Where did empty string come from?**
61
+ ```typescript
62
+ const context = setupCoreTest(); // Returns { tempDir: '' }
63
+ Project.create('name', context.tempDir); // Accessed before beforeEach!
64
+ ```
65
+
66
+ ## Adding Stack Traces
67
+
68
+ When you can't trace manually, add instrumentation:
69
+
70
+ ```typescript
71
+ // Before the problematic operation
72
+ async function gitInit(directory: string) {
73
+ const stack = new Error().stack;
74
+ console.error('DEBUG git init:', {
75
+ directory,
76
+ cwd: process.cwd(),
77
+ nodeEnv: process.env.NODE_ENV,
78
+ stack,
79
+ });
80
+
81
+ await execFileAsync('git', ['init'], { cwd: directory });
82
+ }
83
+ ```
84
+
85
+ **Critical:** Use `console.error()` in tests (not logger - may not show)
86
+
87
+ **Run and capture:**
88
+ ```bash
89
+ npm test 2>&1 | grep 'DEBUG git init'
90
+ ```
91
+
92
+ **Analyze stack traces:**
93
+ - Look for test file names
94
+ - Find the line number triggering the call
95
+ - Identify the pattern (same test? same parameter?)
96
+
97
+ ## Finding Which Test Causes Pollution
98
+
99
+ If something appears during tests but you don't know which test:
100
+
101
+ Use the bisection script `find-polluter.sh` in this directory:
102
+
103
+ ```bash
104
+ bash ./find-polluter.sh '.git' 'src/**/*.test.ts'
105
+ ```
106
+
107
+ Runs tests one-by-one, stops at first polluter. See script for usage.
108
+
109
+ ## Real Example: Empty projectDir
110
+
111
+ **Symptom:** `.git` created in `packages/core/` (source code)
112
+
113
+ **Trace chain:**
114
+ 1. `git init` runs in `process.cwd()` ← empty cwd parameter
115
+ 2. WorktreeManager called with empty projectDir
116
+ 3. Session.create() passed empty string
117
+ 4. Test accessed `context.tempDir` before beforeEach
118
+ 5. setupCoreTest() returns `{ tempDir: '' }` initially
119
+
120
+ **Root cause:** Top-level variable initialization accessing empty value
121
+
122
+ **Fix:** Made tempDir a getter that throws if accessed before beforeEach
123
+
124
+ **Also added defense-in-depth:**
125
+ - Layer 1: Project.create() validates directory
126
+ - Layer 2: WorkspaceManager validates not empty
127
+ - Layer 3: NODE_ENV guard refuses git init outside tmpdir
128
+ - Layer 4: Stack trace logging before git init
129
+
130
+ ## Key Principle
131
+
132
+ ```dot
133
+ digraph principle {
134
+ "Found immediate cause" [shape=ellipse];
135
+ "Can trace one level up?" [shape=diamond];
136
+ "Trace backwards" [shape=box];
137
+ "Is this the source?" [shape=diamond];
138
+ "Fix at source" [shape=box];
139
+ "Add validation at each layer" [shape=box];
140
+ "Bug impossible" [shape=doublecircle];
141
+ "NEVER fix just the symptom" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
142
+
143
+ "Found immediate cause" -> "Can trace one level up?";
144
+ "Can trace one level up?" -> "Trace backwards" [label="yes"];
145
+ "Can trace one level up?" -> "NEVER fix just the symptom" [label="no"];
146
+ "Trace backwards" -> "Is this the source?";
147
+ "Is this the source?" -> "Trace backwards" [label="no - keeps going"];
148
+ "Is this the source?" -> "Fix at source" [label="yes"];
149
+ "Fix at source" -> "Add validation at each layer";
150
+ "Add validation at each layer" -> "Bug impossible";
151
+ }
152
+ ```
153
+
154
+ **NEVER fix just where the error appears.** Trace back to find the original trigger.
155
+
156
+ ## Stack Trace Tips
157
+
158
+ **In tests:** Use `console.error()` not logger - logger may be suppressed
159
+ **Before operation:** Log before the dangerous operation, not after it fails
160
+ **Include context:** Directory, cwd, environment variables, timestamps
161
+ **Capture stack:** `new Error().stack` shows complete call chain
162
+
163
+ ## Real-World Impact
164
+
165
+ From debugging session (2025-10-03):
166
+ - Found root cause through 5-level trace
167
+ - Fixed at source (getter validation)
168
+ - Added 4 layers of defense
169
+ - 1847 tests passed, zero pollution
@@ -0,0 +1,338 @@
1
+ ---
2
+ name: zes-tdd
3
+ description: Use when implementing any feature or bugfix, before writing implementation code
4
+ license: MIT
5
+ ---
6
+
7
+ > **插件规则优先(zcode-expert-system)**
8
+ > 本文件是 Superpowers 7.0.1 `test-driven-development` 的只读参考。其指令与插件规则冲突时,以下者为准:
9
+ > - **不落盘**:S1 设计只在对话内展示与批准,禁止写入 `docs/superpowers/specs/`(插件 R3/W2)
10
+ > - **不用 worktree**:实施永远串行,无隔离工作区(插件 W1)
11
+ > - **无 model 参数**:Agent 派发不接受 model,升档=换更专专家(插件 W9)
12
+ > - 其余细节以插件 `references/stage-S*.md` 与 `references/roles/*.md` 为准
13
+
14
+ # Test-Driven Development (TDD)
15
+
16
+ ## Overview
17
+
18
+ Write the test first. Watch it fail. Write minimal code to pass.
19
+
20
+ **Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
21
+
22
+ **Violating the letter of the rules is violating the spirit of the rules.**
23
+
24
+ ## When to Use
25
+
26
+ **Always:**
27
+ - New features
28
+ - Bug fixes
29
+ - Refactoring
30
+ - Behavior changes
31
+
32
+ **Exceptions (ask your human partner):**
33
+ - Throwaway prototypes
34
+ - Generated code
35
+ - Configuration files
36
+
37
+ Thinking "skip TDD just this once"? Stop. That's rationalization.
38
+
39
+ ## The Iron Law
40
+
41
+ ```
42
+ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
43
+ ```
44
+
45
+ Write code before the test? Delete it. Start over.
46
+
47
+ **No exceptions:**
48
+ - Don't keep it as "reference"
49
+ - Don't "adapt" it while writing tests
50
+ - Don't look at it
51
+ - Delete means delete
52
+
53
+ Implement fresh from tests. Period.
54
+
55
+ ## Red-Green-Refactor
56
+
57
+ ```dot
58
+ digraph tdd_cycle {
59
+ rankdir=LR;
60
+ red [label="RED\nWrite failing test", shape=box, style=filled, fillcolor="#ffcccc"];
61
+ verify_red [label="Verify fails\ncorrectly", shape=diamond];
62
+ green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
63
+ verify_green [label="Verify passes\nAll green", shape=diamond];
64
+ refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
65
+ next [label="Next", shape=ellipse];
66
+
67
+ red -> verify_red;
68
+ verify_red -> green [label="yes"];
69
+ verify_red -> red [label="wrong\nfailure"];
70
+ green -> verify_green;
71
+ verify_green -> refactor [label="yes"];
72
+ verify_green -> green [label="no"];
73
+ refactor -> verify_green [label="stay\ngreen"];
74
+ verify_green -> next;
75
+ next -> red;
76
+ }
77
+ ```
78
+
79
+ ### RED - Write Failing Test
80
+
81
+ Write one minimal test showing what should happen.
82
+
83
+ <Good>
84
+ ```typescript
85
+ test('retries failed operations 3 times', async () => {
86
+ let attempts = 0;
87
+ const operation = () => {
88
+ attempts++;
89
+ if (attempts < 3) throw new Error('fail');
90
+ return 'success';
91
+ };
92
+
93
+ const result = await retryOperation(operation);
94
+
95
+ expect(result).toBe('success');
96
+ expect(attempts).toBe(3);
97
+ });
98
+ ```
99
+ Clear name, tests real behavior, one thing
100
+ </Good>
101
+
102
+ <Bad>
103
+ ```typescript
104
+ test('retry works', async () => {
105
+ const mock = jest.fn()
106
+ .mockRejectedValueOnce(new Error())
107
+ .mockRejectedValueOnce(new Error())
108
+ .mockResolvedValueOnce('success');
109
+ await retryOperation(mock);
110
+ expect(mock).toHaveBeenCalledTimes(3);
111
+ });
112
+ ```
113
+ Vague name, tests mock not code
114
+ </Bad>
115
+
116
+ **Requirements:**
117
+ - One behavior
118
+ - Clear name
119
+ - Real code (no mocks unless unavoidable)
120
+
121
+ ### Verify RED - Watch It Fail
122
+
123
+ **MANDATORY. Never skip.**
124
+
125
+ ```bash
126
+ npm test path/to/test.test.ts
127
+ ```
128
+
129
+ Confirm:
130
+ - Test fails (not errors)
131
+ - Failure message is expected
132
+ - Fails because feature missing (not typos)
133
+
134
+ **Test passes?** You're testing existing behavior. Fix test.
135
+
136
+ **Test errors?** Fix error, re-run until it fails correctly.
137
+
138
+ ### GREEN - Minimal Code
139
+
140
+ Write simplest code to pass the test.
141
+
142
+ <Good>
143
+ ```typescript
144
+ async function retryOperation<T>(fn: () => Promise<T>): Promise<T> {
145
+ for (let i = 0; i < 3; i++) {
146
+ try {
147
+ return await fn();
148
+ } catch (e) {
149
+ if (i === 2) throw e;
150
+ }
151
+ }
152
+ throw new Error('unreachable');
153
+ }
154
+ ```
155
+ Just enough to pass
156
+ </Good>
157
+
158
+ <Bad>
159
+ ```typescript
160
+ async function retryOperation<T>(
161
+ fn: () => Promise<T>,
162
+ options?: {
163
+ maxRetries?: number;
164
+ backoff?: 'linear' | 'exponential';
165
+ onRetry?: (attempt: number) => void;
166
+ }
167
+ ): Promise<T> {
168
+ // YAGNI
169
+ }
170
+ ```
171
+ Over-engineered
172
+ </Bad>
173
+
174
+ Don't add features, refactor other code, or "improve" beyond the test.
175
+
176
+ ### Verify GREEN - Watch It Pass
177
+
178
+ **MANDATORY.**
179
+
180
+ ```bash
181
+ npm test path/to/test.test.ts
182
+ ```
183
+
184
+ Confirm:
185
+ - Test passes
186
+ - Other tests still pass
187
+ - Output pristine (no errors, warnings)
188
+
189
+ **Test fails?** Fix code, not test.
190
+
191
+ **Other tests fail?** Fix now.
192
+
193
+ **"Other tests" means the project's suite, not just your file.** A
194
+ green run of the test you wrote is not a green suite. Before you call
195
+ the change done, run the project's test command (bare `pytest`,
196
+ `npm test`, `cargo test` — whatever the repo uses) even when your task
197
+ named only one test file. A scope statement in your task bounds the
198
+ deliverable, not your verification. Any failure that run shows —
199
+ including one you didn't cause — goes in your report by name; a red
200
+ test you watched scroll past and didn't mention is a report falsified
201
+ by omission.
202
+
203
+ ### REFACTOR - Clean Up
204
+
205
+ After green only:
206
+ - Remove duplication
207
+ - Improve names
208
+ - Extract helpers
209
+
210
+ Keep tests green. Don't add behavior.
211
+
212
+ ### Repeat
213
+
214
+ Next failing test for next feature.
215
+
216
+ ## Good Tests
217
+
218
+ | Quality | Good | Bad |
219
+ |---------|------|-----|
220
+ | **Minimal** | One thing. "and" in name? Split it. | `test('validates email and domain and whitespace')` |
221
+ | **Clear** | Name describes behavior | `test('test1')` |
222
+ | **Shows intent** | Demonstrates desired API | Obscures what code should do |
223
+
224
+ When writing or changing any test, read [writing-good-tests.md](writing-good-tests.md) for the rules that keep tests honest:
225
+ - Name the production change that would make the test fail — before writing it
226
+ - Assert on real behavior, never on mock behavior
227
+ - Keep test-only code in test utilities, out of production classes
228
+ - Understand a dependency's side effects before mocking it
229
+
230
+ ## Common Rationalizations
231
+
232
+ | Excuse | Reality |
233
+ |--------|---------|
234
+ | "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
235
+ | "I'll test after" | Tests written after pass immediately — which proves nothing. They may test the wrong thing, test the implementation instead of the behavior, or miss the edge case you forgot. You never watched it fail, so you never proved it can catch the bug. Test-first forces that failure. |
236
+ | "Tests after achieve same goals (spirit not ritual)" | Tests-after answer "what does this do?"; tests-first answer "what should this do?" Tests written after are biased by the code you already wrote — you verify the cases you remembered, not the ones you'd have discovered. Coverage without proof the tests work. |
237
+ | "Already manually tested" | Manual testing is ad-hoc: no record of what you covered, no way to re-run it when the code changes, easy to forget cases under pressure. "Worked when I tried it" ≠ comprehensive. Automated tests run the same way every time. |
238
+ | "Deleting X hours is wasteful" | Sunk cost fallacy — that time is already spent either way. The real choice: rewrite with TDD (high confidence) vs. keep it and bolt tests on after (low confidence, likely bugs). Keeping code you can't trust is the waste. |
239
+ | "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
240
+ | "Need to explore first" | Fine. Throw away exploration, start with TDD. |
241
+ | "Test hard = design unclear" | Listen to test. Hard to test = hard to use. |
242
+ | "TDD will slow me down" | TDD IS the pragmatic path: catches bugs before commit, prevents regressions, lets you refactor without fear. "Pragmatic" shortcuts mean debugging in production — slower, not faster. |
243
+ | "Manual test faster" | Manual doesn't prove edge cases. You'll re-test every change. |
244
+ | "Existing code has no tests" | You're improving it. Add tests for existing code. |
245
+
246
+ ## Red Flags - STOP and Start Over
247
+
248
+ - Code before test
249
+ - Test after implementation
250
+ - Test passes immediately
251
+ - Can't explain why test failed
252
+ - Tests added "later"
253
+ - Rationalizing "just this once"
254
+ - "I already manually tested it"
255
+ - "Tests after achieve the same purpose"
256
+ - "It's about spirit not ritual"
257
+ - "Keep as reference" or "adapt existing code"
258
+ - "Already spent X hours, deleting is wasteful"
259
+ - "TDD is dogmatic, I'm being pragmatic"
260
+ - "This is different because..."
261
+
262
+ **All of these mean: Delete code. Start over with TDD.**
263
+
264
+ ## Example: Bug Fix
265
+
266
+ **Bug:** Empty email accepted
267
+
268
+ **RED**
269
+ ```typescript
270
+ test('rejects empty email', async () => {
271
+ const result = await submitForm({ email: '' });
272
+ expect(result.error).toBe('Email required');
273
+ });
274
+ ```
275
+
276
+ **Verify RED**
277
+ ```bash
278
+ $ npm test
279
+ FAIL: expected 'Email required', got undefined
280
+ ```
281
+
282
+ **GREEN**
283
+ ```typescript
284
+ function submitForm(data: FormData) {
285
+ if (!data.email?.trim()) {
286
+ return { error: 'Email required' };
287
+ }
288
+ // ...
289
+ }
290
+ ```
291
+
292
+ **Verify GREEN**
293
+ ```bash
294
+ $ npm test
295
+ PASS
296
+ ```
297
+
298
+ **REFACTOR**
299
+ Extract validation for multiple fields if needed.
300
+
301
+ ## Verification Checklist
302
+
303
+ Before marking work complete:
304
+
305
+ - [ ] Every new function/method has a test
306
+ - [ ] Watched each test fail before implementing
307
+ - [ ] Each test failed for expected reason (feature missing, not typo)
308
+ - [ ] Wrote minimal code to pass each test
309
+ - [ ] All tests pass
310
+ - [ ] Output pristine (no errors, warnings)
311
+ - [ ] Tests use real code (mocks only if unavoidable)
312
+ - [ ] Edge cases and errors covered
313
+
314
+ Can't check all boxes? You skipped TDD. Start over.
315
+
316
+ ## When Stuck
317
+
318
+ | Problem | Solution |
319
+ |---------|----------|
320
+ | Don't know how to test | Write wished-for API. Write assertion first. Ask your human partner. |
321
+ | Test too complicated | Design too complicated. Simplify interface. |
322
+ | Must mock everything | Code too coupled. Use dependency injection. |
323
+ | Test setup huge | Extract helpers. Still complex? Simplify design. |
324
+
325
+ ## Debugging Integration
326
+
327
+ Bug found? Write failing test reproducing it. Follow TDD cycle. Test proves fix and prevents regression.
328
+
329
+ Never fix bugs without a test.
330
+
331
+ ## Final Rule
332
+
333
+ ```
334
+ Production code → test exists and failed first
335
+ Otherwise → not TDD
336
+ ```
337
+
338
+ No exceptions without your human partner's permission.
@@ -0,0 +1,198 @@
1
+ # Writing Good Tests
2
+
3
+ **Load this reference when:** writing or changing tests, adding mocks, or
4
+ adding cleanup/helper methods for tests.
5
+
6
+ ## Overview
7
+
8
+ A test exists to catch a specific break. Two principles govern everything
9
+ here:
10
+
11
+ ```
12
+ 1. Every test names the break it catches
13
+ 2. Every test exercises the real thing
14
+ ```
15
+
16
+ Strict TDD produces both naturally: a test written first and watched
17
+ failing against real code has already proven it can fail, and only earns
18
+ a mock when the real dependency proves slow or external.
19
+
20
+ ## Principle 1: Name the Break
21
+
22
+ Before writing the test body, answer: **what production change should
23
+ make this test fail — and is that change a bug or a decision?** A test
24
+ earns its place by catching a wrong branch, missing side effect, wrong
25
+ argument, boundary case, or broken contract.
26
+
27
+ **Derive expectations independently.** Use literals and hand-checked
28
+ fixtures; table-driven tests with literal `want` values are the preferred
29
+ shape. An expectation computed by the code under test — or its helpers —
30
+ passes no matter what that code does:
31
+
32
+ ```typescript
33
+ // ❌ Mirror assertion: the same builder computes both sides — always true
34
+ const expected = buildSearchQuery({ tag: 'urgent' });
35
+ expect(buildSearchQuery({ tag: 'urgent' })).toBe(expected);
36
+
37
+ // ✅ Hand-derived literal
38
+ expect(buildSearchQuery({ tag: 'urgent' })).toBe('tag:"urgent"');
39
+ ```
40
+
41
+ **No change detectors.** If only intentional decisions can fail a test —
42
+ a constant's value, exact message wording, private structure — it fires
43
+ on redesign and sleeps through bugs. Test the behavior that depends on
44
+ the decision: not `expect(MAX_RETRIES).toBe(5)` but "a failing call is
45
+ retried 5 times and the 6th attempt never happens."
46
+
47
+ **Behavior, not text.** Asserting that a script, skill, or config
48
+ contains an exact line proves only that the source is the source. Run
49
+ scripts against controlled inputs and assert outputs, side effects, or
50
+ exit codes. Documents that instruct agents are tested by the consuming
51
+ agent's behavior (superpowers:writing-skills); prose for humans earns no
52
+ test at all.
53
+
54
+ **Your code, not the framework.** Test the contract your code makes at
55
+ its boundaries — the route you register, the query you emit, the payload
56
+ you produce. Upstream mechanics are their maintainers' tests to write
57
+ (the classic: asserting your router invokes a registered handler — that
58
+ is the framework's test, not yours). When upstream behavior genuinely
59
+ surprised you, write one narrow characterization test naming the
60
+ assumption. The same boundary applies inside your code: constructors,
61
+ getters, constants, and trivial forwarding earn tests only when they
62
+ validate, normalize, default, derive, enforce, or cause side effects —
63
+ otherwise assert the first consumer-visible result that depends on them.
64
+
65
+ ### Gate Function
66
+
67
+ ```
68
+ BEFORE writing the test body:
69
+ Name the production change that would make this test fail.
70
+
71
+ Cannot name one → redesign around an observable behavior
72
+ "The source text changed" → run the artifact and assert its effects
73
+ Only intentional decisions → change detector; test the behavior
74
+ that depends on the decision
75
+
76
+ Confirm the expected value is derived without the code under test.
77
+ IF it reuses the code's logic or helpers:
78
+ Replace it with a literal or hand-checked fixture
79
+ ```
80
+
81
+ ## Principle 2: Exercise the Real Thing
82
+
83
+ **The mock earns no assertions.** A mock assertion passes when the mock
84
+ is present and fails when it is absent — it says nothing about the
85
+ component. Assert the real component's behavior; if the mock is what you
86
+ are checking, unmock it or delete the assertion.
87
+
88
+ ```typescript
89
+ // ✅ Real behavior
90
+ expect(screen.getByRole('navigation')).toBeInTheDocument();
91
+
92
+ // ❌ Mock existence
93
+ expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
94
+ ```
95
+
96
+ **your human partner's correction:** "Are we testing the behavior of a
97
+ mock?"
98
+
99
+ **Mock at the right level.** Learn every side effect of the real method
100
+ before replacing it; mock the slow or external operation and keep what
101
+ the test depends on real. When unsure, run the test against the real
102
+ implementation first and observe what actually needs to happen.
103
+
104
+ ```typescript
105
+ // ❌ The mock swallows the config write that duplicate detection reads
106
+ vi.mock('ToolCatalog', () => ({
107
+ discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
108
+ }));
109
+
110
+ // ✅ Mock only the slow server startup; the config write stays real
111
+ vi.mock('MCPServerManager');
112
+ ```
113
+
114
+ **Make doubles specific.** When arguments, call counts, or ordering are
115
+ part of the contract, assert them — a fake that accepts anything verifies
116
+ nothing. Give each branch (success, error, malformed) its own fixture or
117
+ spy, so the wrong branch cannot satisfy the expectation.
118
+
119
+ **Mirror real data completely.** Mock the complete structure as it exists
120
+ in reality — all documented fields — not just the ones your test reads.
121
+ Partial mocks fail silently when downstream code reads an omitted field:
122
+ the test passes while integration breaks.
123
+
124
+ **Production classes carry production methods only.** Cleanup that only
125
+ tests need lives in test utilities, never as a `destroy()` on the
126
+ production class. Ask: is this method called only from tests? Does this
127
+ class own this resource's lifecycle? Wrong answers → test utility.
128
+
129
+ **Prefer real components over complex mocks.** When mock setup outgrows
130
+ the test logic, mocks miss methods the real components have, or tests
131
+ break when the mock changes, switch to an integration test with real
132
+ components. **your human partner's question:** "Do we need to be using a
133
+ mock here?"
134
+
135
+ ### Gate Function
136
+
137
+ ```
138
+ BEFORE adding a mock or test helper:
139
+ List the real method's side effects; keep the ones the test
140
+ depends on real — mock the slow/external level below them.
141
+
142
+ Mock responses mirror the complete real structure.
143
+
144
+ A method only tests call lives in test utilities, not production.
145
+
146
+ About to assert on the mock itself?
147
+ Unmock it or delete the assertion.
148
+ ```
149
+
150
+ ## Tests Ship With the Implementation
151
+
152
+ The TDD cycle — failing test, minimal implementation, refactor — is what
153
+ "complete" means. Ship the tests the behavior needs and only those:
154
+ trivial code and human prose earn none, and a test written to satisfy
155
+ process costs maintenance forever.
156
+
157
+ ## The Mutation Check
158
+
159
+ Before finishing, mentally mutate the production code; at least one test
160
+ should fail for each realistic mutation:
161
+
162
+ - Wrong constant or argument
163
+ - Wrong branch handler
164
+ - Missing state change or side effect
165
+ - Empty or default return
166
+ - Missing validation for zero, empty, nil, unauthorized, or malformed input
167
+
168
+ A mutation nothing catches marks the behavior as unprotected — or the
169
+ test as tautological.
170
+
171
+ ## Quick Reference
172
+
173
+ | When you... | Do |
174
+ |-------------|-----|
175
+ | Write any test | Name the break it catches — a bug, not a decision |
176
+ | Build an expected value | Derive it by hand; never with the code under test |
177
+ | Test a script or document | Run it / pressure-test its consumer; never grep its text |
178
+ | Reach for a dependency test | Test your boundary contract, not their documented mechanics |
179
+ | Want to assert on a mocked element | Test the real component, or unmock it |
180
+ | Are about to mock a method | Learn its side effects; mock the slow/external level |
181
+ | Build a mock response | Mirror the real structure completely |
182
+ | Need cleanup only tests use | Put it in test utilities |
183
+ | Watch mock setup balloon | Switch to an integration test with real components |
184
+ | Finish a test file | Run the mutation check |
185
+
186
+ ## Warning Signs
187
+
188
+ - Setup and assertion share the same object, guaranteeing equality
189
+ - The test can fail only through a panic, crash, or missing selector
190
+ - The test fails on every intentional change, never on accidental breakage
191
+ - Expected values are hidden behind loops, builders, or helpers
192
+ - The test greps source text, or asserts a removed symbol stays removed
193
+ - The test would still matter if only the framework remained
194
+ - The test exists for coverage, checking no side effect or outcome
195
+ - An assertion checks a `*-mock` test ID, or fails if you remove the mock
196
+ - A method is called only from test files
197
+ - Mock setup is more than half the test, or you can't explain why the mock is needed
198
+ - Mocking "just to be safe"