@oriro/orirocli 0.1.9 → 0.1.11

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 (1102) hide show
  1. package/ATTRIBUTION.md +53 -53
  2. package/LICENSE +21 -21
  3. package/README.md +20 -17
  4. package/dist/cli.js +4425 -2975
  5. package/package.json +64 -64
  6. package/skills/1password/SKILL.md +118 -118
  7. package/skills/1password/references/cli-examples.md +29 -29
  8. package/skills/1password/references/get-started.md +21 -21
  9. package/skills/21stdev/SKILL.md +64 -64
  10. package/skills/algorithmic-art/LICENSE +21 -21
  11. package/skills/algorithmic-art/SKILL.md +446 -446
  12. package/skills/algorithmic-art/templates/generator_template.js +223 -223
  13. package/skills/algorithmic-art/templates/viewer.html +598 -598
  14. package/skills/apple-notes/SKILL.md +81 -81
  15. package/skills/apple-reminders/SKILL.md +122 -122
  16. package/skills/bear-notes/SKILL.md +111 -111
  17. package/skills/blogwatcher/SKILL.md +73 -73
  18. package/skills/blucli/SKILL.md +51 -51
  19. package/skills/brand-guidelines/LICENSE +21 -21
  20. package/skills/brand-guidelines/SKILL.md +76 -76
  21. package/skills/business/biz-analysis/LICENSE +21 -21
  22. package/skills/business/biz-analysis/SKILL.md +103 -103
  23. package/skills/business/biz-corporate-strategy/LICENSE +21 -21
  24. package/skills/business/biz-corporate-strategy/SKILL.md +76 -76
  25. package/skills/business/biz-customer-success/LICENSE +21 -21
  26. package/skills/business/biz-customer-success/SKILL.md +55 -55
  27. package/skills/business/biz-entrepreneurship/LICENSE +21 -21
  28. package/skills/business/biz-entrepreneurship/SKILL.md +72 -72
  29. package/skills/business/biz-hr/LICENSE +21 -21
  30. package/skills/business/biz-hr/SKILL.md +67 -67
  31. package/skills/business/biz-international/LICENSE +21 -21
  32. package/skills/business/biz-international/SKILL.md +51 -51
  33. package/skills/business/biz-leadership/LICENSE +21 -21
  34. package/skills/business/biz-leadership/SKILL.md +106 -106
  35. package/skills/business/biz-marketing-strategy/LICENSE +21 -21
  36. package/skills/business/biz-marketing-strategy/SKILL.md +119 -119
  37. package/skills/business/biz-negotiation/LICENSE +21 -21
  38. package/skills/business/biz-negotiation/SKILL.md +152 -152
  39. package/skills/business/biz-operations/LICENSE +21 -21
  40. package/skills/business/biz-operations/SKILL.md +74 -74
  41. package/skills/business/biz-project/LICENSE +21 -21
  42. package/skills/business/biz-project/SKILL.md +203 -203
  43. package/skills/business/biz-risk/LICENSE +21 -21
  44. package/skills/business/biz-risk/SKILL.md +85 -85
  45. package/skills/business/biz-sales/LICENSE +21 -21
  46. package/skills/business/biz-sales/SKILL.md +92 -92
  47. package/skills/business/biz-startup-ops/LICENSE +21 -21
  48. package/skills/business/biz-startup-ops/SKILL.md +70 -70
  49. package/skills/business/biz-strategy/LICENSE +21 -21
  50. package/skills/business/biz-strategy/SKILL.md +233 -233
  51. package/skills/business/biz-supply-chain-advanced/LICENSE +21 -21
  52. package/skills/business/biz-supply-chain-advanced/SKILL.md +68 -68
  53. package/skills/business/fin-chartered-exams/LICENSE +21 -21
  54. package/skills/business/fin-chartered-exams/SKILL.md +69 -69
  55. package/skills/camsnap/SKILL.md +49 -49
  56. package/skills/canvas/SKILL.md +82 -82
  57. package/skills/canvas-design/LICENSE +21 -21
  58. package/skills/canvas-design/SKILL.md +140 -140
  59. package/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -93
  60. package/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -93
  61. package/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -93
  62. package/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -93
  63. package/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -93
  64. package/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -93
  65. package/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -94
  66. package/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -93
  67. package/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -93
  68. package/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -93
  69. package/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -93
  70. package/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -93
  71. package/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -93
  72. package/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -93
  73. package/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -93
  74. package/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -93
  75. package/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -93
  76. package/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -93
  77. package/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -93
  78. package/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -93
  79. package/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -93
  80. package/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -93
  81. package/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -93
  82. package/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -93
  83. package/skills/coding-agent/SKILL.md +146 -146
  84. package/skills/communication/comm-business-writing/LICENSE +21 -21
  85. package/skills/communication/comm-business-writing/SKILL.md +67 -67
  86. package/skills/communication/comm-cross-cultural/LICENSE +21 -21
  87. package/skills/communication/comm-cross-cultural/SKILL.md +88 -88
  88. package/skills/communication/comm-journalism/LICENSE +21 -21
  89. package/skills/communication/comm-journalism/SKILL.md +81 -81
  90. package/skills/communication/comm-linguistics/LICENSE +21 -21
  91. package/skills/communication/comm-linguistics/SKILL.md +82 -82
  92. package/skills/communication/comm-negotiation/LICENSE +21 -21
  93. package/skills/communication/comm-negotiation/SKILL.md +120 -120
  94. package/skills/communication/comm-presentations/LICENSE +21 -21
  95. package/skills/communication/comm-presentations/SKILL.md +93 -93
  96. package/skills/communication/comm-public-speaking/LICENSE +21 -21
  97. package/skills/communication/comm-public-speaking/SKILL.md +68 -68
  98. package/skills/communication/comm-writing/LICENSE +21 -21
  99. package/skills/communication/comm-writing/SKILL.md +69 -69
  100. package/skills/craft/ai-engineering/LICENSE +21 -21
  101. package/skills/craft/ai-engineering/SKILL.md +828 -828
  102. package/skills/craft/app-builder-guide/LICENSE +21 -21
  103. package/skills/craft/app-builder-guide/SKILL.md +332 -332
  104. package/skills/craft/become-an-ai-engineer-26/CONTRIBUTING.md +46 -46
  105. package/skills/craft/become-an-ai-engineer-26/LICENSE +21 -21
  106. package/skills/craft/become-an-ai-engineer-26/README.md +270 -270
  107. package/skills/craft/become-an-ai-engineer-26/SKILL.md +667 -667
  108. package/skills/craft/become-an-ai-engineer-26/community/BUILDS.md +13 -13
  109. package/skills/craft/become-an-ai-engineer-26/community/DISCUSSIONS.md +8 -8
  110. package/skills/craft/become-an-ai-engineer-26/phases/phase-0-mental-models/README.md +14 -14
  111. package/skills/craft/become-an-ai-engineer-26/phases/phase-0-mental-models/project/TEMPLATE.md +33 -33
  112. package/skills/craft/become-an-ai-engineer-26/phases/phase-1-first-agent/README.md +25 -25
  113. package/skills/craft/become-an-ai-engineer-26/phases/phase-1-first-agent/code/raw_loop.py +126 -126
  114. package/skills/craft/become-an-ai-engineer-26/phases/phase-2-architecture/README.md +17 -17
  115. package/skills/craft/become-an-ai-engineer-26/phases/phase-3-harness/README.md +17 -17
  116. package/skills/craft/become-an-ai-engineer-26/phases/phase-4-evals/README.md +21 -21
  117. package/skills/craft/become-an-ai-engineer-26/phases/phase-4-evals/code/.github/workflows/eval.yml +40 -40
  118. package/skills/craft/become-an-ai-engineer-26/phases/phase-5-production/README.md +16 -16
  119. package/skills/craft/become-an-ai-engineer-26/projects/1-mobile-app-slm/README.md +11 -11
  120. package/skills/craft/become-an-ai-engineer-26/projects/2-self-improving-coder/README.md +11 -11
  121. package/skills/craft/become-an-ai-engineer-26/projects/3-video-editor-agent/README.md +11 -11
  122. package/skills/craft/become-an-ai-engineer-26/projects/4-personal-life-os/README.md +12 -12
  123. package/skills/craft/become-an-ai-engineer-26/projects/5-enterprise-workflow/README.md +12 -12
  124. package/skills/craft/become-an-ai-engineer-26/references/benchmark-numbers.md +41 -41
  125. package/skills/craft/become-an-ai-engineer-26/references/mhc-stable-training.md +73 -73
  126. package/skills/craft/become-an-ai-engineer-26/references/stack-decisions.md +37 -37
  127. package/skills/craft/become-an-ai-engineer-26/references/yarn-context-extension.md +123 -123
  128. package/skills/craft/codex-result-handling/LICENSE +21 -21
  129. package/skills/craft/codex-result-handling/SKILL.md +26 -26
  130. package/skills/craft/debug-and-build-methodology/LICENSE +21 -21
  131. package/skills/craft/debug-and-build-methodology/SKILL.md +432 -432
  132. package/skills/craft/design/LICENSE +21 -21
  133. package/skills/craft/design/SKILL.md +274 -274
  134. package/skills/craft/dev/LICENSE +21 -21
  135. package/skills/craft/dev/SKILL.md +12 -12
  136. package/skills/craft/dev/release.md +85 -85
  137. package/skills/craft/dev/roll.md +50 -50
  138. package/skills/craft/doc-coauthoring/LICENSE +21 -21
  139. package/skills/craft/doc-coauthoring/SKILL.md +397 -397
  140. package/skills/craft/focus/LICENSE +21 -21
  141. package/skills/craft/focus/SKILL.md +432 -432
  142. package/skills/craft/focus/UPSTREAM_README.md +233 -233
  143. package/skills/craft/gh/LICENSE +21 -21
  144. package/skills/craft/gh/SKILL.md +84 -84
  145. package/skills/craft/gh-skill/LICENSE +21 -21
  146. package/skills/craft/gh-skill/SKILL.md +121 -121
  147. package/skills/craft/godmode/LICENSE +21 -21
  148. package/skills/craft/godmode/SKILL.md +87 -87
  149. package/skills/craft/godmode/references/android-launch.md +680 -680
  150. package/skills/craft/godmode/references/data-gcp.md +1038 -1038
  151. package/skills/craft/godmode/references/expo-eas.md +816 -816
  152. package/skills/craft/godmode/references/ios-launch.md +734 -734
  153. package/skills/craft/google-ai-latest/LICENSE +21 -21
  154. package/skills/craft/google-ai-latest/SKILL.md +682 -682
  155. package/skills/craft/gpt-5-4-prompting/LICENSE +21 -21
  156. package/skills/craft/gpt-5-4-prompting/SKILL.md +63 -63
  157. package/skills/craft/gpt-5-4-prompting/references/codex-prompt-antipatterns.md +101 -101
  158. package/skills/craft/gpt-5-4-prompting/references/codex-prompt-recipes.md +150 -150
  159. package/skills/craft/gpt-5-4-prompting/references/prompt-blocks.md +172 -172
  160. package/skills/craft/grill-me/LICENSE +21 -21
  161. package/skills/craft/grill-me/SKILL.md +13 -13
  162. package/skills/craft/idea-to-deploy/LICENSE +21 -21
  163. package/skills/craft/idea-to-deploy/SKILL.md +292 -292
  164. package/skills/craft/idea-to-deploy/references/auth-playbook.md +195 -195
  165. package/skills/craft/idea-to-deploy/references/gcp-deployment.md +268 -268
  166. package/skills/craft/idea-to-deploy/references/stack-selection.md +117 -117
  167. package/skills/craft/image-generation-engineer/LICENSE +21 -21
  168. package/skills/craft/image-generation-engineer/SKILL.md +183 -183
  169. package/skills/craft/image-generation-engineer/references/architectures.md +260 -260
  170. package/skills/craft/image-generation-engineer/references/foundations.md +107 -107
  171. package/skills/craft/image-generation-engineer/references/inference-and-serving.md +253 -253
  172. package/skills/craft/image-generation-engineer/references/training.md +149 -149
  173. package/skills/craft/marketing/LICENSE +21 -21
  174. package/skills/craft/marketing/SKILL.md +1954 -1954
  175. package/skills/craft/master-architect/LICENSE +21 -21
  176. package/skills/craft/master-architect/SKILL.md +361 -361
  177. package/skills/craft/master-architect/references/ai-ml.md +317 -317
  178. package/skills/craft/master-architect/references/architecture.md +268 -268
  179. package/skills/craft/master-architect/references/auth-playbook.md +195 -195
  180. package/skills/craft/master-architect/references/cloud.md +323 -323
  181. package/skills/craft/master-architect/references/cyber.md +839 -839
  182. package/skills/craft/master-architect/references/data-eng.md +366 -366
  183. package/skills/craft/master-architect/references/devops.md +550 -550
  184. package/skills/craft/master-architect/references/gcp-deployment.md +268 -268
  185. package/skills/craft/master-architect/references/languages.md +748 -748
  186. package/skills/craft/master-architect/references/legacy.md +240 -240
  187. package/skills/craft/master-architect/references/mobile.md +447 -447
  188. package/skills/craft/master-architect/references/patterns.md +451 -451
  189. package/skills/craft/master-architect/references/saas-patterns.md +379 -379
  190. package/skills/craft/master-architect/references/sdlc.md +349 -349
  191. package/skills/craft/master-architect/references/stack-selection.md +117 -117
  192. package/skills/craft/oriro-ui-2026/LICENSE +21 -21
  193. package/skills/craft/oriro-ui-2026/SKILL.md +329 -329
  194. package/skills/craft/playwright-cli/LICENSE +21 -21
  195. package/skills/craft/playwright-cli/SKILL.md +393 -393
  196. package/skills/craft/playwright-cli/references/element-attributes.md +23 -23
  197. package/skills/craft/playwright-cli/references/playwright-tests.md +39 -39
  198. package/skills/craft/playwright-cli/references/request-mocking.md +87 -87
  199. package/skills/craft/playwright-cli/references/running-code.md +240 -240
  200. package/skills/craft/playwright-cli/references/session-management.md +226 -226
  201. package/skills/craft/playwright-cli/references/spec-driven-testing.md +312 -312
  202. package/skills/craft/playwright-cli/references/storage-state.md +275 -275
  203. package/skills/craft/playwright-cli/references/test-generation.md +134 -134
  204. package/skills/craft/playwright-cli/references/tracing.md +142 -142
  205. package/skills/craft/playwright-cli/references/video-recording.md +150 -150
  206. package/skills/craft/remotion-best-practices/LICENSE +21 -21
  207. package/skills/craft/remotion-best-practices/SKILL.md +345 -345
  208. package/skills/craft/remotion-best-practices/rules/3d.md +86 -86
  209. package/skills/craft/remotion-best-practices/rules/assets/charts-bar-chart.tsx +165 -165
  210. package/skills/craft/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +89 -89
  211. package/skills/craft/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +101 -101
  212. package/skills/craft/remotion-best-practices/rules/audio-visualization.md +195 -195
  213. package/skills/craft/remotion-best-practices/rules/audio.md +167 -167
  214. package/skills/craft/remotion-best-practices/rules/calculate-metadata.md +118 -118
  215. package/skills/craft/remotion-best-practices/rules/compositions.md +132 -132
  216. package/skills/craft/remotion-best-practices/rules/display-captions.md +176 -176
  217. package/skills/craft/remotion-best-practices/rules/ffmpeg.md +34 -34
  218. package/skills/craft/remotion-best-practices/rules/get-audio-duration.md +58 -58
  219. package/skills/craft/remotion-best-practices/rules/get-video-dimensions.md +68 -68
  220. package/skills/craft/remotion-best-practices/rules/get-video-duration.md +60 -60
  221. package/skills/craft/remotion-best-practices/rules/gifs.md +135 -135
  222. package/skills/craft/remotion-best-practices/rules/google-fonts.md +72 -72
  223. package/skills/craft/remotion-best-practices/rules/html-in-canvas.md +122 -122
  224. package/skills/craft/remotion-best-practices/rules/images.md +67 -67
  225. package/skills/craft/remotion-best-practices/rules/import-srt-captions.md +69 -69
  226. package/skills/craft/remotion-best-practices/rules/light-leaks.md +73 -73
  227. package/skills/craft/remotion-best-practices/rules/local-fonts.md +65 -65
  228. package/skills/craft/remotion-best-practices/rules/lottie.md +67 -67
  229. package/skills/craft/remotion-best-practices/rules/maplibre.md +441 -441
  230. package/skills/craft/remotion-best-practices/rules/measuring-dom-nodes.md +34 -34
  231. package/skills/craft/remotion-best-practices/rules/measuring-text.md +140 -140
  232. package/skills/craft/remotion-best-practices/rules/parameters.md +109 -109
  233. package/skills/craft/remotion-best-practices/rules/sequencing.md +144 -144
  234. package/skills/craft/remotion-best-practices/rules/sfx.md +30 -30
  235. package/skills/craft/remotion-best-practices/rules/silence-detection.md +73 -73
  236. package/skills/craft/remotion-best-practices/rules/subtitles.md +36 -36
  237. package/skills/craft/remotion-best-practices/rules/tailwind.md +11 -11
  238. package/skills/craft/remotion-best-practices/rules/text-animations.md +20 -20
  239. package/skills/craft/remotion-best-practices/rules/timing.md +130 -130
  240. package/skills/craft/remotion-best-practices/rules/transcribe-captions.md +70 -70
  241. package/skills/craft/remotion-best-practices/rules/transitions.md +193 -193
  242. package/skills/craft/remotion-best-practices/rules/transparent-videos.md +102 -102
  243. package/skills/craft/remotion-best-practices/rules/trimming.md +51 -51
  244. package/skills/craft/remotion-best-practices/rules/videos.md +169 -169
  245. package/skills/craft/remotion-best-practices/rules/voiceover.md +94 -94
  246. package/skills/craft/supabase-postgres-best-practices/CHANGELOG.md +25 -25
  247. package/skills/craft/supabase-postgres-best-practices/LICENSE +21 -21
  248. package/skills/craft/supabase-postgres-best-practices/SKILL.md +69 -69
  249. package/skills/craft/supabase-postgres-best-practices/references/_contributing.md +166 -166
  250. package/skills/craft/supabase-postgres-best-practices/references/_sections.md +47 -47
  251. package/skills/craft/supabase-postgres-best-practices/references/_template.md +34 -34
  252. package/skills/craft/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -55
  253. package/skills/craft/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -49
  254. package/skills/craft/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -46
  255. package/skills/craft/supabase-postgres-best-practices/references/conn-limits.md +44 -44
  256. package/skills/craft/supabase-postgres-best-practices/references/conn-pooling.md +41 -41
  257. package/skills/craft/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -46
  258. package/skills/craft/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -54
  259. package/skills/craft/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -53
  260. package/skills/craft/supabase-postgres-best-practices/references/data-pagination.md +50 -50
  261. package/skills/craft/supabase-postgres-best-practices/references/data-upsert.md +50 -50
  262. package/skills/craft/supabase-postgres-best-practices/references/lock-advisory.md +56 -56
  263. package/skills/craft/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -68
  264. package/skills/craft/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -50
  265. package/skills/craft/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -54
  266. package/skills/craft/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -45
  267. package/skills/craft/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -55
  268. package/skills/craft/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -55
  269. package/skills/craft/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -44
  270. package/skills/craft/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -40
  271. package/skills/craft/supabase-postgres-best-practices/references/query-index-types.md +48 -48
  272. package/skills/craft/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -43
  273. package/skills/craft/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -45
  274. package/skills/craft/supabase-postgres-best-practices/references/schema-constraints.md +80 -80
  275. package/skills/craft/supabase-postgres-best-practices/references/schema-data-types.md +46 -46
  276. package/skills/craft/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -59
  277. package/skills/craft/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -55
  278. package/skills/craft/supabase-postgres-best-practices/references/schema-partitioning.md +55 -55
  279. package/skills/craft/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -61
  280. package/skills/craft/supabase-postgres-best-practices/references/security-privileges.md +54 -54
  281. package/skills/craft/supabase-postgres-best-practices/references/security-rls-basics.md +50 -50
  282. package/skills/craft/supabase-postgres-best-practices/references/security-rls-performance.md +63 -63
  283. package/skills/craft/uipm-banner-design/LICENSE +21 -21
  284. package/skills/craft/uipm-banner-design/SKILL.md +201 -201
  285. package/skills/craft/uipm-banner-design/references/banner-sizes-and-styles.md +129 -129
  286. package/skills/craft/uipm-brand/LICENSE +21 -21
  287. package/skills/craft/uipm-brand/SKILL.md +104 -104
  288. package/skills/craft/uipm-brand/references/approval-checklist.md +184 -184
  289. package/skills/craft/uipm-brand/references/asset-organization.md +167 -167
  290. package/skills/craft/uipm-brand/references/brand-guideline-template.md +161 -161
  291. package/skills/craft/uipm-brand/references/color-palette-management.md +203 -203
  292. package/skills/craft/uipm-brand/references/consistency-checklist.md +105 -105
  293. package/skills/craft/uipm-brand/references/logo-usage-rules.md +204 -204
  294. package/skills/craft/uipm-brand/references/messaging-framework.md +91 -91
  295. package/skills/craft/uipm-brand/references/typography-specifications.md +265 -265
  296. package/skills/craft/uipm-brand/references/update.md +128 -128
  297. package/skills/craft/uipm-brand/references/visual-identity.md +109 -109
  298. package/skills/craft/uipm-brand/references/voice-framework.md +99 -99
  299. package/skills/craft/uipm-brand/scripts/extract-colors.cjs +333 -333
  300. package/skills/craft/uipm-brand/scripts/inject-brand-context.cjs +324 -324
  301. package/skills/craft/uipm-brand/scripts/sync-brand-to-tokens.cjs +269 -269
  302. package/skills/craft/uipm-brand/scripts/validate-asset.cjs +361 -361
  303. package/skills/craft/uipm-brand/templates/brand-guidelines-starter.md +280 -280
  304. package/skills/craft/uipm-design/LICENSE +21 -21
  305. package/skills/craft/uipm-design/SKILL.md +305 -305
  306. package/skills/craft/uipm-design/data/cip/deliverables.csv +50 -50
  307. package/skills/craft/uipm-design/data/cip/industries.csv +20 -20
  308. package/skills/craft/uipm-design/data/cip/mockup-contexts.csv +20 -20
  309. package/skills/craft/uipm-design/data/cip/styles.csv +20 -20
  310. package/skills/craft/uipm-design/data/icon/styles.csv +16 -16
  311. package/skills/craft/uipm-design/data/logo/colors.csv +56 -56
  312. package/skills/craft/uipm-design/data/logo/industries.csv +56 -56
  313. package/skills/craft/uipm-design/data/logo/styles.csv +56 -56
  314. package/skills/craft/uipm-design/references/banner-sizes-and-styles.md +129 -129
  315. package/skills/craft/uipm-design/references/cip-deliverable-guide.md +111 -111
  316. package/skills/craft/uipm-design/references/cip-design.md +121 -121
  317. package/skills/craft/uipm-design/references/cip-prompt-engineering.md +94 -94
  318. package/skills/craft/uipm-design/references/cip-style-guide.md +76 -76
  319. package/skills/craft/uipm-design/references/design-routing.md +226 -226
  320. package/skills/craft/uipm-design/references/icon-design.md +122 -122
  321. package/skills/craft/uipm-design/references/logo-color-psychology.md +113 -113
  322. package/skills/craft/uipm-design/references/logo-design.md +92 -92
  323. package/skills/craft/uipm-design/references/logo-prompt-engineering.md +176 -176
  324. package/skills/craft/uipm-design/references/logo-style-guide.md +129 -129
  325. package/skills/craft/uipm-design/references/slides-copywriting-formulas.md +92 -92
  326. package/skills/craft/uipm-design/references/slides-create.md +5 -5
  327. package/skills/craft/uipm-design/references/slides-html-template.md +374 -374
  328. package/skills/craft/uipm-design/references/slides-layout-patterns.md +155 -155
  329. package/skills/craft/uipm-design/references/slides-strategies.md +97 -97
  330. package/skills/craft/uipm-design/references/slides.md +42 -42
  331. package/skills/craft/uipm-design/references/social-photos-design.md +353 -353
  332. package/skills/craft/uipm-design/scripts/cip/core.py +215 -215
  333. package/skills/craft/uipm-design/scripts/cip/generate.py +484 -484
  334. package/skills/craft/uipm-design/scripts/cip/render-html.py +424 -424
  335. package/skills/craft/uipm-design/scripts/cip/search.py +127 -127
  336. package/skills/craft/uipm-design/scripts/icon/generate.py +487 -487
  337. package/skills/craft/uipm-design/scripts/logo/core.py +175 -175
  338. package/skills/craft/uipm-design/scripts/logo/generate.py +362 -362
  339. package/skills/craft/uipm-design/scripts/logo/search.py +114 -114
  340. package/skills/craft/uipm-design-system/LICENSE +21 -21
  341. package/skills/craft/uipm-design-system/SKILL.md +255 -255
  342. package/skills/craft/uipm-design-system/data/slide-backgrounds.csv +11 -11
  343. package/skills/craft/uipm-design-system/data/slide-charts.csv +26 -26
  344. package/skills/craft/uipm-design-system/data/slide-color-logic.csv +14 -14
  345. package/skills/craft/uipm-design-system/data/slide-copy.csv +26 -26
  346. package/skills/craft/uipm-design-system/data/slide-layout-logic.csv +16 -16
  347. package/skills/craft/uipm-design-system/data/slide-layouts.csv +26 -26
  348. package/skills/craft/uipm-design-system/data/slide-strategies.csv +16 -16
  349. package/skills/craft/uipm-design-system/data/slide-typography.csv +15 -15
  350. package/skills/craft/uipm-design-system/references/component-specs.md +236 -236
  351. package/skills/craft/uipm-design-system/references/component-tokens.md +214 -214
  352. package/skills/craft/uipm-design-system/references/primitive-tokens.md +199 -199
  353. package/skills/craft/uipm-design-system/references/semantic-tokens.md +215 -215
  354. package/skills/craft/uipm-design-system/references/states-and-variants.md +243 -243
  355. package/skills/craft/uipm-design-system/references/tailwind-integration.md +257 -257
  356. package/skills/craft/uipm-design-system/references/token-architecture.md +226 -226
  357. package/skills/craft/uipm-design-system/scripts/embed-tokens.cjs +97 -97
  358. package/skills/craft/uipm-design-system/scripts/fetch-background.py +317 -317
  359. package/skills/craft/uipm-design-system/scripts/generate-slide.py +753 -753
  360. package/skills/craft/uipm-design-system/scripts/generate-tokens.cjs +213 -213
  361. package/skills/craft/uipm-design-system/scripts/html-token-validator.py +327 -327
  362. package/skills/craft/uipm-design-system/scripts/search-slides.py +218 -218
  363. package/skills/craft/uipm-design-system/scripts/slide-token-validator.py +35 -35
  364. package/skills/craft/uipm-design-system/scripts/slide_search_core.py +453 -453
  365. package/skills/craft/uipm-design-system/scripts/validate-tokens.cjs +254 -254
  366. package/skills/craft/uipm-design-system/templates/design-tokens-starter.json +143 -143
  367. package/skills/craft/uipm-slides/LICENSE +21 -21
  368. package/skills/craft/uipm-slides/SKILL.md +45 -45
  369. package/skills/craft/uipm-slides/references/copywriting-formulas.md +92 -92
  370. package/skills/craft/uipm-slides/references/create.md +5 -5
  371. package/skills/craft/uipm-slides/references/html-template.md +374 -374
  372. package/skills/craft/uipm-slides/references/layout-patterns.md +155 -155
  373. package/skills/craft/uipm-slides/references/slide-strategies.md +97 -97
  374. package/skills/craft/uipm-ui-ux-pro-max/LICENSE +21 -21
  375. package/skills/craft/uipm-ui-ux-pro-max/SKILL.md +678 -678
  376. package/skills/craft/uipm-ui-ux-pro-max/data/_sync_all.py +414 -414
  377. package/skills/craft/uipm-ui-ux-pro-max/data/app-interface.csv +30 -30
  378. package/skills/craft/uipm-ui-ux-pro-max/data/charts.csv +26 -26
  379. package/skills/craft/uipm-ui-ux-pro-max/data/colors.csv +161 -161
  380. package/skills/craft/uipm-ui-ux-pro-max/data/design.csv +1775 -1775
  381. package/skills/craft/uipm-ui-ux-pro-max/data/draft.csv +1778 -1778
  382. package/skills/craft/uipm-ui-ux-pro-max/data/google-fonts.csv +1924 -1924
  383. package/skills/craft/uipm-ui-ux-pro-max/data/icons.csv +105 -105
  384. package/skills/craft/uipm-ui-ux-pro-max/data/landing.csv +35 -35
  385. package/skills/craft/uipm-ui-ux-pro-max/data/products.csv +162 -162
  386. package/skills/craft/uipm-ui-ux-pro-max/data/react-performance.csv +45 -45
  387. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/angular.csv +51 -51
  388. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/astro.csv +54 -54
  389. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/flutter.csv +53 -53
  390. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -56
  391. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -53
  392. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/laravel.csv +51 -51
  393. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/nextjs.csv +53 -53
  394. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -51
  395. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -59
  396. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/react-native.csv +52 -52
  397. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/react.csv +54 -54
  398. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/shadcn.csv +61 -61
  399. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/svelte.csv +54 -54
  400. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/swiftui.csv +51 -51
  401. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/threejs.csv +54 -54
  402. package/skills/craft/uipm-ui-ux-pro-max/data/stacks/vue.csv +50 -50
  403. package/skills/craft/uipm-ui-ux-pro-max/data/styles.csv +85 -85
  404. package/skills/craft/uipm-ui-ux-pro-max/data/typography.csv +74 -74
  405. package/skills/craft/uipm-ui-ux-pro-max/data/ui-reasoning.csv +162 -162
  406. package/skills/craft/uipm-ui-ux-pro-max/data/ux-guidelines.csv +99 -99
  407. package/skills/craft/uipm-ui-ux-pro-max/scripts/core.py +262 -262
  408. package/skills/craft/uipm-ui-ux-pro-max/scripts/design_system.py +1148 -1148
  409. package/skills/craft/uipm-ui-ux-pro-max/scripts/search.py +114 -114
  410. package/skills/craft/uipm-ui-ux-pro-max/templates/base/quick-reference.md +297 -297
  411. package/skills/craft/uipm-ui-ux-pro-max/templates/base/skill-content.md +375 -375
  412. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/agent.json +21 -21
  413. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/augment.json +18 -18
  414. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/claude.json +21 -21
  415. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/codebuddy.json +21 -21
  416. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/codex.json +21 -21
  417. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/continue.json +21 -21
  418. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/copilot.json +21 -21
  419. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/cursor.json +21 -21
  420. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/droid.json +21 -21
  421. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/gemini.json +21 -21
  422. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/kilocode.json +21 -21
  423. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/kiro.json +21 -21
  424. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/opencode.json +21 -21
  425. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/qoder.json +21 -21
  426. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/roocode.json +21 -21
  427. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/trae.json +21 -21
  428. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/warp.json +18 -18
  429. package/skills/craft/uipm-ui-ux-pro-max/templates/platforms/windsurf.json +21 -21
  430. package/skills/craft/vercel-optimize/AGENTS.md +48 -48
  431. package/skills/craft/vercel-optimize/CONTRIBUTING.md +41 -41
  432. package/skills/craft/vercel-optimize/LICENSE +21 -21
  433. package/skills/craft/vercel-optimize/README.md +91 -91
  434. package/skills/craft/vercel-optimize/SKILL.md +325 -325
  435. package/skills/craft/vercel-optimize/lib/auth-route.mjs +23 -23
  436. package/skills/craft/vercel-optimize/lib/budget-summary.mjs +208 -208
  437. package/skills/craft/vercel-optimize/lib/citations.mjs +147 -147
  438. package/skills/craft/vercel-optimize/lib/cost-coverage.mjs +162 -162
  439. package/skills/craft/vercel-optimize/lib/dedup-recs.mjs +340 -340
  440. package/skills/craft/vercel-optimize/lib/deep-dive.mjs +371 -371
  441. package/skills/craft/vercel-optimize/lib/display-labels.mjs +219 -219
  442. package/skills/craft/vercel-optimize/lib/extract-claims.mjs +640 -640
  443. package/skills/craft/vercel-optimize/lib/framework-support.mjs +69 -69
  444. package/skills/craft/vercel-optimize/lib/gates/build-minutes-fanout.mjs +73 -73
  445. package/skills/craft/vercel-optimize/lib/gates/cold-start.mjs +72 -72
  446. package/skills/craft/vercel-optimize/lib/gates/contract.mjs +82 -82
  447. package/skills/craft/vercel-optimize/lib/gates/cwv-poor.mjs +95 -95
  448. package/skills/craft/vercel-optimize/lib/gates/external-api-slow.mjs +60 -60
  449. package/skills/craft/vercel-optimize/lib/gates/hard-gates.mjs +70 -70
  450. package/skills/craft/vercel-optimize/lib/gates/index.mjs +45 -45
  451. package/skills/craft/vercel-optimize/lib/gates/isr-overrevalidation.mjs +62 -62
  452. package/skills/craft/vercel-optimize/lib/gates/middleware-heavy.mjs +53 -53
  453. package/skills/craft/vercel-optimize/lib/gates/observability-events-attribution.mjs +58 -58
  454. package/skills/craft/vercel-optimize/lib/gates/platform-bot-protection.mjs +123 -123
  455. package/skills/craft/vercel-optimize/lib/gates/platform-fluid-compute.mjs +94 -94
  456. package/skills/craft/vercel-optimize/lib/gates/region-misconfig.mjs +71 -71
  457. package/skills/craft/vercel-optimize/lib/gates/route-errors.mjs +95 -95
  458. package/skills/craft/vercel-optimize/lib/gates/scanner-driven.mjs +150 -150
  459. package/skills/craft/vercel-optimize/lib/gates/select-candidates.mjs +137 -137
  460. package/skills/craft/vercel-optimize/lib/gates/slow-route.mjs +97 -97
  461. package/skills/craft/vercel-optimize/lib/gates/types.d.ts +38 -38
  462. package/skills/craft/vercel-optimize/lib/gates/uncached-route.mjs +103 -103
  463. package/skills/craft/vercel-optimize/lib/gates/usage-spike-triage.mjs +122 -122
  464. package/skills/craft/vercel-optimize/lib/grade-recommendation.mjs +170 -170
  465. package/skills/craft/vercel-optimize/lib/impact-label.mjs +128 -128
  466. package/skills/craft/vercel-optimize/lib/impact-magnitude.mjs +66 -66
  467. package/skills/craft/vercel-optimize/lib/investigation-brief.mjs +751 -751
  468. package/skills/craft/vercel-optimize/lib/observation-safety.mjs +217 -217
  469. package/skills/craft/vercel-optimize/lib/project-facts.mjs +101 -101
  470. package/skills/craft/vercel-optimize/lib/queries.mjs +333 -333
  471. package/skills/craft/vercel-optimize/lib/reconcile-candidates.mjs +388 -388
  472. package/skills/craft/vercel-optimize/lib/render-report.mjs +1065 -1065
  473. package/skills/craft/vercel-optimize/lib/repo-root.mjs +97 -97
  474. package/skills/craft/vercel-optimize/lib/route-normalize.mjs +224 -224
  475. package/skills/craft/vercel-optimize/lib/sanitizers/bot-protection-certainty.mjs +56 -56
  476. package/skills/craft/vercel-optimize/lib/sanitizers/cache-tag-invalidation-certainty.mjs +33 -33
  477. package/skills/craft/vercel-optimize/lib/sanitizers/count-correct.mjs +53 -53
  478. package/skills/craft/vercel-optimize/lib/sanitizers/function-duration-invocations.mjs +32 -32
  479. package/skills/craft/vercel-optimize/lib/sanitizers/index.mjs +87 -87
  480. package/skills/craft/vercel-optimize/lib/sanitizers/middleware-conflict.mjs +37 -37
  481. package/skills/craft/vercel-optimize/lib/sanitizers/missing-citation.mjs +16 -16
  482. package/skills/craft/vercel-optimize/lib/sanitizers/pre-release.mjs +75 -75
  483. package/skills/craft/vercel-optimize/lib/sanitizers/rate-limit.mjs +73 -73
  484. package/skills/craft/vercel-optimize/lib/sanitizers/rendering-mode-mislabel.mjs +42 -42
  485. package/skills/craft/vercel-optimize/lib/sanitizers/undeclared-dep.mjs +110 -110
  486. package/skills/craft/vercel-optimize/lib/sanitizers/vercel-directive-strip.mjs +37 -37
  487. package/skills/craft/vercel-optimize/lib/sanitizers/window-units.mjs +26 -26
  488. package/skills/craft/vercel-optimize/lib/scanners/cache-components-suspense-dedupe.mjs +114 -114
  489. package/skills/craft/vercel-optimize/lib/scanners/edge-heavy-import.mjs +102 -102
  490. package/skills/craft/vercel-optimize/lib/scanners/force-dynamic.mjs +39 -39
  491. package/skills/craft/vercel-optimize/lib/scanners/headers-in-page.mjs +43 -43
  492. package/skills/craft/vercel-optimize/lib/scanners/index.mjs +35 -35
  493. package/skills/craft/vercel-optimize/lib/scanners/large-static-asset.mjs +93 -93
  494. package/skills/craft/vercel-optimize/lib/scanners/max-age-without-s-maxage.mjs +47 -47
  495. package/skills/craft/vercel-optimize/lib/scanners/middleware-broad-matcher.mjs +53 -53
  496. package/skills/craft/vercel-optimize/lib/scanners/missing-cache-headers.mjs +97 -97
  497. package/skills/craft/vercel-optimize/lib/scanners/prisma-include-tree.mjs +39 -39
  498. package/skills/craft/vercel-optimize/lib/scanners/region-pin-in-config.mjs +89 -89
  499. package/skills/craft/vercel-optimize/lib/scanners/source-maps-production.mjs +33 -33
  500. package/skills/craft/vercel-optimize/lib/scanners/sveltekit-prerender-missing.mjs +47 -47
  501. package/skills/craft/vercel-optimize/lib/scanners/turbo-force-bypass.mjs +136 -136
  502. package/skills/craft/vercel-optimize/lib/scanners/unoptimized-image.mjs +127 -127
  503. package/skills/craft/vercel-optimize/lib/scanners/use-cache-date-stamp.mjs +112 -112
  504. package/skills/craft/vercel-optimize/lib/support-topics.mjs +365 -365
  505. package/skills/craft/vercel-optimize/lib/throttle.mjs +280 -280
  506. package/skills/craft/vercel-optimize/lib/util.mjs +17 -17
  507. package/skills/craft/vercel-optimize/lib/vercel.mjs +855 -855
  508. package/skills/craft/vercel-optimize/lib/verify-claim.mjs +1843 -1843
  509. package/skills/craft/vercel-optimize/lib/workspace-resolver.mjs +552 -552
  510. package/skills/craft/vercel-optimize/metadata.json +14 -14
  511. package/skills/craft/vercel-optimize/references/candidates.md +176 -176
  512. package/skills/craft/vercel-optimize/references/data-collection.md +224 -224
  513. package/skills/craft/vercel-optimize/references/docs-library.json +683 -683
  514. package/skills/craft/vercel-optimize/references/doctrine.md +108 -108
  515. package/skills/craft/vercel-optimize/references/observability-plus.md +109 -109
  516. package/skills/craft/vercel-optimize/references/playbooks/README.md +57 -57
  517. package/skills/craft/vercel-optimize/references/playbooks/ai-application.md +32 -32
  518. package/skills/craft/vercel-optimize/references/playbooks/api-service.md +30 -30
  519. package/skills/craft/vercel-optimize/references/playbooks/content-site.md +30 -30
  520. package/skills/craft/vercel-optimize/references/playbooks/ecommerce.md +30 -30
  521. package/skills/craft/vercel-optimize/references/playbooks/marketing.md +30 -30
  522. package/skills/craft/vercel-optimize/references/playbooks/saas.md +31 -31
  523. package/skills/craft/vercel-optimize/references/playbooks/sveltekit.md +75 -75
  524. package/skills/craft/vercel-optimize/references/recommendations.md +214 -214
  525. package/skills/craft/vercel-optimize/references/scanner-patterns.md +266 -266
  526. package/skills/craft/vercel-optimize/references/scoring.md +208 -208
  527. package/skills/craft/vercel-optimize/references/support-topics/README.md +50 -50
  528. package/skills/craft/vercel-optimize/references/support-topics/astro-edge-middleware-scope.md +30 -30
  529. package/skills/craft/vercel-optimize/references/support-topics/astro-output-mode-and-isr.md +31 -31
  530. package/skills/craft/vercel-optimize/references/support-topics/auth-preserving-parallelization.md +30 -30
  531. package/skills/craft/vercel-optimize/references/support-topics/bot-protection-product-guardrails.md +32 -32
  532. package/skills/craft/vercel-optimize/references/support-topics/build-minutes-monorepo-fanout.md +32 -32
  533. package/skills/craft/vercel-optimize/references/support-topics/cache-components-static-shell-boundaries.md +31 -31
  534. package/skills/craft/vercel-optimize/references/support-topics/cache-components-suspense-dedupe-pitfall.md +32 -32
  535. package/skills/craft/vercel-optimize/references/support-topics/cdn-cache-auth-safety.md +31 -31
  536. package/skills/craft/vercel-optimize/references/support-topics/cold-start-initialization-bundle.md +31 -31
  537. package/skills/craft/vercel-optimize/references/support-topics/core-web-vitals-client-bottlenecks.md +33 -33
  538. package/skills/craft/vercel-optimize/references/support-topics/database-egress-pooling-region.md +32 -32
  539. package/skills/craft/vercel-optimize/references/support-topics/dynamic-rendering-traps.md +31 -31
  540. package/skills/craft/vercel-optimize/references/support-topics/external-api-critical-path-platform.md +31 -31
  541. package/skills/craft/vercel-optimize/references/support-topics/external-api-critical-path.md +31 -31
  542. package/skills/craft/vercel-optimize/references/support-topics/fast-data-transfer-payloads.md +26 -26
  543. package/skills/craft/vercel-optimize/references/support-topics/fluid-compute-caveats.md +26 -26
  544. package/skills/craft/vercel-optimize/references/support-topics/function-duration-io-and-after.md +31 -31
  545. package/skills/craft/vercel-optimize/references/support-topics/function-invocation-reduction.md +31 -31
  546. package/skills/craft/vercel-optimize/references/support-topics/function-region-misconfiguration-ttfb.md +31 -31
  547. package/skills/craft/vercel-optimize/references/support-topics/image-optimization-cost-control.md +31 -31
  548. package/skills/craft/vercel-optimize/references/support-topics/isr-revalidation-static-generation.md +31 -31
  549. package/skills/craft/vercel-optimize/references/support-topics/middleware-proxy-edge-cost.md +30 -30
  550. package/skills/craft/vercel-optimize/references/support-topics/next-fetch-revalidate-floor.md +30 -30
  551. package/skills/craft/vercel-optimize/references/support-topics/next-font-cls-self-hosting.md +31 -31
  552. package/skills/craft/vercel-optimize/references/support-topics/next-heavy-ui-lazy-load-boundaries.md +28 -28
  553. package/skills/craft/vercel-optimize/references/support-topics/next-image-lcp-preload-sizes.md +31 -31
  554. package/skills/craft/vercel-optimize/references/support-topics/next-route-handler-get-cache-defaults.md +30 -30
  555. package/skills/craft/vercel-optimize/references/support-topics/next-script-third-party-strategy.md +31 -31
  556. package/skills/craft/vercel-optimize/references/support-topics/nextjs-version-cache-semantics.md +31 -31
  557. package/skills/craft/vercel-optimize/references/support-topics/not-found-catchall-request-waste.md +33 -33
  558. package/skills/craft/vercel-optimize/references/support-topics/nuxt-route-rules-cache-isr.md +31 -31
  559. package/skills/craft/vercel-optimize/references/support-topics/observability-events-cost-attribution.md +27 -27
  560. package/skills/craft/vercel-optimize/references/support-topics/post-response-work-waituntil.md +26 -26
  561. package/skills/craft/vercel-optimize/references/support-topics/route-error-durable-offload.md +33 -33
  562. package/skills/craft/vercel-optimize/references/support-topics/route-error-runtime-limits.md +31 -31
  563. package/skills/craft/vercel-optimize/references/support-topics/runtime-cache-reusable-data.md +30 -30
  564. package/skills/craft/vercel-optimize/references/support-topics/sveltekit-isr-prerender-safety.md +31 -31
  565. package/skills/craft/vercel-optimize/references/support-topics/sveltekit-split-cold-start-tradeoff.md +30 -30
  566. package/skills/craft/vercel-optimize/references/support-topics/usage-spike-triage.md +31 -31
  567. package/skills/craft/vercel-optimize/references/support-topics/use-cache-date-stamp-isr-write-amplifier.md +31 -31
  568. package/skills/craft/vercel-optimize/references/support-topics/use-cache-remote-shared-origin-data.md +30 -30
  569. package/skills/craft/vercel-optimize/references/support-topics/workflow-resumable-stream-routes.md +32 -32
  570. package/skills/craft/vercel-optimize/references/verification.md +102 -102
  571. package/skills/craft/vercel-optimize/references/voice.md +76 -76
  572. package/skills/craft/vercel-optimize/scripts/budget-summary.mjs +58 -58
  573. package/skills/craft/vercel-optimize/scripts/build-docs.mjs +76 -76
  574. package/skills/craft/vercel-optimize/scripts/check-citations.mjs +91 -91
  575. package/skills/craft/vercel-optimize/scripts/check-docs-fresh.mjs +100 -100
  576. package/skills/craft/vercel-optimize/scripts/collect-signals.mjs +638 -638
  577. package/skills/craft/vercel-optimize/scripts/collect-sub-agent-outputs.mjs +306 -306
  578. package/skills/craft/vercel-optimize/scripts/deep-dive.mjs +358 -358
  579. package/skills/craft/vercel-optimize/scripts/gate-investigations.mjs +178 -178
  580. package/skills/craft/vercel-optimize/scripts/merge-signals.mjs +203 -203
  581. package/skills/craft/vercel-optimize/scripts/prepare-investigation-brief.mjs +249 -249
  582. package/skills/craft/vercel-optimize/scripts/reconcile-candidates.mjs +69 -69
  583. package/skills/craft/vercel-optimize/scripts/render-report.mjs +462 -462
  584. package/skills/craft/vercel-optimize/scripts/scan-codebase.mjs +361 -361
  585. package/skills/craft/vercel-optimize/scripts/verify-and-regen.mjs +379 -379
  586. package/skills/craft/vercel-optimize/scripts/verify-finding.mjs +21 -21
  587. package/skills/craft/web-design-guidelines/LICENSE +21 -21
  588. package/skills/craft/web-design-guidelines/SKILL.md +43 -43
  589. package/skills/craft/zero-to-live/LICENSE +21 -21
  590. package/skills/craft/zero-to-live/SKILL.md +422 -422
  591. package/skills/creative/creative-3d-modeling/LICENSE +21 -21
  592. package/skills/creative/creative-3d-modeling/SKILL.md +70 -70
  593. package/skills/creative/creative-architecture/LICENSE +21 -21
  594. package/skills/creative/creative-architecture/SKILL.md +94 -94
  595. package/skills/creative/creative-design-principles/LICENSE +21 -21
  596. package/skills/creative/creative-design-principles/SKILL.md +95 -95
  597. package/skills/creative/creative-fashion-advanced/LICENSE +21 -21
  598. package/skills/creative/creative-fashion-advanced/SKILL.md +68 -68
  599. package/skills/creative/creative-fashion-design/LICENSE +21 -21
  600. package/skills/creative/creative-fashion-design/SKILL.md +66 -66
  601. package/skills/creative/creative-game-design/LICENSE +21 -21
  602. package/skills/creative/creative-game-design/SKILL.md +77 -77
  603. package/skills/creative/creative-industrial-design/LICENSE +21 -21
  604. package/skills/creative/creative-industrial-design/SKILL.md +57 -57
  605. package/skills/creative/creative-interior-design/LICENSE +21 -21
  606. package/skills/creative/creative-interior-design/SKILL.md +59 -59
  607. package/skills/creative/creative-music-theory/LICENSE +21 -21
  608. package/skills/creative/creative-music-theory/SKILL.md +98 -98
  609. package/skills/creative/creative-photography/LICENSE +21 -21
  610. package/skills/creative/creative-photography/SKILL.md +87 -87
  611. package/skills/creative/creative-textile-science/LICENSE +21 -21
  612. package/skills/creative/creative-textile-science/SKILL.md +67 -67
  613. package/skills/creative/creative-ux/LICENSE +21 -21
  614. package/skills/creative/creative-ux/SKILL.md +81 -81
  615. package/skills/creative/creative-video/LICENSE +21 -21
  616. package/skills/creative/creative-video/SKILL.md +84 -84
  617. package/skills/creative/creative-writing-craft/LICENSE +21 -21
  618. package/skills/creative/creative-writing-craft/SKILL.md +91 -91
  619. package/skills/diagram-maker/SKILL.md +56 -56
  620. package/skills/diagram-maker/references/excalidraw-patterns.md +85 -85
  621. package/skills/diagram-maker/references/svg-template.md +112 -112
  622. package/skills/discord/SKILL.md +140 -140
  623. package/skills/education/edu-adult-learning/LICENSE +21 -21
  624. package/skills/education/edu-adult-learning/SKILL.md +81 -81
  625. package/skills/education/edu-africa-multilingual/LICENSE +21 -21
  626. package/skills/education/edu-africa-multilingual/SKILL.md +55 -55
  627. package/skills/education/edu-arabic/LICENSE +21 -21
  628. package/skills/education/edu-arabic/SKILL.md +60 -60
  629. package/skills/education/edu-australia-nz/LICENSE +21 -21
  630. package/skills/education/edu-australia-nz/SKILL.md +48 -48
  631. package/skills/education/edu-china-mandarin/LICENSE +21 -21
  632. package/skills/education/edu-china-mandarin/SKILL.md +58 -58
  633. package/skills/education/edu-critical-thinking/LICENSE +21 -21
  634. package/skills/education/edu-critical-thinking/SKILL.md +86 -86
  635. package/skills/education/edu-curriculum/LICENSE +21 -21
  636. package/skills/education/edu-curriculum/SKILL.md +87 -87
  637. package/skills/education/edu-ed-tech/LICENSE +21 -21
  638. package/skills/education/edu-ed-tech/SKILL.md +73 -73
  639. package/skills/education/edu-france/LICENSE +21 -21
  640. package/skills/education/edu-france/SKILL.md +42 -42
  641. package/skills/education/edu-germany/LICENSE +21 -21
  642. package/skills/education/edu-germany/SKILL.md +46 -46
  643. package/skills/education/edu-india-competitive/LICENSE +21 -21
  644. package/skills/education/edu-india-competitive/SKILL.md +159 -159
  645. package/skills/education/edu-india-east/LICENSE +21 -21
  646. package/skills/education/edu-india-east/SKILL.md +60 -60
  647. package/skills/education/edu-india-hindi/LICENSE +21 -21
  648. package/skills/education/edu-india-hindi/SKILL.md +107 -107
  649. package/skills/education/edu-india-south/LICENSE +21 -21
  650. package/skills/education/edu-india-south/SKILL.md +64 -64
  651. package/skills/education/edu-india-west/LICENSE +21 -21
  652. package/skills/education/edu-india-west/SKILL.md +68 -68
  653. package/skills/education/edu-indonesia-malay/LICENSE +21 -21
  654. package/skills/education/edu-indonesia-malay/SKILL.md +57 -57
  655. package/skills/education/edu-international-ib/LICENSE +21 -21
  656. package/skills/education/edu-international-ib/SKILL.md +61 -61
  657. package/skills/education/edu-japan/LICENSE +21 -21
  658. package/skills/education/edu-japan/SKILL.md +48 -48
  659. package/skills/education/edu-korea/LICENSE +21 -21
  660. package/skills/education/edu-korea/SKILL.md +48 -48
  661. package/skills/education/edu-learning-science/LICENSE +21 -21
  662. package/skills/education/edu-learning-science/SKILL.md +76 -76
  663. package/skills/education/edu-portuguese-brazil/LICENSE +21 -21
  664. package/skills/education/edu-portuguese-brazil/SKILL.md +51 -51
  665. package/skills/education/edu-russia/LICENSE +21 -21
  666. package/skills/education/edu-russia/SKILL.md +50 -50
  667. package/skills/education/edu-spain-latam/LICENSE +21 -21
  668. package/skills/education/edu-spain-latam/SKILL.md +55 -55
  669. package/skills/education/edu-special/LICENSE +21 -21
  670. package/skills/education/edu-special/SKILL.md +76 -76
  671. package/skills/education/edu-thailand/LICENSE +21 -21
  672. package/skills/education/edu-thailand/SKILL.md +55 -55
  673. package/skills/education/edu-turkey/LICENSE +21 -21
  674. package/skills/education/edu-turkey/SKILL.md +58 -58
  675. package/skills/education/edu-uk-gcse-alevel/LICENSE +21 -21
  676. package/skills/education/edu-uk-gcse-alevel/SKILL.md +51 -51
  677. package/skills/education/edu-usa-graduate/LICENSE +21 -21
  678. package/skills/education/edu-usa-graduate/SKILL.md +57 -57
  679. package/skills/education/edu-usa-sat-act/LICENSE +21 -21
  680. package/skills/education/edu-usa-sat-act/SKILL.md +55 -55
  681. package/skills/education/edu-vietnam/LICENSE +21 -21
  682. package/skills/education/edu-vietnam/SKILL.md +53 -53
  683. package/skills/eightctl/SKILL.md +54 -54
  684. package/skills/engineering/eng-aerospace/LICENSE +21 -21
  685. package/skills/engineering/eng-aerospace/SKILL.md +117 -117
  686. package/skills/engineering/eng-chemical/LICENSE +21 -21
  687. package/skills/engineering/eng-chemical/SKILL.md +63 -63
  688. package/skills/engineering/eng-civil/LICENSE +21 -21
  689. package/skills/engineering/eng-civil/SKILL.md +223 -223
  690. package/skills/engineering/eng-control-systems/LICENSE +21 -21
  691. package/skills/engineering/eng-control-systems/SKILL.md +158 -158
  692. package/skills/engineering/eng-cryogenics/LICENSE +21 -21
  693. package/skills/engineering/eng-cryogenics/SKILL.md +151 -151
  694. package/skills/engineering/eng-electrical/LICENSE +21 -21
  695. package/skills/engineering/eng-electrical/SKILL.md +70 -70
  696. package/skills/engineering/eng-electronics-embedded/LICENSE +21 -21
  697. package/skills/engineering/eng-electronics-embedded/SKILL.md +89 -89
  698. package/skills/engineering/eng-environmental/LICENSE +21 -21
  699. package/skills/engineering/eng-environmental/SKILL.md +66 -66
  700. package/skills/engineering/eng-manufacturing/LICENSE +21 -21
  701. package/skills/engineering/eng-manufacturing/SKILL.md +78 -78
  702. package/skills/engineering/eng-mechanical/LICENSE +21 -21
  703. package/skills/engineering/eng-mechanical/SKILL.md +66 -66
  704. package/skills/engineering/eng-project/LICENSE +21 -21
  705. package/skills/engineering/eng-project/SKILL.md +72 -72
  706. package/skills/engineering/eng-propulsion/LICENSE +21 -21
  707. package/skills/engineering/eng-propulsion/SKILL.md +133 -133
  708. package/skills/engineering/eng-robotics/LICENSE +21 -21
  709. package/skills/engineering/eng-robotics/SKILL.md +92 -92
  710. package/skills/engineering/eng-systems/LICENSE +21 -21
  711. package/skills/engineering/eng-systems/SKILL.md +81 -81
  712. package/skills/environment/env-biodiversity/LICENSE +21 -21
  713. package/skills/environment/env-biodiversity/SKILL.md +66 -66
  714. package/skills/environment/env-circular-economy/LICENSE +21 -21
  715. package/skills/environment/env-circular-economy/SKILL.md +71 -71
  716. package/skills/environment/env-climate-action/LICENSE +21 -21
  717. package/skills/environment/env-climate-action/SKILL.md +55 -55
  718. package/skills/environment/env-energy/LICENSE +21 -21
  719. package/skills/environment/env-energy/SKILL.md +83 -83
  720. package/skills/environment/env-sustainability-biz/LICENSE +21 -21
  721. package/skills/environment/env-sustainability-biz/SKILL.md +65 -65
  722. package/skills/environment/env-water/LICENSE +21 -21
  723. package/skills/environment/env-water/SKILL.md +67 -67
  724. package/skills/finance/finance-accounting/LICENSE +21 -21
  725. package/skills/finance/finance-accounting/SKILL.md +239 -239
  726. package/skills/finance/finance-banking/LICENSE +21 -21
  727. package/skills/finance/finance-banking/SKILL.md +54 -54
  728. package/skills/finance/finance-corporate/LICENSE +21 -21
  729. package/skills/finance/finance-corporate/SKILL.md +105 -105
  730. package/skills/finance/finance-crypto/LICENSE +21 -21
  731. package/skills/finance/finance-crypto/SKILL.md +94 -94
  732. package/skills/finance/finance-debt-management/LICENSE +21 -21
  733. package/skills/finance/finance-debt-management/SKILL.md +87 -87
  734. package/skills/finance/finance-insurance/LICENSE +21 -21
  735. package/skills/finance/finance-insurance/SKILL.md +91 -91
  736. package/skills/finance/finance-investing/LICENSE +21 -21
  737. package/skills/finance/finance-investing/SKILL.md +269 -269
  738. package/skills/finance/finance-options-derivatives/LICENSE +21 -21
  739. package/skills/finance/finance-options-derivatives/SKILL.md +68 -68
  740. package/skills/finance/finance-personal/LICENSE +21 -21
  741. package/skills/finance/finance-personal/SKILL.md +268 -268
  742. package/skills/finance/finance-real-estate/LICENSE +21 -21
  743. package/skills/finance/finance-real-estate/SKILL.md +110 -110
  744. package/skills/finance/finance-startup/LICENSE +21 -21
  745. package/skills/finance/finance-startup/SKILL.md +253 -253
  746. package/skills/finance/finance-tax-planning/LICENSE +21 -21
  747. package/skills/finance/finance-tax-planning/SKILL.md +89 -89
  748. package/skills/finance/finance-trading/LICENSE +21 -21
  749. package/skills/finance/finance-trading/SKILL.md +112 -112
  750. package/skills/gemini/SKILL.md +51 -51
  751. package/skills/gh-issues/SKILL.md +216 -216
  752. package/skills/gifgrep/SKILL.md +89 -89
  753. package/skills/github/SKILL.md +87 -87
  754. package/skills/gog/SKILL.md +120 -120
  755. package/skills/goplaces/SKILL.md +56 -56
  756. package/skills/graphify/SKILL.md +619 -619
  757. package/skills/health/health-aging/LICENSE +21 -21
  758. package/skills/health/health-aging/SKILL.md +82 -82
  759. package/skills/health/health-chronic/LICENSE +21 -21
  760. package/skills/health/health-chronic/SKILL.md +202 -202
  761. package/skills/health/health-dental/LICENSE +21 -21
  762. package/skills/health/health-dental/SKILL.md +41 -41
  763. package/skills/health/health-eye-care/LICENSE +21 -21
  764. package/skills/health/health-eye-care/SKILL.md +56 -56
  765. package/skills/health/health-first-aid/LICENSE +21 -21
  766. package/skills/health/health-first-aid/SKILL.md +201 -201
  767. package/skills/health/health-fitness/LICENSE +21 -21
  768. package/skills/health/health-fitness/SKILL.md +111 -111
  769. package/skills/health/health-general/LICENSE +21 -21
  770. package/skills/health/health-general/SKILL.md +277 -277
  771. package/skills/health/health-mens/LICENSE +21 -21
  772. package/skills/health/health-mens/SKILL.md +53 -53
  773. package/skills/health/health-mental/LICENSE +21 -21
  774. package/skills/health/health-mental/SKILL.md +221 -221
  775. package/skills/health/health-naturopathy-ayurveda/LICENSE +21 -21
  776. package/skills/health/health-naturopathy-ayurveda/SKILL.md +60 -60
  777. package/skills/health/health-nutrition/LICENSE +21 -21
  778. package/skills/health/health-nutrition/SKILL.md +262 -262
  779. package/skills/health/health-pediatric/LICENSE +21 -21
  780. package/skills/health/health-pediatric/SKILL.md +94 -94
  781. package/skills/health/health-pharmacology/LICENSE +21 -21
  782. package/skills/health/health-pharmacology/SKILL.md +87 -87
  783. package/skills/health/health-pregnancy/LICENSE +21 -21
  784. package/skills/health/health-pregnancy/SKILL.md +71 -71
  785. package/skills/health/health-skin/LICENSE +21 -21
  786. package/skills/health/health-skin/SKILL.md +71 -71
  787. package/skills/health/health-sleep/LICENSE +21 -21
  788. package/skills/health/health-sleep/SKILL.md +81 -81
  789. package/skills/health/health-womens/LICENSE +21 -21
  790. package/skills/health/health-womens/SKILL.md +72 -72
  791. package/skills/health/health-yoga-wellness/LICENSE +21 -21
  792. package/skills/health/health-yoga-wellness/SKILL.md +58 -58
  793. package/skills/healthcare-systems/health-sys-global/LICENSE +21 -21
  794. package/skills/healthcare-systems/health-sys-global/SKILL.md +69 -69
  795. package/skills/healthcare-systems/health-sys-management/LICENSE +21 -21
  796. package/skills/healthcare-systems/health-sys-management/SKILL.md +71 -71
  797. package/skills/healthcare-systems/health-sys-navigation/LICENSE +21 -21
  798. package/skills/healthcare-systems/health-sys-navigation/SKILL.md +60 -60
  799. package/skills/healthcare-systems/health-sys-public/LICENSE +21 -21
  800. package/skills/healthcare-systems/health-sys-public/SKILL.md +71 -71
  801. package/skills/healthcheck/SKILL.md +109 -109
  802. package/skills/himalaya/SKILL.md +84 -84
  803. package/skills/himalaya/references/configuration.md +184 -184
  804. package/skills/himalaya/references/message-composition.md +199 -199
  805. package/skills/humanities/humanities-history-world/LICENSE +21 -21
  806. package/skills/humanities/humanities-history-world/SKILL.md +59 -59
  807. package/skills/humanities/humanities-indian-classical/LICENSE +21 -21
  808. package/skills/humanities/humanities-indian-classical/SKILL.md +104 -104
  809. package/skills/humanities/humanities-philosophy/LICENSE +21 -21
  810. package/skills/humanities/humanities-philosophy/SKILL.md +105 -105
  811. package/skills/humanities/humanities-world-religions/LICENSE +21 -21
  812. package/skills/humanities/humanities-world-religions/SKILL.md +67 -67
  813. package/skills/impeccable/SKILL.md +185 -185
  814. package/skills/imsg/SKILL.md +126 -126
  815. package/skills/industry/industry-construction/LICENSE +21 -21
  816. package/skills/industry/industry-construction/SKILL.md +81 -81
  817. package/skills/industry/industry-education-sector/LICENSE +21 -21
  818. package/skills/industry/industry-education-sector/SKILL.md +49 -49
  819. package/skills/industry/industry-fashion/LICENSE +21 -21
  820. package/skills/industry/industry-fashion/SKILL.md +82 -82
  821. package/skills/industry/industry-food/LICENSE +21 -21
  822. package/skills/industry/industry-food/SKILL.md +79 -79
  823. package/skills/industry/industry-government/LICENSE +21 -21
  824. package/skills/industry/industry-government/SKILL.md +80 -80
  825. package/skills/industry/industry-hospitality/LICENSE +21 -21
  826. package/skills/industry/industry-hospitality/SKILL.md +73 -73
  827. package/skills/industry/industry-insurance-sector/LICENSE +21 -21
  828. package/skills/industry/industry-insurance-sector/SKILL.md +57 -57
  829. package/skills/industry/industry-logistics/LICENSE +21 -21
  830. package/skills/industry/industry-logistics/SKILL.md +80 -80
  831. package/skills/industry/industry-media/LICENSE +21 -21
  832. package/skills/industry/industry-media/SKILL.md +66 -66
  833. package/skills/industry/industry-nonprofit/LICENSE +21 -21
  834. package/skills/industry/industry-nonprofit/SKILL.md +77 -77
  835. package/skills/industry/industry-pharma/LICENSE +21 -21
  836. package/skills/industry/industry-pharma/SKILL.md +69 -69
  837. package/skills/industry/industry-real-estate/LICENSE +21 -21
  838. package/skills/industry/industry-real-estate/SKILL.md +61 -61
  839. package/skills/industry/industry-sports/LICENSE +21 -21
  840. package/skills/industry/industry-sports/SKILL.md +71 -71
  841. package/skills/industry/industry-tech-startup/LICENSE +21 -21
  842. package/skills/industry/industry-tech-startup/SKILL.md +82 -82
  843. package/skills/internal-comms/LICENSE +21 -21
  844. package/skills/internal-comms/SKILL.md +38 -38
  845. package/skills/internal-comms/examples/3p-updates.md +49 -49
  846. package/skills/internal-comms/examples/company-newsletter.md +76 -76
  847. package/skills/internal-comms/examples/faq-answers.md +35 -35
  848. package/skills/internal-comms/examples/general-comms.md +19 -19
  849. package/skills/legal/legal-business/LICENSE +21 -21
  850. package/skills/legal/legal-business/SKILL.md +227 -227
  851. package/skills/legal/legal-consumer/LICENSE +21 -21
  852. package/skills/legal/legal-consumer/SKILL.md +155 -155
  853. package/skills/legal/legal-contracts/LICENSE +21 -21
  854. package/skills/legal/legal-contracts/SKILL.md +268 -268
  855. package/skills/legal/legal-corporate-governance/LICENSE +21 -21
  856. package/skills/legal/legal-corporate-governance/SKILL.md +53 -53
  857. package/skills/legal/legal-employment/LICENSE +21 -21
  858. package/skills/legal/legal-employment/SKILL.md +291 -291
  859. package/skills/legal/legal-immigration/LICENSE +21 -21
  860. package/skills/legal/legal-immigration/SKILL.md +146 -146
  861. package/skills/legal/legal-international/LICENSE +21 -21
  862. package/skills/legal/legal-international/SKILL.md +51 -51
  863. package/skills/legal/legal-ip/LICENSE +21 -21
  864. package/skills/legal/legal-ip/SKILL.md +264 -264
  865. package/skills/legal/legal-privacy/LICENSE +21 -21
  866. package/skills/legal/legal-privacy/SKILL.md +161 -161
  867. package/skills/legal/legal-real-estate/LICENSE +21 -21
  868. package/skills/legal/legal-real-estate/SKILL.md +142 -142
  869. package/skills/legal/legal-startup/LICENSE +21 -21
  870. package/skills/legal/legal-startup/SKILL.md +182 -182
  871. package/skills/legal/legal-tax/LICENSE +21 -21
  872. package/skills/legal/legal-tax/SKILL.md +156 -156
  873. package/skills/mcp-builder/LICENSE +21 -21
  874. package/skills/mcp-builder/SKILL.md +257 -257
  875. package/skills/mcp-builder/reference/evaluation.md +630 -630
  876. package/skills/mcp-builder/reference/mcp_best_practices.md +269 -269
  877. package/skills/mcp-builder/reference/node_mcp_server.md +980 -980
  878. package/skills/mcp-builder/reference/python_mcp_server.md +737 -737
  879. package/skills/mcp-builder/scripts/connections.py +151 -151
  880. package/skills/mcp-builder/scripts/evaluation.py +373 -373
  881. package/skills/mcp-builder/scripts/example_evaluation.xml +22 -22
  882. package/skills/mcp-builder/scripts/requirements.txt +2 -2
  883. package/skills/mcporter/SKILL.md +65 -65
  884. package/skills/meme-maker/SKILL.md +46 -46
  885. package/skills/meme-maker/references/templates.json +358 -358
  886. package/skills/meme-maker/scripts/meme.mjs +398 -398
  887. package/skills/mental-health/mental-health-cbt/LICENSE +21 -21
  888. package/skills/mental-health/mental-health-cbt/SKILL.md +254 -254
  889. package/skills/mental-health/psych-addiction/LICENSE +21 -21
  890. package/skills/mental-health/psych-addiction/SKILL.md +79 -79
  891. package/skills/mental-health/psych-behavioral-econ/LICENSE +21 -21
  892. package/skills/mental-health/psych-behavioral-econ/SKILL.md +84 -84
  893. package/skills/mental-health/psych-child/LICENSE +21 -21
  894. package/skills/mental-health/psych-child/SKILL.md +84 -84
  895. package/skills/mental-health/psych-grief/LICENSE +21 -21
  896. package/skills/mental-health/psych-grief/SKILL.md +85 -85
  897. package/skills/mental-health/psych-mindfulness/LICENSE +21 -21
  898. package/skills/mental-health/psych-mindfulness/SKILL.md +71 -71
  899. package/skills/mental-health/psych-org/LICENSE +21 -21
  900. package/skills/mental-health/psych-org/SKILL.md +115 -115
  901. package/skills/mental-health/psych-positive/LICENSE +21 -21
  902. package/skills/mental-health/psych-positive/SKILL.md +86 -86
  903. package/skills/mental-health/psych-relationships/LICENSE +21 -21
  904. package/skills/mental-health/psych-relationships/SKILL.md +100 -100
  905. package/skills/mental-health/psych-trauma/LICENSE +21 -21
  906. package/skills/mental-health/psych-trauma/SKILL.md +109 -109
  907. package/skills/model-usage/SKILL.md +75 -75
  908. package/skills/model-usage/references/codexbar-cli.md +33 -33
  909. package/skills/model-usage/scripts/model_usage.py +319 -319
  910. package/skills/model-usage/scripts/test_model_usage.py +40 -40
  911. package/skills/nano-pdf/SKILL.md +42 -42
  912. package/skills/node-connect/SKILL.md +147 -147
  913. package/skills/node-inspect-debugger/SKILL.md +88 -88
  914. package/skills/notion/SKILL.md +154 -154
  915. package/skills/obsidian/SKILL.md +123 -123
  916. package/skills/openai-whisper/SKILL.md +42 -42
  917. package/skills/openai-whisper-api/SKILL.md +75 -75
  918. package/skills/openai-whisper-api/scripts/transcribe.sh +154 -154
  919. package/skills/openhue/SKILL.md +116 -116
  920. package/skills/oracle/SKILL.md +130 -130
  921. package/skills/ordercli/SKILL.md +82 -82
  922. package/skills/peekaboo/SKILL.md +217 -217
  923. package/skills/pyproject.toml +10 -10
  924. package/skills/python-debugpy/SKILL.md +76 -76
  925. package/skills/sag/SKILL.md +91 -91
  926. package/skills/science/sci-astronomy/LICENSE +21 -21
  927. package/skills/science/sci-astronomy/SKILL.md +80 -80
  928. package/skills/science/sci-biology/LICENSE +21 -21
  929. package/skills/science/sci-biology/SKILL.md +74 -74
  930. package/skills/science/sci-chemistry/LICENSE +21 -21
  931. package/skills/science/sci-chemistry/SKILL.md +89 -89
  932. package/skills/science/sci-climate/LICENSE +21 -21
  933. package/skills/science/sci-climate/SKILL.md +72 -72
  934. package/skills/science/sci-data-analysis/LICENSE +21 -21
  935. package/skills/science/sci-data-analysis/SKILL.md +87 -87
  936. package/skills/science/sci-environmental-science/LICENSE +21 -21
  937. package/skills/science/sci-environmental-science/SKILL.md +69 -69
  938. package/skills/science/sci-geology/LICENSE +21 -21
  939. package/skills/science/sci-geology/SKILL.md +56 -56
  940. package/skills/science/sci-method/LICENSE +21 -21
  941. package/skills/science/sci-method/SKILL.md +77 -77
  942. package/skills/science/sci-neuroscience/LICENSE +21 -21
  943. package/skills/science/sci-neuroscience/SKILL.md +79 -79
  944. package/skills/science/sci-physics/LICENSE +21 -21
  945. package/skills/science/sci-physics/SKILL.md +78 -78
  946. package/skills/science/sci-research-methods/LICENSE +21 -21
  947. package/skills/science/sci-research-methods/SKILL.md +83 -83
  948. package/skills/science/sci-statistics/LICENSE +21 -21
  949. package/skills/science/sci-statistics/SKILL.md +249 -249
  950. package/skills/session-logs/SKILL.md +155 -155
  951. package/skills/sherpa-onnx-tts/SKILL.md +113 -113
  952. package/skills/skill-creator/SKILL.md +81 -81
  953. package/skills/skill-creator/license.txt +202 -202
  954. package/skills/skill-creator/scripts/init_skill.py +378 -378
  955. package/skills/skill-creator/scripts/package_skill.py +144 -144
  956. package/skills/skill-creator/scripts/quick_validate.py +169 -169
  957. package/skills/skill-creator/scripts/test_init_skill.py +51 -51
  958. package/skills/skill-creator/scripts/test_package_skill.py +199 -199
  959. package/skills/skill-creator/scripts/test_quick_validate.py +116 -116
  960. package/skills/slack/SKILL.md +82 -82
  961. package/skills/slack-gif-creator/LICENSE +21 -21
  962. package/skills/slack-gif-creator/SKILL.md +293 -293
  963. package/skills/slack-gif-creator/requirements.txt +3 -3
  964. package/skills/social-sciences/social-anthropology/LICENSE +21 -21
  965. package/skills/social-sciences/social-anthropology/SKILL.md +62 -62
  966. package/skills/social-sciences/social-economics/LICENSE +21 -21
  967. package/skills/social-sciences/social-economics/SKILL.md +88 -88
  968. package/skills/social-sciences/social-geography/LICENSE +21 -21
  969. package/skills/social-sciences/social-geography/SKILL.md +61 -61
  970. package/skills/social-sciences/social-international-dev/LICENSE +21 -21
  971. package/skills/social-sciences/social-international-dev/SKILL.md +76 -76
  972. package/skills/social-sciences/social-political-science/LICENSE +21 -21
  973. package/skills/social-sciences/social-political-science/SKILL.md +70 -70
  974. package/skills/social-sciences/social-public-policy/LICENSE +21 -21
  975. package/skills/social-sciences/social-public-policy/SKILL.md +73 -73
  976. package/skills/social-sciences/social-sociology/LICENSE +21 -21
  977. package/skills/social-sciences/social-sociology/SKILL.md +78 -78
  978. package/skills/songsee/SKILL.md +53 -53
  979. package/skills/sonoscli/SKILL.md +69 -69
  980. package/skills/spike/SKILL.md +55 -55
  981. package/skills/spotify-player/SKILL.md +68 -68
  982. package/skills/summarize/SKILL.md +90 -90
  983. package/skills/taskflow/SKILL.md +153 -153
  984. package/skills/taskflow/examples/inbox-triage.lobster +33 -33
  985. package/skills/taskflow/examples/pr-intake.lobster +32 -32
  986. package/skills/taskflow-inbox-triage/SKILL.md +123 -123
  987. package/skills/technical/ai-ethics/LICENSE +21 -21
  988. package/skills/technical/ai-ethics/SKILL.md +92 -92
  989. package/skills/technical/ai-product-builder/LICENSE +21 -21
  990. package/skills/technical/ai-product-builder/SKILL.md +180 -180
  991. package/skills/technical/analytics-setup/LICENSE +21 -21
  992. package/skills/technical/analytics-setup/SKILL.md +125 -125
  993. package/skills/technical/api-builder/LICENSE +21 -21
  994. package/skills/technical/api-builder/SKILL.md +202 -202
  995. package/skills/technical/architecture-decisions/LICENSE +21 -21
  996. package/skills/technical/architecture-decisions/SKILL.md +120 -120
  997. package/skills/technical/auth-security/LICENSE +21 -21
  998. package/skills/technical/auth-security/SKILL.md +209 -209
  999. package/skills/technical/blockchain-web3/LICENSE +21 -21
  1000. package/skills/technical/blockchain-web3/SKILL.md +84 -84
  1001. package/skills/technical/cloud-architecture/LICENSE +21 -21
  1002. package/skills/technical/cloud-architecture/SKILL.md +85 -85
  1003. package/skills/technical/content-platform/LICENSE +21 -21
  1004. package/skills/technical/content-platform/SKILL.md +134 -134
  1005. package/skills/technical/cybersecurity-advanced/LICENSE +21 -21
  1006. package/skills/technical/cybersecurity-advanced/SKILL.md +99 -99
  1007. package/skills/technical/data-engineering/LICENSE +21 -21
  1008. package/skills/technical/data-engineering/SKILL.md +117 -117
  1009. package/skills/technical/database-design/LICENSE +21 -21
  1010. package/skills/technical/database-design/SKILL.md +185 -185
  1011. package/skills/technical/devops-cicd/LICENSE +21 -21
  1012. package/skills/technical/devops-cicd/SKILL.md +181 -181
  1013. package/skills/technical/ecommerce-builder/LICENSE +21 -21
  1014. package/skills/technical/ecommerce-builder/SKILL.md +123 -123
  1015. package/skills/technical/email-marketing/LICENSE +21 -21
  1016. package/skills/technical/email-marketing/SKILL.md +128 -128
  1017. package/skills/technical/fintech-builder/LICENSE +21 -21
  1018. package/skills/technical/fintech-builder/SKILL.md +141 -141
  1019. package/skills/technical/full-stack-web/LICENSE +21 -21
  1020. package/skills/technical/full-stack-web/SKILL.md +173 -173
  1021. package/skills/technical/gdpr-basics/LICENSE +21 -21
  1022. package/skills/technical/gdpr-basics/SKILL.md +145 -145
  1023. package/skills/technical/launch-playbook/LICENSE +21 -21
  1024. package/skills/technical/launch-playbook/SKILL.md +95 -95
  1025. package/skills/technical/marketing-copy/LICENSE +21 -21
  1026. package/skills/technical/marketing-copy/SKILL.md +126 -126
  1027. package/skills/technical/marketplace-builder/LICENSE +21 -21
  1028. package/skills/technical/marketplace-builder/SKILL.md +105 -105
  1029. package/skills/technical/mobile-pwa/LICENSE +21 -21
  1030. package/skills/technical/mobile-pwa/SKILL.md +191 -191
  1031. package/skills/technical/no-code-tools/LICENSE +21 -21
  1032. package/skills/technical/no-code-tools/SKILL.md +80 -80
  1033. package/skills/technical/open-source/LICENSE +21 -21
  1034. package/skills/technical/open-source/SKILL.md +71 -71
  1035. package/skills/technical/performance-optimization/LICENSE +21 -21
  1036. package/skills/technical/performance-optimization/SKILL.md +155 -155
  1037. package/skills/technical/pricing-design/LICENSE +21 -21
  1038. package/skills/technical/pricing-design/SKILL.md +87 -87
  1039. package/skills/technical/product-management/LICENSE +21 -21
  1040. package/skills/technical/product-management/SKILL.md +94 -94
  1041. package/skills/technical/saas-builder/LICENSE +21 -21
  1042. package/skills/technical/saas-builder/SKILL.md +138 -138
  1043. package/skills/technical/scope-estimation/LICENSE +21 -21
  1044. package/skills/technical/scope-estimation/SKILL.md +99 -99
  1045. package/skills/technical/secrets-management/LICENSE +21 -21
  1046. package/skills/technical/secrets-management/SKILL.md +135 -135
  1047. package/skills/technical/seo-technical/LICENSE +21 -21
  1048. package/skills/technical/seo-technical/SKILL.md +136 -136
  1049. package/skills/technical/technical-writing/LICENSE +21 -21
  1050. package/skills/technical/technical-writing/SKILL.md +149 -149
  1051. package/skills/technical/ux-research-tools/LICENSE +21 -21
  1052. package/skills/technical/ux-research-tools/SKILL.md +54 -54
  1053. package/skills/theme-factory/LICENSE +21 -21
  1054. package/skills/theme-factory/SKILL.md +65 -65
  1055. package/skills/theme-factory/themes/arctic-frost.md +19 -19
  1056. package/skills/theme-factory/themes/botanical-garden.md +19 -19
  1057. package/skills/theme-factory/themes/desert-rose.md +19 -19
  1058. package/skills/theme-factory/themes/forest-canopy.md +19 -19
  1059. package/skills/theme-factory/themes/golden-hour.md +19 -19
  1060. package/skills/theme-factory/themes/midnight-galaxy.md +19 -19
  1061. package/skills/theme-factory/themes/modern-minimalist.md +19 -19
  1062. package/skills/theme-factory/themes/ocean-depths.md +19 -19
  1063. package/skills/theme-factory/themes/sunset-boulevard.md +19 -19
  1064. package/skills/theme-factory/themes/tech-innovation.md +19 -19
  1065. package/skills/things-mac/SKILL.md +90 -90
  1066. package/skills/tmux/SKILL.md +95 -95
  1067. package/skills/tmux/scripts/find-sessions.sh +112 -112
  1068. package/skills/tmux/scripts/wait-for-text.sh +83 -83
  1069. package/skills/trades/trades-agriculture/LICENSE +21 -21
  1070. package/skills/trades/trades-agriculture/SKILL.md +80 -80
  1071. package/skills/trades/trades-automotive/LICENSE +21 -21
  1072. package/skills/trades/trades-automotive/SKILL.md +84 -84
  1073. package/skills/trades/trades-carpentry/LICENSE +21 -21
  1074. package/skills/trades/trades-carpentry/SKILL.md +71 -71
  1075. package/skills/trades/trades-cooking-pro/LICENSE +21 -21
  1076. package/skills/trades/trades-cooking-pro/SKILL.md +90 -90
  1077. package/skills/trades/trades-electrical/LICENSE +21 -21
  1078. package/skills/trades/trades-electrical/SKILL.md +146 -146
  1079. package/skills/trades/trades-hvac/LICENSE +21 -21
  1080. package/skills/trades/trades-hvac/SKILL.md +80 -80
  1081. package/skills/trades/trades-landscaping/LICENSE +21 -21
  1082. package/skills/trades/trades-landscaping/SKILL.md +60 -60
  1083. package/skills/trades/trades-metalworking/LICENSE +21 -21
  1084. package/skills/trades/trades-metalworking/SKILL.md +64 -64
  1085. package/skills/trades/trades-painting/LICENSE +21 -21
  1086. package/skills/trades/trades-painting/SKILL.md +70 -70
  1087. package/skills/trades/trades-plumbing/LICENSE +21 -21
  1088. package/skills/trades/trades-plumbing/SKILL.md +160 -160
  1089. package/skills/trades/trades-welding/LICENSE +21 -21
  1090. package/skills/trades/trades-welding/SKILL.md +82 -82
  1091. package/skills/trello/SKILL.md +112 -112
  1092. package/skills/uipm-ui-styling/SKILL.md +328 -328
  1093. package/skills/video-frames/SKILL.md +50 -50
  1094. package/skills/video-frames/scripts/frame.sh +81 -81
  1095. package/skills/voice-call/SKILL.md +49 -49
  1096. package/skills/wacli/SKILL.md +76 -76
  1097. package/skills/weather/SKILL.md +91 -91
  1098. package/skills/web-artifacts-builder/LICENSE +21 -21
  1099. package/skills/web-artifacts-builder/SKILL.md +82 -82
  1100. package/skills/web-artifacts-builder/scripts/bundle-artifact.sh +53 -53
  1101. package/skills/web-artifacts-builder/scripts/init-artifact.sh +322 -322
  1102. package/skills/xurl/SKILL.md +124 -124
@@ -1,751 +1,751 @@
1
- // Sub-agent investigation brief — the entire prompt the sub-agent sees.
2
- // Constraints: target ≤ 12 KB per brief; deterministic (same input → byte-identical output, modulo generatedAt).
3
-
4
- import { isAbsolute, join, normalize, relative } from "node:path";
5
- import { loadLibrary, matchesFrameworkVersion } from "./citations.mjs";
6
- import { deriveProjectFacts } from "./project-facts.mjs";
7
- import { renderSupportTopics } from "./support-topics.mjs";
8
-
9
- const NON_LAYOUT_FILE_CAP = 12;
10
- const LAYOUT_FILE_CAP = 3;
11
-
12
- // Playbook is a tilt, not a requirement.
13
- export function inferPlaybook(signals) {
14
- const deps = signals?.stack?.deps ?? {};
15
- const codebaseStack = signals?.codebase?.stack ?? {};
16
- const routes = signals?.codebase?.routes ?? [];
17
- const routePaths = routes.map((r) => r.routePath ?? "");
18
- const services = Array.isArray(signals?.usage?.services) ? signals.usage.services : [];
19
-
20
- const has = (name) => Boolean(deps[name]);
21
- const hasPrefix = (prefix) => Object.keys(deps).some((k) => k === prefix || k.startsWith(prefix));
22
- const anyRouteMatches = (re) => routePaths.some((p) => re.test(p));
23
- const usageHas = (re, minBilled = 0) =>
24
- services.some(
25
- (s) => re.test(String(s?.name ?? "")) && Number(s?.billedCost ?? s?.cost ?? 0) > minBilled,
26
- );
27
-
28
- // AI app first — billing shape (AI Gateway > Sandbox > Function Duration) overrides
29
- // the ecommerce/saas tilt when both apply (an "AI shopping assistant" lives in ai-application's
30
- // priority patterns, not the cart-checkout ones).
31
- const aiDep =
32
- has("@vercel/sandbox") ||
33
- has("@vercel/ai-gateway") ||
34
- has("ai") ||
35
- has("openai") ||
36
- has("@anthropic-ai/sdk") ||
37
- hasPrefix("@ai-sdk/");
38
- const aiUsage = usageHas(/^AI Gateway$/i) || usageHas(/^Sandbox/i);
39
- if (aiDep || aiUsage) {
40
- return "ai-application";
41
- }
42
- if (
43
- has("stripe") ||
44
- has("@stripe/stripe-js") ||
45
- has("react-stripe-js") ||
46
- anyRouteMatches(/^\/(cart|checkout|products?)\b/i)
47
- ) {
48
- return "ecommerce";
49
- }
50
- if (
51
- has("next-auth") ||
52
- has("@clerk/nextjs") ||
53
- has("@workos-inc/authkit-nextjs") ||
54
- anyRouteMatches(/^\/(admin|dashboard|settings|account|billing)\b/i)
55
- ) {
56
- return "saas";
57
- }
58
- if (routes.length > 0 && routes.every((r) => /^\/api\//.test(r.routePath ?? ""))) {
59
- return "api-service";
60
- }
61
- if (codebaseStack.hasAppRouter || codebaseStack.hasPagesRouter) {
62
- if (anyRouteMatches(/^\/(blog|docs|posts?|articles?|guides?)\b/i)) return "content-site";
63
- if (anyRouteMatches(/^\/\(?marketing\)?\b/i)) return "marketing";
64
- }
65
- return null;
66
- }
67
-
68
- // SvelteKit/Nuxt/Astro have framework-shaped advice that doesn't fit the Next.js-flavored profile playbooks — both can ship together.
69
- export function inferFrameworkPlaybook(signals) {
70
- const stack = signals?.stack ?? signals?.codebase?.stack ?? {};
71
- switch (stack.framework) {
72
- case "sveltekit":
73
- return "sveltekit";
74
- default:
75
- return null;
76
- }
77
- }
78
-
79
- // Empty result = no source files; investigate via evidence only (legitimate for platform_* candidates).
80
- // Workspace imports expand one level deep — keeps brief small. A thin shell page.tsx delegates work; bottleneck usually lives in workspace files.
81
- export function resolveFiles(candidate, signals) {
82
- const route = candidate.route;
83
- const routes = signals?.codebase?.routes ?? [];
84
- if (Array.isArray(candidate.files) && candidate.files.length > 0) {
85
- return capBriefFiles(
86
- candidate.files,
87
- route ? closestAncestorLayoutFiles(route, routes) : [],
88
- routes,
89
- );
90
- }
91
- if (!route) return [];
92
- const nonLayoutRoutes = routes.filter((r) => r.type !== "layout");
93
- const layoutFiles = closestAncestorLayoutFiles(route, routes);
94
- let matched = nonLayoutRoutes.filter((r) => r.routePath === route);
95
- if (matched.length === 0) {
96
- // Fuzzy: prefer max literal-segment matches so `/event/[code]/teaser` beats `/event/[code]/[location]` when candidate is `/event/[*]/teaser`.
97
- const scored = nonLayoutRoutes
98
- .map((r) => ({ r, score: routePathMatchScore(r.routePath, route) }))
99
- .filter((x) => x.score > 0);
100
- if (scored.length === 0) return capBriefFiles([], layoutFiles, routes);
101
- const top = Math.max(...scored.map((s) => s.score));
102
- matched = scored.filter((s) => s.score === top).map((s) => s.r);
103
- }
104
- const direct = matched.map((r) => r.file).filter(Boolean);
105
- const workspaceImports = matched
106
- .flatMap((r) => (Array.isArray(r.workspaceImports) ? r.workspaceImports : []))
107
- .filter(Boolean);
108
- return capBriefFiles(uniq([...direct, ...workspaceImports]), layoutFiles, routes);
109
- }
110
-
111
- // literal-segment match × 10, dynamic × 1, pure equality = sentinel that always wins.
112
- export function routePathMatchScore(routePath, metricPath) {
113
- if (typeof routePath !== "string" || typeof metricPath !== "string") return 0;
114
- if (routePath === metricPath) return 1000 + routePath.split("/").filter(Boolean).length;
115
- const rTokens = routePath.split("/").filter(Boolean);
116
- const mTokens = metricPath.split("/").filter(Boolean);
117
- let ri = 0,
118
- mi = 0,
119
- literals = 0,
120
- dynamicMatches = 0;
121
- while (ri < rTokens.length && mi < mTokens.length) {
122
- const r = rTokens[ri];
123
- const m = mTokens[mi];
124
- if (isCatchAllPlaceholder(r)) return 1 + literals * 10 + dynamicMatches;
125
- if (r === m) {
126
- literals++;
127
- ri++;
128
- mi++;
129
- continue;
130
- }
131
- // Route patterns may match concrete metric paths, and route/metric dynamic
132
- // placeholders may match each other. A metric-side placeholder must not
133
- // match a static route literal: that would let `/docs/[...slug]` traffic
134
- // attach to an unrelated static scanner route like `/docs/llms.txt`.
135
- if (isDynamicPlaceholder(r) && !isCatchAllPlaceholder(m)) {
136
- dynamicMatches++;
137
- ri++;
138
- mi++;
139
- continue;
140
- }
141
- return 0;
142
- }
143
- if (
144
- ri === rTokens.length - 1 &&
145
- /^\[\[\.\.\..+\]\]$/.test(rTokens[ri]) &&
146
- mi === mTokens.length
147
- ) {
148
- return 1 + literals * 10 + dynamicMatches;
149
- }
150
- if (ri !== rTokens.length || mi !== mTokens.length) {
151
- return trailingSingleDynamicPartialScore(rTokens, mTokens, ri, mi, literals, dynamicMatches);
152
- }
153
- return 1 + literals * 10 + dynamicMatches;
154
- }
155
-
156
- export function routePathsMatch(routePath, metricPath) {
157
- return routePathMatchScore(routePath, metricPath) > 0;
158
- }
159
-
160
- function isDynamicPlaceholder(token) {
161
- return /^\[.*\]$/.test(token);
162
- }
163
- function isSingleDynamicPlaceholder(token) {
164
- return /^\[[^[.\].][^\]]*\]$/.test(token);
165
- }
166
- function isCatchAllPlaceholder(token) {
167
- return (
168
- /^\[(?:\[\.\.\..+\]|\.\.\..+)\]$/.test(token) ||
169
- /^\[\.\.\..+\]$/.test(token) ||
170
- /^\[\[\.\.\..+\]\]$/.test(token)
171
- );
172
- }
173
-
174
- function trailingSingleDynamicPartialScore(rTokens, mTokens, ri, mi, literals, dynamicMatches) {
175
- const rRemaining = rTokens.length - ri;
176
- const mRemaining = mTokens.length - mi;
177
- if (Math.abs(rRemaining - mRemaining) !== 1) return 0;
178
- if (rRemaining !== 0 && mRemaining !== 0) return 0;
179
- const lastRouteToken = rTokens[ri - 1];
180
- const lastMetricToken = mTokens[mi - 1];
181
- if (!isSingleDynamicPlaceholder(lastRouteToken) && !isSingleDynamicPlaceholder(lastMetricToken))
182
- return 0;
183
- return literals * 10 + dynamicMatches;
184
- }
185
-
186
- function uniq(xs) {
187
- return Array.from(new Set(xs));
188
- }
189
-
190
- function briefRoots(signals) {
191
- const codebase = signals?.codebase ?? {};
192
- const appRoot =
193
- typeof codebase.rootDir === "string" && codebase.rootDir.length > 0
194
- ? normalize(codebase.rootDir)
195
- : null;
196
- const repoRoot =
197
- typeof codebase.monorepoRoot === "string" && codebase.monorepoRoot.length > 0
198
- ? normalize(codebase.monorepoRoot)
199
- : appRoot;
200
- return { appRoot, repoRoot };
201
- }
202
-
203
- function absoluteBriefPath(file, roots) {
204
- if (typeof file !== "string" || file.length === 0) return null;
205
- if (isAbsolute(file)) return normalize(file);
206
- const base = isRepoRelativePath(file) ? roots.repoRoot : roots.appRoot;
207
- return base ? normalize(join(base, file)) : null;
208
- }
209
-
210
- function repoRelativeBriefPath(file, roots) {
211
- if (typeof file !== "string" || file.length === 0) return null;
212
- const normalized = normalize(file);
213
- if (isRepoRelativePath(normalized)) return normalized;
214
- const abs = absoluteBriefPath(file, roots);
215
- if (!abs || !roots.repoRoot) return normalized;
216
- const rel = normalize(relative(roots.repoRoot, abs));
217
- return rel.startsWith("..") ? normalized : rel;
218
- }
219
-
220
- function isRepoRelativePath(file) {
221
- return /^(apps|packages)\//.test(file);
222
- }
223
-
224
- function capBriefFiles(nonLayoutCandidates, layoutCandidates, routes) {
225
- const knownLayoutFiles = new Set(
226
- routes
227
- .filter((r) => r.type === "layout")
228
- .map((r) => r.file)
229
- .filter(Boolean),
230
- );
231
- const nonLayout = [];
232
- const layouts = [];
233
- for (const f of uniq(nonLayoutCandidates)) {
234
- if (knownLayoutFiles.has(f) || isLayoutPath(f)) layouts.push(f);
235
- else nonLayout.push(f);
236
- }
237
- for (const f of layoutCandidates) layouts.push(f);
238
- return [
239
- ...uniq(nonLayout).slice(0, NON_LAYOUT_FILE_CAP),
240
- ...uniq(layouts).slice(0, LAYOUT_FILE_CAP),
241
- ];
242
- }
243
-
244
- function closestAncestorLayoutFiles(route, routes) {
245
- if (!route) return [];
246
- return routes
247
- .filter((r) => r.type === "layout" && r.file && layoutAppliesToRoute(r.routePath, route))
248
- .sort(
249
- (a, b) => routeDepth(b.routePath) - routeDepth(a.routePath) || a.file.localeCompare(b.file),
250
- )
251
- .map((r) => r.file);
252
- }
253
-
254
- function layoutAppliesToRoute(layoutPath, routePath) {
255
- if (typeof layoutPath !== "string" || typeof routePath !== "string") return false;
256
- if (layoutPath === "/") return true;
257
- const layoutTokens = layoutPath.split("/").filter(Boolean);
258
- const routeTokens = routePath.split("/").filter(Boolean);
259
- if (layoutTokens.length > routeTokens.length) return false;
260
- for (let i = 0; i < layoutTokens.length; i++) {
261
- const l = layoutTokens[i];
262
- const r = routeTokens[i];
263
- if (isCatchAllPlaceholder(l)) return true;
264
- if (l === r) continue;
265
- if (isDynamicPlaceholder(l) || isDynamicPlaceholder(r)) continue;
266
- return false;
267
- }
268
- return true;
269
- }
270
-
271
- function routeDepth(routePath) {
272
- return String(routePath ?? "")
273
- .split("/")
274
- .filter(Boolean).length;
275
- }
276
-
277
- function isLayoutPath(file) {
278
- return /(^|\/)(?:\+layout(?:\.server)?|layout)\.(?:svelte|tsx?|jsx?)$/.test(String(file ?? ""));
279
- }
280
-
281
- // Tells the sub-agent which signals are missing so it doesn't conflate "no data" with "no bottleneck."
282
- export function summarizeDeepDiveFailures(deepDive) {
283
- if (!deepDive || typeof deepDive !== "object") return null;
284
- const entries = Object.entries(deepDive);
285
- if (entries.length === 0) return null;
286
- const failures = entries.filter(([, v]) => isFailureEntry(v));
287
- if (failures.length === 0) return null;
288
- // Surface when ≥50% failed OR ≥3 distinct signals failed.
289
- if (failures.length / entries.length < 0.5 && failures.length < 3) return null;
290
- const failedIds = failures
291
- .map(([k]) => k)
292
- .slice(0, 6)
293
- .join(", ");
294
- const codes = uniq(failures.map(([, v]) => v?.code ?? v?.error ?? "unknown"))
295
- .slice(0, 3)
296
- .join(" / ");
297
- return `${failures.length} of ${entries.length} deep-dive signals failed (${failedIds}${failures.length > 6 ? ", …" : ""}) — error: ${codes}.`;
298
- }
299
-
300
- function isFailureEntry(v) {
301
- if (!v || typeof v !== "object") return false;
302
- if (v.ok === false) return true;
303
- if (typeof v.code === "string" && v.code !== "OK") return true;
304
- if (typeof v.error === "string" && v.error.length > 0) return true;
305
- return false;
306
- }
307
-
308
- export async function citationSubset(candidateKind, framework, version) {
309
- const lib = await loadLibrary();
310
- const versionOk = (entry) =>
311
- entry.applicableFrameworks.includes("*") ||
312
- entry.applicableFrameworks.some((p) => matchesFrameworkVersion(p, framework, version));
313
- const kindOk = (entry) => {
314
- const at = Array.isArray(entry.appliesTo) ? entry.appliesTo : [];
315
- return at.length === 0 || at.includes(candidateKind);
316
- };
317
- return {
318
- urls: lib.urls.filter((e) => versionOk(e) && kindOk(e)),
319
- ruleSkillRefs: lib.ruleSkillRefs.filter((r) => versionOk(r) && kindOk(r)),
320
- };
321
- }
322
-
323
- // Per-kind hints tell the investigator which comparison to draw first.
324
- export const KIND_INTERPRETATION_HINTS = {
325
- slow_route: [
326
- "Compare `cpu.p95` vs `latency.p95`. If cpu << latency, the bottleneck is wall-clock / external IO / awaits — look for sequential awaits, slow DB queries, slow external APIs. If cpu ≈ latency, look for in-process compute (rendering, JSON serialization, crypto).",
327
- "Compare `ttfb.p95` vs `latency.p95`. If ttfb ≈ latency, response generation finishes near the end — streaming or `after()` may shift perceived latency.",
328
- "For streaming, SSE, resumable chat, or other intentionally long-lived routes, do not treat high wall-clock duration alone as a bug. Recommend a change only when evidence shows avoidable pre-first-byte work, high active CPU, duplicate invocations, or post-response work that can move out of the user-visible path.",
329
- 'Inspect `perDeployment`: a 2x step between deployments points to a regression introduced in the newer deployment. Frame the rec as "regression introduced in <deployment_id>" rather than a generic perf claim.',
330
- "Inspect `startTypeSplit.cold` share. >5% cold means cold starts contribute meaningfully — Fluid Compute or warmer keep-alive is on the table.",
331
- "Inspect `statusDistribution`. A non-trivial 3xx/4xx slice may be inflating p95 because redirects/auth bounces still count as invocations.",
332
- "Inspect `cacheBreakdown`. If the route uses Next.js `dynamic = 'error'` (or otherwise static) but the breakdown shows substantial MISS/BYPASS counts, the latency lives on the cache-miss path — investigate the origin fetch / ISR revalidation cost, NOT in-handler compute. `bandwidthByCache` tells you the byte cost of those misses.",
333
- ],
334
- uncached_route: [
335
- "`cacheBreakdown` tells you what fraction is BYPASS vs HIT vs MISS. BYPASS without explicit `Cache-Control` directives in the response is the canonical fix.",
336
- "`methodDistribution`: GET-only routes are cacheable; POST/PUT/DELETE are not. If the route is GET-heavy but BYPASSing, the cache headers are missing or wrong.",
337
- "`botShare` (bandwidth by bot_category): if bots dominate uncached bandwidth, the right rec may be Bot Protection rather than route caching.",
338
- "`bandwidthByCache`: pair with cacheBreakdown to confirm the dollar/bandwidth impact of moving uncached → cached.",
339
- "A ready cache recommendation must name a positive cache policy. If the right answer is `no-store`, emit no recommendation / observation instead of a cache fix.",
340
- ],
341
- cold_start: [
342
- "`startTypeSplit`: cold vs hot vs prewarmed. Fluid Compute meaningfully helps when cold > 5%.",
343
- "`coldVsWarmLatencyP95`: how much SLOWER is cold than warm. If 5x+, cold starts are amplifying tail latency, not just adding fixed overhead.",
344
- "`coldByDeployment`: if cold-start cluster around the newest deployment, the slowdown is a regression — check imports, init code, framework upgrade.",
345
- ],
346
- route_errors: [
347
- "`errorStatusPattern`: distinguishes 500 (app crash) vs 502/503 (gateway/upstream timeout) vs 504 (downstream timeout).",
348
- "`errorCodes`: a non-empty error_code dimension narrows to a specific failure class (e.g., FUNCTION_INVOCATION_TIMEOUT).",
349
- "`errorsByDeployment`: a deployment-localized spike points to a regression.",
350
- ],
351
- external_api_slow: [
352
- "`latency.p95` vs `latency.p99`: spreads point to flaky upstream; narrow gap points to slow-by-design.",
353
- "`callersByRoute` (`origin_route` dim): which of OUR routes call this upstream — that's where the rec should land.",
354
- "`transferBytes`: large payloads suggest caching or partial-response opportunities at our edge.",
355
- ],
356
- isr_overrevalidation: [
357
- "`writePattern` (write_units by cache_result) — STALE writes vs HIT writes. STALE-write means the revalidate ran on every stale request.",
358
- "`readPattern` (read_units by cache_result) — HIT vs MISS. Low MISS means cache fills are not the issue.",
359
- "If writes / reads > 0.5, the revalidate cadence is too aggressive; lengthen `revalidate` or switch to on-demand `revalidateTag`.",
360
- ],
361
- cwv_poor: [
362
- '`lcp`/`inp`/`cls` percentiles. p75 > Web Vitals "Good" threshold is the bar.',
363
- "LCP > 2500ms → server response or critical image. INP > 200ms → long tasks / heavy JS on interaction. CLS > 0.1 → layout shift, usually images/ads/fonts.",
364
- ],
365
- middleware_heavy: [
366
- "`topMiddlewarePaths`: paths that hit middleware most. If non-asset paths dominate, the matcher is too broad — narrow to the request shapes that actually need middleware.",
367
- ],
368
- platform_fluid_compute: [
369
- "Cross-check the broad-pass `fnStartTypeByRoute` for cold-rate concentration. If a few routes carry most cold starts, frame the rec around those routes rather than fleet-wide.",
370
- ],
371
- platform_bot_protection: [
372
- "`wafRuleFirings`: which managed rules are already firing (challenge/block). If `bot_filter` is already challenging but you still see significant bot bandwidth, BotID adds a verified-human signal that lets the WAF do its job.",
373
- ],
374
- };
375
-
376
- export function buildBrief({
377
- candidate,
378
- candidateIndex,
379
- candidateGroup,
380
- files,
381
- signals,
382
- citations,
383
- playbookId,
384
- playbookBody,
385
- frameworkPlaybookId,
386
- frameworkPlaybookBody,
387
- supportTopics = [],
388
- generatedAt,
389
- }) {
390
- const stack = signals?.stack ?? signals?.codebase?.stack ?? {};
391
- const framework = stack.framework ?? "unknown";
392
- const version = stack.frameworkVersion ?? "unknown";
393
- const kind = candidate.kind;
394
- const routeOrHost = candidate.route ?? candidate.hostname ?? null;
395
- const interp = KIND_INTERPRETATION_HINTS[kind] ?? [];
396
- const candidateRef = candidate.candidateRef ?? `${kind}:${routeOrHost ?? "<account>"}`;
397
- const roots = briefRoots(signals);
398
-
399
- const lines = [];
400
- lines.push(`# Investigation brief — ${kind}${routeOrHost ? ` — ${routeOrHost}` : ""}`);
401
- lines.push("");
402
- lines.push(
403
- "You are a Vercel-optimize investigation sub-agent. Your job is to investigate ONE evidence-backed candidate and emit ONE recommendation JSON. Stay narrow. Stay grounded. Do NOT widen the search.",
404
- );
405
- lines.push("");
406
- lines.push(
407
- `Brief id: \`${candidateGroup}#${candidateIndex}\` · candidateRef: \`${candidateRef}\``,
408
- );
409
- if (generatedAt) lines.push(`Generated: ${generatedAt}`);
410
- lines.push("");
411
-
412
- lines.push("## Candidate");
413
- lines.push("");
414
- lines.push(`- **Kind:** \`${kind}\``);
415
- lines.push(`- **Scope:** ${candidate.scope ?? "route"}`);
416
- if (routeOrHost) lines.push(`- **Target:** \`${routeOrHost}\``);
417
- if (roots.repoRoot) lines.push(`- **Repo root:** \`${roots.repoRoot}\``);
418
- if (roots.appRoot) lines.push(`- **App root:** \`${roots.appRoot}\``);
419
- if (candidate.o11ySignal)
420
- lines.push(`- **o11y signal at gate-time:** \`${candidate.o11ySignal}\``);
421
- lines.push(`- **Confidence:** ${candidate.confidence ?? "n/a"}`);
422
- lines.push(`- **Priority:** ${candidate.priority ?? "n/a"}`);
423
- if (candidate.disqualified) {
424
- lines.push(`- **⚠ Disqualifier present:** ${candidate.disqualifyReason ?? "disqualified"}`);
425
- }
426
- lines.push("");
427
- lines.push(
428
- `**Gate question (the hypothesis you're verifying):** ${candidate.question ?? "(no question)"}`,
429
- );
430
- lines.push("");
431
- if (Array.isArray(files) && files.length > 0) {
432
- lines.push(
433
- "**Files you may read (read ONLY these — open each one directly, NOT a repo-wide grep):**",
434
- );
435
- lines.push(
436
- `_Capped at ${NON_LAYOUT_FILE_CAP} non-layout files + up to ${LAYOUT_FILE_CAP} layouts._`,
437
- );
438
- // Tag route vs workspace-import — workspace files are usually where the bottleneck lives.
439
- const routes = signals?.codebase?.routes ?? [];
440
- const routeScores = routes
441
- .filter((r) => r.type !== "layout")
442
- .map((r) => ({
443
- r,
444
- score: routePathMatchScore(r.routePath, routeOrHost),
445
- }))
446
- .filter((x) => x.score > 0);
447
- const topScore = routeScores.length > 0 ? Math.max(...routeScores.map((x) => x.score)) : 0;
448
- const routeFiles = new Set(
449
- routeScores
450
- .filter((x) => x.score === topScore)
451
- .map((x) => x.r.file)
452
- .filter(Boolean),
453
- );
454
- const layoutFiles = new Set(closestAncestorLayoutFiles(routeOrHost, routes));
455
- const workspaceImportFiles = [];
456
- for (const f of files) {
457
- const tag =
458
- layoutFiles.has(f) || isLayoutPath(f)
459
- ? "(layout)"
460
- : routeFiles.has(f)
461
- ? "(route)"
462
- : "(workspace import)";
463
- if (tag === "(workspace import)") workspaceImportFiles.push(f);
464
- const repoRel = repoRelativeBriefPath(f, roots) ?? f;
465
- const abs = absoluteBriefPath(f, roots);
466
- const sourceSuffix = repoRel !== f ? ` (scan path: \`${f}\`)` : "";
467
- const absSuffix = abs && abs !== repoRel ? ` — open \`${abs}\`` : "";
468
- lines.push(`- \`${repoRel}\` ${tag}${sourceSuffix}${absSuffix}`);
469
- }
470
- if ([...routeFiles].length > 0 && workspaceImportFiles.length > 0) {
471
- lines.push("");
472
- lines.push(
473
- "_The route file is often a thin shell that re-exports from a workspace package. If the route file has no awaits / heavy imports / data fetching of its own, the bottleneck almost certainly lives in one of the (workspace import) files above — read those._",
474
- );
475
- }
476
- } else {
477
- lines.push(
478
- "**Files:** none mapped to this candidate. Either the gate is account-scope (platform_*) or the scanner could not resolve a route→file mapping (legitimate data gap). Work from the deep-dive evidence alone.",
479
- );
480
- }
481
- lines.push("");
482
-
483
- lines.push("## Stack context");
484
- lines.push("");
485
- lines.push(`- **Framework:** \`${framework}@${version}\``);
486
- if (stack.hasAppRouter) lines.push("- **Router:** App Router");
487
- if (stack.hasPagesRouter) lines.push("- **Router:** Pages Router");
488
- if (stack.orm && stack.orm !== "none") lines.push(`- **ORM:** ${stack.orm}`);
489
- if (stack.isMonorepo) lines.push("- **Monorepo:** yes (watch for cross-package effects)");
490
- lines.push("");
491
-
492
- // Negative-space filter: sub-agent must not recommend toggling on something already on.
493
- const projectFacts = deriveProjectFacts(signals);
494
- if (projectFacts.length > 0) {
495
- lines.push("## Project config (already on — do NOT recommend toggling)");
496
- lines.push("");
497
- lines.push(
498
- 'These settings are already enabled on the project. A recommendation that says "enable X" or "turn on X" for any of these is wrong and will be rejected by the verifier. Treat them as the starting state for your investigation.',
499
- );
500
- lines.push("");
501
- for (const f of projectFacts) lines.push(`- ${f.briefLine}`);
502
- lines.push("");
503
- }
504
-
505
- lines.push("## Deep-dive evidence (already collected — do NOT re-query)");
506
- lines.push("");
507
- const deepDive = candidate?.evidence?.deepDive ?? {};
508
- const failureNotice = summarizeDeepDiveFailures(deepDive);
509
- if (failureNotice) {
510
- lines.push(`> ⚠ **Deep-dive partly incomplete.** ${failureNotice}`);
511
- lines.push(">");
512
- lines.push(
513
- `> The base evidence below is still valid — \`o11ySignal=${candidate.o11ySignal ?? "(unset)"}\` came directly from the gate's broad-pass query and is unaffected. Investigate against that signal and any deep-dive keys that DID populate. Do not conflate "missing data" with "no bottleneck": if the data didn't come back, abstain on the missing dimensions, not on the candidate as a whole.`,
514
- );
515
- lines.push("");
516
- }
517
- lines.push(
518
- "Treat these as ground truth. Cite the specific paths and values verbatim in `why` and `verify`. Numeric values are rounded to 4 decimal places.",
519
- );
520
- lines.push("");
521
- lines.push(
522
- "**Units legend** — all duration/timing fields below are in **milliseconds** (`latency.*`, `ttfb.*`, `cpu.p95`, `memory.*`). All `value` fields under `startTypeSplit` / `statusDistribution` / `methodDistribution` / `cacheBreakdown` are **invocation counts**. `botShare` / `bandwidthByCache` values are **bytes**. `perDeployment.value` is **p95 latency in ms** for that deployment.",
523
- );
524
- lines.push("");
525
- lines.push("```json");
526
- lines.push(JSON.stringify(deepDive, null, 2));
527
- lines.push("```");
528
- lines.push("");
529
- if (interp.length > 0) {
530
- lines.push("**How to read the evidence for this candidate kind:**");
531
- lines.push("");
532
- for (const h of interp) lines.push(`- ${h}`);
533
- lines.push("");
534
- }
535
-
536
- const cachePolicyHints = cachePolicyGuidance(kind, stack);
537
- if (cachePolicyHints.length > 0) {
538
- lines.push("## Cache-policy decision");
539
- lines.push("");
540
- lines.push(
541
- "Pick the narrowest cache mechanism that matches the source. Do not default to `no-store`; if data is unsafe to cache, abstain or emit a no-change observation.",
542
- );
543
- lines.push("");
544
- for (const h of cachePolicyHints) lines.push(`- ${h}`);
545
- lines.push("");
546
- }
547
-
548
- lines.push(...renderSupportTopics(supportTopics));
549
- if (supportTopics.length > 0) lines.push("");
550
-
551
- lines.push("## Citation library (USE ONLY THESE)");
552
- lines.push("");
553
- lines.push(
554
- `You may cite ONLY these URLs and skill-rule references. They are filtered for \`${framework}@${version}\` and the candidate kind \`${kind}\`. Any other URL will be stripped by the \`unknown-citation\` sanitizer; any URL whose version range doesn't cover \`${framework}@${version}\` will be stripped by \`version-mismatch\`.`,
555
- );
556
- lines.push("");
557
- lines.push("### URLs");
558
- if (citations.urls.length === 0) {
559
- lines.push(
560
- "_(no URLs match this kind + version — investigate, but the rec may fail `missing-citation`; consider abstaining)_",
561
- );
562
- } else {
563
- for (const e of citations.urls) {
564
- lines.push(`- \`${e.url}\` — ${e.topic}`);
565
- }
566
- }
567
- lines.push("");
568
- lines.push("### Skill-rule references");
569
- if (citations.ruleSkillRefs.length === 0) {
570
- lines.push("_(none applicable)_");
571
- } else {
572
- for (const r of citations.ruleSkillRefs) {
573
- lines.push(`- \`${r.skill}:${r.rule}\` — ${r.topic}`);
574
- }
575
- }
576
- lines.push("");
577
-
578
- if (playbookId && playbookBody) {
579
- lines.push(`## Playbook hint (\`${playbookId}\`)`);
580
- lines.push("");
581
- lines.push(playbookBody.trim());
582
- lines.push("");
583
- lines.push(
584
- "_Use the playbook to tilt phrasing and pattern priority. NEVER invent a claim because the playbook mentions a pattern — only emit it if the evidence supports it._",
585
- );
586
- lines.push("");
587
- }
588
- if (frameworkPlaybookId && frameworkPlaybookBody) {
589
- lines.push(`## Framework-specific playbook (\`${frameworkPlaybookId}\`)`);
590
- lines.push("");
591
- lines.push(frameworkPlaybookBody.trim());
592
- lines.push("");
593
- lines.push(`_Framework-shaped advice for ${framework}. Same rule: evidence-grounded only._`);
594
- lines.push("");
595
- }
596
-
597
- lines.push("## Two valid outcomes");
598
- lines.push("");
599
- lines.push(
600
- "Your job is to answer the gate question above. There are exactly two valid outcomes:",
601
- );
602
- lines.push("");
603
- lines.push(
604
- "**A. Emit a recommendation** (schema below) — ONLY when you found a verifiable file:line cause that the deep-dive evidence supports.",
605
- );
606
- lines.push("");
607
- lines.push(
608
- "**B. Abstain** — when the gate's hypothesis does not survive contact with the source. Emit:",
609
- );
610
- lines.push("```json");
611
- lines.push(
612
- `{"abstain": true, "candidateRef": "${candidateRef}", "reason": "<one-sentence explanation grounded in what you found vs what the gate assumed>"}`,
613
- );
614
- lines.push("```");
615
- lines.push(
616
- "Abstaining is the RIGHT call when evidence is ambiguous, when the bottleneck isn't in the resolved files, or when the gate's hypothesis was wrong (e.g. an \"uncached_route\" candidate where the route is mostly POST traffic and uncacheable by protocol). Abstention is preferred over a speculative rec. The orchestrator surfaces abstentions in the trust section of the final report.",
617
- );
618
- lines.push("");
619
- lines.push(
620
- "**B1. Abstain with an observation** — when you find something real while abstaining (e.g., perDeployment regression, error-rate spike, infrastructure config gap) that the customer should know about but isn't a perf rec in the gate's framing. Emit:",
621
- );
622
- lines.push("```json");
623
- lines.push(`{
624
- "abstain": true,
625
- "candidateRef": "${candidateRef}",
626
- "reason": "<why you abstained from a perf rec>",
627
- "observation": {
628
- "summary": "<one-line headline — what you noticed>",
629
- "evidence": "<the deep-dive datum or file:line that backs it>",
630
- "suggestedAction": "<what the customer should do next>",
631
- "kind": "regression | error_storm | config_gap | upstream_dependency | other"
632
- }
633
- }`);
634
- lines.push("```");
635
- lines.push(
636
- 'Use `observation` ONLY when the finding is grounded in specific evidence the gate already gave you. Do NOT invent observations to fill the slot. The renderer surfaces these in a separate "Observations from investigation" section.',
637
- );
638
- lines.push("");
639
-
640
- lines.push("## Investigation protocol");
641
- lines.push("");
642
- lines.push(
643
- '1. **Read ONLY the files listed under "Files you may read".** Do NOT `grep -r` the repo. If you find yourself wanting to widen the search, stop and re-read the gate question. If it doesn\'t constrain the search, abstain.',
644
- );
645
- lines.push(
646
- "2. Read each file, then run targeted `grep` / `ast-grep` inside it to count patterns. Verify line numbers exactly.",
647
- );
648
- lines.push(
649
- "3. Follow imports within the chain only when relevant to the gate question (one level deep max).",
650
- );
651
- lines.push("4. Stop after 5 files exhausted, or when you have a verified root cause.");
652
- lines.push(
653
- "5. Drop findings that fail mechanical verification (file missing, pattern not present, etc.).",
654
- );
655
- lines.push(
656
- "6. **Zero-finding case:** if you read the named file(s) and find no mechanism that matches the gate question, abstain (Outcome B). Do NOT invent a rec to fill the slot.",
657
- );
658
- lines.push(
659
- '7. **Evidence-contradicts-source case:** if the deep-dive shows a real signal (e.g. high p95) but the source looks fine (no awaits, no heavy imports, small render), the bottleneck is upstream (DB, external API, or in code not shown). Abstain with reason "evidence and source diverge."',
660
- );
661
- lines.push("");
662
-
663
- lines.push("## Pre-emit self-check");
664
- lines.push("");
665
- lines.push("Before emitting a recommendation (Outcome A), verify ALL of:");
666
- lines.push(
667
- '- Every file in `affectedFiles` appears in "Files you may read" as a repo-relative path. If a line shows `(scan path: ...)`, do not use the scan path in JSON.',
668
- );
669
- lines.push(
670
- "- `why` quotes at least one specific `file:line` AND at least one deep-dive datum (e.g. `ttfb.p95=576ms`).",
671
- );
672
- lines.push("- Every citation appears in the library above. No invented URLs.");
673
- lines.push("- `currentBehavior` snippet appears in the actual file (not a paraphrase).");
674
- lines.push("- No `$N` dollar literals in any customer-facing field.");
675
- lines.push("");
676
- lines.push("If ANY of these fails, fix the rec OR switch to Outcome B (abstain).");
677
- lines.push("");
678
-
679
- lines.push("## Required output (one JSON object, no prose around it)");
680
- lines.push("");
681
- lines.push("```json");
682
- lines.push(`{
683
- "what": "...", // 1 line, verb-first, scope-explicit. NO "$N" literals.
684
- "why": "...", // 1-2 sentences. MUST cite ≥1 file:line AND ≥1 deep-dive datum (e.g. "ttfb.p95=576ms while cpu.p95=117ms").
685
- "fix": "...", // step-by-step. Reference the specific files.
686
- "bucket": "performance", // "cost" | "performance" | "reliability"
687
- "effort": "medium", // "low" | "medium" | "high"
688
- "affectedFiles": ["..."], // repo-relative paths from the Files list above
689
- "currentBehavior": "\`\`\`ts\\n...current snippet...\\n\`\`\`",
690
- "desiredBehavior": "\`\`\`ts\\n...target snippet...\\n\`\`\`",
691
- "verify": "Re-run \`vercel metrics ...\` and watch the named metric.",
692
- "citations": ["<url-from-library>", "skill:rule"],
693
- "candidateRef": "${candidateRef}",
694
- "findingRefs": ["src/.../file.ts:42"],
695
- "impactTier": "high", // "high" | "medium" | "low"
696
- "billingDimension": "function-duration" // see references/recommendations.md schema
697
- }`);
698
- lines.push("```");
699
- lines.push("");
700
-
701
- lines.push("## Critical rules");
702
- lines.push("");
703
- lines.push("Ordered by priority — top is most important.");
704
- lines.push("");
705
- lines.push(
706
- "1. **`why` must cite a specific `file:line` AND a specific deep-dive datum.** Both. Not one or the other. This is THE quality gate — recs without both will be dropped by the verifier.",
707
- );
708
- lines.push(
709
- `2. **No invented citations.** Only URLs and refs from the library above. The \`unknown-citation\` sanitizer strips anything else.`,
710
- );
711
- lines.push(
712
- `3. **No version-mismatched features.** This project is \`${framework}@${version}\` — do not recommend APIs unavailable in that version. The version-aware library above is your filter.`,
713
- );
714
- lines.push(
715
- `4. **No \`$N\` dollar literals** in customer-facing fields. Use magnitude phrases ("hundreds of dollars per month at current traffic"). The \`$-strip\` sanitizer strips them, but emitting them is wasted output.`,
716
- );
717
- lines.push(
718
- "5. **Stay within scope.** Do not investigate other routes or fleet-wide patterns; that is the orchestrator's job. If this candidate doesn't yield a finding, abstain (Outcome B above).",
719
- );
720
- lines.push(
721
- "6. **Vercel voice.** Sharp teammate, clear, competent, no fluff. Lead with observed metrics and the user action. Avoid marketing language (`leverage`, `streamline`, `powerful`), filler adverbs (`just`, `simply`, `actually`), hedged starts (`Consider`, `You may want to`), rhetorical reframes, and arrows in prose. Do not expose internal terms like `sub-agent`, `abstention`, `passRate`, or `quality score`. Product names: `Observability Plus`, `Vercel Functions`, `fluid compute` mid-sentence, `BotID`, `AI Gateway`, `AI SDK`, `Edge Config`, `Routing Middleware`, `Web Analytics`. Explain `function invocations` and `95th percentile`; do not use `inv` or `p95` in customer output. See `references/voice.md`.",
722
- );
723
- lines.push("");
724
-
725
- return lines.join("\n");
726
- }
727
-
728
- function cachePolicyGuidance(kind, stack = {}) {
729
- if (!["uncached_route", "cache_header_gap"].includes(kind)) return [];
730
- const framework = stack.framework ?? "unknown";
731
- const cacheComponents = stack.cacheComponents === true;
732
- const hints = [
733
- "Whole public GET response: recommend `Cache-Control` / `CDN-Cache-Control` with `s-maxage` and `stale-while-revalidate`; name the TTL/freshness window and required `Vary` headers. Avoid high-cardinality `Vary` headers such as `X-Vercel-IP-Latitude` or `X-Vercel-IP-Longitude`; use coarser geography only when the product can tolerate it.",
734
- "Fallback, 404, auth, preview, webhook, mutation, and per-user branches: keep them uncached or short-lived while caching only the safe success branch.",
735
- ];
736
- if (framework === "next") {
737
- if (cacheComponents) {
738
- hints.push(
739
- "Next.js with Cache Components: for reusable data inside the render path, prefer `use cache` / `use cache: remote` plus `cacheLife()` and `cacheTag()` when invalidation evidence exists.",
740
- );
741
- } else {
742
- hints.push(
743
- "Next.js data fetch path: use `fetch(..., { next: { revalidate: seconds } })` or route-level `revalidate` only when it matches the project version and route semantics. Before recommending route-level `export const revalidate`, inspect the page/layout route chain for `cookies()`, `headers()`, `draftMode()`, `connection()`, and auth helpers; if any parent layout is request-time dynamic, require `next build` or manifest proof that the route is still ISR/static, otherwise abstain.",
744
- );
745
- }
746
- }
747
- hints.push(
748
- "Reusable server data where whole-response CDN caching is unsafe: recommend Runtime Cache only when the same result is reused across requests and the freshness/invalidation story is explicit.",
749
- );
750
- return hints;
751
- }
1
+ // Sub-agent investigation brief — the entire prompt the sub-agent sees.
2
+ // Constraints: target ≤ 12 KB per brief; deterministic (same input → byte-identical output, modulo generatedAt).
3
+
4
+ import { isAbsolute, join, normalize, relative } from "node:path";
5
+ import { loadLibrary, matchesFrameworkVersion } from "./citations.mjs";
6
+ import { deriveProjectFacts } from "./project-facts.mjs";
7
+ import { renderSupportTopics } from "./support-topics.mjs";
8
+
9
+ const NON_LAYOUT_FILE_CAP = 12;
10
+ const LAYOUT_FILE_CAP = 3;
11
+
12
+ // Playbook is a tilt, not a requirement.
13
+ export function inferPlaybook(signals) {
14
+ const deps = signals?.stack?.deps ?? {};
15
+ const codebaseStack = signals?.codebase?.stack ?? {};
16
+ const routes = signals?.codebase?.routes ?? [];
17
+ const routePaths = routes.map((r) => r.routePath ?? "");
18
+ const services = Array.isArray(signals?.usage?.services) ? signals.usage.services : [];
19
+
20
+ const has = (name) => Boolean(deps[name]);
21
+ const hasPrefix = (prefix) => Object.keys(deps).some((k) => k === prefix || k.startsWith(prefix));
22
+ const anyRouteMatches = (re) => routePaths.some((p) => re.test(p));
23
+ const usageHas = (re, minBilled = 0) =>
24
+ services.some(
25
+ (s) => re.test(String(s?.name ?? "")) && Number(s?.billedCost ?? s?.cost ?? 0) > minBilled,
26
+ );
27
+
28
+ // AI app first — billing shape (AI Gateway > Sandbox > Function Duration) overrides
29
+ // the ecommerce/saas tilt when both apply (an "AI shopping assistant" lives in ai-application's
30
+ // priority patterns, not the cart-checkout ones).
31
+ const aiDep =
32
+ has("@vercel/sandbox") ||
33
+ has("@vercel/ai-gateway") ||
34
+ has("ai") ||
35
+ has("openai") ||
36
+ has("@anthropic-ai/sdk") ||
37
+ hasPrefix("@ai-sdk/");
38
+ const aiUsage = usageHas(/^AI Gateway$/i) || usageHas(/^Sandbox/i);
39
+ if (aiDep || aiUsage) {
40
+ return "ai-application";
41
+ }
42
+ if (
43
+ has("stripe") ||
44
+ has("@stripe/stripe-js") ||
45
+ has("react-stripe-js") ||
46
+ anyRouteMatches(/^\/(cart|checkout|products?)\b/i)
47
+ ) {
48
+ return "ecommerce";
49
+ }
50
+ if (
51
+ has("next-auth") ||
52
+ has("@clerk/nextjs") ||
53
+ has("@workos-inc/authkit-nextjs") ||
54
+ anyRouteMatches(/^\/(admin|dashboard|settings|account|billing)\b/i)
55
+ ) {
56
+ return "saas";
57
+ }
58
+ if (routes.length > 0 && routes.every((r) => /^\/api\//.test(r.routePath ?? ""))) {
59
+ return "api-service";
60
+ }
61
+ if (codebaseStack.hasAppRouter || codebaseStack.hasPagesRouter) {
62
+ if (anyRouteMatches(/^\/(blog|docs|posts?|articles?|guides?)\b/i)) return "content-site";
63
+ if (anyRouteMatches(/^\/\(?marketing\)?\b/i)) return "marketing";
64
+ }
65
+ return null;
66
+ }
67
+
68
+ // SvelteKit/Nuxt/Astro have framework-shaped advice that doesn't fit the Next.js-flavored profile playbooks — both can ship together.
69
+ export function inferFrameworkPlaybook(signals) {
70
+ const stack = signals?.stack ?? signals?.codebase?.stack ?? {};
71
+ switch (stack.framework) {
72
+ case "sveltekit":
73
+ return "sveltekit";
74
+ default:
75
+ return null;
76
+ }
77
+ }
78
+
79
+ // Empty result = no source files; investigate via evidence only (legitimate for platform_* candidates).
80
+ // Workspace imports expand one level deep — keeps brief small. A thin shell page.tsx delegates work; bottleneck usually lives in workspace files.
81
+ export function resolveFiles(candidate, signals) {
82
+ const route = candidate.route;
83
+ const routes = signals?.codebase?.routes ?? [];
84
+ if (Array.isArray(candidate.files) && candidate.files.length > 0) {
85
+ return capBriefFiles(
86
+ candidate.files,
87
+ route ? closestAncestorLayoutFiles(route, routes) : [],
88
+ routes,
89
+ );
90
+ }
91
+ if (!route) return [];
92
+ const nonLayoutRoutes = routes.filter((r) => r.type !== "layout");
93
+ const layoutFiles = closestAncestorLayoutFiles(route, routes);
94
+ let matched = nonLayoutRoutes.filter((r) => r.routePath === route);
95
+ if (matched.length === 0) {
96
+ // Fuzzy: prefer max literal-segment matches so `/event/[code]/teaser` beats `/event/[code]/[location]` when candidate is `/event/[*]/teaser`.
97
+ const scored = nonLayoutRoutes
98
+ .map((r) => ({ r, score: routePathMatchScore(r.routePath, route) }))
99
+ .filter((x) => x.score > 0);
100
+ if (scored.length === 0) return capBriefFiles([], layoutFiles, routes);
101
+ const top = Math.max(...scored.map((s) => s.score));
102
+ matched = scored.filter((s) => s.score === top).map((s) => s.r);
103
+ }
104
+ const direct = matched.map((r) => r.file).filter(Boolean);
105
+ const workspaceImports = matched
106
+ .flatMap((r) => (Array.isArray(r.workspaceImports) ? r.workspaceImports : []))
107
+ .filter(Boolean);
108
+ return capBriefFiles(uniq([...direct, ...workspaceImports]), layoutFiles, routes);
109
+ }
110
+
111
+ // literal-segment match × 10, dynamic × 1, pure equality = sentinel that always wins.
112
+ export function routePathMatchScore(routePath, metricPath) {
113
+ if (typeof routePath !== "string" || typeof metricPath !== "string") return 0;
114
+ if (routePath === metricPath) return 1000 + routePath.split("/").filter(Boolean).length;
115
+ const rTokens = routePath.split("/").filter(Boolean);
116
+ const mTokens = metricPath.split("/").filter(Boolean);
117
+ let ri = 0,
118
+ mi = 0,
119
+ literals = 0,
120
+ dynamicMatches = 0;
121
+ while (ri < rTokens.length && mi < mTokens.length) {
122
+ const r = rTokens[ri];
123
+ const m = mTokens[mi];
124
+ if (isCatchAllPlaceholder(r)) return 1 + literals * 10 + dynamicMatches;
125
+ if (r === m) {
126
+ literals++;
127
+ ri++;
128
+ mi++;
129
+ continue;
130
+ }
131
+ // Route patterns may match concrete metric paths, and route/metric dynamic
132
+ // placeholders may match each other. A metric-side placeholder must not
133
+ // match a static route literal: that would let `/docs/[...slug]` traffic
134
+ // attach to an unrelated static scanner route like `/docs/llms.txt`.
135
+ if (isDynamicPlaceholder(r) && !isCatchAllPlaceholder(m)) {
136
+ dynamicMatches++;
137
+ ri++;
138
+ mi++;
139
+ continue;
140
+ }
141
+ return 0;
142
+ }
143
+ if (
144
+ ri === rTokens.length - 1 &&
145
+ /^\[\[\.\.\..+\]\]$/.test(rTokens[ri]) &&
146
+ mi === mTokens.length
147
+ ) {
148
+ return 1 + literals * 10 + dynamicMatches;
149
+ }
150
+ if (ri !== rTokens.length || mi !== mTokens.length) {
151
+ return trailingSingleDynamicPartialScore(rTokens, mTokens, ri, mi, literals, dynamicMatches);
152
+ }
153
+ return 1 + literals * 10 + dynamicMatches;
154
+ }
155
+
156
+ export function routePathsMatch(routePath, metricPath) {
157
+ return routePathMatchScore(routePath, metricPath) > 0;
158
+ }
159
+
160
+ function isDynamicPlaceholder(token) {
161
+ return /^\[.*\]$/.test(token);
162
+ }
163
+ function isSingleDynamicPlaceholder(token) {
164
+ return /^\[[^[.\].][^\]]*\]$/.test(token);
165
+ }
166
+ function isCatchAllPlaceholder(token) {
167
+ return (
168
+ /^\[(?:\[\.\.\..+\]|\.\.\..+)\]$/.test(token) ||
169
+ /^\[\.\.\..+\]$/.test(token) ||
170
+ /^\[\[\.\.\..+\]\]$/.test(token)
171
+ );
172
+ }
173
+
174
+ function trailingSingleDynamicPartialScore(rTokens, mTokens, ri, mi, literals, dynamicMatches) {
175
+ const rRemaining = rTokens.length - ri;
176
+ const mRemaining = mTokens.length - mi;
177
+ if (Math.abs(rRemaining - mRemaining) !== 1) return 0;
178
+ if (rRemaining !== 0 && mRemaining !== 0) return 0;
179
+ const lastRouteToken = rTokens[ri - 1];
180
+ const lastMetricToken = mTokens[mi - 1];
181
+ if (!isSingleDynamicPlaceholder(lastRouteToken) && !isSingleDynamicPlaceholder(lastMetricToken))
182
+ return 0;
183
+ return literals * 10 + dynamicMatches;
184
+ }
185
+
186
+ function uniq(xs) {
187
+ return Array.from(new Set(xs));
188
+ }
189
+
190
+ function briefRoots(signals) {
191
+ const codebase = signals?.codebase ?? {};
192
+ const appRoot =
193
+ typeof codebase.rootDir === "string" && codebase.rootDir.length > 0
194
+ ? normalize(codebase.rootDir)
195
+ : null;
196
+ const repoRoot =
197
+ typeof codebase.monorepoRoot === "string" && codebase.monorepoRoot.length > 0
198
+ ? normalize(codebase.monorepoRoot)
199
+ : appRoot;
200
+ return { appRoot, repoRoot };
201
+ }
202
+
203
+ function absoluteBriefPath(file, roots) {
204
+ if (typeof file !== "string" || file.length === 0) return null;
205
+ if (isAbsolute(file)) return normalize(file);
206
+ const base = isRepoRelativePath(file) ? roots.repoRoot : roots.appRoot;
207
+ return base ? normalize(join(base, file)) : null;
208
+ }
209
+
210
+ function repoRelativeBriefPath(file, roots) {
211
+ if (typeof file !== "string" || file.length === 0) return null;
212
+ const normalized = normalize(file);
213
+ if (isRepoRelativePath(normalized)) return normalized;
214
+ const abs = absoluteBriefPath(file, roots);
215
+ if (!abs || !roots.repoRoot) return normalized;
216
+ const rel = normalize(relative(roots.repoRoot, abs));
217
+ return rel.startsWith("..") ? normalized : rel;
218
+ }
219
+
220
+ function isRepoRelativePath(file) {
221
+ return /^(apps|packages)\//.test(file);
222
+ }
223
+
224
+ function capBriefFiles(nonLayoutCandidates, layoutCandidates, routes) {
225
+ const knownLayoutFiles = new Set(
226
+ routes
227
+ .filter((r) => r.type === "layout")
228
+ .map((r) => r.file)
229
+ .filter(Boolean),
230
+ );
231
+ const nonLayout = [];
232
+ const layouts = [];
233
+ for (const f of uniq(nonLayoutCandidates)) {
234
+ if (knownLayoutFiles.has(f) || isLayoutPath(f)) layouts.push(f);
235
+ else nonLayout.push(f);
236
+ }
237
+ for (const f of layoutCandidates) layouts.push(f);
238
+ return [
239
+ ...uniq(nonLayout).slice(0, NON_LAYOUT_FILE_CAP),
240
+ ...uniq(layouts).slice(0, LAYOUT_FILE_CAP),
241
+ ];
242
+ }
243
+
244
+ function closestAncestorLayoutFiles(route, routes) {
245
+ if (!route) return [];
246
+ return routes
247
+ .filter((r) => r.type === "layout" && r.file && layoutAppliesToRoute(r.routePath, route))
248
+ .sort(
249
+ (a, b) => routeDepth(b.routePath) - routeDepth(a.routePath) || a.file.localeCompare(b.file),
250
+ )
251
+ .map((r) => r.file);
252
+ }
253
+
254
+ function layoutAppliesToRoute(layoutPath, routePath) {
255
+ if (typeof layoutPath !== "string" || typeof routePath !== "string") return false;
256
+ if (layoutPath === "/") return true;
257
+ const layoutTokens = layoutPath.split("/").filter(Boolean);
258
+ const routeTokens = routePath.split("/").filter(Boolean);
259
+ if (layoutTokens.length > routeTokens.length) return false;
260
+ for (let i = 0; i < layoutTokens.length; i++) {
261
+ const l = layoutTokens[i];
262
+ const r = routeTokens[i];
263
+ if (isCatchAllPlaceholder(l)) return true;
264
+ if (l === r) continue;
265
+ if (isDynamicPlaceholder(l) || isDynamicPlaceholder(r)) continue;
266
+ return false;
267
+ }
268
+ return true;
269
+ }
270
+
271
+ function routeDepth(routePath) {
272
+ return String(routePath ?? "")
273
+ .split("/")
274
+ .filter(Boolean).length;
275
+ }
276
+
277
+ function isLayoutPath(file) {
278
+ return /(^|\/)(?:\+layout(?:\.server)?|layout)\.(?:svelte|tsx?|jsx?)$/.test(String(file ?? ""));
279
+ }
280
+
281
+ // Tells the sub-agent which signals are missing so it doesn't conflate "no data" with "no bottleneck."
282
+ export function summarizeDeepDiveFailures(deepDive) {
283
+ if (!deepDive || typeof deepDive !== "object") return null;
284
+ const entries = Object.entries(deepDive);
285
+ if (entries.length === 0) return null;
286
+ const failures = entries.filter(([, v]) => isFailureEntry(v));
287
+ if (failures.length === 0) return null;
288
+ // Surface when ≥50% failed OR ≥3 distinct signals failed.
289
+ if (failures.length / entries.length < 0.5 && failures.length < 3) return null;
290
+ const failedIds = failures
291
+ .map(([k]) => k)
292
+ .slice(0, 6)
293
+ .join(", ");
294
+ const codes = uniq(failures.map(([, v]) => v?.code ?? v?.error ?? "unknown"))
295
+ .slice(0, 3)
296
+ .join(" / ");
297
+ return `${failures.length} of ${entries.length} deep-dive signals failed (${failedIds}${failures.length > 6 ? ", …" : ""}) — error: ${codes}.`;
298
+ }
299
+
300
+ function isFailureEntry(v) {
301
+ if (!v || typeof v !== "object") return false;
302
+ if (v.ok === false) return true;
303
+ if (typeof v.code === "string" && v.code !== "OK") return true;
304
+ if (typeof v.error === "string" && v.error.length > 0) return true;
305
+ return false;
306
+ }
307
+
308
+ export async function citationSubset(candidateKind, framework, version) {
309
+ const lib = await loadLibrary();
310
+ const versionOk = (entry) =>
311
+ entry.applicableFrameworks.includes("*") ||
312
+ entry.applicableFrameworks.some((p) => matchesFrameworkVersion(p, framework, version));
313
+ const kindOk = (entry) => {
314
+ const at = Array.isArray(entry.appliesTo) ? entry.appliesTo : [];
315
+ return at.length === 0 || at.includes(candidateKind);
316
+ };
317
+ return {
318
+ urls: lib.urls.filter((e) => versionOk(e) && kindOk(e)),
319
+ ruleSkillRefs: lib.ruleSkillRefs.filter((r) => versionOk(r) && kindOk(r)),
320
+ };
321
+ }
322
+
323
+ // Per-kind hints tell the investigator which comparison to draw first.
324
+ export const KIND_INTERPRETATION_HINTS = {
325
+ slow_route: [
326
+ "Compare `cpu.p95` vs `latency.p95`. If cpu << latency, the bottleneck is wall-clock / external IO / awaits — look for sequential awaits, slow DB queries, slow external APIs. If cpu ≈ latency, look for in-process compute (rendering, JSON serialization, crypto).",
327
+ "Compare `ttfb.p95` vs `latency.p95`. If ttfb ≈ latency, response generation finishes near the end — streaming or `after()` may shift perceived latency.",
328
+ "For streaming, SSE, resumable chat, or other intentionally long-lived routes, do not treat high wall-clock duration alone as a bug. Recommend a change only when evidence shows avoidable pre-first-byte work, high active CPU, duplicate invocations, or post-response work that can move out of the user-visible path.",
329
+ 'Inspect `perDeployment`: a 2x step between deployments points to a regression introduced in the newer deployment. Frame the rec as "regression introduced in <deployment_id>" rather than a generic perf claim.',
330
+ "Inspect `startTypeSplit.cold` share. >5% cold means cold starts contribute meaningfully — Fluid Compute or warmer keep-alive is on the table.",
331
+ "Inspect `statusDistribution`. A non-trivial 3xx/4xx slice may be inflating p95 because redirects/auth bounces still count as invocations.",
332
+ "Inspect `cacheBreakdown`. If the route uses Next.js `dynamic = 'error'` (or otherwise static) but the breakdown shows substantial MISS/BYPASS counts, the latency lives on the cache-miss path — investigate the origin fetch / ISR revalidation cost, NOT in-handler compute. `bandwidthByCache` tells you the byte cost of those misses.",
333
+ ],
334
+ uncached_route: [
335
+ "`cacheBreakdown` tells you what fraction is BYPASS vs HIT vs MISS. BYPASS without explicit `Cache-Control` directives in the response is the canonical fix.",
336
+ "`methodDistribution`: GET-only routes are cacheable; POST/PUT/DELETE are not. If the route is GET-heavy but BYPASSing, the cache headers are missing or wrong.",
337
+ "`botShare` (bandwidth by bot_category): if bots dominate uncached bandwidth, the right rec may be Bot Protection rather than route caching.",
338
+ "`bandwidthByCache`: pair with cacheBreakdown to confirm the dollar/bandwidth impact of moving uncached → cached.",
339
+ "A ready cache recommendation must name a positive cache policy. If the right answer is `no-store`, emit no recommendation / observation instead of a cache fix.",
340
+ ],
341
+ cold_start: [
342
+ "`startTypeSplit`: cold vs hot vs prewarmed. Fluid Compute meaningfully helps when cold > 5%.",
343
+ "`coldVsWarmLatencyP95`: how much SLOWER is cold than warm. If 5x+, cold starts are amplifying tail latency, not just adding fixed overhead.",
344
+ "`coldByDeployment`: if cold-start cluster around the newest deployment, the slowdown is a regression — check imports, init code, framework upgrade.",
345
+ ],
346
+ route_errors: [
347
+ "`errorStatusPattern`: distinguishes 500 (app crash) vs 502/503 (gateway/upstream timeout) vs 504 (downstream timeout).",
348
+ "`errorCodes`: a non-empty error_code dimension narrows to a specific failure class (e.g., FUNCTION_INVOCATION_TIMEOUT).",
349
+ "`errorsByDeployment`: a deployment-localized spike points to a regression.",
350
+ ],
351
+ external_api_slow: [
352
+ "`latency.p95` vs `latency.p99`: spreads point to flaky upstream; narrow gap points to slow-by-design.",
353
+ "`callersByRoute` (`origin_route` dim): which of OUR routes call this upstream — that's where the rec should land.",
354
+ "`transferBytes`: large payloads suggest caching or partial-response opportunities at our edge.",
355
+ ],
356
+ isr_overrevalidation: [
357
+ "`writePattern` (write_units by cache_result) — STALE writes vs HIT writes. STALE-write means the revalidate ran on every stale request.",
358
+ "`readPattern` (read_units by cache_result) — HIT vs MISS. Low MISS means cache fills are not the issue.",
359
+ "If writes / reads > 0.5, the revalidate cadence is too aggressive; lengthen `revalidate` or switch to on-demand `revalidateTag`.",
360
+ ],
361
+ cwv_poor: [
362
+ '`lcp`/`inp`/`cls` percentiles. p75 > Web Vitals "Good" threshold is the bar.',
363
+ "LCP > 2500ms → server response or critical image. INP > 200ms → long tasks / heavy JS on interaction. CLS > 0.1 → layout shift, usually images/ads/fonts.",
364
+ ],
365
+ middleware_heavy: [
366
+ "`topMiddlewarePaths`: paths that hit middleware most. If non-asset paths dominate, the matcher is too broad — narrow to the request shapes that actually need middleware.",
367
+ ],
368
+ platform_fluid_compute: [
369
+ "Cross-check the broad-pass `fnStartTypeByRoute` for cold-rate concentration. If a few routes carry most cold starts, frame the rec around those routes rather than fleet-wide.",
370
+ ],
371
+ platform_bot_protection: [
372
+ "`wafRuleFirings`: which managed rules are already firing (challenge/block). If `bot_filter` is already challenging but you still see significant bot bandwidth, BotID adds a verified-human signal that lets the WAF do its job.",
373
+ ],
374
+ };
375
+
376
+ export function buildBrief({
377
+ candidate,
378
+ candidateIndex,
379
+ candidateGroup,
380
+ files,
381
+ signals,
382
+ citations,
383
+ playbookId,
384
+ playbookBody,
385
+ frameworkPlaybookId,
386
+ frameworkPlaybookBody,
387
+ supportTopics = [],
388
+ generatedAt,
389
+ }) {
390
+ const stack = signals?.stack ?? signals?.codebase?.stack ?? {};
391
+ const framework = stack.framework ?? "unknown";
392
+ const version = stack.frameworkVersion ?? "unknown";
393
+ const kind = candidate.kind;
394
+ const routeOrHost = candidate.route ?? candidate.hostname ?? null;
395
+ const interp = KIND_INTERPRETATION_HINTS[kind] ?? [];
396
+ const candidateRef = candidate.candidateRef ?? `${kind}:${routeOrHost ?? "<account>"}`;
397
+ const roots = briefRoots(signals);
398
+
399
+ const lines = [];
400
+ lines.push(`# Investigation brief — ${kind}${routeOrHost ? ` — ${routeOrHost}` : ""}`);
401
+ lines.push("");
402
+ lines.push(
403
+ "You are a Vercel-optimize investigation sub-agent. Your job is to investigate ONE evidence-backed candidate and emit ONE recommendation JSON. Stay narrow. Stay grounded. Do NOT widen the search.",
404
+ );
405
+ lines.push("");
406
+ lines.push(
407
+ `Brief id: \`${candidateGroup}#${candidateIndex}\` · candidateRef: \`${candidateRef}\``,
408
+ );
409
+ if (generatedAt) lines.push(`Generated: ${generatedAt}`);
410
+ lines.push("");
411
+
412
+ lines.push("## Candidate");
413
+ lines.push("");
414
+ lines.push(`- **Kind:** \`${kind}\``);
415
+ lines.push(`- **Scope:** ${candidate.scope ?? "route"}`);
416
+ if (routeOrHost) lines.push(`- **Target:** \`${routeOrHost}\``);
417
+ if (roots.repoRoot) lines.push(`- **Repo root:** \`${roots.repoRoot}\``);
418
+ if (roots.appRoot) lines.push(`- **App root:** \`${roots.appRoot}\``);
419
+ if (candidate.o11ySignal)
420
+ lines.push(`- **o11y signal at gate-time:** \`${candidate.o11ySignal}\``);
421
+ lines.push(`- **Confidence:** ${candidate.confidence ?? "n/a"}`);
422
+ lines.push(`- **Priority:** ${candidate.priority ?? "n/a"}`);
423
+ if (candidate.disqualified) {
424
+ lines.push(`- **⚠ Disqualifier present:** ${candidate.disqualifyReason ?? "disqualified"}`);
425
+ }
426
+ lines.push("");
427
+ lines.push(
428
+ `**Gate question (the hypothesis you're verifying):** ${candidate.question ?? "(no question)"}`,
429
+ );
430
+ lines.push("");
431
+ if (Array.isArray(files) && files.length > 0) {
432
+ lines.push(
433
+ "**Files you may read (read ONLY these — open each one directly, NOT a repo-wide grep):**",
434
+ );
435
+ lines.push(
436
+ `_Capped at ${NON_LAYOUT_FILE_CAP} non-layout files + up to ${LAYOUT_FILE_CAP} layouts._`,
437
+ );
438
+ // Tag route vs workspace-import — workspace files are usually where the bottleneck lives.
439
+ const routes = signals?.codebase?.routes ?? [];
440
+ const routeScores = routes
441
+ .filter((r) => r.type !== "layout")
442
+ .map((r) => ({
443
+ r,
444
+ score: routePathMatchScore(r.routePath, routeOrHost),
445
+ }))
446
+ .filter((x) => x.score > 0);
447
+ const topScore = routeScores.length > 0 ? Math.max(...routeScores.map((x) => x.score)) : 0;
448
+ const routeFiles = new Set(
449
+ routeScores
450
+ .filter((x) => x.score === topScore)
451
+ .map((x) => x.r.file)
452
+ .filter(Boolean),
453
+ );
454
+ const layoutFiles = new Set(closestAncestorLayoutFiles(routeOrHost, routes));
455
+ const workspaceImportFiles = [];
456
+ for (const f of files) {
457
+ const tag =
458
+ layoutFiles.has(f) || isLayoutPath(f)
459
+ ? "(layout)"
460
+ : routeFiles.has(f)
461
+ ? "(route)"
462
+ : "(workspace import)";
463
+ if (tag === "(workspace import)") workspaceImportFiles.push(f);
464
+ const repoRel = repoRelativeBriefPath(f, roots) ?? f;
465
+ const abs = absoluteBriefPath(f, roots);
466
+ const sourceSuffix = repoRel !== f ? ` (scan path: \`${f}\`)` : "";
467
+ const absSuffix = abs && abs !== repoRel ? ` — open \`${abs}\`` : "";
468
+ lines.push(`- \`${repoRel}\` ${tag}${sourceSuffix}${absSuffix}`);
469
+ }
470
+ if ([...routeFiles].length > 0 && workspaceImportFiles.length > 0) {
471
+ lines.push("");
472
+ lines.push(
473
+ "_The route file is often a thin shell that re-exports from a workspace package. If the route file has no awaits / heavy imports / data fetching of its own, the bottleneck almost certainly lives in one of the (workspace import) files above — read those._",
474
+ );
475
+ }
476
+ } else {
477
+ lines.push(
478
+ "**Files:** none mapped to this candidate. Either the gate is account-scope (platform_*) or the scanner could not resolve a route→file mapping (legitimate data gap). Work from the deep-dive evidence alone.",
479
+ );
480
+ }
481
+ lines.push("");
482
+
483
+ lines.push("## Stack context");
484
+ lines.push("");
485
+ lines.push(`- **Framework:** \`${framework}@${version}\``);
486
+ if (stack.hasAppRouter) lines.push("- **Router:** App Router");
487
+ if (stack.hasPagesRouter) lines.push("- **Router:** Pages Router");
488
+ if (stack.orm && stack.orm !== "none") lines.push(`- **ORM:** ${stack.orm}`);
489
+ if (stack.isMonorepo) lines.push("- **Monorepo:** yes (watch for cross-package effects)");
490
+ lines.push("");
491
+
492
+ // Negative-space filter: sub-agent must not recommend toggling on something already on.
493
+ const projectFacts = deriveProjectFacts(signals);
494
+ if (projectFacts.length > 0) {
495
+ lines.push("## Project config (already on — do NOT recommend toggling)");
496
+ lines.push("");
497
+ lines.push(
498
+ 'These settings are already enabled on the project. A recommendation that says "enable X" or "turn on X" for any of these is wrong and will be rejected by the verifier. Treat them as the starting state for your investigation.',
499
+ );
500
+ lines.push("");
501
+ for (const f of projectFacts) lines.push(`- ${f.briefLine}`);
502
+ lines.push("");
503
+ }
504
+
505
+ lines.push("## Deep-dive evidence (already collected — do NOT re-query)");
506
+ lines.push("");
507
+ const deepDive = candidate?.evidence?.deepDive ?? {};
508
+ const failureNotice = summarizeDeepDiveFailures(deepDive);
509
+ if (failureNotice) {
510
+ lines.push(`> ⚠ **Deep-dive partly incomplete.** ${failureNotice}`);
511
+ lines.push(">");
512
+ lines.push(
513
+ `> The base evidence below is still valid — \`o11ySignal=${candidate.o11ySignal ?? "(unset)"}\` came directly from the gate's broad-pass query and is unaffected. Investigate against that signal and any deep-dive keys that DID populate. Do not conflate "missing data" with "no bottleneck": if the data didn't come back, abstain on the missing dimensions, not on the candidate as a whole.`,
514
+ );
515
+ lines.push("");
516
+ }
517
+ lines.push(
518
+ "Treat these as ground truth. Cite the specific paths and values verbatim in `why` and `verify`. Numeric values are rounded to 4 decimal places.",
519
+ );
520
+ lines.push("");
521
+ lines.push(
522
+ "**Units legend** — all duration/timing fields below are in **milliseconds** (`latency.*`, `ttfb.*`, `cpu.p95`, `memory.*`). All `value` fields under `startTypeSplit` / `statusDistribution` / `methodDistribution` / `cacheBreakdown` are **invocation counts**. `botShare` / `bandwidthByCache` values are **bytes**. `perDeployment.value` is **p95 latency in ms** for that deployment.",
523
+ );
524
+ lines.push("");
525
+ lines.push("```json");
526
+ lines.push(JSON.stringify(deepDive, null, 2));
527
+ lines.push("```");
528
+ lines.push("");
529
+ if (interp.length > 0) {
530
+ lines.push("**How to read the evidence for this candidate kind:**");
531
+ lines.push("");
532
+ for (const h of interp) lines.push(`- ${h}`);
533
+ lines.push("");
534
+ }
535
+
536
+ const cachePolicyHints = cachePolicyGuidance(kind, stack);
537
+ if (cachePolicyHints.length > 0) {
538
+ lines.push("## Cache-policy decision");
539
+ lines.push("");
540
+ lines.push(
541
+ "Pick the narrowest cache mechanism that matches the source. Do not default to `no-store`; if data is unsafe to cache, abstain or emit a no-change observation.",
542
+ );
543
+ lines.push("");
544
+ for (const h of cachePolicyHints) lines.push(`- ${h}`);
545
+ lines.push("");
546
+ }
547
+
548
+ lines.push(...renderSupportTopics(supportTopics));
549
+ if (supportTopics.length > 0) lines.push("");
550
+
551
+ lines.push("## Citation library (USE ONLY THESE)");
552
+ lines.push("");
553
+ lines.push(
554
+ `You may cite ONLY these URLs and skill-rule references. They are filtered for \`${framework}@${version}\` and the candidate kind \`${kind}\`. Any other URL will be stripped by the \`unknown-citation\` sanitizer; any URL whose version range doesn't cover \`${framework}@${version}\` will be stripped by \`version-mismatch\`.`,
555
+ );
556
+ lines.push("");
557
+ lines.push("### URLs");
558
+ if (citations.urls.length === 0) {
559
+ lines.push(
560
+ "_(no URLs match this kind + version — investigate, but the rec may fail `missing-citation`; consider abstaining)_",
561
+ );
562
+ } else {
563
+ for (const e of citations.urls) {
564
+ lines.push(`- \`${e.url}\` — ${e.topic}`);
565
+ }
566
+ }
567
+ lines.push("");
568
+ lines.push("### Skill-rule references");
569
+ if (citations.ruleSkillRefs.length === 0) {
570
+ lines.push("_(none applicable)_");
571
+ } else {
572
+ for (const r of citations.ruleSkillRefs) {
573
+ lines.push(`- \`${r.skill}:${r.rule}\` — ${r.topic}`);
574
+ }
575
+ }
576
+ lines.push("");
577
+
578
+ if (playbookId && playbookBody) {
579
+ lines.push(`## Playbook hint (\`${playbookId}\`)`);
580
+ lines.push("");
581
+ lines.push(playbookBody.trim());
582
+ lines.push("");
583
+ lines.push(
584
+ "_Use the playbook to tilt phrasing and pattern priority. NEVER invent a claim because the playbook mentions a pattern — only emit it if the evidence supports it._",
585
+ );
586
+ lines.push("");
587
+ }
588
+ if (frameworkPlaybookId && frameworkPlaybookBody) {
589
+ lines.push(`## Framework-specific playbook (\`${frameworkPlaybookId}\`)`);
590
+ lines.push("");
591
+ lines.push(frameworkPlaybookBody.trim());
592
+ lines.push("");
593
+ lines.push(`_Framework-shaped advice for ${framework}. Same rule: evidence-grounded only._`);
594
+ lines.push("");
595
+ }
596
+
597
+ lines.push("## Two valid outcomes");
598
+ lines.push("");
599
+ lines.push(
600
+ "Your job is to answer the gate question above. There are exactly two valid outcomes:",
601
+ );
602
+ lines.push("");
603
+ lines.push(
604
+ "**A. Emit a recommendation** (schema below) — ONLY when you found a verifiable file:line cause that the deep-dive evidence supports.",
605
+ );
606
+ lines.push("");
607
+ lines.push(
608
+ "**B. Abstain** — when the gate's hypothesis does not survive contact with the source. Emit:",
609
+ );
610
+ lines.push("```json");
611
+ lines.push(
612
+ `{"abstain": true, "candidateRef": "${candidateRef}", "reason": "<one-sentence explanation grounded in what you found vs what the gate assumed>"}`,
613
+ );
614
+ lines.push("```");
615
+ lines.push(
616
+ "Abstaining is the RIGHT call when evidence is ambiguous, when the bottleneck isn't in the resolved files, or when the gate's hypothesis was wrong (e.g. an \"uncached_route\" candidate where the route is mostly POST traffic and uncacheable by protocol). Abstention is preferred over a speculative rec. The orchestrator surfaces abstentions in the trust section of the final report.",
617
+ );
618
+ lines.push("");
619
+ lines.push(
620
+ "**B1. Abstain with an observation** — when you find something real while abstaining (e.g., perDeployment regression, error-rate spike, infrastructure config gap) that the customer should know about but isn't a perf rec in the gate's framing. Emit:",
621
+ );
622
+ lines.push("```json");
623
+ lines.push(`{
624
+ "abstain": true,
625
+ "candidateRef": "${candidateRef}",
626
+ "reason": "<why you abstained from a perf rec>",
627
+ "observation": {
628
+ "summary": "<one-line headline — what you noticed>",
629
+ "evidence": "<the deep-dive datum or file:line that backs it>",
630
+ "suggestedAction": "<what the customer should do next>",
631
+ "kind": "regression | error_storm | config_gap | upstream_dependency | other"
632
+ }
633
+ }`);
634
+ lines.push("```");
635
+ lines.push(
636
+ 'Use `observation` ONLY when the finding is grounded in specific evidence the gate already gave you. Do NOT invent observations to fill the slot. The renderer surfaces these in a separate "Observations from investigation" section.',
637
+ );
638
+ lines.push("");
639
+
640
+ lines.push("## Investigation protocol");
641
+ lines.push("");
642
+ lines.push(
643
+ '1. **Read ONLY the files listed under "Files you may read".** Do NOT `grep -r` the repo. If you find yourself wanting to widen the search, stop and re-read the gate question. If it doesn\'t constrain the search, abstain.',
644
+ );
645
+ lines.push(
646
+ "2. Read each file, then run targeted `grep` / `ast-grep` inside it to count patterns. Verify line numbers exactly.",
647
+ );
648
+ lines.push(
649
+ "3. Follow imports within the chain only when relevant to the gate question (one level deep max).",
650
+ );
651
+ lines.push("4. Stop after 5 files exhausted, or when you have a verified root cause.");
652
+ lines.push(
653
+ "5. Drop findings that fail mechanical verification (file missing, pattern not present, etc.).",
654
+ );
655
+ lines.push(
656
+ "6. **Zero-finding case:** if you read the named file(s) and find no mechanism that matches the gate question, abstain (Outcome B). Do NOT invent a rec to fill the slot.",
657
+ );
658
+ lines.push(
659
+ '7. **Evidence-contradicts-source case:** if the deep-dive shows a real signal (e.g. high p95) but the source looks fine (no awaits, no heavy imports, small render), the bottleneck is upstream (DB, external API, or in code not shown). Abstain with reason "evidence and source diverge."',
660
+ );
661
+ lines.push("");
662
+
663
+ lines.push("## Pre-emit self-check");
664
+ lines.push("");
665
+ lines.push("Before emitting a recommendation (Outcome A), verify ALL of:");
666
+ lines.push(
667
+ '- Every file in `affectedFiles` appears in "Files you may read" as a repo-relative path. If a line shows `(scan path: ...)`, do not use the scan path in JSON.',
668
+ );
669
+ lines.push(
670
+ "- `why` quotes at least one specific `file:line` AND at least one deep-dive datum (e.g. `ttfb.p95=576ms`).",
671
+ );
672
+ lines.push("- Every citation appears in the library above. No invented URLs.");
673
+ lines.push("- `currentBehavior` snippet appears in the actual file (not a paraphrase).");
674
+ lines.push("- No `$N` dollar literals in any customer-facing field.");
675
+ lines.push("");
676
+ lines.push("If ANY of these fails, fix the rec OR switch to Outcome B (abstain).");
677
+ lines.push("");
678
+
679
+ lines.push("## Required output (one JSON object, no prose around it)");
680
+ lines.push("");
681
+ lines.push("```json");
682
+ lines.push(`{
683
+ "what": "...", // 1 line, verb-first, scope-explicit. NO "$N" literals.
684
+ "why": "...", // 1-2 sentences. MUST cite ≥1 file:line AND ≥1 deep-dive datum (e.g. "ttfb.p95=576ms while cpu.p95=117ms").
685
+ "fix": "...", // step-by-step. Reference the specific files.
686
+ "bucket": "performance", // "cost" | "performance" | "reliability"
687
+ "effort": "medium", // "low" | "medium" | "high"
688
+ "affectedFiles": ["..."], // repo-relative paths from the Files list above
689
+ "currentBehavior": "\`\`\`ts\\n...current snippet...\\n\`\`\`",
690
+ "desiredBehavior": "\`\`\`ts\\n...target snippet...\\n\`\`\`",
691
+ "verify": "Re-run \`vercel metrics ...\` and watch the named metric.",
692
+ "citations": ["<url-from-library>", "skill:rule"],
693
+ "candidateRef": "${candidateRef}",
694
+ "findingRefs": ["src/.../file.ts:42"],
695
+ "impactTier": "high", // "high" | "medium" | "low"
696
+ "billingDimension": "function-duration" // see references/recommendations.md schema
697
+ }`);
698
+ lines.push("```");
699
+ lines.push("");
700
+
701
+ lines.push("## Critical rules");
702
+ lines.push("");
703
+ lines.push("Ordered by priority — top is most important.");
704
+ lines.push("");
705
+ lines.push(
706
+ "1. **`why` must cite a specific `file:line` AND a specific deep-dive datum.** Both. Not one or the other. This is THE quality gate — recs without both will be dropped by the verifier.",
707
+ );
708
+ lines.push(
709
+ `2. **No invented citations.** Only URLs and refs from the library above. The \`unknown-citation\` sanitizer strips anything else.`,
710
+ );
711
+ lines.push(
712
+ `3. **No version-mismatched features.** This project is \`${framework}@${version}\` — do not recommend APIs unavailable in that version. The version-aware library above is your filter.`,
713
+ );
714
+ lines.push(
715
+ `4. **No \`$N\` dollar literals** in customer-facing fields. Use magnitude phrases ("hundreds of dollars per month at current traffic"). The \`$-strip\` sanitizer strips them, but emitting them is wasted output.`,
716
+ );
717
+ lines.push(
718
+ "5. **Stay within scope.** Do not investigate other routes or fleet-wide patterns; that is the orchestrator's job. If this candidate doesn't yield a finding, abstain (Outcome B above).",
719
+ );
720
+ lines.push(
721
+ "6. **Vercel voice.** Sharp teammate, clear, competent, no fluff. Lead with observed metrics and the user action. Avoid marketing language (`leverage`, `streamline`, `powerful`), filler adverbs (`just`, `simply`, `actually`), hedged starts (`Consider`, `You may want to`), rhetorical reframes, and arrows in prose. Do not expose internal terms like `sub-agent`, `abstention`, `passRate`, or `quality score`. Product names: `Observability Plus`, `Vercel Functions`, `fluid compute` mid-sentence, `BotID`, `AI Gateway`, `AI SDK`, `Edge Config`, `Routing Middleware`, `Web Analytics`. Explain `function invocations` and `95th percentile`; do not use `inv` or `p95` in customer output. See `references/voice.md`.",
722
+ );
723
+ lines.push("");
724
+
725
+ return lines.join("\n");
726
+ }
727
+
728
+ function cachePolicyGuidance(kind, stack = {}) {
729
+ if (!["uncached_route", "cache_header_gap"].includes(kind)) return [];
730
+ const framework = stack.framework ?? "unknown";
731
+ const cacheComponents = stack.cacheComponents === true;
732
+ const hints = [
733
+ "Whole public GET response: recommend `Cache-Control` / `CDN-Cache-Control` with `s-maxage` and `stale-while-revalidate`; name the TTL/freshness window and required `Vary` headers. Avoid high-cardinality `Vary` headers such as `X-Vercel-IP-Latitude` or `X-Vercel-IP-Longitude`; use coarser geography only when the product can tolerate it.",
734
+ "Fallback, 404, auth, preview, webhook, mutation, and per-user branches: keep them uncached or short-lived while caching only the safe success branch.",
735
+ ];
736
+ if (framework === "next") {
737
+ if (cacheComponents) {
738
+ hints.push(
739
+ "Next.js with Cache Components: for reusable data inside the render path, prefer `use cache` / `use cache: remote` plus `cacheLife()` and `cacheTag()` when invalidation evidence exists.",
740
+ );
741
+ } else {
742
+ hints.push(
743
+ "Next.js data fetch path: use `fetch(..., { next: { revalidate: seconds } })` or route-level `revalidate` only when it matches the project version and route semantics. Before recommending route-level `export const revalidate`, inspect the page/layout route chain for `cookies()`, `headers()`, `draftMode()`, `connection()`, and auth helpers; if any parent layout is request-time dynamic, require `next build` or manifest proof that the route is still ISR/static, otherwise abstain.",
744
+ );
745
+ }
746
+ }
747
+ hints.push(
748
+ "Reusable server data where whole-response CDN caching is unsafe: recommend Runtime Cache only when the same result is reused across requests and the freshness/invalidation story is explicit.",
749
+ );
750
+ return hints;
751
+ }