cue-ai 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +82 -33
  3. package/bin/cue-review-progress +107 -0
  4. package/bin/cue-review-watch +98 -0
  5. package/dist/cue.js +7352 -3744
  6. package/package.json +16 -5
  7. package/profiles/_types.ts +9 -0
  8. package/profiles/backend/profile.yaml +2 -0
  9. package/profiles/blog-writer/profile.yaml +10 -0
  10. package/profiles/browser/profile.yaml +9 -2
  11. package/profiles/builder/profile.yaml +3 -6
  12. package/profiles/career/profile.yaml +13 -2
  13. package/profiles/claude-api/profile.yaml +1 -1
  14. package/profiles/commerce/profile.yaml +27 -3
  15. package/profiles/core/logo.png +0 -0
  16. package/profiles/core/profile.yaml +62 -2
  17. package/profiles/dash-merge-test/profile.yaml +109 -0
  18. package/profiles/designer/profile.yaml +2 -0
  19. package/profiles/designer-medusa-next/profile.yaml +4 -1
  20. package/profiles/designer-medusa-vite/profile.yaml +4 -1
  21. package/profiles/docs-writer/profile.yaml +3 -1
  22. package/profiles/eu-tender-research/README.md +48 -0
  23. package/profiles/eu-tender-research/logo.png +0 -0
  24. package/profiles/eu-tender-research/profile.yaml +108 -0
  25. package/profiles/finance/logo.png +0 -0
  26. package/profiles/finance/profile.yaml +46 -0
  27. package/profiles/frontend/profile.yaml +5 -9
  28. package/profiles/growth/profile.yaml +2 -3
  29. package/profiles/gstack/profile.yaml +15 -0
  30. package/profiles/higgsfield/profile.yaml +3 -0
  31. package/profiles/hyperframes/logo.png +0 -0
  32. package/profiles/hyperframes/profile.yaml +59 -0
  33. package/profiles/improver/profile.yaml +88 -0
  34. package/profiles/marketing/profile.yaml +0 -3
  35. package/profiles/medusa-dev/profile.yaml +2 -0
  36. package/profiles/medusa-next/profile.yaml +2 -3
  37. package/profiles/medusa-vite/profile.yaml +2 -3
  38. package/profiles/n8n/logo.png +0 -0
  39. package/profiles/n8n/profile.yaml +50 -0
  40. package/profiles/nextjs/profile.yaml +2 -3
  41. package/profiles/ops/profile.yaml +2 -0
  42. package/profiles/postizz/profile.yaml +13 -3
  43. package/profiles/python/profile.yaml +3 -0
  44. package/profiles/research/profile.yaml +3 -1
  45. package/profiles/schema.json +10 -0
  46. package/profiles/secops/profile.yaml +2 -0
  47. package/profiles/seo/profile.yaml +56 -0
  48. package/profiles/skill-writer/profile.yaml +8 -0
  49. package/profiles/ssh/profile.yaml +32 -0
  50. package/profiles/strapi/logo.png +0 -0
  51. package/profiles/strapi/profile.yaml +45 -0
  52. package/profiles/stripe/logo.png +0 -0
  53. package/profiles/stripe/profile.yaml +1 -0
  54. package/profiles/supabase/logo.png +0 -0
  55. package/profiles/supabase/profile.yaml +85 -0
  56. package/profiles/vercel/logo.png +0 -0
  57. package/profiles/vercel/profile.yaml +25 -1
  58. package/profiles/vite/profile.yaml +4 -3
  59. package/profiles/web-frontend-base/profile.yaml +5 -4
  60. package/profiles/webshop/profile.yaml +23 -5
  61. package/profiles/x-growth-bot/profile.yaml +44 -0
  62. package/resources/icons/generate-icons.py +128 -2
  63. package/resources/mcps/configs/claude.sanitized.json +42 -0
  64. package/resources/mcps/configs/codex.sanitized.json +7 -0
  65. package/resources/skills/skills/career/resume-version-manager/SKILL.md +351 -0
  66. package/resources/skills/skills/career/salary-negotiation-prep/SKILL.md +378 -0
  67. package/resources/skills/skills/content/pdf/SKILL.md +2 -0
  68. package/resources/skills/skills/content/postiz-cards/SKILL.md +48 -0
  69. package/resources/skills/skills/content/postiz-cards/scripts/analytics.sh +38 -0
  70. package/resources/skills/skills/content/postiz-cards/scripts/card.sh +42 -0
  71. package/resources/skills/skills/content/postiz-cards/scripts/lint.py +38 -0
  72. package/resources/skills/skills/design/headless-gif-demo/SKILL.md +1 -1
  73. package/resources/skills/skills/design/readme-svg-design/SKILL.md +1 -1
  74. package/resources/skills/skills/eu-funding/grant-outreach/SKILL.md +70 -0
  75. package/resources/skills/skills/eu-funding/hu-grant-finder/SKILL.md +114 -0
  76. package/resources/skills/skills/eu-funding/hu-grant-finder/evals.md +26 -0
  77. package/resources/skills/skills/eu-funding/ted-tender-search/SKILL.md +80 -0
  78. package/resources/skills/skills/eu-funding/ted-tender-search/evals.md +26 -0
  79. package/resources/skills/skills/eu-funding/ted-tender-search/scripts/ted-search.sh +46 -0
  80. package/resources/skills/skills/event-design/wedding-invitations/SKILL.md +1 -1
  81. package/resources/skills/skills/github/gx-agents/SKILL.md +96 -0
  82. package/resources/skills/skills/gstack/design-shotgun/SKILL.md +1 -1
  83. package/resources/skills/skills/marketing/ab-test-analyzer/SKILL.md +1 -1
  84. package/resources/skills/skills/marketing/ab-test-setup-and-analysis/SKILL.md +1 -1
  85. package/resources/skills/skills/marketing/account-structure-review/SKILL.md +1 -1
  86. package/resources/skills/skills/marketing/ad-copy-variant-generator/SKILL.md +1 -1
  87. package/resources/skills/skills/marketing/ad-extension-audit/SKILL.md +1 -1
  88. package/resources/skills/skills/marketing/ad-spend-allocator/SKILL.md +1 -1
  89. package/resources/skills/skills/marketing/anomaly-detection/SKILL.md +1 -1
  90. package/resources/skills/skills/marketing/attribution-model-comparison/SKILL.md +1 -1
  91. package/resources/skills/skills/marketing/audience-overlap-analysis/SKILL.md +7 -1
  92. package/resources/skills/skills/marketing/bid-strategy-recommendations/SKILL.md +7 -1
  93. package/resources/skills/skills/marketing/budget-scenario-planner/SKILL.md +6 -1
  94. package/resources/skills/skills/marketing/campaign-naming-convention-builder/SKILL.md +7 -1
  95. package/resources/skills/skills/marketing/channel-mix-optimizer/SKILL.md +7 -1
  96. package/resources/skills/skills/marketing/client-report-narratives/SKILL.md +6 -1
  97. package/resources/skills/skills/marketing/competitor-creative-analysis/SKILL.md +1 -1
  98. package/resources/skills/skills/marketing/competitor-teardown/SKILL.md +1 -1
  99. package/resources/skills/skills/marketing/content-repurposer/SKILL.md +1 -1
  100. package/resources/skills/skills/marketing/conversion-path-analysis/SKILL.md +1 -1
  101. package/resources/skills/skills/marketing/cpa-diagnostics/SKILL.md +1 -1
  102. package/resources/skills/skills/marketing/creative-fatigue-detection/SKILL.md +1 -1
  103. package/resources/skills/skills/marketing/day-hour-performance-breakdown/SKILL.md +1 -1
  104. package/resources/skills/skills/marketing/device-performance-split/SKILL.md +1 -1
  105. package/resources/skills/skills/marketing/e2e-seo-assistant/SKILL.md +1 -1
  106. package/resources/skills/skills/marketing/email-sequence-writer/SKILL.md +1 -1
  107. package/resources/skills/skills/marketing/frequency-cap-recommendations/SKILL.md +1 -1
  108. package/resources/skills/skills/marketing/geo-performance-analysis/SKILL.md +1 -1
  109. package/resources/skills/skills/marketing/google-ads-audit/SKILL.md +1 -1
  110. package/resources/skills/skills/marketing/icp-research-assistant/SKILL.md +1 -1
  111. package/resources/skills/skills/marketing/keyword-cannibalization-check/SKILL.md +1 -1
  112. package/resources/skills/skills/marketing/landing-page-audit/SKILL.md +1 -1
  113. package/resources/skills/skills/marketing/landing-page-audit-quick/SKILL.md +1 -1
  114. package/resources/skills/skills/marketing/linkedin-ads-audit/SKILL.md +1 -1
  115. package/resources/skills/skills/marketing/meta-ads-audit/SKILL.md +1 -1
  116. package/resources/skills/skills/marketing/pacing-monitor/SKILL.md +1 -1
  117. package/resources/skills/skills/marketing/performance-benchmarking/SKILL.md +1 -1
  118. package/resources/skills/skills/marketing/programmatic-seo-builder/SKILL.md +1 -1
  119. package/resources/skills/skills/marketing/quality-score-breakdown/SKILL.md +1 -1
  120. package/resources/skills/skills/marketing/reddit-ads-audit/SKILL.md +1 -1
  121. package/resources/skills/skills/marketing/retargeting-window-analysis/SKILL.md +1 -1
  122. package/resources/skills/skills/marketing/roas-forecasting/SKILL.md +1 -1
  123. package/resources/skills/skills/marketing/search-term-mining/SKILL.md +1 -1
  124. package/resources/skills/skills/marketing/utm-tracking-generator/SKILL.md +1 -1
  125. package/resources/skills/skills/marketing/wasted-spend-finder/SKILL.md +1 -1
  126. package/resources/skills/skills/marketing/weekly-account-summary/SKILL.md +1 -1
  127. package/resources/skills/skills/meta/awesome-list-submit/SKILL.md +4 -4
  128. package/resources/skills/skills/meta/cue-dashboard/SKILL.md +109 -0
  129. package/resources/skills/skills/meta/cue-developer/SKILL.md +161 -0
  130. package/resources/skills/skills/meta/cue-developer/evals/evals.json +57 -0
  131. package/resources/skills/skills/meta/cue-developer/references/architecture.md +65 -0
  132. package/resources/skills/skills/meta/cue-developer/references/build_and_test.md +72 -0
  133. package/resources/skills/skills/meta/cue-developer/references/contributing.md +75 -0
  134. package/resources/skills/skills/meta/cue-developer/references/conventions.md +57 -0
  135. package/resources/skills/skills/meta/cue-developer/references/first_time_setup.md +51 -0
  136. package/resources/skills/skills/meta/cue-developer/references/skill_and_mcp_authoring.md +84 -0
  137. package/resources/skills/skills/meta/cue-developer/references/troubleshooting.md +42 -0
  138. package/resources/skills/skills/meta/delegation-check/SKILL.md +148 -0
  139. package/resources/skills/skills/meta/delegation-check/specs/scan-algorithm.md +125 -0
  140. package/resources/skills/skills/meta/delegation-check/specs/separation-rules.md +190 -0
  141. package/resources/skills/skills/meta/focus/SKILL.md +62 -0
  142. package/resources/skills/skills/meta/help/SKILL.md +1 -1
  143. package/resources/skills/skills/meta/integrity-tags/SKILL.md +2 -0
  144. package/resources/skills/skills/meta/next-steps/SKILL.md +124 -0
  145. package/resources/skills/skills/meta/next-steps/evals/eval-set.json +92 -0
  146. package/resources/skills/skills/meta/profile-from-docs/SKILL.md +141 -0
  147. package/resources/skills/skills/meta/ralph-loop/SKILL.md +83 -0
  148. package/resources/skills/skills/meta/ralph-loop/scripts/loop.sh +73 -0
  149. package/resources/skills/skills/meta/skill-simplify/SKILL.md +136 -0
  150. package/resources/skills/skills/meta/skill-simplify/phases/01-analysis.md +173 -0
  151. package/resources/skills/skills/meta/skill-simplify/phases/02-optimize.md +104 -0
  152. package/resources/skills/skills/meta/skill-simplify/phases/03-check.md +145 -0
  153. package/resources/skills/skills/meta/smart-loader/scripts/smart-lookup.sh +13 -4
  154. package/resources/skills/skills/meta/verify-council/SKILL.md +182 -0
  155. package/resources/skills/skills/meta/verify-council/references/lane-prompts.md +103 -0
  156. package/resources/skills/skills/meta/verify-council/references/workflow.js +217 -0
  157. package/resources/skills/skills/nvidia/aiq-research/SKILL.md +1 -1
  158. package/resources/skills/skills/nvidia/cuopt-developer/SKILL.md +16 -1
  159. package/resources/skills/skills/nvidia/cuopt-developer/resources/contributing.md +2 -2
  160. package/resources/skills/skills/nvidia/cuopt-developer/resources/numerical_debugging.md +128 -0
  161. package/resources/skills/skills/nvidia/cuopt-developer/resources/python_bindings.md +2 -9
  162. package/resources/skills/skills/nvidia/cuopt-developer/resources/vrp_skills.md +166 -0
  163. package/resources/skills/skills/nvidia/cuopt-install/SKILL.md +2 -10
  164. package/resources/skills/skills/nvidia/cuopt-numerical-optimization-api-c/SKILL.md +3 -23
  165. package/resources/skills/skills/nvidia/cuopt-numerical-optimization-api-c/resources/examples.md +40 -20
  166. package/resources/skills/skills/nvidia/cuopt-numerical-optimization-api-python/SKILL.md +5 -1
  167. package/resources/skills/skills/nvidia/skill-evolution/SKILL.md +4 -5
  168. package/resources/skills/skills/research/trendradar/SKILL.md +1 -1
  169. package/resources/skills/skills/ssh/ssh-config/SKILL.md +94 -0
  170. package/resources/skills/skills/ssh/ssh-copy/SKILL.md +92 -0
  171. package/resources/skills/skills/ssh/ssh-harden/SKILL.md +108 -0
  172. package/resources/skills/skills/ssh/ssh-keys/SKILL.md +82 -0
  173. package/resources/skills/skills/ssh/ssh-paste-image/LICENSE +28 -0
  174. package/resources/skills/skills/ssh/ssh-paste-image/SKILL.md +149 -0
  175. package/resources/skills/skills/ssh/ssh-paste-image/scripts/build.sh +29 -0
  176. package/resources/skills/skills/ssh/ssh-paste-image/scripts/client/go.mod +3 -0
  177. package/resources/skills/skills/ssh/ssh-paste-image/scripts/client/main.go +79 -0
  178. package/resources/skills/skills/ssh/ssh-paste-image/scripts/daemon/ccimgd.service +12 -0
  179. package/resources/skills/skills/ssh/ssh-paste-image/scripts/daemon/com.ccimgd.plist +20 -0
  180. package/resources/skills/skills/ssh/ssh-paste-image/scripts/daemon/go.mod +3 -0
  181. package/resources/skills/skills/ssh/ssh-paste-image/scripts/daemon/main.go +98 -0
  182. package/resources/skills/skills/ssh/ssh-tunnel/SKILL.md +96 -0
  183. package/resources/skills/skills/strapi/building-with-strapi/SKILL.md +112 -0
  184. package/resources/skills/skills/strapi/strapi-cli/SKILL.md +93 -0
  185. package/resources/skills/skills/strapi/strapi-content-api/SKILL.md +115 -0
  186. package/resources/skills/skills/strapi/strapi-deploy/SKILL.md +89 -0
  187. package/resources/skills/skills/strapi/strapi-mcp-setup/SKILL.md +101 -0
  188. package/resources/skills/skills/strapi/strapi-plugins/SKILL.md +97 -0
  189. package/resources/skills/skills/tools/context7/SKILL.md +101 -0
  190. package/resources/skills/skills/tools/opensrc/SKILL.md +1 -1
  191. package/resources/skills/skills/tools/portless/SKILL.md +186 -0
  192. package/resources/skills/skills/xbot/operate/SKILL.md +229 -0
  193. package/src/commands/_index.ts +8 -0
  194. package/src/commands/ai-score.e2e.test.ts +11 -4
  195. package/src/commands/ai.ts +3 -4
  196. package/src/commands/auto-detect.ts +1 -1
  197. package/src/commands/cli.test.ts +1 -2
  198. package/src/commands/cli.ts +1 -1
  199. package/src/commands/cloud.ts +1 -1
  200. package/src/commands/current.ts +1 -4
  201. package/src/commands/dash.test.ts +110 -0
  202. package/src/commands/dash.ts +194 -0
  203. package/src/commands/dashboard.ts +26 -0
  204. package/src/commands/diff.ts +1 -1
  205. package/src/commands/discover.test.ts +1 -1
  206. package/src/commands/discover.ts +90 -40
  207. package/src/commands/doctor.test.ts +58 -0
  208. package/src/commands/doctor.ts +79 -3
  209. package/src/commands/eval-behavior.ts +1 -1
  210. package/src/commands/eval.ts +2 -2
  211. package/src/commands/evolve.ts +4 -3
  212. package/src/commands/failures.test.ts +1 -1
  213. package/src/commands/features-batch1.test.ts +6 -1
  214. package/src/commands/icon.ts +1 -5
  215. package/src/commands/import-profile.ts +1 -1
  216. package/src/commands/init.ts +50 -7
  217. package/src/commands/install-sh.e2e.test.ts +65 -0
  218. package/src/commands/launch-handoff.e2e.test.ts +88 -0
  219. package/src/commands/launch.e2e.test.ts +8 -1
  220. package/src/commands/launch.test.ts +29 -0
  221. package/src/commands/launch.ts +185 -131
  222. package/src/commands/lock.ts +0 -1
  223. package/src/commands/marketplace.ts +0 -4
  224. package/src/commands/materialize.ts +1 -1
  225. package/src/commands/mem.ts +341 -0
  226. package/src/commands/optimizer.ts +0 -3
  227. package/src/commands/playground.ts +1 -2
  228. package/src/commands/profile-draft-skill.ts +1 -1
  229. package/src/commands/replay-whatif.ts +1 -6
  230. package/src/commands/score.ts +2 -2
  231. package/src/commands/security.test.ts +88 -0
  232. package/src/commands/security.ts +74 -28
  233. package/src/commands/shell.test.ts +65 -4
  234. package/src/commands/shell.ts +67 -7
  235. package/src/commands/skills-test.ts +0 -1
  236. package/src/commands/skills.ts +28 -2
  237. package/src/commands/sources.ts +1 -2
  238. package/src/commands/status.ts +2 -6
  239. package/src/commands/submit-profile.ts +1 -1
  240. package/src/commands/suggest.ts +35 -10
  241. package/src/commands/trigger-gaps.test.ts +50 -0
  242. package/src/commands/trigger-gaps.ts +63 -29
  243. package/src/commands/update.ts +1 -1
  244. package/src/commands/validate.ts +16 -4
  245. package/src/commands/watch-live.ts +1 -1
  246. package/src/commands/workspace.ts +1 -1
  247. package/src/index.ts +26 -10
  248. package/src/lib/active-sessions.ts +1 -1
  249. package/src/lib/agent-adapters.test.ts +100 -0
  250. package/src/lib/agent-adapters.ts +2 -2
  251. package/src/lib/analytics.test.ts +88 -0
  252. package/src/lib/analytics.ts +82 -1
  253. package/src/lib/auto-detect.test.ts +10 -4
  254. package/src/lib/auto-detect.ts +19 -23
  255. package/src/lib/brand-icons.ts +0 -1
  256. package/src/lib/cache.ts +2 -3
  257. package/src/lib/claude-mem-env.test.ts +148 -0
  258. package/src/lib/claude-mem-env.ts +172 -0
  259. package/src/lib/combo-history.test.ts +53 -0
  260. package/src/lib/combo-history.ts +83 -0
  261. package/src/lib/companion-detect.test.ts +108 -0
  262. package/src/lib/companion-detect.ts +140 -0
  263. package/src/lib/companion-fetch.ts +4 -6
  264. package/src/lib/conditional-skills.test.ts +1 -1
  265. package/src/lib/config-paths.test.ts +53 -0
  266. package/src/lib/config-paths.ts +33 -0
  267. package/src/lib/dashboard-server.test.ts +351 -0
  268. package/src/lib/dashboard-server.ts +1476 -27
  269. package/src/lib/debug-log.test.ts +66 -0
  270. package/src/lib/debug-log.ts +45 -0
  271. package/src/lib/mcp-catalog.test.ts +102 -0
  272. package/src/lib/mcp-catalog.ts +193 -0
  273. package/src/lib/pair-suggestions.test.ts +111 -0
  274. package/src/lib/pair-suggestions.ts +98 -5
  275. package/src/lib/permissions.test.ts +76 -0
  276. package/src/lib/permissions.ts +125 -0
  277. package/src/lib/picker.test.ts +1106 -1
  278. package/src/lib/picker.ts +1230 -142
  279. package/src/lib/plugin-discovery.ts +126 -0
  280. package/src/lib/pr-poster.ts +1 -1
  281. package/src/lib/pr-throttle.ts +2 -6
  282. package/src/lib/profile-linter.test.ts +67 -1
  283. package/src/lib/profile-linter.ts +59 -14
  284. package/src/lib/profile-loader.test.ts +21 -0
  285. package/src/lib/profile-loader.ts +22 -3
  286. package/src/lib/profile-metrics.ts +2 -6
  287. package/src/lib/profile-names.test.ts +58 -0
  288. package/src/lib/repos.test.ts +57 -0
  289. package/src/lib/repos.ts +167 -0
  290. package/src/lib/resolver-npx.ts +10 -1
  291. package/src/lib/runtime-materializer.test.ts +200 -3
  292. package/src/lib/runtime-materializer.ts +129 -20
  293. package/src/lib/shared-profiles.ts +2 -3
  294. package/src/lib/skill-clis.test.ts +113 -0
  295. package/src/lib/skill-clis.ts +232 -0
  296. package/src/lib/skill-dependencies.ts +9 -1
  297. package/src/lib/skill-deps.ts +1 -1
  298. package/src/lib/skill-linter.ts +1 -1
  299. package/src/lib/skill-quality.ts +0 -1
  300. package/src/lib/skill-sandbox.test.ts +1 -1
  301. package/src/lib/skills-lock.test.ts +1 -1
  302. package/src/lib/telemetry-consent.ts +3 -5
  303. package/src/lib/telemetry-report.test.ts +2 -2
  304. package/src/lib/token-budget.ts +111 -0
  305. package/src/lib/trigger-gaps.test.ts +70 -0
  306. package/src/lib/trigger-gaps.ts +48 -6
  307. package/src/lib/tui/data.ts +1 -5
  308. package/src/lib/workflow-store.ts +150 -0
  309. package/src/lib/workspace-secrets.ts +0 -4
  310. package/src/lib/workspaces.ts +1 -1
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: profile-from-docs
3
+ description: 'Use when the user says "create a cue profile for X", "wire X into cue", or "build a profile from these docs". Scaffolds an integration profile: profile.yaml, logo, skills, MCPs, and CLI recipes.'
4
+ tags: [meta, cue, profile, scaffolding, mcp, skills]
5
+ ---
6
+
7
+ # Profile From Docs
8
+
9
+ Turn an upstream product's documentation repo into a complete cue profile:
10
+ the `profile.yaml`, a logo, a set of lint-clean skills, wired MCP servers, and
11
+ CLI recipes. This codifies the clone → map → build → verify loop.
12
+
13
+ ## Use This Skill For
14
+
15
+ - Standing up a new integration profile (Strapi, Supabase, a new platform)
16
+ from its official docs
17
+ - Making sure the profile actually loads, lints, and materializes before you
18
+ hand it over
19
+
20
+ ## Prerequisites
21
+
22
+ - Run from the `cue` repo root (the one with `profiles/`, `resources/skills/`,
23
+ `resources/mcps/`)
24
+ - `git` for cloning the upstream docs
25
+ - `bun` to run the cue source (`bun src/index.ts ...`) and the linter
26
+ - Note: `resources/skills` and `resources/mcps` are git submodules; commits
27
+ land there first, then the main repo bumps the pointers
28
+
29
+ ## Step 1: Opensrc the docs
30
+
31
+ Clone the upstream docs into `/tmp` (read-only reference, never committed):
32
+
33
+ ```bash
34
+ git clone --depth 1 <docs-repo-url> /tmp/<name>-docs
35
+ ```
36
+
37
+ ## Step 2: Map the docs to cue surfaces
38
+
39
+ Scan for the four things a profile needs. Grep the docs, do not guess.
40
+
41
+ | cue surface | Look for in the docs |
42
+ |---|---|
43
+ | **MCP servers** | grep the docs for "mcp" / "model context protocol"; capture exact URLs, transport, auth. Prefer official servers over community ones. |
44
+ | **CLI** | the install/scaffold command and the subcommand reference |
45
+ | **Skills** | top-level doc sections (CLI, APIs, plugins, deploy, config), one skill per cohesive area |
46
+ | **Logo** | `find . -iname '*logo*' \( -iname '*.png' -o -iname '*.svg' \)` |
47
+
48
+ ## Step 3: Build the artifacts
49
+
50
+ ### profile.yaml + logo
51
+
52
+ ```bash
53
+ mkdir -p profiles/<name>
54
+ cp /tmp/<name>-docs/path/to/logo.png profiles/<name>/logo.png
55
+ ```
56
+
57
+ Write `profiles/<name>/profile.yaml`: `name`, `icon`, `iconImage: logo.png`,
58
+ `description`, `inherits: core`, a `persona`, `skills.local`, `mcps`, and an
59
+ `env` block for any MCP placeholders. Validate fields against
60
+ `profiles/schema.json`.
61
+
62
+ ### Skills
63
+
64
+ One skill per area under `resources/skills/skills/<name>/<skill>/SKILL.md`.
65
+ Each must satisfy the linter (see Step 4): `name`, a `description` with a
66
+ trigger phrase, `tags`, a `## Prerequisites` section if it uses a CLI, an
67
+ example, and no em dashes.
68
+
69
+ ### MCP servers
70
+
71
+ Add each server to `resources/mcps/configs/claude.sanitized.json` under
72
+ `servers`. An unknown id throws `McpNotFound` at materialize time, so the id
73
+ in `profile.yaml` `mcps:` must match the registry key exactly.
74
+
75
+ ```json
76
+ "<id>": { "type": "http", "url": "${SERVICE_URL}/mcp",
77
+ "headers": { "Authorization": "Bearer ${SERVICE_TOKEN}" } }
78
+ ```
79
+
80
+ `${VAR}` placeholders resolve from the profile's `env:` then the shell.
81
+ Declare every placeholder in `env:` (an empty default is fine) so
82
+ materialization never throws `UnresolvedEnvPlaceholder`.
83
+
84
+ ### CLI recipes
85
+
86
+ Add install recipes to `resources/cli-recipes.json` (npm / brew / apt / etc.)
87
+ for any CLI the skills invoke.
88
+
89
+ ## Step 4: Verify before claiming done
90
+
91
+ ```bash
92
+ # every skill lints clean (0 errors); --fix auto-resolves em dashes
93
+ bun src/index.ts lint-skill resources/skills/skills/<name>/<skill>/SKILL.md
94
+
95
+ # profile loads and appears in the picker
96
+ bun src/index.ts list | grep <name>
97
+
98
+ # both MCPs materialize with env substitution (no throw)
99
+ bun -e 'import {loadProfile} from "./src/lib/profile-loader.ts";
100
+ import {materializeMcp} from "./src/lib/mcp-materializer.ts";
101
+ const p=await loadProfile("<name>");
102
+ console.log(Object.keys((await materializeMcp(p)).claude.mcpServers));'
103
+ ```
104
+
105
+ ## Step 5: Commit across the submodules
106
+
107
+ ```bash
108
+ # 1. skills submodule — stage ONLY your paths, not others' in-flight work
109
+ git -C resources/skills add skills/<name>
110
+ git -C resources/skills commit -m "feat(skills): add <name> skills"
111
+ # 2. mcps submodule
112
+ git -C resources/mcps add configs/claude.sanitized.json
113
+ git -C resources/mcps commit -m "feat(mcps): register <name> servers"
114
+ # 3. main repo — profile + recipes + submodule pointer bumps
115
+ git add profiles/<name> resources/cli-recipes.json resources/skills resources/mcps
116
+ git commit -m "feat(profiles): add <name> profile"
117
+ ```
118
+
119
+ ## Example
120
+
121
+ > "opensrc https://github.com/strapi/documentation and build a Strapi profile
122
+ > with skills, MCPs, and CLIs."
123
+
124
+ Result: `profiles/strapi/` (logo + yaml wiring the `strapi-docs` and
125
+ `strapi-mcp` servers), six skills under `resources/skills/skills/strapi/`,
126
+ two server entries in `claude.sanitized.json`, and `create-strapi` + `strapi`
127
+ recipes, all lint-clean and materialize-verified.
128
+
129
+ ## Rules
130
+
131
+ - Map from the real docs; never invent MCP URLs, CLI flags, or API shapes.
132
+ - Prefer official MCP servers over community forks.
133
+ - One skill per cohesive area; do not cram CLI + API + deploy into one file.
134
+ - Declare every `${VAR}` in the profile `env:` or materialization throws.
135
+ - Stage only your own paths in the submodules; leave unrelated changes alone.
136
+ - Not done until lint, load, and materialize all pass.
137
+
138
+ ## Next Step
139
+
140
+ After verifying, feature the profile in `profiles/_featured.yaml`, or run
141
+ `description-optimizer` on any skill whose activation you want to tune.
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: ralph-loop
3
+ description: >-
4
+ Use when user says "run this in a loop", "work on it overnight", "keep going
5
+ until done", "ralph loop", "autonomous loop", "make claude work longer", or
6
+ "run until tests pass". Runs an autonomous Ralph-Wiggum loop — re-feeds one
7
+ goal prompt to the agent over and over until a stop condition (tests green /
8
+ PRD done) or a budget/iteration cap, with checkpoints each round. NOT for
9
+ one-shot tasks or interactive back-and-forth.
10
+ tags: [meta, cue, automation, autonomous, loop]
11
+ category: meta
12
+ version: 1.0.0
13
+ ---
14
+
15
+ # ralph-loop — make the agent work longer (autonomously)
16
+
17
+ The "Ralph Wiggum" technique (Geoffrey Huntley: *"Ralph is a Bash loop"*): keep
18
+ feeding the agent the **same goal prompt** until the work is actually done. Each
19
+ iteration sees the previous round's file changes + git history, so it grinds
20
+ toward completion. Huntley famously ran a 3-month loop that built a whole
21
+ programming language. The loop is trivial; **the guardrails are the real work.**
22
+
23
+ ## The Iron Law
24
+
25
+ **No loop without an automated stop condition.** You can't review a 26-hour run
26
+ by hand, so the loop must verify *itself* — typically "tests pass" or a checked
27
+ acceptance command. A loop with no stop check drifts and burns money. If the
28
+ user can't name a verifiable "done", stop and ask for one before looping.
29
+
30
+ ## Two ways to run it
31
+
32
+ 1. **In-session (recommended, safest):** the official Anthropic plugin
33
+ `ralph-wiggum` — a Stop hook intercepts the agent's exit and re-feeds the
34
+ prompt. No external script.
35
+ `/plugin marketplace add anthropics/claude-code` → enable `ralph-wiggum`.
36
+ 2. **External loop (this skill's `scripts/loop.sh`):** a guarded `while` loop
37
+ that re-runs the agent, runs your stop-check after each round, checkpoints to
38
+ git, and caps iterations. Use when you want it outside a live session.
39
+
40
+ ## Run the included script
41
+
42
+ ```bash
43
+ # Loop until `bun test` passes, max 30 rounds, checkpoint each round:
44
+ scripts/loop.sh --prompt ./GOAL.md --until "bun test" --max 30 --checkpoint
45
+
46
+ # Fully unattended (skips permission prompts — ONLY in a sandbox/VM/container):
47
+ scripts/loop.sh --prompt ./GOAL.md --until "bun test" --max 30 --yolo
48
+ ```
49
+
50
+ `GOAL.md` states the objective **and** the done-criterion in plain text
51
+ (e.g. "Implement X. You are done when `bun test` is green and `bun run build`
52
+ succeeds."). Stop-check `--until` is the machine-truth that ends the loop.
53
+
54
+ ## Guardrails (do not skip)
55
+
56
+ - **Stop condition** — `--until "<cmd that exits 0 when done>"`. Required.
57
+ - **Cap iterations** — `--max N` (default 50) so a stuck loop can't spin forever.
58
+ - **Budget** — the Agent SDK exposes `max_budget_usd` / `maxTurns`; for the CLI,
59
+ the iteration cap is your ceiling. A YC team shipped 6 repos overnight for ~$297 —
60
+ cost is real.
61
+ - **Sandbox `--yolo`** — unattended mode passes `--dangerously-skip-permissions`,
62
+ which runs arbitrary commands. Only in a throwaway container/VM/worktree.
63
+ - **Checkpoint** — `--checkpoint` commits after each round so progress is
64
+ recoverable and you can diff what each iteration did.
65
+
66
+ ## Already in your stack
67
+
68
+ cue ships a `/loop` skill (interval / self-paced reruns of a prompt or slash
69
+ command) and `codex-fleet` for multi-agent orchestration — you can drive a
70
+ Ralph loop natively without an external repo. This skill's script is the
71
+ zero-dependency fallback.
72
+
73
+ ## Open-source references (verified June 2026, by stars)
74
+
75
+ | Repo | ⭐ | Note |
76
+ |---|---|---|
77
+ | `anthropics/claude-code` (`ralph-wiggum` plugin) | 129k | Official Stop-hook loop. Start here. |
78
+ | `frankbria/ralph-claude-code` | 9.2k | Loop with intelligent exit detection. |
79
+ | `smtg-ai/claude-squad` | 7.7k | Manage many agents in parallel. |
80
+ | `mikeyobrien/ralph-orchestrator` | 2.9k | Hardened Ralph orchestration. |
81
+ | `michaelshimeles/ralphy` | 2.9k | Bash loop, multi-CLI, runs until PRD complete. |
82
+
83
+ Source: Huntley's writeups + the official plugin README.
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env bash
2
+ # ralph-loop — a guarded "Ralph Wiggum" autonomous loop for Claude Code.
3
+ #
4
+ # Re-feeds one goal prompt to `claude` until a stop-check command succeeds, an
5
+ # iteration cap is hit, or you Ctrl-C. The stop-check is the only source of
6
+ # truth for "done" — keep it honest (tests/build), never a vibe.
7
+ #
8
+ # Usage:
9
+ # loop.sh --prompt GOAL.md --until "bun test" [--max 50] [--sleep 2]
10
+ # [--checkpoint] [--yolo] [--agent claude]
11
+ #
12
+ # --prompt FILE File whose contents are fed to the agent each round (required).
13
+ # --until "CMD" Shell command; loop stops when it exits 0 (required).
14
+ # --max N Hard cap on iterations (default 50). Prevents runaway spin.
15
+ # --sleep S Seconds between rounds (default 2).
16
+ # --checkpoint git add -A && commit after each round (recoverable progress).
17
+ # --yolo Pass --dangerously-skip-permissions (UNATTENDED). Sandbox only.
18
+ # --agent CMD Agent CLI to invoke (default: claude).
19
+ #
20
+ # Exit: 0 if the stop-check passed; 1 if the iteration cap was reached first.
21
+ set -euo pipefail
22
+
23
+ PROMPT=""; UNTIL=""; MAX=50; SLEEP=2; CHECKPOINT=0; YOLO=0; AGENT="claude"
24
+ while [ $# -gt 0 ]; do
25
+ case "$1" in
26
+ --prompt) PROMPT="${2:?}"; shift 2;;
27
+ --until) UNTIL="${2:?}"; shift 2;;
28
+ --max) MAX="${2:?}"; shift 2;;
29
+ --sleep) SLEEP="${2:?}"; shift 2;;
30
+ --checkpoint) CHECKPOINT=1; shift;;
31
+ --yolo) YOLO=1; shift;;
32
+ --agent) AGENT="${2:?}"; shift 2;;
33
+ -h|--help) sed -n '2,22p' "$0"; exit 0;;
34
+ *) echo "unknown arg: $1" >&2; exit 2;;
35
+ esac
36
+ done
37
+
38
+ [ -n "$PROMPT" ] || { echo "error: --prompt is required" >&2; exit 2; }
39
+ [ -f "$PROMPT" ] || { echo "error: prompt file not found: $PROMPT" >&2; exit 2; }
40
+ [ -n "$UNTIL" ] || { echo "error: --until <stop-check command> is required (the Iron Law)" >&2; exit 2; }
41
+ command -v "$AGENT" >/dev/null || { echo "error: agent CLI '$AGENT' not on PATH" >&2; exit 2; }
42
+
43
+ AGENT_FLAGS=(-p)
44
+ if [ "$YOLO" -eq 1 ]; then
45
+ echo "⚠️ --yolo: running with --dangerously-skip-permissions. Sandbox only." >&2
46
+ AGENT_FLAGS+=(--dangerously-skip-permissions)
47
+ fi
48
+
49
+ # Stop-check first: if we're already done, do nothing.
50
+ if eval "$UNTIL" >/dev/null 2>&1; then
51
+ echo "✓ stop-check already passes — nothing to do."; exit 0
52
+ fi
53
+
54
+ i=0
55
+ while [ "$i" -lt "$MAX" ]; do
56
+ i=$((i + 1))
57
+ echo "── ralph round $i/$MAX ($(date +%H:%M:%S)) ──"
58
+ # Feed the goal prompt to the agent. Each round sees prior file changes + git.
59
+ "$AGENT" "${AGENT_FLAGS[@]}" "$(cat "$PROMPT")" || echo " (agent exited non-zero — continuing)"
60
+
61
+ if [ "$CHECKPOINT" -eq 1 ] && git rev-parse --git-dir >/dev/null 2>&1; then
62
+ git add -A && git commit -q -m "ralph: round $i" --no-verify 2>/dev/null \
63
+ && echo " checkpoint: $(git rev-parse --short HEAD)" || echo " (nothing to checkpoint)"
64
+ fi
65
+
66
+ if eval "$UNTIL" >/dev/null 2>&1; then
67
+ echo "✓ stop-check passed after $i round(s): $UNTIL"; exit 0
68
+ fi
69
+ sleep "$SLEEP"
70
+ done
71
+
72
+ echo "✗ hit iteration cap ($MAX) without passing stop-check: $UNTIL" >&2
73
+ exit 1
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: skill-simplify
3
+ description: Use when the user says "simplify skill", "optimize skill", "shrink this skill", or "skill-simplify". Shrinks a SKILL.md without losing behavior, verified by a before/after functional count.
4
+ tags: [meta, cue, skills, quality, refactor]
5
+ category: meta
6
+ version: 1.0.0
7
+ requires_mcps: []
8
+ allowed-tools: Bash(Bash:*), Read, Write, Edit, Grep, Glob, AskUserQuestion
9
+ ---
10
+
11
+ # Skill Simplify
12
+
13
+ Cut a SKILL.md down to size without changing what it does. The safety net is
14
+ a count-based integrity check: every functional element present before the
15
+ edit must still be present after, or the change reverts.
16
+
17
+ The gate is heuristic, not a parser. Both the before and after inventories are
18
+ extracted by reading and counting, so a mis-count in either phase can pass a
19
+ lost element (false PASS) or revert a safe edit (false FAIL). A PASS means the
20
+ two manual counts agreed, not that a machine proved equivalence. Spot-check the
21
+ diff on a high-stakes skill.
22
+
23
+ Run three phases in order. Each phase has a detail file you read on demand,
24
+ not up front:
25
+
26
+ | Phase | Document | Job |
27
+ |-------|----------|-----|
28
+ | 1 | [phases/01-analysis.md](phases/01-analysis.md) | Build the functional inventory, classify every code block, flag format issues |
29
+ | 2 | [phases/02-optimize.md](phases/02-optimize.md) | Delete descriptive content, merge equivalent variants, fix format |
30
+ | 3 | [phases/03-check.md](phases/03-check.md) | Re-extract the inventory, compare counts, PASS / WARN / FAIL, revert on FAIL |
31
+
32
+ ## When to activate
33
+
34
+ - User says "simplify skill", "optimize skill", "shrink this skill"
35
+ - User says "compress SKILL.md", "make this skill smaller", "skill-simplify"
36
+ - User hands you a bloated SKILL.md and asks to trim it without breaking it
37
+
38
+ ## Input
39
+
40
+ Resolve the target to an absolute path. A bare directory means the SKILL.md
41
+ inside it.
42
+
43
+ ```bash
44
+ TARGET="$1"
45
+ case "$TARGET" in
46
+ *.md) FILE="$TARGET" ;;
47
+ *) FILE="$TARGET/SKILL.md" ;;
48
+ esac
49
+ test -f "$FILE" || { echo "Target not found: $FILE"; exit 1; }
50
+ wc -l "$FILE" # original line count, the Phase 3 before/after anchor
51
+ ```
52
+
53
+ Snapshot the original before any edit so Phase 3 can revert:
54
+
55
+ ```bash
56
+ cp "$FILE" "$FILE.simplify.bak"
57
+ ```
58
+
59
+ ## The contract
60
+
61
+ 1. **Preserve every functional element.** Logic blocks, routing branches,
62
+ schemas, agent and skill calls, error handling, input modes, output
63
+ artifacts, AskUserQuestion blocks stay verbatim.
64
+ 2. **Delete only descriptive content.** ASCII art, flowcharts that duplicate a
65
+ table, "When to use" prose, examples that just repeat logic shown elsewhere,
66
+ verbose comments.
67
+ 3. **Never summarize algorithm logic.** If-else branches, function bodies, and
68
+ schema fields are copied, not paraphrased.
69
+ 4. **Classify every code block** as `functional` or `descriptive`. Only
70
+ `descriptive` blocks may be removed. When unsure, mark it `functional` and
71
+ keep it.
72
+ 5. **Merge only equivalent variants.** Two templates that differ by one
73
+ parameter collapse to one template plus a variant comment that names the
74
+ dropped case.
75
+ 6. **Counts are the gate.** Phase 3 re-extracts the same inventory. Critical
76
+ categories must not decrease, or the edit reverts.
77
+
78
+ The critical categories, the ones that trigger a FAIL on any decrease:
79
+
80
+ ```
81
+ functionalCodeBlocks dataStructures routingBranches errorHandlers
82
+ conditionalLogic askUserQuestions inputModes outputArtifacts
83
+ skillInvocations
84
+ ```
85
+
86
+ Descriptive decreases are the whole point and pass clean. Merge-aware
87
+ categories (`agentCalls`, total `codeBlocks`) WARN on a decrease so you verify
88
+ the merged version still covers every original case.
89
+
90
+ ## Error handling
91
+
92
+ | Situation | What to do |
93
+ |-----------|------------|
94
+ | Target file not found | Report the path, stop |
95
+ | Phase 3 FAIL: a critical category dropped | Restore from `.simplify.bak`, report which category and which elements were lost |
96
+ | Phase 3 FAIL: a new format issue appeared | Restore from `.simplify.bak`, report the new issue |
97
+ | Phase 3 WARN: merge-aware drop | Keep the edit, show the merge justification, ask the user to confirm coverage |
98
+ | Phase 3 PASS | Keep the edit, delete the backup, report lines saved |
99
+
100
+ ## Example
101
+
102
+ Input: "simplify skill resources/skills/skills/meta/foo" (220-line SKILL.md
103
+ with an ASCII flowchart, a "Best Practices" section restating Core Rules, and
104
+ two AskUserQuestion blocks that differ only by header text).
105
+
106
+ Process:
107
+ - Phase 1 inventory finds 6 functional code blocks, 2 askUserQuestions, 1
108
+ routing branch, 3 descriptive blocks (the flowchart and two duplicate
109
+ examples). Format scan finds one nested-backtick issue.
110
+ - Phase 2 deletes the flowchart and the "Best Practices" section, merges the
111
+ two AskUserQuestion blocks into one with a `// variant: review mode` comment,
112
+ fixes the nested backticks. File drops to 150 lines.
113
+ - Phase 3 re-extracts: functional blocks still 6, askUserQuestions now 1 but
114
+ the merge comment names the dropped variant so it WARNs not FAILs, routing
115
+ branch still 1. Status PASS with one WARN.
116
+
117
+ Output: "Reduced foo/SKILL.md from 220 to 150 lines (-32%). PASS. 1 WARN: two
118
+ AskUserQuestion blocks merged into one, variant preserved in comment. Verify
119
+ the merged block still asks both headers."
120
+
121
+ ## Rules
122
+
123
+ - Run the phases in order. Phase 3 is not optional. A simplification you did
124
+ not verify is a regression you have not found yet.
125
+ - Keep the backup until Phase 3 reports PASS. Revert on FAIL, do not patch.
126
+ - Do not touch function signatures, variable names, or schema field names.
127
+ Those are functional even inside a block you are compressing.
128
+ - When a decrease is real and not merge-covered, that is a FAIL. Do not argue
129
+ the count down, restore and report.
130
+
131
+ ## What this skill does NOT do
132
+
133
+ - Rewrite descriptions for activation (use `meta/description-optimizer`)
134
+ - Score or audit a skill end to end (use `meta/skill-reviewer`)
135
+ - Split one skill into several (that changes behavior, out of scope)
136
+ - Run the skill being simplified
@@ -0,0 +1,173 @@
1
+ # Phase 1: Functional analysis
2
+
3
+ Read the target, build a quantitative functional inventory with code-block
4
+ classification, find redundancy with line ranges, flag format issues, and
5
+ produce an optimization plan. These counts are the baseline Phase 3 verifies
6
+ against, so be exact.
7
+
8
+ ## Objective
9
+
10
+ - Build the functional inventory with role classification (the Phase 3 anchor).
11
+ - Find redundancy categories with specific line ranges.
12
+ - Detect format issues.
13
+ - Produce an ordered optimization plan with estimated line savings.
14
+
15
+ ## Step 1.1: Read and measure
16
+
17
+ ```bash
18
+ ORIGINAL_LINES=$(wc -l < "$FILE")
19
+ ```
20
+
21
+ Read the whole file into context. You classify and count by reading, not by
22
+ running a parser. The structures below describe what to track; hold them as
23
+ a mental ledger or jot them in scratch notes.
24
+
25
+ ## Step 1.2: Extract the functional inventory
26
+
27
+ Count and catalog every functional element. Track each category with enough
28
+ location detail to match it again in Phase 3.
29
+
30
+ ```
31
+ inventory = {
32
+ codeBlocks: [ { startLine, endLine, language, purpose, role } ], // role = functional | descriptive
33
+ agentCalls: [ { line, agentType, description, mergeGroup? } ],
34
+ dataStructures: [ { line, name, type } ], // object | array | schema
35
+ routingBranches: [ { line, condition, outcomes[] } ],
36
+ errorHandlers: [ { line, errorType, resolution } ],
37
+ conditionalLogic: [ { line, condition, trueAction, falseAction } ],
38
+ askUserQuestions: [ { line, questionCount, headers[], optionType } ], // static | dynamic
39
+ inputModes: [ { line, mode, description } ],
40
+ outputArtifacts: [ { line, artifact, format } ],
41
+ todoWriteBlocks: [ { line, phaseCount } ],
42
+ phaseHandoffs: [ { line, fromPhase, toPhase } ],
43
+ skillInvocations: [ { line, skillName, hasExecutionSteps } ],
44
+ tables: [ { startLine, endLine, columns } ],
45
+ schemas: [ { line, schemaName, fields[] } ],
46
+ formatIssues: [ { line, type, description, severity } ], // error | warning
47
+ counts: {} // computed totals
48
+ }
49
+ ```
50
+
51
+ Extraction cues:
52
+
53
+ - **Code blocks**: every fenced pair. Record start, end, language, first
54
+ meaningful line as the purpose.
55
+ - **Agent calls**: `Agent(`, `Task(`, `subagent_type=`, or a Skill tool call
56
+ spawning a sub-agent.
57
+ - **Data structures**: `const x = {`, `const x = [`, JSON schema objects.
58
+ - **Routing branches**: `if` / `else`, `switch` / `case`, meaningful ternaries.
59
+ - **Error handlers**: `catch`, error-table rows (`| Error |`), fallback blocks.
60
+ - **AskUserQuestion**: `AskUserQuestion(` blocks, record the questions array
61
+ length and the option headers.
62
+ - **Input modes**: `Mode 1/2/3`, `--flag`, argument parsing.
63
+ - **Output artifacts**: `Write(`, `Output:`, file paths in comments.
64
+ - **Phase handoffs**: `Read("phases/`, `Skill(`, "proceed to next phase".
65
+ - **Skill invocations**: `Skill(` or a named `/skill` call with its steps.
66
+ - **Tables**: markdown `| header |` blocks.
67
+ - **Schemas**: named JSON structure definitions and their fields.
68
+
69
+ ### Step 1.2.1: Classify each code block
70
+
71
+ | Role | Criteria | Examples |
72
+ |------|----------|----------|
73
+ | `functional` | Algorithm logic, routing, conditionals, agent calls, schemas, data processing, AskUserQuestion, Skill, Read, Write, Bash | `if (...)`, `Agent({...})`, `const schema = {...}` |
74
+ | `descriptive` | ASCII art, usage examples, display templates, good vs bad comparisons, folder trees | box-drawing chars, `# Example usage`, a bad / good pair, `dir/file.ts` trees |
75
+
76
+ Rules:
77
+
78
+ - Contains any of `Agent(`, `Bash(`, `AskUserQuestion(`, `if (`, `switch`,
79
+ `Skill(`, `Write(`, `Read(`, `TodoWrite(` then it is `functional`.
80
+ - A `bash` block that is only example invocations, no logic, is `descriptive`.
81
+ - A block with no language tag holding only box-drawing characters is
82
+ `descriptive`.
83
+ - A block under an "Example" heading is `descriptive`.
84
+ - Default to `functional`. Conservative wins, a kept block costs lines, a
85
+ dropped functional block costs behavior.
86
+
87
+ ### Step 1.2.2: Validate format
88
+
89
+ Scan the `functional` blocks only:
90
+
91
+ | Check | Detection | Severity |
92
+ |-------|-----------|----------|
93
+ | Nested backticks | A backtick template literal inside a fenced code block | warning |
94
+ | Unclosed brackets | Unmatched `{`, `(`, `[` in a block | error |
95
+ | Undefined references | `${var}` never declared in this or a prior block | warning |
96
+ | Inconsistent indentation | Mixed tabs and spaces, or jumpy nesting | warning |
97
+ | Dead code | Commented-out blocks spanning 5+ lines | warning |
98
+ | Missing output | A function-like block with no return, Write, or log | warning |
99
+
100
+ ### Step 1.2.3: Compute totals
101
+
102
+ Total every category, plus the two derived code-block splits:
103
+
104
+ ```
105
+ counts = {
106
+ codeBlocks, functionalCodeBlocks, descriptiveCodeBlocks,
107
+ agentCalls, dataStructures, routingBranches, errorHandlers,
108
+ conditionalLogic, askUserQuestions, inputModes, outputArtifacts,
109
+ todoWriteBlocks, phaseHandoffs, skillInvocations,
110
+ tables, schemas, formatIssues
111
+ }
112
+ ```
113
+
114
+ `functionalCodeBlocks` and `descriptiveCodeBlocks` come from the role split in
115
+ 1.2.1. These are the numbers Phase 3 reads.
116
+
117
+ ## Step 1.3: Find redundancy
118
+
119
+ Record line ranges for each, so Phase 2 edits surgically.
120
+
121
+ **Deletable** (remove entirely, zero functional loss):
122
+
123
+ | Pattern | Detection |
124
+ |---------|-----------|
125
+ | Duplicate Overview | `## Overview` restating the frontmatter description |
126
+ | ASCII flowchart | A flowchart duplicating a phase table or structure |
127
+ | "When to use" section | Usage prose not needed to execute |
128
+ | Best Practices section | Advice that duplicates Core Rules |
129
+ | Duplicate examples | Examples repeating logic shown elsewhere |
130
+ | Folder-tree duplicate | An ASCII tree repeating an Output Artifacts table |
131
+ | "Next Phase" prose | Phase glue when TodoWrite or a table already handles flow |
132
+ | Descriptive code blocks | Blocks classed `descriptive` covered by nearby prose or tables |
133
+
134
+ **Simplifiable** (compress, keep meaning):
135
+
136
+ | Pattern | Strategy |
137
+ |---------|----------|
138
+ | Verbose comments | Reduce to one line, keep only non-obvious notes |
139
+ | Multi-line logging | Collapse to a single template line |
140
+ | Wordy intros | Drop "In this phase we will..." preambles |
141
+ | Prompt bloat | Trim agent or exploration prompts to the essential instruction |
142
+ | Display-format blocks | Convert a block that only defines output shape to a prose sentence |
143
+
144
+ **Mergeable** (combine related structures):
145
+
146
+ | Pattern | Strategy |
147
+ |---------|----------|
148
+ | Similar AskUserQuestion blocks | One shared block with a mode parameter |
149
+ | Repeated Option routing | One dispatch |
150
+ | Sequential single-line commands | One code block |
151
+ | Repeated TodoWrite blocks | Template once, the rest as one-line deltas |
152
+ | Duplicate error tables | One table |
153
+ | Equivalent template variants | One template plus a variant comment naming the dropped case |
154
+ | Multiple output-artifact tables | One combined table with a phase column |
155
+
156
+ **Format fixes**:
157
+
158
+ | Pattern | Fix |
159
+ |---------|-----|
160
+ | Nested backtick literals | Convert the block to prose, or use a four-backtick fence |
161
+ | Hardcoded option lists | Add a comment: generate dynamically from the named source |
162
+ | Handoff without steps | Add concrete steps referencing the target command's real interface |
163
+ | Unclosed brackets | Match the brackets |
164
+
165
+ ## Step 1.4: Build the plan
166
+
167
+ Order operations delete then merge then simplify then format. Delete is
168
+ safest and highest impact, format is last so it sees the final structure.
169
+
170
+ Report a short summary: category counts, estimated reduction percentage, and
171
+ the sections you will NOT touch (the functional core). Carry forward
172
+ `analysisResult = { inventory, redundancyMap, plan, originalContent,
173
+ originalLines }` for the next phases.