@waoooo/claude-skills 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/README.md +48 -0
  2. package/package.json +28 -0
  3. package/registry.json +431 -0
  4. package/skills/acceptance-review/SKILL.md +537 -0
  5. package/skills/all-plan/SKILL.md +19 -0
  6. package/skills/all-plan/references/flow.md +750 -0
  7. package/skills/api-docs-generate/SKILL.md +204 -0
  8. package/skills/api-docs-generate/assets/templates/api.mdx +140 -0
  9. package/skills/api-docs-generate/scripts/generate-api-docs.ts +308 -0
  10. package/skills/ask/SKILL.md +42 -0
  11. package/skills/autonew/SKILL.md +34 -0
  12. package/skills/capability-analyze/SKILL.md +300 -0
  13. package/skills/capability-analyze/scripts/analyze-capabilities.ts +531 -0
  14. package/skills/capability-docs-generate/SKILL.md +155 -0
  15. package/skills/capability-docs-generate/assets/templates/capability.mdx +271 -0
  16. package/skills/capability-docs-generate/scripts/generate-capability-docs.ts +358 -0
  17. package/skills/capability-tree-query/SKILL.md +112 -0
  18. package/skills/capability-tree-query/scripts/build-capability-tree.ts +402 -0
  19. package/skills/changelog-generator/SKILL.md +104 -0
  20. package/skills/continue/SKILL.md +39 -0
  21. package/skills/continue/agents/openai.yaml +3 -0
  22. package/skills/creating-skills/SKILL.md +158 -0
  23. package/skills/creating-skills/references/official_best_practices.md +128 -0
  24. package/skills/creating-skills/references/skill_examples.md +199 -0
  25. package/skills/docx/LICENSE.txt +30 -0
  26. package/skills/docx/SKILL.md +197 -0
  27. package/skills/docx/docx-js.md +350 -0
  28. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  29. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  30. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  31. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  32. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  33. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  34. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  35. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  36. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  37. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  38. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  39. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  40. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  41. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  42. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  43. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  44. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  45. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  46. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  47. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  48. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  49. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  50. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  51. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  52. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  53. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  54. package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  55. package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  56. package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  57. package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  58. package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  59. package/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
  60. package/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  61. package/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  62. package/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  63. package/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  64. package/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  65. package/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  66. package/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  67. package/skills/docx/ooxml/scripts/pack.py +159 -0
  68. package/skills/docx/ooxml/scripts/unpack.py +29 -0
  69. package/skills/docx/ooxml/scripts/validate.py +69 -0
  70. package/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
  71. package/skills/docx/ooxml/scripts/validation/base.py +951 -0
  72. package/skills/docx/ooxml/scripts/validation/docx.py +274 -0
  73. package/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
  74. package/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
  75. package/skills/docx/ooxml.md +610 -0
  76. package/skills/docx/scripts/__init__.py +1 -0
  77. package/skills/docx/scripts/document.py +1276 -0
  78. package/skills/docx/scripts/templates/comments.xml +3 -0
  79. package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  80. package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  81. package/skills/docx/scripts/templates/commentsIds.xml +3 -0
  82. package/skills/docx/scripts/templates/people.xml +3 -0
  83. package/skills/docx/scripts/utilities.py +374 -0
  84. package/skills/git-branch-create/SKILL.md +170 -0
  85. package/skills/git-branch-merge/SKILL.md +176 -0
  86. package/skills/git-commit/SKILL.md +56 -0
  87. package/skills/git-commit/references/commit_examples.md +311 -0
  88. package/skills/github-actions-trigger/SKILL.md +367 -0
  89. package/skills/github-issue-create/SKILL.md +294 -0
  90. package/skills/github-pr-creation/SKILL.md +137 -0
  91. package/skills/github-pr-creation/references/pr_templates.md +187 -0
  92. package/skills/github-pr-merge/SKILL.md +112 -0
  93. package/skills/github-pr-review/SKILL.md +110 -0
  94. package/skills/github-pr-review/references/severity_guide.md +168 -0
  95. package/skills/job-create/SKILL.md +294 -0
  96. package/skills/job-create/scripts/create-job.ts +105 -0
  97. package/skills/job-workflow/SKILL.md +212 -0
  98. package/skills/keyword-extract/SKILL.md +229 -0
  99. package/skills/mcp-builder/LICENSE.txt +202 -0
  100. package/skills/mcp-builder/SKILL.md +236 -0
  101. package/skills/mcp-builder/reference/evaluation.md +602 -0
  102. package/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
  103. package/skills/mcp-builder/reference/node_mcp_server.md +970 -0
  104. package/skills/mcp-builder/reference/python_mcp_server.md +719 -0
  105. package/skills/mcp-builder/scripts/connections.py +151 -0
  106. package/skills/mcp-builder/scripts/evaluation.py +373 -0
  107. package/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  108. package/skills/mcp-builder/scripts/requirements.txt +2 -0
  109. package/skills/mdx-to-openspec/SKILL.md +827 -0
  110. package/skills/mdx-to-openspec/scripts/mdx-to-openspec.ts +320 -0
  111. package/skills/mounted/SKILL.md +20 -0
  112. package/skills/multi-model-review/SKILL.md +459 -0
  113. package/skills/notion-automation/SKILL.md +215 -0
  114. package/skills/openspec-review/SKILL.md +513 -0
  115. package/skills/pdf/LICENSE.txt +30 -0
  116. package/skills/pdf/SKILL.md +294 -0
  117. package/skills/pdf/forms.md +205 -0
  118. package/skills/pdf/reference.md +612 -0
  119. package/skills/pdf/scripts/check_bounding_boxes.py +70 -0
  120. package/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
  121. package/skills/pdf/scripts/check_fillable_fields.py +12 -0
  122. package/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
  123. package/skills/pdf/scripts/create_validation_image.py +41 -0
  124. package/skills/pdf/scripts/extract_form_field_info.py +152 -0
  125. package/skills/pdf/scripts/fill_fillable_fields.py +114 -0
  126. package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
  127. package/skills/pend/SKILL.md +33 -0
  128. package/skills/ping/SKILL.md +39 -0
  129. package/skills/pptx/LICENSE.txt +30 -0
  130. package/skills/pptx/SKILL.md +484 -0
  131. package/skills/pptx/html2pptx.md +625 -0
  132. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  133. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  134. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  135. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  136. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  137. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  138. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  139. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  140. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  141. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  142. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  143. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  144. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  145. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  146. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  147. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  148. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  149. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  150. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  151. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  152. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  153. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  154. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  155. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  156. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  157. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  158. package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  159. package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  160. package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  161. package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  162. package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  163. package/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
  164. package/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  165. package/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  166. package/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  167. package/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  168. package/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  169. package/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  170. package/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  171. package/skills/pptx/ooxml/scripts/pack.py +159 -0
  172. package/skills/pptx/ooxml/scripts/unpack.py +29 -0
  173. package/skills/pptx/ooxml/scripts/validate.py +69 -0
  174. package/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
  175. package/skills/pptx/ooxml/scripts/validation/base.py +951 -0
  176. package/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
  177. package/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
  178. package/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
  179. package/skills/pptx/ooxml.md +427 -0
  180. package/skills/pptx/scripts/html2pptx.js +979 -0
  181. package/skills/pptx/scripts/inventory.py +1020 -0
  182. package/skills/pptx/scripts/rearrange.py +231 -0
  183. package/skills/pptx/scripts/replace.py +385 -0
  184. package/skills/pptx/scripts/thumbnail.py +450 -0
  185. package/skills/progress-update/SKILL.md +394 -0
  186. package/skills/progress-update/scripts/update-progress.ts +221 -0
  187. package/skills/release-automation/SKILL.md +306 -0
  188. package/skills/requirement-parse/SKILL.md +212 -0
  189. package/skills/requirement-parse/scripts/infer-builder-config.ts +346 -0
  190. package/skills/requirement-parse/scripts/merge-requirements.ts +228 -0
  191. package/skills/requirement-parse/scripts/parse-docs.ts +206 -0
  192. package/skills/requirement-parse/scripts/parse-openspec.ts +168 -0
  193. package/skills/roadmap-docs-generate/SKILL.md +483 -0
  194. package/skills/roadmap-docs-generate/assets/templates/ROADMAP.mdx +75 -0
  195. package/skills/roadmap-docs-generate/assets/templates/ROADMAP.mdx.template +330 -0
  196. package/skills/roadmap-docs-generate/assets/templates/TODO.mdx +56 -0
  197. package/skills/roadmap-docs-generate/assets/templates/TODO.mdx.template +363 -0
  198. package/skills/roadmap-docs-generate/scripts/json-to-mdx.ts +445 -0
  199. package/skills/roadmap-docs-generate/scripts/json-to-mdx.ts.backup +411 -0
  200. package/skills/roadmap-generate/SKILL.md +396 -0
  201. package/skills/roadmap-generate/scripts/generate-roadmap.ts +496 -0
  202. package/skills/skill-creator/LICENSE.txt +202 -0
  203. package/skills/skill-creator/SKILL.md +356 -0
  204. package/skills/skill-creator/references/output-patterns.md +82 -0
  205. package/skills/skill-creator/references/workflows.md +28 -0
  206. package/skills/skill-creator/scripts/init_skill.py +303 -0
  207. package/skills/skill-creator/scripts/package_skill.py +110 -0
  208. package/skills/skill-creator/scripts/quick_validate.py +95 -0
  209. package/skills/spec-generate/SKILL.md +408 -0
  210. package/skills/spec-generate/scripts/generate-specs.ts +538 -0
  211. package/skills/spec-generate/scripts/generate-tasks.ts +174 -0
  212. package/skills/specs-review/SKILL.md +370 -0
  213. package/skills/task-execute/SKILL.md +399 -0
  214. package/skills/task-update-status/SKILL.md +349 -0
  215. package/skills/task-update-status/scripts/update-task-status.ts +192 -0
  216. package/skills/task-verify/SKILL.md +407 -0
  217. package/skills/ui-ux-pro-max/SKILL.md +386 -0
  218. package/skills/ui-ux-pro-max/data/charts.csv +26 -0
  219. package/skills/ui-ux-pro-max/data/colors.csv +97 -0
  220. package/skills/ui-ux-pro-max/data/icons.csv +101 -0
  221. package/skills/ui-ux-pro-max/data/landing.csv +31 -0
  222. package/skills/ui-ux-pro-max/data/products.csv +97 -0
  223. package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  224. package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  225. package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  226. package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  227. package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  228. package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  229. package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  230. package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  231. package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  232. package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  233. package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  234. package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  235. package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  236. package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  237. package/skills/ui-ux-pro-max/data/styles.csv +68 -0
  238. package/skills/ui-ux-pro-max/data/typography.csv +58 -0
  239. package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  240. package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  241. package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  242. package/skills/ui-ux-pro-max/scripts/core.py +253 -0
  243. package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  244. package/skills/ui-ux-pro-max/scripts/search.py +114 -0
  245. package/skills/vercel-automation/SKILL.md +226 -0
  246. package/skills/webapp-testing/LICENSE.txt +202 -0
  247. package/skills/webapp-testing/SKILL.md +96 -0
  248. package/skills/webapp-testing/examples/console_logging.py +35 -0
  249. package/skills/webapp-testing/examples/element_discovery.py +40 -0
  250. package/skills/webapp-testing/examples/static_html_automation.py +33 -0
  251. package/skills/webapp-testing/scripts/with_server.py +106 -0
  252. package/skills/worktree-manager/SKILL.md +725 -0
  253. package/skills/worktree-manager/config.json +15 -0
  254. package/skills/worktree-manager/scripts/allocate-ports.sh +100 -0
  255. package/skills/worktree-manager/scripts/cleanup.sh +185 -0
  256. package/skills/worktree-manager/scripts/launch-agent.sh +155 -0
  257. package/skills/worktree-manager/scripts/register.sh +125 -0
  258. package/skills/worktree-manager/scripts/release-ports.sh +48 -0
  259. package/skills/worktree-manager/scripts/status.sh +169 -0
  260. package/skills/worktree-manager/scripts/sync.sh +168 -0
  261. package/skills/worktree-manager/templates/worktree.json +23 -0
  262. package/skills/xlsx/LICENSE.txt +30 -0
  263. package/skills/xlsx/SKILL.md +289 -0
  264. package/skills/xlsx/recalc.py +178 -0
@@ -0,0 +1,531 @@
1
+ /**
2
+ * Analyze Capabilities (Three-Way Comparison)
3
+ *
4
+ * Compare: Requirements vs Capability Tree vs Project Code
5
+ * Output: capability-analysis.json with available/missing/implemented/dependencies
6
+ */
7
+
8
+ import fs from 'fs';
9
+ import path from 'path';
10
+ import type { UnifiedRequirements } from '../types/unified-requirements';
11
+
12
+ interface CapabilityTree {
13
+ id: string;
14
+ name: string;
15
+ layer: string;
16
+ status: string;
17
+ requires?: string[];
18
+ relatedTo?: string[];
19
+ children?: CapabilityTree[];
20
+ }
21
+
22
+ interface CapabilityStatus {
23
+ capId: string;
24
+ name: string;
25
+ layer: string;
26
+ status: 'available' | 'missing' | 'implemented' | 'available-not-impl';
27
+ source: 'capability-tree' | 'project-code' | 'both';
28
+ usedBy?: string[];
29
+ requiredBy?: string[];
30
+ detectedIn?: string[];
31
+ notInTree?: boolean;
32
+ suggestedAction?: 'use' | 'develop' | 'update-tree' | 'implement';
33
+ }
34
+
35
+ interface CapabilityAnalysis {
36
+ version: string;
37
+ jobId: string;
38
+ analyzedAt: string;
39
+ summary: {
40
+ totalRequirements: number;
41
+ requiredCapabilities: number;
42
+ availableCapabilities: number;
43
+ missingCapabilities: number;
44
+ implementedInProject: number;
45
+ };
46
+ capabilities: {
47
+ available: CapabilityStatus[];
48
+ missing: CapabilityStatus[];
49
+ implemented: CapabilityStatus[];
50
+ };
51
+ dependencies: {
52
+ graph: Record<string, { requires: string[]; blocks: string[] }>;
53
+ layers: Record<string, string[]>;
54
+ capabilityDependencies: Record<string, { requires: string[]; requiredBy: string[]; relatedTo: string[] }>;
55
+ };
56
+ recommendations: Array<{
57
+ type: 'develop' | 'update-tree' | 'implement' | 'use';
58
+ capability: string;
59
+ reason: string;
60
+ priority: 'high' | 'medium' | 'low';
61
+ }>;
62
+ }
63
+
64
+ /**
65
+ * Flatten capability tree to a map
66
+ */
67
+ function flattenCapabilityTree(tree: CapabilityTree[], map: Map<string, CapabilityTree> = new Map()): Map<string, CapabilityTree> {
68
+ for (const cap of tree) {
69
+ map.set(cap.id, cap);
70
+ if (cap.children && cap.children.length > 0) {
71
+ flattenCapabilityTree(cap.children, map);
72
+ }
73
+ }
74
+ return map;
75
+ }
76
+
77
+ /**
78
+ * Extract required capabilities from unified requirements
79
+ */
80
+ function extractRequiredCapabilities(unified: UnifiedRequirements): string[] {
81
+ const capabilities = new Set<string>();
82
+
83
+ // From requirements
84
+ for (const req of unified.requirements || []) {
85
+ if (req.capabilityHints) {
86
+ for (const cap of req.capabilityHints) {
87
+ capabilities.add(cap);
88
+ }
89
+ }
90
+ }
91
+
92
+ // From builder source
93
+ if (unified.sources?.builder?.capabilities) {
94
+ for (const cap of unified.sources.builder.capabilities) {
95
+ capabilities.add(cap);
96
+ }
97
+ }
98
+
99
+ return Array.from(capabilities);
100
+ }
101
+
102
+ /**
103
+ * Detect capabilities in project code
104
+ */
105
+ function detectProjectCapabilities(projectPath: string | null): Map<string, { detectedIn: string[] }> {
106
+ const detected = new Map<string, { detectedIn: string[] }>();
107
+
108
+ if (!projectPath || !fs.existsSync(projectPath)) {
109
+ return detected;
110
+ }
111
+
112
+ console.log(` Scanning project: ${projectPath}`);
113
+
114
+ // Scan directories for capability patterns
115
+ const scanDir = (dir: string, basePath: string = '') => {
116
+ if (!fs.existsSync(dir)) return;
117
+
118
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
119
+
120
+ for (const entry of entries) {
121
+ const fullPath = path.join(dir, entry.name);
122
+ const relativePath = path.join(basePath, entry.name);
123
+
124
+ // Skip node_modules, .git, etc.
125
+ if (entry.name.startsWith('.') || entry.name === 'node_modules') {
126
+ continue;
127
+ }
128
+
129
+ if (entry.isDirectory()) {
130
+ // Check if directory name matches capability pattern
131
+ const capId = entry.name.toLowerCase();
132
+ if (!detected.has(capId)) {
133
+ detected.set(capId, { detectedIn: [] });
134
+ }
135
+ detected.get(capId)!.detectedIn.push(relativePath);
136
+
137
+ // Recursively scan subdirectories
138
+ scanDir(fullPath, relativePath);
139
+ }
140
+ }
141
+ };
142
+
143
+ scanDir(projectPath);
144
+
145
+ return detected;
146
+ }
147
+
148
+ /**
149
+ * Three-way comparison: Requirements vs Capability Tree vs Project Code
150
+ */
151
+ function threeWayComparison(
152
+ requiredCapabilities: string[],
153
+ capabilityMap: Map<string, CapabilityTree>,
154
+ projectCapabilities: Map<string, { detectedIn: string[] }>,
155
+ unified: UnifiedRequirements
156
+ ): {
157
+ available: CapabilityStatus[];
158
+ missing: CapabilityStatus[];
159
+ implemented: CapabilityStatus[];
160
+ } {
161
+ const available: CapabilityStatus[] = [];
162
+ const missing: CapabilityStatus[] = [];
163
+ const implemented: CapabilityStatus[] = [];
164
+
165
+ for (const capId of requiredCapabilities) {
166
+ const inTree = capabilityMap.get(capId);
167
+ const inProject = projectCapabilities.get(capId);
168
+
169
+ // Find which requirements use this capability
170
+ const usedBy = unified.requirements
171
+ ?.filter(req => req.capabilityHints?.includes(capId))
172
+ .map(req => req.reqId) || [];
173
+
174
+ if (inTree && inProject) {
175
+ // ✅ In tree AND in project
176
+ if (inTree.status === 'implemented') {
177
+ available.push({
178
+ capId: inTree.id,
179
+ name: inTree.name,
180
+ layer: inTree.layer,
181
+ status: 'available',
182
+ source: 'both',
183
+ usedBy,
184
+ suggestedAction: 'use',
185
+ });
186
+ console.log(` ✅ ${inTree.name} - available (tree + project)`);
187
+ } else {
188
+ available.push({
189
+ capId: inTree.id,
190
+ name: inTree.name,
191
+ layer: inTree.layer,
192
+ status: 'available-not-impl',
193
+ source: 'both',
194
+ usedBy,
195
+ suggestedAction: 'implement',
196
+ });
197
+ console.log(` ⚠️ ${inTree.name} - in tree but status: ${inTree.status}`);
198
+ }
199
+ } else if (inTree && !inProject) {
200
+ // ✅ In tree but NOT in project
201
+ if (inTree.status === 'implemented') {
202
+ available.push({
203
+ capId: inTree.id,
204
+ name: inTree.name,
205
+ layer: inTree.layer,
206
+ status: 'available',
207
+ source: 'capability-tree',
208
+ usedBy,
209
+ suggestedAction: 'use',
210
+ });
211
+ console.log(` ✅ ${inTree.name} - available (tree only)`);
212
+ } else if (inTree.status === 'partial') {
213
+ // Partial implementation - in tree but not fully implemented
214
+ available.push({
215
+ capId: inTree.id,
216
+ name: inTree.name,
217
+ layer: inTree.layer,
218
+ status: 'available-not-impl',
219
+ source: 'capability-tree',
220
+ usedBy,
221
+ suggestedAction: 'implement',
222
+ });
223
+ console.log(` ⚠️ ${inTree.name} - in tree but status: ${inTree.status}`);
224
+ } else {
225
+ // Planned or missing - not yet implemented
226
+ missing.push({
227
+ capId: inTree.id,
228
+ name: inTree.name,
229
+ layer: inTree.layer,
230
+ status: 'missing',
231
+ source: 'capability-tree',
232
+ requiredBy: usedBy,
233
+ suggestedAction: 'develop',
234
+ });
235
+ console.log(` ❌ ${inTree.name} - in tree but not implemented (status: ${inTree.status})`);
236
+ }
237
+ } else if (!inTree && inProject) {
238
+ // 🔍 In project but NOT in tree
239
+ implemented.push({
240
+ capId,
241
+ name: capId,
242
+ layer: 'unknown',
243
+ status: 'implemented',
244
+ source: 'project-code',
245
+ detectedIn: inProject.detectedIn,
246
+ notInTree: true,
247
+ usedBy,
248
+ suggestedAction: 'update-tree',
249
+ });
250
+ console.log(` 🔍 ${capId} - implemented but not in tree`);
251
+ } else {
252
+ // ❌ NOT in tree AND NOT in project
253
+ missing.push({
254
+ capId,
255
+ name: capId,
256
+ layer: 'unknown',
257
+ status: 'missing',
258
+ source: 'capability-tree',
259
+ requiredBy: usedBy,
260
+ suggestedAction: 'develop',
261
+ });
262
+ console.log(` ❌ ${capId} - missing (not in tree or project)`);
263
+ }
264
+ }
265
+
266
+ return { available, missing, implemented };
267
+ }
268
+
269
+ /**
270
+ * Build capability dependency graph from capability tree
271
+ */
272
+ function buildCapabilityDependencyGraph(capabilityMap: Map<string, CapabilityTree>): Record<string, {
273
+ requires: string[];
274
+ requiredBy: string[];
275
+ relatedTo: string[]
276
+ }> {
277
+ const graph: Record<string, { requires: string[]; requiredBy: string[]; relatedTo: string[] }> = {};
278
+
279
+ // Initialize graph for all capabilities
280
+ for (const [capId, cap] of capabilityMap.entries()) {
281
+ graph[capId] = {
282
+ requires: cap.requires || [],
283
+ requiredBy: [],
284
+ relatedTo: cap.relatedTo || [],
285
+ };
286
+ }
287
+
288
+ // Build reverse dependencies (requiredBy)
289
+ for (const [capId, cap] of capabilityMap.entries()) {
290
+ if (cap.requires) {
291
+ for (const requiredCapId of cap.requires) {
292
+ if (graph[requiredCapId]) {
293
+ graph[requiredCapId].requiredBy.push(capId);
294
+ }
295
+ }
296
+ }
297
+ }
298
+
299
+ return graph;
300
+ }
301
+
302
+ /**
303
+ * Build dependency graph from requirements
304
+ */
305
+ function buildDependencyGraph(
306
+ unified: UnifiedRequirements,
307
+ capabilityMap: Map<string, CapabilityTree>
308
+ ): {
309
+ graph: Record<string, { requires: string[]; blocks: string[] }>;
310
+ layers: Record<string, string[]>;
311
+ capabilityDependencies: Record<string, { requires: string[]; requiredBy: string[]; relatedTo: string[] }>;
312
+ } {
313
+ const graph: Record<string, { requires: string[]; blocks: string[] }> = {};
314
+ const layers: Record<string, string[]> = {};
315
+
316
+ for (const req of unified.requirements || []) {
317
+ graph[req.reqId] = {
318
+ requires: req.capabilityHints || [],
319
+ blocks: req.blocks || [],
320
+ };
321
+
322
+ // Group by layer
323
+ const layer = req.layerHint || 'unknown';
324
+ if (!layers[layer]) {
325
+ layers[layer] = [];
326
+ }
327
+ if (req.capabilityHints) {
328
+ layers[layer].push(...req.capabilityHints);
329
+ }
330
+ }
331
+
332
+ // Build capability dependency graph
333
+ const capabilityDependencies = buildCapabilityDependencyGraph(capabilityMap);
334
+
335
+ return { graph, layers, capabilityDependencies };
336
+ }
337
+
338
+ /**
339
+ * Generate recommendations
340
+ */
341
+ function generateRecommendations(
342
+ available: CapabilityStatus[],
343
+ missing: CapabilityStatus[],
344
+ implemented: CapabilityStatus[],
345
+ capabilityDependencies: Record<string, { requires: string[]; requiredBy: string[]; relatedTo: string[] }>
346
+ ): Array<{
347
+ type: 'develop' | 'update-tree' | 'implement' | 'use';
348
+ capability: string;
349
+ reason: string;
350
+ priority: 'high' | 'medium' | 'low';
351
+ }> {
352
+ const recommendations: Array<{
353
+ type: 'develop' | 'update-tree' | 'implement' | 'use';
354
+ capability: string;
355
+ reason: string;
356
+ priority: 'high' | 'medium' | 'low';
357
+ }> = [];
358
+
359
+ // Missing capabilities - need to develop
360
+ for (const cap of missing) {
361
+ recommendations.push({
362
+ type: 'develop',
363
+ capability: cap.capId,
364
+ reason: `Required by ${cap.requiredBy?.join(', ') || 'requirements'}`,
365
+ priority: cap.layer === 'L1' ? 'high' : cap.layer === 'L2' ? 'medium' : 'low',
366
+ });
367
+ }
368
+
369
+ // Implemented but not in tree - update tree
370
+ for (const cap of implemented) {
371
+ if (cap.notInTree) {
372
+ recommendations.push({
373
+ type: 'update-tree',
374
+ capability: cap.capId,
375
+ reason: `Implemented in project but not recorded in capability tree`,
376
+ priority: 'medium',
377
+ });
378
+ }
379
+ }
380
+
381
+ // Available but not implemented - need to implement
382
+ for (const cap of available) {
383
+ if (cap.status === 'available-not-impl') {
384
+ const deps = capabilityDependencies[cap.capId];
385
+ let reason = `In capability tree but not implemented`;
386
+
387
+ // Add dependency information
388
+ if (deps && deps.requires.length > 0) {
389
+ reason += `. Depends on: ${deps.requires.join(', ')}`;
390
+ }
391
+
392
+ recommendations.push({
393
+ type: 'implement',
394
+ capability: cap.capId,
395
+ reason,
396
+ priority: 'high',
397
+ });
398
+ }
399
+ }
400
+
401
+ return recommendations;
402
+ }
403
+
404
+ /**
405
+ * Main function
406
+ */
407
+ function analyzeCapabilities(
408
+ unifiedPath: string,
409
+ capabilityTreePath: string,
410
+ outputPath: string,
411
+ projectPath: string | null = null,
412
+ jobId: string = 'unknown'
413
+ ) {
414
+ console.log('🔍 Analyzing capabilities (three-way comparison)...');
415
+
416
+ // Read unified.json
417
+ if (!fs.existsSync(unifiedPath)) {
418
+ throw new Error(`Unified file not found: ${unifiedPath}`);
419
+ }
420
+ const unified: UnifiedRequirements = JSON.parse(fs.readFileSync(unifiedPath, 'utf-8'));
421
+
422
+ // Read capability-tree.json
423
+ if (!fs.existsSync(capabilityTreePath)) {
424
+ throw new Error(`Capability tree not found: ${capabilityTreePath}`);
425
+ }
426
+ const capabilityTreeData = JSON.parse(fs.readFileSync(capabilityTreePath, 'utf-8'));
427
+ const capabilityTree: CapabilityTree[] = capabilityTreeData.capabilities || capabilityTreeData;
428
+
429
+ // Flatten capability tree
430
+ const capabilityMap = flattenCapabilityTree(capabilityTree);
431
+ console.log(` Found ${capabilityMap.size} capabilities in tree`);
432
+
433
+ // Extract required capabilities
434
+ const requiredCapabilities = extractRequiredCapabilities(unified);
435
+ console.log(` Required capabilities: ${requiredCapabilities.length}`);
436
+
437
+ // Detect capabilities in project code
438
+ const projectCapabilities = detectProjectCapabilities(projectPath);
439
+ console.log(` Detected ${projectCapabilities.size} capabilities in project`);
440
+
441
+ // Three-way comparison
442
+ console.log('\n🔄 Three-way comparison:');
443
+ const { available, missing, implemented } = threeWayComparison(
444
+ requiredCapabilities,
445
+ capabilityMap,
446
+ projectCapabilities,
447
+ unified
448
+ );
449
+
450
+ // Build dependency graph
451
+ const dependencies = buildDependencyGraph(unified, capabilityMap);
452
+
453
+ // Generate recommendations
454
+ const recommendations = generateRecommendations(
455
+ available,
456
+ missing,
457
+ implemented,
458
+ dependencies.capabilityDependencies
459
+ );
460
+
461
+ // Build analysis result
462
+ const analysis: CapabilityAnalysis = {
463
+ version: '1.0.0',
464
+ jobId,
465
+ analyzedAt: new Date().toISOString(),
466
+ summary: {
467
+ totalRequirements: unified.requirements?.length || 0,
468
+ requiredCapabilities: requiredCapabilities.length,
469
+ availableCapabilities: available.length,
470
+ missingCapabilities: missing.length,
471
+ implementedInProject: implemented.length,
472
+ },
473
+ capabilities: {
474
+ available,
475
+ missing,
476
+ implemented,
477
+ },
478
+ dependencies,
479
+ recommendations,
480
+ };
481
+
482
+ // Write output
483
+ const outputDir = path.dirname(outputPath);
484
+ if (!fs.existsSync(outputDir)) {
485
+ fs.mkdirSync(outputDir, { recursive: true });
486
+ }
487
+
488
+ fs.writeFileSync(outputPath, JSON.stringify(analysis, null, 2));
489
+ console.log(`\n✅ Capability analysis saved to: ${outputPath}`);
490
+ console.log(` Total requirements: ${analysis.summary.totalRequirements}`);
491
+ console.log(` Required capabilities: ${analysis.summary.requiredCapabilities}`);
492
+ console.log(` Available: ${analysis.summary.availableCapabilities}`);
493
+ console.log(` Missing: ${analysis.summary.missingCapabilities}`);
494
+ console.log(` Implemented (not in tree): ${analysis.summary.implementedInProject}`);
495
+ console.log(` Recommendations: ${recommendations.length}`);
496
+ }
497
+
498
+ // CLI
499
+ if (import.meta.url === `file://${process.argv[1]}`) {
500
+ const args = process.argv.slice(2);
501
+
502
+ if (args.length < 3) {
503
+ console.error('Usage: tsx analyze-capabilities.ts <unified.json> <capability-tree.json> <output.json> [--project-path <path>] [--job-id <id>]');
504
+ process.exit(1);
505
+ }
506
+
507
+ const [unifiedPath, capabilityTreePath, outputPath] = args;
508
+
509
+ // Parse optional arguments
510
+ let projectPath: string | null = null;
511
+ let jobId = 'unknown';
512
+
513
+ for (let i = 3; i < args.length; i++) {
514
+ if (args[i] === '--project-path' && i + 1 < args.length) {
515
+ projectPath = args[i + 1];
516
+ i++;
517
+ } else if (args[i] === '--job-id' && i + 1 < args.length) {
518
+ jobId = args[i + 1];
519
+ i++;
520
+ }
521
+ }
522
+
523
+ try {
524
+ analyzeCapabilities(unifiedPath, capabilityTreePath, outputPath, projectPath, jobId);
525
+ } catch (error) {
526
+ console.error('❌ Error:', error);
527
+ process.exit(1);
528
+ }
529
+ }
530
+
531
+ export { analyzeCapabilities };
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: capability-docs-generate
3
+ description: 从 OpenSpec 和代码自动生成能力文档(capabilities/*.mdx),包含架构设计、API 接口、使用示例等内容
4
+ version: 0.1.0
5
+ ---
6
+
7
+ # Skill: capability-docs-generate
8
+
9
+ ## 功能
10
+
11
+ 从 OpenSpec 提案和代码实现自动生成能力文档,输出到 waoooo-docs 的 capabilities 目录。
12
+
13
+ ## 何时调用
14
+
15
+ - 开发完成后,需要生成能力文档
16
+ - 更新能力实现后,需要更新文档
17
+ - 用户说:"生成能力文档"、"更新能力文档"
18
+
19
+ ## 输入
20
+
21
+ - `openspecPath` - OpenSpec 目录路径(包含 proposal.md, design.md)
22
+ - `capabilityId` - 能力 ID(如 `pricing`, `auth`)
23
+ - `layer` - 能力层级(`l1-foundation`, `l2-integration`, `l3-workflow`)
24
+ - `frontendPath` - 前端代码路径(可选)
25
+ - `backendPath` - 后端代码路径(可选)
26
+
27
+ ## 输出
28
+
29
+ - `waoooo-docs/developer-docs/capabilities/<layer>/<capability-id>.mdx`
30
+
31
+ ## 执行步骤
32
+
33
+ ### 1. 读取 OpenSpec
34
+
35
+ ```bash
36
+ # 读取 OpenSpec 文件
37
+ - proposal.md(提取概述、目标、背景)
38
+ - design.md(提取架构设计、技术方案)
39
+ ```
40
+
41
+ ### 2. 分析代码实现
42
+
43
+ ```bash
44
+ # 扫描前端代码
45
+ - 查找 API 调用
46
+ - 查找 Hooks 使用
47
+ - 查找组件实现
48
+
49
+ # 扫描后端代码
50
+ - 查找 API 端点
51
+ - 查找数据模型
52
+ - 查找业务逻辑
53
+ ```
54
+
55
+ ### 3. 生成文档
56
+
57
+ ```bash
58
+ # 使用模板生成
59
+ npx tsx .claude/skills/capability-docs-generate/scripts/generate-capability-docs.ts \
60
+ --openspec-path <path> \
61
+ --capability-id <id> \
62
+ --layer <layer> \
63
+ --frontend-path <path> \
64
+ --backend-path <path>
65
+ ```
66
+
67
+ ### 4. 验证输出
68
+
69
+ - 检查文档是否生成
70
+ - 检查 Mermaid 图是否正确
71
+ - 检查代码示例是否完整
72
+
73
+ ## 使用示例
74
+
75
+ ### 示例 1:生成 L1 能力文档
76
+
77
+ ```
78
+ 用户: "生成 pricing 能力文档"
79
+
80
+ Agent 行动:
81
+ 1. 读取 OpenSpec: openspec/changes/001-pricing-system/
82
+ 2. 扫描前端代码: packages/pricing/
83
+ 3. 扫描后端代码: waoooo-service/domains/pricing/
84
+ 4. 生成文档: capabilities/l1-foundation/pricing.mdx
85
+ 5. 显示结果
86
+ ```
87
+
88
+ ### 示例 2:更新能力文档
89
+
90
+ ```
91
+ 用户: "更新 auth 能力文档"
92
+
93
+ Agent 行动:
94
+ 1. 读取现有文档: capabilities/l1-foundation/auth.mdx
95
+ 2. 读取 OpenSpec(如果有更新)
96
+ 3. 扫描代码(获取最新实现)
97
+ 4. 更新文档
98
+ 5. 显示变更
99
+ ```
100
+
101
+ ## 文档结构
102
+
103
+ 生成的文档包含以下章节:
104
+
105
+ 1. **概述** - 能力简介、核心功能、能力定位
106
+ 2. **核心职责** - 负责什么、不负责什么
107
+ 3. **整体架构** - 系统架构图(Mermaid)
108
+ 4. **前端实现** - Hooks、组件、使用示例
109
+ 5. **后端实现** - API 端点、数据模型、业务逻辑
110
+ 6. **配置说明** - 环境变量、配置文件
111
+ 7. **使用示例** - 完整的代码示例
112
+ 8. **相关文档** - 链接到其他文档
113
+
114
+ ## 模板文件
115
+
116
+ - `assets/templates/capability.mdx` - 能力文档模板
117
+
118
+ ## 错误处理
119
+
120
+ ### 错误 1:OpenSpec 不存在
121
+
122
+ ```
123
+ ❌ 错误: OpenSpec 目录不存在
124
+ 📁 路径: openspec/changes/001-pricing-system/
125
+
126
+ 💡 建议:
127
+ 1. 检查 OpenSpec 路径是否正确
128
+ 2. 确认 OpenSpec 已创建
129
+ 3. 使用 mdx-to-openspec Skill 创建 OpenSpec
130
+ ```
131
+
132
+ ### 错误 2:代码路径不存在
133
+
134
+ ```
135
+ ❌ 错误: 代码目录不存在
136
+ 📁 路径: packages/pricing/
137
+
138
+ 💡 建议:
139
+ 1. 检查代码路径是否正确
140
+ 2. 确认代码已实现
141
+ 3. 如果代码未实现,可以只基于 OpenSpec 生成文档
142
+ ```
143
+
144
+ ## 注意事项
145
+
146
+ 1. **文档与代码同步** - 生成的文档应该反映实际代码实现
147
+ 2. **Mermaid 图正确性** - 确保架构图准确反映系统设计
148
+ 3. **代码示例完整性** - 提供可运行的完整示例
149
+ 4. **链接有效性** - 确保相关文档链接正确
150
+
151
+ ## 相关 Skills
152
+
153
+ - `mdx-to-openspec` - 创建 OpenSpec
154
+ - `spec-generate` - 生成开发规范
155
+ - `api-docs-generate` - 生成 API 文档