@booklib/core 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (374) hide show
  1. package/.cursor/rules/booklib-standards.mdc +40 -0
  2. package/.gemini/context.md +372 -0
  3. package/AGENTS.md +166 -0
  4. package/CHANGELOG.md +226 -0
  5. package/CLAUDE.md +81 -0
  6. package/CODE_OF_CONDUCT.md +31 -0
  7. package/CONTRIBUTING.md +304 -0
  8. package/LICENSE +21 -0
  9. package/PLAN.md +28 -0
  10. package/README.ja.md +198 -0
  11. package/README.ko.md +198 -0
  12. package/README.md +503 -0
  13. package/README.pt-BR.md +198 -0
  14. package/README.uk.md +241 -0
  15. package/README.zh-CN.md +198 -0
  16. package/SECURITY.md +9 -0
  17. package/agents/architecture-reviewer.md +136 -0
  18. package/agents/booklib-reviewer.md +90 -0
  19. package/agents/data-reviewer.md +107 -0
  20. package/agents/jvm-reviewer.md +146 -0
  21. package/agents/python-reviewer.md +128 -0
  22. package/agents/rust-reviewer.md +115 -0
  23. package/agents/ts-reviewer.md +110 -0
  24. package/agents/ui-reviewer.md +117 -0
  25. package/assets/logo.svg +36 -0
  26. package/bin/booklib-mcp.js +304 -0
  27. package/bin/booklib.js +1705 -0
  28. package/bin/skills.cjs +1292 -0
  29. package/booklib-router.mdc +36 -0
  30. package/booklib.config.json +19 -0
  31. package/commands/animation-at-work.md +10 -0
  32. package/commands/clean-code-reviewer.md +10 -0
  33. package/commands/data-intensive-patterns.md +10 -0
  34. package/commands/data-pipelines.md +10 -0
  35. package/commands/design-patterns.md +10 -0
  36. package/commands/domain-driven-design.md +10 -0
  37. package/commands/effective-java.md +10 -0
  38. package/commands/effective-kotlin.md +10 -0
  39. package/commands/effective-python.md +10 -0
  40. package/commands/effective-typescript.md +10 -0
  41. package/commands/kotlin-in-action.md +10 -0
  42. package/commands/lean-startup.md +10 -0
  43. package/commands/microservices-patterns.md +10 -0
  44. package/commands/programming-with-rust.md +10 -0
  45. package/commands/refactoring-ui.md +10 -0
  46. package/commands/rust-in-action.md +10 -0
  47. package/commands/skill-router.md +10 -0
  48. package/commands/spring-boot-in-action.md +10 -0
  49. package/commands/storytelling-with-data.md +10 -0
  50. package/commands/system-design-interview.md +10 -0
  51. package/commands/using-asyncio-python.md +10 -0
  52. package/commands/web-scraping-python.md +10 -0
  53. package/community/registry.json +1616 -0
  54. package/hooks/hooks.json +23 -0
  55. package/hooks/posttooluse-capture.mjs +67 -0
  56. package/hooks/suggest.js +153 -0
  57. package/lib/agent-behaviors.js +40 -0
  58. package/lib/agent-detector.js +96 -0
  59. package/lib/config-loader.js +39 -0
  60. package/lib/conflict-resolver.js +148 -0
  61. package/lib/context-builder.js +574 -0
  62. package/lib/discovery-engine.js +298 -0
  63. package/lib/doctor/hook-installer.js +83 -0
  64. package/lib/doctor/usage-tracker.js +87 -0
  65. package/lib/engine/ai-features.js +253 -0
  66. package/lib/engine/auditor.js +103 -0
  67. package/lib/engine/bm25-index.js +178 -0
  68. package/lib/engine/capture.js +120 -0
  69. package/lib/engine/corrections.js +198 -0
  70. package/lib/engine/doctor.js +195 -0
  71. package/lib/engine/graph-injector.js +137 -0
  72. package/lib/engine/graph.js +161 -0
  73. package/lib/engine/handoff.js +405 -0
  74. package/lib/engine/indexer.js +242 -0
  75. package/lib/engine/parser.js +53 -0
  76. package/lib/engine/query-expander.js +42 -0
  77. package/lib/engine/reranker.js +40 -0
  78. package/lib/engine/rrf.js +59 -0
  79. package/lib/engine/scanner.js +151 -0
  80. package/lib/engine/searcher.js +139 -0
  81. package/lib/engine/session-coordinator.js +306 -0
  82. package/lib/engine/session-manager.js +429 -0
  83. package/lib/engine/synthesizer.js +70 -0
  84. package/lib/installer.js +70 -0
  85. package/lib/instinct-block.js +33 -0
  86. package/lib/mcp-config-writer.js +88 -0
  87. package/lib/paths.js +57 -0
  88. package/lib/profiles/design.md +19 -0
  89. package/lib/profiles/general.md +16 -0
  90. package/lib/profiles/research-analysis.md +22 -0
  91. package/lib/profiles/software-development.md +23 -0
  92. package/lib/profiles/writing-content.md +19 -0
  93. package/lib/project-initializer.js +916 -0
  94. package/lib/registry/skills.js +102 -0
  95. package/lib/registry-searcher.js +99 -0
  96. package/lib/rules/rules-manager.js +169 -0
  97. package/lib/skill-fetcher.js +333 -0
  98. package/lib/well-known-builder.js +70 -0
  99. package/lib/wizard/index.js +404 -0
  100. package/lib/wizard/integration-detector.js +41 -0
  101. package/lib/wizard/project-detector.js +100 -0
  102. package/lib/wizard/prompt.js +156 -0
  103. package/lib/wizard/registry-embeddings.js +107 -0
  104. package/lib/wizard/skill-recommender.js +69 -0
  105. package/llms-full.txt +254 -0
  106. package/llms.txt +70 -0
  107. package/package.json +45 -0
  108. package/research-reports/2026-04-01-current-architecture.md +160 -0
  109. package/research-reports/IDEAS.md +93 -0
  110. package/rules/common/clean-code.md +42 -0
  111. package/rules/java/effective-java.md +42 -0
  112. package/rules/kotlin/effective-kotlin.md +37 -0
  113. package/rules/python/effective-python.md +38 -0
  114. package/rules/rust/rust.md +37 -0
  115. package/rules/typescript/effective-typescript.md +42 -0
  116. package/scripts/gen-llms-full.mjs +36 -0
  117. package/scripts/gen-og.mjs +142 -0
  118. package/scripts/validate-frontmatter.js +25 -0
  119. package/skills/animation-at-work/SKILL.md +270 -0
  120. package/skills/animation-at-work/assets/example_asset.txt +1 -0
  121. package/skills/animation-at-work/evals/evals.json +44 -0
  122. package/skills/animation-at-work/evals/results.json +13 -0
  123. package/skills/animation-at-work/examples/after.md +64 -0
  124. package/skills/animation-at-work/examples/before.md +35 -0
  125. package/skills/animation-at-work/references/api_reference.md +369 -0
  126. package/skills/animation-at-work/references/review-checklist.md +79 -0
  127. package/skills/animation-at-work/scripts/audit_animations.py +295 -0
  128. package/skills/animation-at-work/scripts/example.py +1 -0
  129. package/skills/clean-code-reviewer/SKILL.md +444 -0
  130. package/skills/clean-code-reviewer/audit.json +35 -0
  131. package/skills/clean-code-reviewer/evals/evals.json +185 -0
  132. package/skills/clean-code-reviewer/evals/results.json +13 -0
  133. package/skills/clean-code-reviewer/examples/after.md +48 -0
  134. package/skills/clean-code-reviewer/examples/before.md +33 -0
  135. package/skills/clean-code-reviewer/references/api_reference.md +158 -0
  136. package/skills/clean-code-reviewer/references/practices-catalog.md +282 -0
  137. package/skills/clean-code-reviewer/references/review-checklist.md +254 -0
  138. package/skills/clean-code-reviewer/scripts/pre-review.py +206 -0
  139. package/skills/data-intensive-patterns/SKILL.md +267 -0
  140. package/skills/data-intensive-patterns/assets/example_asset.txt +1 -0
  141. package/skills/data-intensive-patterns/evals/evals.json +54 -0
  142. package/skills/data-intensive-patterns/evals/results.json +13 -0
  143. package/skills/data-intensive-patterns/examples/after.md +61 -0
  144. package/skills/data-intensive-patterns/examples/before.md +38 -0
  145. package/skills/data-intensive-patterns/references/api_reference.md +34 -0
  146. package/skills/data-intensive-patterns/references/patterns-catalog.md +551 -0
  147. package/skills/data-intensive-patterns/references/review-checklist.md +193 -0
  148. package/skills/data-intensive-patterns/scripts/adr.py +213 -0
  149. package/skills/data-intensive-patterns/scripts/example.py +1 -0
  150. package/skills/data-pipelines/SKILL.md +259 -0
  151. package/skills/data-pipelines/assets/example_asset.txt +1 -0
  152. package/skills/data-pipelines/evals/evals.json +45 -0
  153. package/skills/data-pipelines/evals/results.json +13 -0
  154. package/skills/data-pipelines/examples/after.md +97 -0
  155. package/skills/data-pipelines/examples/before.md +37 -0
  156. package/skills/data-pipelines/references/api_reference.md +301 -0
  157. package/skills/data-pipelines/references/review-checklist.md +181 -0
  158. package/skills/data-pipelines/scripts/example.py +1 -0
  159. package/skills/data-pipelines/scripts/new_pipeline.py +444 -0
  160. package/skills/design-patterns/SKILL.md +271 -0
  161. package/skills/design-patterns/assets/example_asset.txt +1 -0
  162. package/skills/design-patterns/evals/evals.json +46 -0
  163. package/skills/design-patterns/evals/results.json +13 -0
  164. package/skills/design-patterns/examples/after.md +52 -0
  165. package/skills/design-patterns/examples/before.md +29 -0
  166. package/skills/design-patterns/references/api_reference.md +1 -0
  167. package/skills/design-patterns/references/patterns-catalog.md +726 -0
  168. package/skills/design-patterns/references/review-checklist.md +173 -0
  169. package/skills/design-patterns/scripts/example.py +1 -0
  170. package/skills/design-patterns/scripts/scaffold.py +807 -0
  171. package/skills/domain-driven-design/SKILL.md +142 -0
  172. package/skills/domain-driven-design/assets/example_asset.txt +1 -0
  173. package/skills/domain-driven-design/evals/evals.json +48 -0
  174. package/skills/domain-driven-design/evals/results.json +13 -0
  175. package/skills/domain-driven-design/examples/after.md +80 -0
  176. package/skills/domain-driven-design/examples/before.md +43 -0
  177. package/skills/domain-driven-design/references/api_reference.md +1 -0
  178. package/skills/domain-driven-design/references/patterns-catalog.md +545 -0
  179. package/skills/domain-driven-design/references/review-checklist.md +158 -0
  180. package/skills/domain-driven-design/scripts/example.py +1 -0
  181. package/skills/domain-driven-design/scripts/scaffold.py +421 -0
  182. package/skills/effective-java/SKILL.md +227 -0
  183. package/skills/effective-java/assets/example_asset.txt +1 -0
  184. package/skills/effective-java/evals/evals.json +46 -0
  185. package/skills/effective-java/evals/results.json +13 -0
  186. package/skills/effective-java/examples/after.md +83 -0
  187. package/skills/effective-java/examples/before.md +37 -0
  188. package/skills/effective-java/references/api_reference.md +1 -0
  189. package/skills/effective-java/references/items-catalog.md +955 -0
  190. package/skills/effective-java/references/review-checklist.md +216 -0
  191. package/skills/effective-java/scripts/checkstyle_setup.py +211 -0
  192. package/skills/effective-java/scripts/example.py +1 -0
  193. package/skills/effective-kotlin/SKILL.md +271 -0
  194. package/skills/effective-kotlin/assets/example_asset.txt +1 -0
  195. package/skills/effective-kotlin/audit.json +29 -0
  196. package/skills/effective-kotlin/evals/evals.json +45 -0
  197. package/skills/effective-kotlin/evals/results.json +13 -0
  198. package/skills/effective-kotlin/examples/after.md +36 -0
  199. package/skills/effective-kotlin/examples/before.md +38 -0
  200. package/skills/effective-kotlin/references/api_reference.md +1 -0
  201. package/skills/effective-kotlin/references/practices-catalog.md +1228 -0
  202. package/skills/effective-kotlin/references/review-checklist.md +126 -0
  203. package/skills/effective-kotlin/scripts/example.py +1 -0
  204. package/skills/effective-python/SKILL.md +441 -0
  205. package/skills/effective-python/evals/evals.json +44 -0
  206. package/skills/effective-python/evals/results.json +13 -0
  207. package/skills/effective-python/examples/after.md +56 -0
  208. package/skills/effective-python/examples/before.md +40 -0
  209. package/skills/effective-python/ref-01-pythonic-thinking.md +202 -0
  210. package/skills/effective-python/ref-02-lists-and-dicts.md +146 -0
  211. package/skills/effective-python/ref-03-functions.md +186 -0
  212. package/skills/effective-python/ref-04-comprehensions-generators.md +211 -0
  213. package/skills/effective-python/ref-05-classes-interfaces.md +188 -0
  214. package/skills/effective-python/ref-06-metaclasses-attributes.md +209 -0
  215. package/skills/effective-python/ref-07-concurrency.md +213 -0
  216. package/skills/effective-python/ref-08-robustness-performance.md +248 -0
  217. package/skills/effective-python/ref-09-testing-debugging.md +253 -0
  218. package/skills/effective-python/ref-10-collaboration.md +175 -0
  219. package/skills/effective-python/references/api_reference.md +218 -0
  220. package/skills/effective-python/references/practices-catalog.md +483 -0
  221. package/skills/effective-python/references/review-checklist.md +190 -0
  222. package/skills/effective-python/scripts/lint.py +173 -0
  223. package/skills/effective-typescript/SKILL.md +262 -0
  224. package/skills/effective-typescript/audit.json +29 -0
  225. package/skills/effective-typescript/evals/evals.json +37 -0
  226. package/skills/effective-typescript/evals/results.json +13 -0
  227. package/skills/effective-typescript/examples/after.md +70 -0
  228. package/skills/effective-typescript/examples/before.md +47 -0
  229. package/skills/effective-typescript/references/api_reference.md +118 -0
  230. package/skills/effective-typescript/references/practices-catalog.md +371 -0
  231. package/skills/effective-typescript/scripts/review.py +169 -0
  232. package/skills/kotlin-in-action/SKILL.md +261 -0
  233. package/skills/kotlin-in-action/assets/example_asset.txt +1 -0
  234. package/skills/kotlin-in-action/evals/evals.json +43 -0
  235. package/skills/kotlin-in-action/evals/results.json +13 -0
  236. package/skills/kotlin-in-action/examples/after.md +53 -0
  237. package/skills/kotlin-in-action/examples/before.md +39 -0
  238. package/skills/kotlin-in-action/references/api_reference.md +1 -0
  239. package/skills/kotlin-in-action/references/practices-catalog.md +436 -0
  240. package/skills/kotlin-in-action/references/review-checklist.md +204 -0
  241. package/skills/kotlin-in-action/scripts/example.py +1 -0
  242. package/skills/kotlin-in-action/scripts/setup_detekt.py +224 -0
  243. package/skills/lean-startup/SKILL.md +160 -0
  244. package/skills/lean-startup/assets/example_asset.txt +1 -0
  245. package/skills/lean-startup/evals/evals.json +43 -0
  246. package/skills/lean-startup/evals/results.json +13 -0
  247. package/skills/lean-startup/examples/after.md +80 -0
  248. package/skills/lean-startup/examples/before.md +34 -0
  249. package/skills/lean-startup/references/api_reference.md +319 -0
  250. package/skills/lean-startup/references/review-checklist.md +137 -0
  251. package/skills/lean-startup/scripts/example.py +1 -0
  252. package/skills/lean-startup/scripts/new_experiment.py +286 -0
  253. package/skills/microservices-patterns/SKILL.md +384 -0
  254. package/skills/microservices-patterns/evals/evals.json +45 -0
  255. package/skills/microservices-patterns/evals/results.json +13 -0
  256. package/skills/microservices-patterns/examples/after.md +69 -0
  257. package/skills/microservices-patterns/examples/before.md +40 -0
  258. package/skills/microservices-patterns/references/patterns-catalog.md +391 -0
  259. package/skills/microservices-patterns/references/review-checklist.md +169 -0
  260. package/skills/microservices-patterns/scripts/new_service.py +583 -0
  261. package/skills/programming-with-rust/SKILL.md +209 -0
  262. package/skills/programming-with-rust/evals/evals.json +37 -0
  263. package/skills/programming-with-rust/evals/results.json +13 -0
  264. package/skills/programming-with-rust/examples/after.md +107 -0
  265. package/skills/programming-with-rust/examples/before.md +59 -0
  266. package/skills/programming-with-rust/references/api_reference.md +152 -0
  267. package/skills/programming-with-rust/references/practices-catalog.md +335 -0
  268. package/skills/programming-with-rust/scripts/review.py +142 -0
  269. package/skills/refactoring-ui/SKILL.md +362 -0
  270. package/skills/refactoring-ui/assets/example_asset.txt +1 -0
  271. package/skills/refactoring-ui/evals/evals.json +45 -0
  272. package/skills/refactoring-ui/evals/results.json +13 -0
  273. package/skills/refactoring-ui/examples/after.md +85 -0
  274. package/skills/refactoring-ui/examples/before.md +58 -0
  275. package/skills/refactoring-ui/references/api_reference.md +355 -0
  276. package/skills/refactoring-ui/references/review-checklist.md +114 -0
  277. package/skills/refactoring-ui/scripts/audit_css.py +250 -0
  278. package/skills/refactoring-ui/scripts/example.py +1 -0
  279. package/skills/rust-in-action/SKILL.md +350 -0
  280. package/skills/rust-in-action/evals/evals.json +38 -0
  281. package/skills/rust-in-action/evals/results.json +13 -0
  282. package/skills/rust-in-action/examples/after.md +156 -0
  283. package/skills/rust-in-action/examples/before.md +56 -0
  284. package/skills/rust-in-action/references/practices-catalog.md +346 -0
  285. package/skills/rust-in-action/scripts/review.py +147 -0
  286. package/skills/skill-router/SKILL.md +186 -0
  287. package/skills/skill-router/evals/evals.json +38 -0
  288. package/skills/skill-router/evals/results.json +13 -0
  289. package/skills/skill-router/examples/after.md +63 -0
  290. package/skills/skill-router/examples/before.md +39 -0
  291. package/skills/skill-router/references/api_reference.md +24 -0
  292. package/skills/skill-router/references/routing-heuristics.md +89 -0
  293. package/skills/skill-router/references/skill-catalog.md +174 -0
  294. package/skills/skill-router/scripts/route.py +266 -0
  295. package/skills/spring-boot-in-action/SKILL.md +340 -0
  296. package/skills/spring-boot-in-action/evals/evals.json +39 -0
  297. package/skills/spring-boot-in-action/evals/results.json +13 -0
  298. package/skills/spring-boot-in-action/examples/after.md +185 -0
  299. package/skills/spring-boot-in-action/examples/before.md +84 -0
  300. package/skills/spring-boot-in-action/references/practices-catalog.md +403 -0
  301. package/skills/spring-boot-in-action/scripts/review.py +184 -0
  302. package/skills/storytelling-with-data/SKILL.md +241 -0
  303. package/skills/storytelling-with-data/assets/example_asset.txt +1 -0
  304. package/skills/storytelling-with-data/evals/evals.json +47 -0
  305. package/skills/storytelling-with-data/evals/results.json +13 -0
  306. package/skills/storytelling-with-data/examples/after.md +50 -0
  307. package/skills/storytelling-with-data/examples/before.md +33 -0
  308. package/skills/storytelling-with-data/references/api_reference.md +379 -0
  309. package/skills/storytelling-with-data/references/review-checklist.md +111 -0
  310. package/skills/storytelling-with-data/scripts/chart_review.py +301 -0
  311. package/skills/storytelling-with-data/scripts/example.py +1 -0
  312. package/skills/system-design-interview/SKILL.md +233 -0
  313. package/skills/system-design-interview/assets/example_asset.txt +1 -0
  314. package/skills/system-design-interview/evals/evals.json +46 -0
  315. package/skills/system-design-interview/evals/results.json +13 -0
  316. package/skills/system-design-interview/examples/after.md +94 -0
  317. package/skills/system-design-interview/examples/before.md +27 -0
  318. package/skills/system-design-interview/references/api_reference.md +582 -0
  319. package/skills/system-design-interview/references/review-checklist.md +201 -0
  320. package/skills/system-design-interview/scripts/example.py +1 -0
  321. package/skills/system-design-interview/scripts/new_design.py +421 -0
  322. package/skills/using-asyncio-python/SKILL.md +290 -0
  323. package/skills/using-asyncio-python/assets/example_asset.txt +1 -0
  324. package/skills/using-asyncio-python/evals/evals.json +43 -0
  325. package/skills/using-asyncio-python/evals/results.json +13 -0
  326. package/skills/using-asyncio-python/examples/after.md +68 -0
  327. package/skills/using-asyncio-python/examples/before.md +39 -0
  328. package/skills/using-asyncio-python/references/api_reference.md +267 -0
  329. package/skills/using-asyncio-python/references/review-checklist.md +149 -0
  330. package/skills/using-asyncio-python/scripts/check_blocking.py +270 -0
  331. package/skills/using-asyncio-python/scripts/example.py +1 -0
  332. package/skills/web-scraping-python/SKILL.md +280 -0
  333. package/skills/web-scraping-python/assets/example_asset.txt +1 -0
  334. package/skills/web-scraping-python/evals/evals.json +46 -0
  335. package/skills/web-scraping-python/evals/results.json +13 -0
  336. package/skills/web-scraping-python/examples/after.md +109 -0
  337. package/skills/web-scraping-python/examples/before.md +40 -0
  338. package/skills/web-scraping-python/references/api_reference.md +393 -0
  339. package/skills/web-scraping-python/references/review-checklist.md +163 -0
  340. package/skills/web-scraping-python/scripts/example.py +1 -0
  341. package/skills/web-scraping-python/scripts/new_scraper.py +231 -0
  342. package/skills/writing-plans/audit.json +34 -0
  343. package/tests/agent-detector.test.js +83 -0
  344. package/tests/corrections.test.js +245 -0
  345. package/tests/doctor/hook-installer.test.js +72 -0
  346. package/tests/doctor/usage-tracker.test.js +140 -0
  347. package/tests/engine/benchmark-eval.test.js +31 -0
  348. package/tests/engine/bm25-index.test.js +85 -0
  349. package/tests/engine/capture-command.test.js +35 -0
  350. package/tests/engine/capture.test.js +17 -0
  351. package/tests/engine/graph-augmented-search.test.js +107 -0
  352. package/tests/engine/graph-injector.test.js +44 -0
  353. package/tests/engine/graph.test.js +216 -0
  354. package/tests/engine/hybrid-searcher.test.js +74 -0
  355. package/tests/engine/indexer-bm25.test.js +37 -0
  356. package/tests/engine/mcp-tools.test.js +73 -0
  357. package/tests/engine/project-initializer-mcp.test.js +99 -0
  358. package/tests/engine/query-expander.test.js +36 -0
  359. package/tests/engine/reranker.test.js +51 -0
  360. package/tests/engine/rrf.test.js +49 -0
  361. package/tests/engine/srag-prefix.test.js +47 -0
  362. package/tests/instinct-block.test.js +23 -0
  363. package/tests/mcp-config-writer.test.js +60 -0
  364. package/tests/project-initializer-new-agents.test.js +48 -0
  365. package/tests/rules/rules-manager.test.js +230 -0
  366. package/tests/well-known-builder.test.js +40 -0
  367. package/tests/wizard/integration-detector.test.js +31 -0
  368. package/tests/wizard/project-detector.test.js +51 -0
  369. package/tests/wizard/prompt-session.test.js +61 -0
  370. package/tests/wizard/prompt.test.js +16 -0
  371. package/tests/wizard/registry-embeddings.test.js +35 -0
  372. package/tests/wizard/skill-recommender.test.js +34 -0
  373. package/tests/wizard/slot-count.test.js +25 -0
  374. package/vercel.json +21 -0
@@ -0,0 +1,156 @@
1
+ // lib/wizard/prompt.js
2
+ import * as clack from '@clack/prompts';
3
+ import { createInterface } from 'node:readline';
4
+
5
+ // ── Clack-based wizard session ───────────────────────────────────────────────
6
+
7
+ export function createWizardUI() {
8
+ return {
9
+ intro(text) { clack.intro(text); },
10
+ outro(text) { clack.outro(text); },
11
+
12
+ async confirm(message, initial = true) {
13
+ const result = await clack.confirm({ message, initialValue: initial });
14
+ if (clack.isCancel(result)) { clack.outro('Setup cancelled.'); process.exit(0); }
15
+ return result;
16
+ },
17
+
18
+ async text(message, placeholder) {
19
+ const result = await clack.text({ message, placeholder });
20
+ if (clack.isCancel(result)) { clack.outro('Setup cancelled.'); process.exit(0); }
21
+ return result;
22
+ },
23
+
24
+ async select(message, options) {
25
+ const result = await clack.select({ message, options });
26
+ if (clack.isCancel(result)) { clack.outro('Setup cancelled.'); process.exit(0); }
27
+ return result;
28
+ },
29
+
30
+ async multiselect(message, options, opts = {}) {
31
+ const result = await clack.multiselect({
32
+ message: `${message} (space to toggle, enter to confirm)`,
33
+ options,
34
+ required: false,
35
+ ...opts,
36
+ });
37
+ if (clack.isCancel(result)) { clack.outro('Setup cancelled.'); process.exit(0); }
38
+ return result;
39
+ },
40
+
41
+ spinner() { return clack.spinner(); },
42
+ log: clack.log,
43
+ isCancel: clack.isCancel,
44
+ };
45
+ }
46
+
47
+ // ── Legacy standalone functions (used outside wizard) ────────────────────────
48
+
49
+ function readLine() {
50
+ return new Promise((resolve) => {
51
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
52
+ const onSigint = () => { rl.close(); process.exit(130); };
53
+ process.once('SIGINT', onSigint);
54
+ rl.once('line', line => {
55
+ process.removeListener('SIGINT', onSigint);
56
+ rl.close();
57
+ resolve(line.trim());
58
+ });
59
+ rl.once('close', () => {
60
+ process.removeListener('SIGINT', onSigint);
61
+ resolve('');
62
+ });
63
+ });
64
+ }
65
+
66
+ export async function confirm(question, defaultY = true) {
67
+ process.stdout.write(`${question} [${defaultY ? 'Y/n' : 'y/N'}] `);
68
+ const answer = await readLine();
69
+ if (!answer) return defaultY;
70
+ return answer.toLowerCase().startsWith('y');
71
+ }
72
+
73
+ export async function multiSelect(question, choices) {
74
+ process.stdout.write(`\n${question}\n\n`);
75
+ choices.forEach((c, i) => {
76
+ const desc = c.description ? ` — ${c.description}` : '';
77
+ process.stdout.write(` ${i + 1}. ${c.label}${desc}\n`);
78
+ });
79
+ process.stdout.write(`\n [A] All (recommended) [1,2,3...] pick [S] Skip\n\n > `);
80
+ const answer = await readLine();
81
+ if (!answer) return process.stdin.isTTY ? choices.map((_, i) => i) : [];
82
+ if (answer.toLowerCase() === 'a') return choices.map((_, i) => i);
83
+ if (answer.toLowerCase() === 's') return [];
84
+ return answer.split(',')
85
+ .map(n => parseInt(n.trim(), 10) - 1)
86
+ .filter(n => !isNaN(n) && n >= 0 && n < choices.length);
87
+ }
88
+
89
+ export function formatProgress(current, total, width = 30) {
90
+ const clamped = Math.min(current, total);
91
+ const filled = total > 0 ? Math.round((clamped / total) * width) : 0;
92
+ const bar = '\u2588'.repeat(filled) + '\u2591'.repeat(Math.max(0, width - filled));
93
+ return `[${bar}] ${clamped}/${total}`;
94
+ }
95
+
96
+ export function progressBar(total) {
97
+ let current = 0;
98
+ function render() { process.stdout.write(`\r ${formatProgress(current, total)}`); }
99
+ render();
100
+ return {
101
+ tick(n = 1) { current = Math.min(current + n, total); render(); },
102
+ done() { process.stdout.write('\n'); },
103
+ };
104
+ }
105
+
106
+ export async function readText(promptText) {
107
+ process.stdout.write(promptText);
108
+ return readLine();
109
+ }
110
+
111
+ export function sep(char = '\u2500', width = 45) {
112
+ return char.repeat(width);
113
+ }
114
+
115
+ export function createSession(opts = {}) {
116
+ const rl = createInterface({
117
+ input: opts.input ?? process.stdin,
118
+ output: opts.output ?? process.stdout,
119
+ });
120
+ function question(prompt) {
121
+ return new Promise(resolve => {
122
+ rl.question(prompt, answer => resolve(answer.trim()));
123
+ });
124
+ }
125
+ return {
126
+ async confirm(text, defaultY = true) {
127
+ const answer = await question(`${text} [${defaultY ? 'Y/n' : 'y/N'}] `);
128
+ if (!answer) return defaultY;
129
+ return answer.toLowerCase().startsWith('y');
130
+ },
131
+ async readText(prompt) { return question(prompt); },
132
+ async multiSelect(title, choices) {
133
+ process.stdout.write(`\n${title}\n\n`);
134
+ choices.forEach((c, i) => {
135
+ const desc = c.description ? ` — ${c.description}` : '';
136
+ process.stdout.write(` ${i + 1}. ${c.label}${desc}\n`);
137
+ });
138
+ process.stdout.write(`\n [A] All [1,2,3...] pick [S] Skip\n\n`);
139
+ const answer = await question(' > ');
140
+ if (!answer) return choices.map((_, i) => i);
141
+ if (answer.toLowerCase() === 'a') return choices.map((_, i) => i);
142
+ if (answer.toLowerCase() === 's') return [];
143
+ return answer.split(',')
144
+ .map(n => parseInt(n.trim(), 10) - 1)
145
+ .filter(n => !isNaN(n) && n >= 0 && n < choices.length);
146
+ },
147
+ async numberedInput(prompt, maxN) {
148
+ const answer = await question(prompt);
149
+ if (!answer) return [];
150
+ return answer.split(',')
151
+ .map(n => parseInt(n.trim(), 10) - 1)
152
+ .filter(n => !isNaN(n) && n >= 0 && n < maxN);
153
+ },
154
+ close() { rl.close(); },
155
+ };
156
+ }
@@ -0,0 +1,107 @@
1
+ // lib/wizard/registry-embeddings.js
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import os from 'os';
5
+ import { fileURLToPath } from 'url';
6
+ import { BookLibSearcher } from '../engine/searcher.js';
7
+
8
+ const PACKAGE_ROOT = path.resolve(fileURLToPath(import.meta.url), '..', '..', '..');
9
+ const CACHE_PATH = path.join(os.homedir(), '.booklib', 'registry-embeddings.json');
10
+
11
+ /**
12
+ * Extracts description from SKILL.md frontmatter.
13
+ * Exported for testing.
14
+ */
15
+ export function extractDescription(content) {
16
+ // Try inline: description: some text on one line
17
+ const inline = content.match(/^description:\s+(?!>)(.+)$/m);
18
+ if (inline?.[1]?.trim()) return inline[1].trim();
19
+
20
+ // Try YAML folded scalar: description: >\n line one\n line two
21
+ const folded = content.match(/^description:\s*>\s*\n((?:[ \t]+[^\n]*\n?)+)/m);
22
+ if (folded) {
23
+ return folded[1]
24
+ .split('\n')
25
+ .map(l => l.trim())
26
+ .filter(Boolean)
27
+ .join(' ')
28
+ .slice(0, 200);
29
+ }
30
+
31
+ return null;
32
+ }
33
+
34
+ /**
35
+ * Returns unified skill catalog: bundled skills + community registry.
36
+ * Each entry: { name, description, source: 'bundled'|'registry', entry? }
37
+ */
38
+ export function loadSkillCatalog() {
39
+ const skills = [];
40
+ const seen = new Set();
41
+
42
+ // 1. Bundled skills from package's skills/ directory
43
+ const skillsDir = path.join(PACKAGE_ROOT, 'skills');
44
+ try {
45
+ for (const name of fs.readdirSync(skillsDir)) {
46
+ const skillFile = path.join(skillsDir, name, 'SKILL.md');
47
+ if (!fs.existsSync(skillFile)) continue;
48
+ const content = fs.readFileSync(skillFile, 'utf8');
49
+ const description = extractDescription(content);
50
+ if (description && !seen.has(name)) {
51
+ skills.push({ name, description, source: 'bundled' });
52
+ seen.add(name);
53
+ }
54
+ }
55
+ } catch { /* skip if skills dir missing */ }
56
+
57
+ // 2. Community registry
58
+ const registryPath = path.join(PACKAGE_ROOT, 'community', 'registry.json');
59
+ try {
60
+ const raw = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
61
+ const entries = Array.isArray(raw) ? raw : raw.skills ?? [];
62
+ for (const entry of entries) {
63
+ if (entry.name && entry.description && !seen.has(entry.name)) {
64
+ skills.push({ name: entry.name, description: entry.description, source: 'registry', entry });
65
+ seen.add(entry.name);
66
+ }
67
+ }
68
+ } catch { /* skip */ }
69
+
70
+ return skills;
71
+ }
72
+
73
+ /**
74
+ * Loads (or computes) embeddings for every skill in the catalog.
75
+ * Caches result to ~/.booklib/registry-embeddings.json.
76
+ *
77
+ * @param {Function} [onProgress] - (done: number, total: number) => void
78
+ * @returns {Promise<Map<string, number[]>>}
79
+ */
80
+ export async function getEmbeddings(onProgress) {
81
+ const catalog = loadSkillCatalog();
82
+ const cached = _loadCache();
83
+ const result = new Map(Object.entries(cached));
84
+ const missing = catalog.filter(s => !result.has(s.name));
85
+
86
+ if (missing.length > 0) {
87
+ const searcher = new BookLibSearcher();
88
+ for (let i = 0; i < missing.length; i++) {
89
+ result.set(missing[i].name, await searcher.getEmbedding(missing[i].description));
90
+ onProgress?.(i + 1, missing.length);
91
+ }
92
+ _saveCache(Object.fromEntries(result));
93
+ }
94
+
95
+ return result;
96
+ }
97
+
98
+ function _loadCache() {
99
+ try { return JSON.parse(fs.readFileSync(CACHE_PATH, 'utf8')); } catch { return {}; }
100
+ }
101
+
102
+ function _saveCache(data) {
103
+ try {
104
+ fs.mkdirSync(path.dirname(CACHE_PATH), { recursive: true });
105
+ fs.writeFileSync(CACHE_PATH, JSON.stringify(data));
106
+ } catch { /* best-effort */ }
107
+ }
@@ -0,0 +1,69 @@
1
+ // lib/wizard/skill-recommender.js
2
+ import { BookLibSearcher } from '../engine/searcher.js';
3
+ import { loadSkillCatalog, getEmbeddings } from './registry-embeddings.js';
4
+
5
+ export const SKILL_LIMIT = 32;
6
+
7
+ /**
8
+ * Cosine similarity between two vectors. Exported for testing.
9
+ */
10
+ export function cosine(a, b) {
11
+ let dot = 0, na = 0, nb = 0;
12
+ for (let i = 0; i < a.length; i++) {
13
+ dot += a[i] * b[i];
14
+ na += a[i] * a[i];
15
+ nb += b[i] * b[i];
16
+ }
17
+ return dot / (Math.sqrt(na) * Math.sqrt(nb) || 1);
18
+ }
19
+
20
+ /**
21
+ * Filters and ranks pre-scored catalog by installed exclusion and slot limit.
22
+ * Exported for testing.
23
+ *
24
+ * @param {Array<{name, score}>} catalog - already scored entries
25
+ * @param {{ installedNames: string[], available: number }} opts
26
+ */
27
+ export function filterAndRank(catalog, { installedNames = [], available = SKILL_LIMIT } = {}) {
28
+ const installed = new Set(installedNames.map(n => n.toLowerCase()));
29
+ return catalog
30
+ .filter(s => !installed.has(s.name.toLowerCase()))
31
+ .sort((a, b) => (b.score ?? 0) - (a.score ?? 0))
32
+ .slice(0, available);
33
+ }
34
+
35
+ /**
36
+ * Returns ranked skill recommendations.
37
+ *
38
+ * @param {string} query - Free-text user goal (may be empty)
39
+ * @param {object} opts
40
+ * @param {string[]} opts.languages - Detected project languages
41
+ * @param {string[]} opts.installedNames - Already-installed skill names to exclude
42
+ * @param {number} opts.slotsUsed - Current installed slot count
43
+ * @param {Function} [opts.onEmbeddingProgress] - (done, total) => void
44
+ * @returns {Promise<Array<{name, description, source, score, entry?}>>}
45
+ */
46
+ export async function recommend(query, {
47
+ languages = [],
48
+ installedNames = [],
49
+ slotsUsed = 0,
50
+ onEmbeddingProgress,
51
+ } = {}) {
52
+ const catalog = loadSkillCatalog();
53
+ const embeddings = await getEmbeddings(onEmbeddingProgress);
54
+ const available = Math.max(0, SKILL_LIMIT - slotsUsed);
55
+
56
+ // Build query: user text + language hints
57
+ const queryText = [query, ...languages.map(l => `${l} programming`)].filter(Boolean).join('. ')
58
+ || 'software engineering best practices';
59
+
60
+ const searcher = new BookLibSearcher();
61
+ const queryVec = await searcher.getEmbedding(queryText);
62
+
63
+ const scored = catalog.map(s => ({
64
+ ...s,
65
+ score: embeddings.has(s.name) ? cosine(queryVec, embeddings.get(s.name)) : 0,
66
+ }));
67
+
68
+ return filterAndRank(scored, { installedNames, available });
69
+ }
package/llms-full.txt ADDED
@@ -0,0 +1,254 @@
1
+ # BookLib Full Skill Catalog
2
+
3
+ An open knowledge ecosystem for AI coding agents. Packages expert knowledge from canonical books as skills, with a discovery engine for community sources, semantic search, and orchestrator compatibility (obra/superpowers, ruflo).
4
+
5
+ This file contains detailed descriptions and triggers for every bundled skill, plus documentation of the discovery system and CLI commands, optimized for RAG retrieval.
6
+
7
+ ## Skill: animation-at-work
8
+ **Description**: Apply web animation principles from Animation at Work by Rachel Nabors. Covers human perception of motion, 12 principles of animation, animation patterns (transitions, supplements, feedback, demonstrations, decorations), CSS transitions, CSS animations, Web Animations API, SVG/Canvas/WebGL, communicating animation with storyboards and motion comps, performance (composite-only properties, will-change, RAIL), accessibility (prefers- reduced-motion, vestibular disorders), and team workflow. Trigger on "animation", "transition", "CSS animation", "keyframe", "easing", "motion design", "web animation", "prefers-reduced-motion", "storyboard", "parallax", "loading animation", "hover effect", "micro-interaction".
9
+
10
+ **Directory**: `skills/animation-at-work/`
11
+
12
+ ---
13
+
14
+ ## Skill: clean-code-reviewer
15
+ **Description**: Reviews code against Robert C. Martin's Clean Code principles. Use when users share code for review, ask for refactoring suggestions, or want to improve code quality. Produces actionable feedback organized by Clean Code principles with concrete before/after examples.
16
+ **Directory**: `skills/clean-code-reviewer/`
17
+
18
+ ---
19
+
20
+ ## Skill: data-intensive-patterns
21
+ **Description**: Generate and review data-intensive application code using patterns from Martin Kleppmann's "Designing Data-Intensive Applications." Use this skill whenever the user asks about data storage engines, replication, partitioning, transactions, distributed systems, batch or stream processing, encoding/serialization, consistency models, consensus, event sourcing, CQRS, change data capture, or anything related to building reliable, scalable, and maintainable data systems. Trigger on phrases like "data-intensive", "replication", "partitioning", "sharding", "LSM-tree", "B-tree", "transaction isolation", "distributed consensus", "stream processing", "batch processing", "event sourcing", "CQRS", "CDC", "change data capture", "serialization format", "schema evolution", "consensus algorithm", "leader election", "total order broadcast", or "data pipeline."
22
+
23
+ **Directory**: `skills/data-intensive-patterns/`
24
+
25
+ ---
26
+
27
+ ## Skill: data-pipelines
28
+ **Description**: Apply Data Pipelines Pocket Reference practices (James Densmore). Covers Infrastructure (Ch 1-2: warehouses, lakes, cloud), Patterns (Ch 3: ETL, ELT, CDC), DB Ingestion (Ch 4: MySQL, PostgreSQL, MongoDB, full/incremental), File Ingestion (Ch 5: CSV, JSON, cloud storage), API Ingestion (Ch 6: REST, pagination, rate limiting), Streaming (Ch 7: Kafka, Kinesis, event-driven), Storage (Ch 8: Redshift, BigQuery, Snowflake), Transforms (Ch 9: SQL, Python, dbt), Validation (Ch 10: Great Expectations, schema checks), Orchestration (Ch 11: Airflow, DAGs, scheduling), Monitoring (Ch 12: SLAs, alerting), Best Practices (Ch 13: idempotency, backfilling, error handling). Trigger on "data pipeline", "ETL", "ELT", "data ingestion", "Airflow", "dbt", "data warehouse", "Kafka streaming", "CDC", "data orchestration".
29
+
30
+ **Directory**: `skills/data-pipelines/`
31
+
32
+ ---
33
+
34
+ ## Skill: design-patterns
35
+ **Description**: Apply and review GoF design patterns from Head First Design Patterns. Use for Creational patterns (Factory Method, Abstract Factory, Singleton, Builder, Prototype), Structural patterns (Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy), Behavioral patterns (Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor), compound patterns (MVC), and OO design principles. Trigger on "design pattern", "GoF", "Gang of Four", "factory", "singleton", "observer", "strategy", "decorator", "adapter", "facade", "proxy", "composite", "command", "iterator", "state", "template method", "builder", "prototype", "bridge", "flyweight", "mediator", "memento", "visitor", "chain of responsibility", "interpreter", "MVC", "refactor to pattern", or "code smells."
36
+
37
+ **Directory**: `skills/design-patterns/`
38
+
39
+ ---
40
+
41
+ ## Skill: domain-driven-design
42
+ **Description**: Design and review software using patterns from Eric Evans' "Domain-Driven Design." Use for DDD tactical patterns (Entities, Value Objects, Aggregates, Repositories, Factories, Domain Services), strategic patterns (Bounded Context, Context Map, Anticorruption Layer, Shared Kernel, Open Host Service), supple design (Intention-Revealing Interfaces, Side-Effect-Free Functions, Closure of Operations), distillation (Core Domain, Segregated Core), large-scale structure (Responsibility Layers, Knowledge Level), and Ubiquitous Language. Trigger on "DDD", "domain-driven design", "bounded context", "aggregate root", "value object", "entity", "repository pattern", "domain service", "anticorruption layer", "context map", "ubiquitous language", "core domain", "specification pattern", "supple design", "layered architecture", or "strategic design."
43
+
44
+ **Directory**: `skills/domain-driven-design/`
45
+
46
+ ---
47
+
48
+ ## Skill: effective-java
49
+ **Description**: Generate and review Java code using patterns and best practices from Joshua Bloch's "Effective Java" (3rd Edition). Use this skill whenever the user asks about Java best practices, API design, object creation patterns, generics, enums, lambdas, streams, concurrency, serialization, method design, exception handling, or writing clean, maintainable Java code. Trigger on phrases like "Effective Java", "Java best practices", "builder pattern", "static factory", "defensive copy", "immutable class", "enum type", "generics", "bounded wildcard", "PECS", "stream pipeline", "optional", "thread safety", "serialization proxy", "checked exception", "try-with-resources", "composition over inheritance", "method reference", "functional interface", or "Java API design."
50
+
51
+ **Directory**: `skills/effective-java/`
52
+
53
+ ---
54
+
55
+ ## Skill: effective-kotlin
56
+ **Description**: Apply Effective Kotlin best practices (Marcin Moskała, 2nd Ed). Covers Safety (Items 1-10: mutability, scope, nulls, types, expectations, errors, resources, tests), Readability (Items 11-18: operators, receivers, properties, naming), Reusability (Items 19-25: DRY, generics, delegation, variance), Abstraction (Items 26-32: levels, stability, visibility, contracts), Object Creation (Items 33-35: factories, constructors, DSLs), Class Design (Items 36-44: composition, data classes, sealed hierarchies, equals/hashCode/compareTo, extensions), Efficiency (Items 45-52: object creation, inline, sequences, collections). Trigger on "Effective Kotlin", "Kotlin best practice", "Kotlin idiom", "Kotlin style", "Kotlin review", "Kotlin safety", "Kotlin performance", "Kotlin readability", or "Kotlin design".
57
+
58
+ **Directory**: `skills/effective-kotlin/`
59
+
60
+ ---
61
+
62
+ ## Skill: effective-python
63
+ **Description**: Review existing Python code and write new Python code following the 90 best practices from "Effective Python" by Brett Slatkin (2nd Edition). Use when writing Python, reviewing Python code, or wanting idiomatic, Pythonic solutions.
64
+ **Directory**: `skills/effective-python/`
65
+
66
+ ---
67
+
68
+ ## Skill: effective-typescript
69
+ **Description**: Review existing TypeScript code and write new TypeScript following the 62 items from "Effective TypeScript" by Dan Vanderkam. Use when writing TypeScript, reviewing TypeScript code, working with type design, avoiding any, managing type declarations, or migrating JavaScript to TypeScript. Trigger on: "TypeScript best practices", "type safety", "any", "type assertions", "type design", "strict mode", "TypeScript review", "migrate to TypeScript".
70
+
71
+ **Directory**: `skills/effective-typescript/`
72
+
73
+ ---
74
+
75
+ ## Skill: kotlin-in-action
76
+ **Description**: Apply Kotlin In Action practices (Elizarov, Isakova, Aigner, Jemerov, 2nd Ed). Covers Basics (Ch 1-3: functions, extensions, default args), Classes (Ch 4: sealed, data, delegation, companion objects), Lambdas (Ch 5-6: functional APIs, sequences, scope functions), Nullability (Ch 7-8: safe calls, Elvis, platform types, primitives), Conventions (Ch 9: operators, delegated properties), Higher-Order (Ch 10: inline, noinline, crossinline), Generics (Ch 11: variance, reified), Reflection (Ch 12: KClass, KProperty), DSLs (Ch 13: receivers, @DslMarker), Coroutines (Ch 14: structured concurrency, dispatchers, cancellation), Flows (Ch 15: operators, StateFlow, SharedFlow). Trigger on "Kotlin In Action", "Kotlin idiom", "Kotlin coroutine", "Kotlin flow", "Kotlin DSL", "Kotlin generics", "Kotlin null safety", "Kotlin delegation", "Kotlin inline", or "Kotlin extension".
77
+
78
+ **Directory**: `skills/kotlin-in-action/`
79
+
80
+ ---
81
+
82
+ ## Skill: lean-startup
83
+ **Description**: Apply The Lean Startup practices (Eric Ries). Covers Vision (Ch 1-4: Start, Define, Learn, Experiment — validated learning, Build-Measure-Learn loop), Steer (Ch 5-8: Leap of faith assumptions, MVP testing, innovation accounting, pivot or persevere decisions), Accelerate (Ch 9-14: small batches, engines of growth — sticky/viral/paid, adaptive organization, Five Whys, innovation sandbox, startup within enterprise). Trigger on "lean startup", "MVP", "minimum viable product", "validated learning", "pivot", "Build-Measure-Learn", "innovation accounting", "product-market fit", "startup strategy", "lean methodology", "growth engine", "Five Whys".
84
+
85
+ **Directory**: `skills/lean-startup/`
86
+
87
+ ---
88
+
89
+ ## Skill: microservices-patterns
90
+ **Description**: Generate and review microservices code using patterns from Chris Richardson's "Microservices Patterns." Use this skill whenever the user asks about microservices architecture, wants to generate service code, design distributed systems, review microservices code, implement sagas, set up CQRS, configure API gateways, handle inter-service communication, or anything related to breaking apart monoliths. Trigger on phrases like "microservice", "saga pattern", "event sourcing", "CQRS", "API gateway", "service mesh", "domain-driven design for services", "distributed transactions", "decompose my monolith", or "review my microservice."
91
+
92
+ **Directory**: `skills/microservices-patterns/`
93
+
94
+ ---
95
+
96
+ ## Skill: programming-with-rust
97
+ **Description**: Write and review Rust code using practices from "Programming with Rust" by Donis Marshall. Covers ownership, borrowing, lifetimes, error handling with Result/Option, traits, generics, pattern matching, closures, fearless concurrency, and macros. Use when writing Rust, reviewing Rust code, or learning Rust idioms. Trigger on: "Rust", "ownership", "borrow checker", "lifetimes", "Result", "Option", "traits", "fearless concurrency", ".rs files", "cargo".
98
+
99
+ **Directory**: `skills/programming-with-rust/`
100
+
101
+ ---
102
+
103
+ ## Skill: refactoring-ui
104
+ **Description**: Apply UI design principles from Refactoring UI by Adam Wathan & Steve Schoger. Covers visual hierarchy (size, weight, color, spacing), layout systems (spacing scales, grids), typography (type scales, line-height, alignment), color (HSL palettes, shade systems, accessible contrast), depth (shadow elevation, overlap), images (text on images, user content, icons), and finishing touches (accent borders, empty states, fewer borders). Trigger on "UI design", "visual hierarchy", "spacing system", "type scale", "color palette", "shadow", "layout", "design system", "component design", "card design", "form design", "button design", "refactoring UI", "design tokens", "dark mode", "responsive design".
105
+
106
+ **Directory**: `skills/refactoring-ui/`
107
+
108
+ ---
109
+
110
+ ## Skill: rust-in-action
111
+ **Description**: Write and review Rust code using systems programming concepts from "Rust in Action" by Tim McNamara. Covers language foundations, ownership and borrowing, smart pointers, data representation (bits, endianness, floats), memory (stack/heap/virtual), file I/O, networking (TCP/HTTP), concurrency (threads/closures), and OS-level programming. Use when writing systems-level Rust, working with binary data, raw pointers, file formats, network protocols, or low-level memory. Trigger on: "Rust", "systems programming", "smart pointers", "endianness", "bit manipulation", "TCP", "raw pointers", "serde", "borrow checker", "ownership", "concurrency", "kernel", ".rs files", "cargo".
112
+
113
+ **Directory**: `skills/rust-in-action/`
114
+
115
+ ---
116
+
117
+ ## Skill: skill-router
118
+ **Description**: Select the 1-2 most relevant booklib for a given file, PR, or task. Use before applying any skill when unsure which book's lens applies, or when multiple skills could apply. Trigger on "which skill", "which book", "route this", "what skill should I use", or whenever a user describes a task without specifying a skill. Returns a ranked recommendation with rationale and anti-triggers.
119
+
120
+ **Directory**: `skills/skill-router/`
121
+
122
+ ---
123
+
124
+ ## Skill: spring-boot-in-action
125
+ **Description**: Write and review Spring Boot applications using practices from "Spring Boot in Action" by Craig Walls. Covers auto-configuration, starter dependencies, externalizing configuration with properties and profiles, Spring Security, testing with MockMvc and @SpringBootTest, Spring Actuator for production observability, and deployment strategies (JAR, WAR, Cloud Foundry). Use when building Spring Boot apps, configuring beans, writing integration tests, setting up health checks, or deploying to production. Trigger on: "Spring Boot", "Spring", "@SpringBootApplication", "auto-configuration", "application.properties", "application.yml", "@RestController", "@Service", "@Repository", "SpringBootTest", "Actuator", "starter", ".java files", "Maven", "Gradle".
126
+
127
+ **Directory**: `skills/spring-boot-in-action/`
128
+
129
+ ---
130
+
131
+ ## Skill: storytelling-with-data
132
+ **Description**: Apply data visualization and storytelling principles from Storytelling with Data by Cole Nussbaumer Knaflic. Covers choosing effective visuals (line, bar, table, scatterplot), eliminating clutter (Gestalt principles, data-ink ratio), focusing attention (preattentive attributes, strategic color), thinking like a designer (affordances, alignment, white space), and narrative structure (three-act story, horizontal/vertical logic, Big Idea). Trigger on "data visualization", "chart design", "dashboard design", "data storytelling", "presentation chart", "declutter chart", "bar chart", "line chart", "data narrative", "slide deck data", "chart review", "viz critique", "storytelling with data".
133
+
134
+ **Directory**: `skills/storytelling-with-data/`
135
+
136
+ ---
137
+
138
+ ## Skill: system-design-interview
139
+ **Description**: Apply system design principles from System Design Interview by Alex Xu. Covers scaling (load balancing, DB replication, sharding, caching, CDN), estimation (QPS, storage, bandwidth), the 4-step framework, and 12 real designs: rate limiter, consistent hashing, key-value store, unique ID generator, URL shortener, web crawler, notification system, news feed, chat system, search autocomplete, YouTube, Google Drive. Trigger on "system design", "scale", "high-level design", "distributed system", "rate limiter", "consistent hashing", "back-of-envelope", "QPS", "sharding", "load balancer", "CDN", "cache", "message queue", "web crawler", "news feed", "chat system", "autocomplete", "URL shortener".
140
+
141
+ **Directory**: `skills/system-design-interview/`
142
+
143
+ ---
144
+
145
+ ## Skill: using-asyncio-python
146
+ **Description**: Apply Using Asyncio in Python practices (Caleb Hattingh). Covers Introducing Asyncio (Ch 1: what it is, I/O-bound concurrency), Threads (Ch 2: drawbacks, race conditions, GIL, ThreadPoolExecutor), Asyncio Walk-Through (Ch 3: event loop, coroutines, async def/await, tasks, futures, gather, wait, async with, async for, async comprehensions, startup/shutdown, signal handling, executors), Libraries (Ch 4: aiohttp, aiofiles, Sanic, aioredis, asyncpg), Concluding Thoughts (Ch 5), History (App A: generators to async/await), Supplementary (App B). Trigger on "asyncio", "async/await", "event loop", "coroutine", "aiohttp", "async Python", "concurrent I/O", "non-blocking".
147
+
148
+ **Directory**: `skills/using-asyncio-python/`
149
+
150
+ ---
151
+
152
+ ## Skill: web-scraping-python
153
+ **Description**: Apply Web Scraping with Python practices (Ryan Mitchell). Covers First Scrapers (Ch 1: urllib, BeautifulSoup), HTML Parsing (Ch 2: find, findAll, CSS selectors, regex, lambda), Crawling (Ch 3-4: single-domain, cross-site, crawl models), Scrapy (Ch 5: spiders, items, pipelines, rules), Storing Data (Ch 6: CSV, MySQL, files, email), Reading Documents (Ch 7: PDF, Word, encoding), Cleaning Data (Ch 8: normalization, OpenRefine), NLP (Ch 9: n-grams, Markov, NLTK), Forms & Logins (Ch 10: POST, sessions, cookies), JavaScript (Ch 11: Selenium, headless, Ajax), APIs (Ch 12: REST, undocumented), Image/OCR (Ch 13: Pillow, Tesseract), Avoiding Traps (Ch 14: headers, honeypots), Testing (Ch 15: unittest, Selenium), Parallel (Ch 16: threads, processes), Remote (Ch 17: Tor, proxies), Legalities (Ch 18: robots.txt, CFAA, ethics). Trigger on "web scraping", "BeautifulSoup", "Scrapy", "crawler", "spider", "scraper", "parse HTML", "Selenium scraping", "data extraction".
154
+
155
+ **Directory**: `skills/web-scraping-python/`
156
+
157
+ ---
158
+ ---
159
+
160
+ ## Discovery & Community Skills
161
+
162
+ BookLib can discover and fetch skills beyond the 22 bundled ones. As of the current registry, 258 community skills are discoverable.
163
+
164
+ ### Configuration (booklib.config.json)
165
+
166
+ Source types:
167
+ - `registry` — bundled skills (this package)
168
+ - `manifest` — JSON list at a URL or local path; `community/registry.json` ships 258 skills with star counts and role tags
169
+ - `github-skills-dir` — scans a subdirectory of a GitHub repo for SKILL.md files (e.g. obra/superpowers `skills/`, ruvnet/ruflo `.claude/skills/`)
170
+ - `github-org` — scans all public repos in a GitHub org for SKILL.md at root
171
+ - `npm-scope` — searches an npm scope for packages containing SKILL.md
172
+
173
+ Set `GITHUB_TOKEN` env var to raise the GitHub API limit from 60 to 5000 req/hr.
174
+
175
+ ### Discovery Commands
176
+
177
+ - `booklib discover` — list available skills from all configured sources (cached 24h)
178
+ - `booklib discover --refresh` — force re-scan
179
+ - `booklib fetch <name>` — download, index, and sync a specific skill
180
+ - `booklib setup` — fetch all trusted skills at once
181
+
182
+ ---
183
+
184
+ ## Orchestrator Compatibility
185
+
186
+ After `booklib sync`, every fetched skill is written to `~/.claude/skills/<name>/SKILL.md` with clean frontmatter (no internal XML wrappers). A `.booklib` marker file identifies BookLib-managed directories so user-placed skills are never overwritten.
187
+
188
+ Compatible with:
189
+ - **obra/superpowers** — install with `/plugin install superpowers`; skills surface via Claude Code's native Skill tool
190
+ - **ruflo** — install with `npm install -g ruflo`; same Skill tool path
191
+
192
+ ---
193
+
194
+ ## Swarm & Role-Based Profiles
195
+
196
+ ### booklib profile <role>
197
+
198
+ Returns skills most relevant to an agent role. Available roles:
199
+ `architect` · `coder` · `reviewer` · `tester` · `security` · `frontend` · `optimizer` · `devops` · `ai-engineer` · `manager`
200
+
201
+ ### booklib swarm-config [trigger]
202
+
203
+ Maps a swarm trigger to agent roles and their recommended skills. Built-in triggers:
204
+ - `audit` → security-scan · coverage · vulnerability-check
205
+ - `feature` → architect · coder · reviewer · tester
206
+ - `refactor` → reviewer · coder · optimizer
207
+ - `deploy` → devops · security
208
+
209
+ ### booklib init [--orchestrator=obra|ruflo]
210
+
211
+ Generates context files for all AI tools in the project:
212
+ - `CLAUDE.md` — Claude Code
213
+ - `.cursor/rules/booklib-standards.mdc` — Cursor
214
+ - `.github/copilot-instructions.md` — GitHub Copilot
215
+ - `.gemini/context.md` — Gemini CLI
216
+
217
+ With `--orchestrator`, appends install instructions for the chosen framework.
218
+
219
+ ---
220
+
221
+ ## Skill Activation Mechanisms
222
+
223
+ | Mechanism | How it works |
224
+ |-----------|-------------|
225
+ | PreToolUse hook | Fires on every Read/Edit/Write/Bash call; matches file path against skill `filePattern` metadata; injects relevant chunks as `additionalContext`. Fine-grained, automatic, silent. |
226
+ | Skill tool | `Skill("<name>")` returns the full SKILL.md content. Coarse, on-demand, used by orchestrator subagents. Reads from `~/.claude/skills/` after `booklib sync`. |
227
+ | Search | `booklib search "<concept>"` runs vector search over indexed chunks; returns the most relevant passages. |
228
+ | Audit | `booklib audit <skill> <file>` applies a skill's principles to a specific file and reports violations. |
229
+
230
+ ---
231
+
232
+ ## Session Handoff
233
+
234
+ - `booklib save-state --goal="..." --next="..." --progress="..."` — save context snapshot
235
+ - `booklib resume` — restore last session
236
+ - `booklib recover-auto` — auto-recover from session files or git history
237
+ - `booklib sessions-list` — all sessions across agents
238
+ - `booklib sessions-merge <a>,<b> <output>` — merge two session contexts
239
+ - `booklib sessions-lineage <parent> <child> "<note>"` — track session inheritance
240
+ - `booklib sessions-compare <a>,<b> <file> <output>` — compare multi-agent audit findings
241
+
242
+ All session data stored in `.booklib/sessions/` (gitignored).
243
+
244
+ ---
245
+
246
+ ## MCP Server
247
+
248
+ Start: `node bin/booklib-mcp.js`
249
+
250
+ Tools exposed:
251
+ - `search_skills` — semantic search over skill content
252
+ - `audit_content` — apply a skill to arbitrary code content
253
+ - `save_session_state` — persist a handoff snapshot
254
+ - `scan_project` — generate wisdom heatmap for a project directory