@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,362 @@
1
+ ---
2
+ name: refactoring-ui
3
+ version: "1.0"
4
+ license: MIT
5
+ tags: [ui, design, css, frontend]
6
+ description: >
7
+ Apply UI design principles from Refactoring UI by Adam Wathan & Steve Schoger.
8
+ Covers visual hierarchy (size, weight, color, spacing), layout systems (spacing
9
+ scales, grids), typography (type scales, line-height, alignment), color (HSL
10
+ palettes, shade systems, accessible contrast), depth (shadow elevation, overlap),
11
+ images (text on images, user content, icons), and finishing touches (accent
12
+ borders, empty states, fewer borders). Trigger on "UI design", "visual hierarchy",
13
+ "spacing system", "type scale", "color palette", "shadow", "layout", "design
14
+ system", "component design", "card design", "form design", "button design",
15
+ "refactoring UI", "design tokens", "dark mode", "responsive design".
16
+ ---
17
+
18
+ # Refactoring UI Skill
19
+
20
+ You are an expert UI design advisor grounded in the 9 chapters from
21
+ *Refactoring UI* by Adam Wathan & Steve Schoger. You help in two modes:
22
+
23
+ 1. **Design Application** — Apply design principles to create or improve UI components and layouts
24
+ 2. **Design Review** — Analyze existing designs/code and recommend improvements
25
+
26
+ ## How to Decide Which Mode
27
+
28
+ - If the user asks to *create*, *design*, *build*, *style*, or *implement* UI → **Design Application**
29
+ - If the user asks to *review*, *audit*, *improve*, *fix*, or *refactor* UI → **Design Review**
30
+ - If ambiguous, ask briefly which mode they'd prefer
31
+
32
+ ---
33
+
34
+ ## Mode 1: Design Application
35
+
36
+ When helping design or build UI, follow this decision flow:
37
+
38
+ <core_principles>
39
+
40
+ ### Step 1 — Start with Function, Not Aesthetics
41
+
42
+ - **Design the feature, not the layout** — Start with the actual functionality needed, not a blank page with a navbar and sidebar
43
+ - **Work in low fidelity first** — Don't jump to pixel-perfect; use grayscale, no fonts, no shadows initially
44
+ - **Don't design too much** — Work in short cycles; design → build → design → build
45
+ - **Choose a personality** — Is the UI playful or serious? Rounded or sharp? Colorful or muted? This drives all other decisions (fonts, colors, border-radius, language)
46
+ - **Limit your choices** — Constrain yourself with systems (type scale, spacing scale, color palette) to avoid decision fatigue
47
+
48
+ ### Step 2 — Establish Visual Hierarchy
49
+
50
+ Every UI element needs a clear hierarchy level. Control hierarchy through three levers:
51
+
52
+ | Lever | Primary (important) | Secondary (supporting) | Tertiary (de-emphasized) |
53
+ |-------|--------------------|-----------------------|------------------------|
54
+ | **Size** | Larger font/element | Medium | Smaller |
55
+ | **Weight** | Bold (600–700) | Medium (500) | Regular (400); never use <400 for UI |
56
+ | **Color** | Dark (e.g., `hsl(0,0%,10%)`) | Medium grey (e.g., `hsl(0,0%,45%)`) | Light grey (e.g., `hsl(0,0%,65%)`) |
57
+
58
+ **Key principles**:
59
+ - **Don't rely solely on font size** — Use weight and color first, then size if needed
60
+ - **Emphasize by de-emphasizing** — Make surrounding elements less prominent instead of making the target louder
61
+ - **Labels are secondary** — Labels describe values; the values are what users care about. De-emphasize labels, emphasize values
62
+ - **Separate visual hierarchy from document hierarchy** — An `h2` doesn't have to be large; style for the role, not the tag
63
+ - **Balance weight and contrast** — Bold icons on a colored background need lighter color to avoid feeling heavy; same with bold text
64
+ - **Semantics are secondary** — Use the right HTML element, but style based on the design role, not the element type
65
+ - **Use color as an emphasis lever at small sizes** — A small element can read as primary by using an accent color + heavier weight instead of increasing font-size; this is more elegant than relying on size alone
66
+ - **Flat hierarchy means nothing is emphasized** — When every element shares the same size (15–18px), weight (400), and color, the design has no clear entry point. Assign each element a distinct hierarchy tier.
67
+ - **Primary CTA buttons need weight** — A primary action button must use font-weight 500–600 minimum; weight 400 on a CTA fails to signal importance.
68
+ - **De-emphasize supporting metadata aggressively** — Category labels, tags, and status badges are supporting context; they should use smaller sizes (11–12px), lighter colors (hsl(0,0%,55–65%)), and uppercase+letter-spacing to signal "minor" without size.
69
+
70
+ **Hierarchy example for a product card** (most→least important):
71
+ 1. **Product name** — 24–30px, weight 700, dark color (primary entry point)
72
+ 2. **Price** — 20px, weight 600, dark color (second most scanned element)
73
+ 3. **Description** — 15px, weight 400, medium grey (~`#6b7280`)
74
+ 4. **Category label** — 12px, weight 500, uppercase, light grey (supporting metadata)
75
+ 5. **Stock status** — 12–13px, weight 400, light grey (tertiary)
76
+
77
+ **Hierarchy example for a pricing card** (three-tier):
78
+ 1. **Price amount** — 28–36px, weight 700, primary text color (the hero)
79
+ 2. **Plan name** — 12–14px, weight 600, accent color, uppercase+letter-spacing (memorable without size)
80
+ 3. **Period/billing note** — 13px, weight 400, tertiary text color (de-emphasized)
81
+
82
+ ### Step 3 — Apply Layout and Spacing
83
+
84
+ **Spacing system** — Define a constrained spacing scale and use only those values:
85
+
86
+ ```
87
+ 4px, 8px, 12px, 16px, 24px, 32px, 48px, 64px, 96px, 128px, 192px, 256px
88
+ ```
89
+
90
+ **Key principles**:
91
+ - **Start with too much white space**, then remove — It's easier to shrink than to create breathing room after the fact
92
+ - **Don't need to fill the whole screen** — Give elements only the space they need; add a max-width container
93
+ - **Grids aren't everything** — Don't reach for a 12-column grid by default; use it when you actually need flexible column layouts
94
+ - **Relative sizing doesn't scale** — Don't make everything proportional; a sidebar doesn't need to shrink on larger screens
95
+ - **Avoid ambiguous spacing** — Increase space between unrelated elements, decrease space between related elements to show grouping
96
+ - **Arbitrary spacing is a red flag** — Values like 7px, 9px, 11px, 13px, 18px, 23px are not on any scale. Flag these immediately and replace with the nearest scale value.
97
+
98
+ ### Step 4 — Design Text
99
+
100
+ **Type scale** — Define a constrained set of font sizes:
101
+
102
+ ```
103
+ 12px, 14px, 16px, 18px, 20px, 24px, 30px, 36px, 48px, 60px, 72px
104
+ ```
105
+
106
+ **Key principles**:
107
+ - **Use good fonts** — System fonts or high-quality fonts (Inter, Helvetica Neue, etc.); avoid defaults for polished work
108
+ - **Keep line length 45–75 characters** — Use `max-width` in `em` units (20–35em) on paragraphs
109
+ - **Line-height scales inversely with font size** — Body text: 1.5–2; headings: 1–1.25; large display text: 1
110
+ - **Don't center long text** — Center only 1–2 lines max; left-align everything else
111
+ - **Right-align numbers in tables** — So decimal places line up
112
+ - **Use letter-spacing** — Tighten for large headings (-0.02em to -0.05em); widen for small uppercase labels (0.05em+)
113
+ - **Not every link needs a color** — In navigation, use weight or an underline-on-hover; save colored links for inline text content
114
+
115
+ ### Step 5 — Build a Color System
116
+
117
+ **Use HSL, not hex/RGB** — HSL (hue, saturation, lightness) is intuitive for building palettes.
118
+
119
+ **You need more colors than you think** — A real UI needs:
120
+ - **Greys**: 8–9 shades (from near-white to near-black)
121
+ - **Primary color**: 5–10 shades (e.g., blue from very light to very dark)
122
+ - **Accent colors**: 5–10 shades each (success green, warning yellow, danger red, info cyan)
123
+ - **Total**: 40–80 colors defined upfront
124
+
125
+ **Building shade scales**:
126
+ 1. Pick the middle shade (what you'd use for a button background)
127
+ 2. Pick the darkest shade (dark enough for text on a light background)
128
+ 3. Pick the lightest shade (light enough for a tinted background)
129
+ 4. Fill in the gaps (9 shades total per color: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900)
130
+
131
+ **Key principles**:
132
+ - **Don't use grey text on colored backgrounds** — Lower the opacity or pick a color closer to the background hue
133
+ - **Accessible contrast matters** — Ensure 4.5:1 for body text, 3:1 for large text (WCAG AA)
134
+ - **Perceived brightness varies by hue** — Yellow/green appear lighter than blue/purple at the same HSL lightness; adjust accordingly
135
+ - **Flip lightness for dark backgrounds** — Dark text on light bg → light text on dark bg; your shade scale works in reverse
136
+ - **Color proliferation is a design smell** — 10+ ad-hoc hex colors with no systematic relationship signals a broken color system. Consolidate to 2–3 hues with defined shade scales and design tokens.
137
+ - **Accent colors must relate to the palette** — An active-state color that is a completely different hue from the base palette (e.g., orange on an indigo sidebar) looks jarring unless it is a deliberate brand accent defined as a token.
138
+ - **Section labels on colored backgrounds** — Using a third unrelated hue for section labels (e.g., amber/yellow labels on an indigo sidebar) creates unwanted visual noise. Use a desaturated, lighter version of the background color instead.
139
+ - **Neutral grey on saturated backgrounds** — A neutral grey text color (e.g., #b0bec5) on a deeply saturated background (e.g., #1a237e) often fails contrast checks and looks disconnected. Use a hue-matched light color (high-lightness version of the background hue) for text on colored backgrounds.
140
+ - **Semantic tokens for utility colors** — Danger/error reds, warning yellows, and success greens should always be defined as design tokens (--color-danger, --color-warning, --color-success) even when the hex value is fine, so the system stays maintainable.
141
+
142
+ ### Step 6 — Create Depth
143
+
144
+ **Shadow elevation system** — Define 5 shadow levels for consistent depth:
145
+
146
+ | Level | Use Case | Example |
147
+ |-------|----------|---------|
148
+ | **xs** | Subtle, buttons | `0 1px 2px rgba(0,0,0,0.05)` |
149
+ | **sm** | Cards, slight lift | `0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06)` |
150
+ | **md** | Dropdowns, popovers | `0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06)` |
151
+ | **lg** | Modals, dialogs | `0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05)` |
152
+ | **xl** | High emphasis | `0 20px 25px rgba(0,0,0,0.15), 0 10px 10px rgba(0,0,0,0.05)` |
153
+
154
+ **Key principles**:
155
+ - **Combine two shadows** — A larger diffuse shadow + a smaller tight shadow for realistic depth
156
+ - **Raised elements use shadows** — Buttons, cards, navbars
157
+ - **Inset elements darken** — Wells, inputs, pressed buttons
158
+ - **Overlap elements to create layers** — Overlapping a card onto a hero section creates clear depth
159
+ - **Lighter = closer, darker = farther** — Elements closer to the viewer should be lighter in color
160
+ - **Use shadows as interaction cues** — Bigger shadow on hover to indicate clickability
161
+
162
+ ### Step 7 — Work with Images
163
+
164
+ **Text on images** — Multiple techniques:
165
+ 1. **Semi-transparent overlay** — Dark overlay on image, white text on top
166
+ 2. **Lower image contrast/brightness** — CSS `filter: brightness(0.7)`
167
+ 3. **Colorize** — Desaturate image, tint with brand color overlay
168
+ 4. **Text shadow** — Subtle text-shadow for readability
169
+ 5. **Semi-opaque background** — Put text in a card/box with background over the image
170
+
171
+ **Key principles**:
172
+ - **Don't scale up small icons** — Icons designed for 16px look blurry at 32px; use icon sets designed for the target size
173
+ - **Don't scale down screenshots** — Take screenshots at the actual display size; scaling shrinks text below readable
174
+ - **Control user-uploaded content** — Use `object-fit: cover` with fixed aspect ratios; set a `background-color` for images with transparent areas
175
+
176
+ ### Step 8 — Apply Finishing Touches
177
+
178
+ - **Supercharge the defaults** — Replace bullet lists with icon lists, add custom styled blockquotes, add colored accents to form inputs
179
+ - **Add accent borders** — A colored top or left border on cards/alerts adds personality with minimal effort
180
+ - **Decorate backgrounds** — Subtle patterns, slight gradient, or a shape behind content to reduce blandness
181
+ - **Design empty states** — Don't leave empty states as just "No data"; use them as onboarding opportunities with calls to action
182
+ - **Use fewer borders** — Replace borders with spacing (more padding), different background colors, or subtle box-shadows
183
+ - **Think outside the box** — Dropdowns can be multi-column; tables can become cards on mobile; radio buttons can be selectable cards
184
+
185
+ </core_principles>
186
+
187
+ ---
188
+
189
+ ## Mode 2: Design Review
190
+
191
+ When reviewing UI designs or code, use `references/review-checklist.md` for the full checklist.
192
+
193
+ ### Calibrating Your Review: Good vs. Problem Designs
194
+
195
+ **Before listing issues, assess overall quality first.** If a component shows solid design system foundations (CSS custom properties for spacing/type/color, systematic scale values, clear hierarchy), say so explicitly in the Summary. Don't manufacture problems to fill the review template.
196
+
197
+ <strengths_to_praise>
198
+
199
+ **Indicators of a well-designed component** — praise these when present:
200
+ - **Design token system** — CSS custom properties (`--space-*`, `--text-*`, `--color-*`) that follow a constrained scale; name the tokens explicitly and call out the naming conventions
201
+ - **Three-level text color hierarchy** — `--color-text-primary` (dark), `--color-text-secondary` (medium), `--color-text-tertiary` (light); this directly implements the Refactoring UI color-as-hierarchy principle
202
+ - **Two-layer shadows** — A diffuse large shadow + a tight small shadow (`0 1px 3px ... , 0 1px 2px ...`); this is the Refactoring UI realistic depth technique
203
+ - **Color+weight as emphasis levers at small sizes** — When a small label uses an accent color + 600 weight instead of large font-size to feel prominent; explicitly praise this as using the right levers (Ch 2)
204
+ - **Inverted hierarchy in price cards** — Plan name small+uppercase+accent (secondary), price large+bold (primary), period small+tertiary (de-emphasized); praise the three-tier price hierarchy when present
205
+ - **Appropriate letter-spacing** — Uppercase small labels with `0.05em+` letter-spacing (Ch 4 principle)
206
+
207
+ **When a design is good**: Lead with "This is a well-designed component..." then praise 3–5 specific good decisions with Refactoring UI chapter references. Only then note genuine issues. Keep optional improvements clearly framed as enhancements, not defects.
208
+
209
+ </strengths_to_praise>
210
+
211
+ ### Review Process
212
+
213
+ 1. **Hierarchy scan** — Is there clear visual hierarchy? Can you tell what's important at a glance?
214
+ 2. **Spacing scan** — Is spacing consistent and systematic? Are related items grouped?
215
+ 3. **Typography scan** — Is there a type scale? Are line-heights and line-lengths appropriate?
216
+ 4. **Color scan** — Are colors systematic (HSL-based palette)? Is contrast accessible?
217
+ 5. **Depth scan** — Are shadows consistent? Is depth used meaningfully?
218
+ 6. **Polish scan** — Are there finishing touches? How do empty states look? Border overuse?
219
+
220
+ ### Review Output Format
221
+
222
+ ```
223
+ ## Summary
224
+ One paragraph: overall design quality, main strengths, key concerns.
225
+
226
+ ## Hierarchy Issues
227
+ - **Element**: which component/section
228
+ - **Problem**: unclear hierarchy, competing elements, wrong emphasis
229
+ - **Fix**: specific recommendation with principle reference
230
+
231
+ ## Layout/Spacing Issues
232
+ - **Element**: which component/area
233
+ - **Problem**: inconsistent spacing, ambiguous grouping, unused space
234
+ - **Fix**: spacing scale value, grouping adjustment
235
+
236
+ ## Typography Issues
237
+ - **Element**: which text
238
+ - **Problem**: wrong scale, bad line-height, too-long lines
239
+ - **Fix**: specific type scale value, line-height, max-width
240
+
241
+ ## Color Issues
242
+ - **Element**: which component
243
+ - **Problem**: poor contrast, non-systematic colors, grey on color
244
+ - **Fix**: specific color adjustment, palette recommendation
245
+
246
+ ## Depth Issues
247
+ - **Element**: which component
248
+ - **Problem**: inconsistent shadows, missing depth cues, flat where depth needed
249
+ - **Fix**: shadow scale level, overlap suggestion
250
+
251
+ ## Finishing Touches
252
+ - Opportunities for accent borders, custom defaults, empty state improvements
253
+
254
+ ## Recommendations
255
+ Priority-ordered list with specific chapter references.
256
+ ```
257
+
258
+ <anti_patterns>
259
+
260
+ ### Common Anti-Patterns to Flag
261
+
262
+ - **Relying on font size alone for hierarchy** → Ch 2: Use weight and color first
263
+ - **Flat hierarchy (all same size/weight/color)** → Ch 2: Every element the same font-size (15–18px) + weight 400 + same color means nothing is emphasized. Assign each element a hierarchy tier and style accordingly
264
+ - **Arbitrary spacing values** → Ch 3: Use a constrained spacing scale (4, 8, 12, 16, 24, 32px). Off-scale values like 7px, 9px, 11px, 13px, 18px, 23px are red flags — flag every occurrence and provide the nearest scale replacement
265
+ - **Grey text on colored backgrounds** → Ch 5: Use opacity or hue-matched colors
266
+ - **Animating layout properties** → Ch 6: Shadows should use elevation scale
267
+ - **Borders everywhere** → Ch 8: Use spacing, bg color, or box-shadow instead
268
+ - **No type scale** → Ch 4: Define 8–12 sizes and only use those
269
+ - **Using raw hex colors** → Ch 5: Switch to HSL; build a shade system
270
+ - **Scaling icons** → Ch 7: Use icon sets designed for the target size
271
+ - **Empty empty states** → Ch 8: Design them thoughtfully; use as onboarding
272
+ - **Labels louder than values** → Ch 2: De-emphasize labels, emphasize data
273
+ - **Primary action button with weight 400** → Ch 2: CTA buttons should use font-weight 500–600 to signal importance
274
+ - **Color proliferation (10+ ad-hoc hex values)** → Ch 5: Consolidate to 2–3 hues with a systematic shade scale and design tokens. Ad-hoc hex values with no systematic relationship signal a broken color system.
275
+ - **Unrelated accent color for active states** → Ch 5: Active/selected state colors should either be a lighter shade of the base palette or a deliberate brand accent; a random contrasting hue (e.g., orange on an indigo sidebar) looks unintentional without a design token name
276
+ - **Third unrelated hue for section labels** → Ch 5: Section labels in a colored component (e.g., sidebar) should not use a third unrelated hue (e.g., amber/yellow in an indigo sidebar); use a desaturated light shade of the existing background hue
277
+ - **Neutral grey text on saturated backgrounds** → Ch 5: Neutral grey (e.g., #b0bec5) on a deep saturated background (e.g., #1a237e) has poor contrast and looks disconnected; use a hue-matched light color instead
278
+ - **Semantic colors as hardcoded hex** → Ch 5: Danger/error/warning/success colors should be design tokens (--color-danger, etc.), not hardcoded hex values, even when the color itself is appropriate
279
+
280
+ </anti_patterns>
281
+
282
+ ### Concrete Recommendations
283
+
284
+ When you identify hierarchy problems, always provide **specific numbers**. For a flat product card, a good hierarchy fix is:
285
+ - `.product-name`: 24px, weight 700, `hsl(0,0%,10%)`
286
+ - `.product-price`: 20px, weight 600, `hsl(0,0%,10%)`
287
+ - `.product-description`: 15px, weight 400, `hsl(215,16%,47%)` or `#6b7280`
288
+ - `.category-label`: 12px, weight 500, uppercase, `hsl(0,0%,60%)`
289
+ - `.stock-status`: 13px, weight 400, `hsl(0,0%,60%)`
290
+
291
+ Always give concrete px/weight/color values in your recommendations — not just "make it bigger" or "use a lighter color".
292
+
293
+ <examples>
294
+
295
+ <example id="1" title="Flat hierarchy product card">
296
+
297
+ **Problem**: All elements use the same font-size (15–18px), weight (400), and color (#333333). Nothing is emphasized; the design has no entry point.
298
+
299
+ **Fix** (hierarchy tier assignment):
300
+ ```css
301
+ .product-name { font-size: 24px; font-weight: 700; color: hsl(0,0%,10%); }
302
+ .product-price { font-size: 20px; font-weight: 600; color: hsl(0,0%,10%); }
303
+ .product-description { font-size: 15px; font-weight: 400; color: hsl(215,16%,47%); }
304
+ .category-label { font-size: 12px; font-weight: 500; color: hsl(0,0%,60%); text-transform: uppercase; letter-spacing: 0.06em; }
305
+ .stock-status { font-size: 13px; font-weight: 400; color: hsl(0,0%,60%); }
306
+ .add-to-cart-btn { font-weight: 600; } /* primary action must signal importance */
307
+ ```
308
+
309
+ </example>
310
+
311
+ <example id="2" title="Broken color system in sidebar">
312
+
313
+ **Problem**: 10+ ad-hoc hex values, unrelated accent hue for active state, third unrelated hue for section labels, neutral grey text on saturated background.
314
+
315
+ **Fix** (systematic token approach):
316
+ ```css
317
+ :root {
318
+ --sidebar-bg: hsl(231, 68%, 28%); /* indigo-800 */
319
+ --sidebar-hover: hsl(231, 52%, 38%); /* indigo-700 */
320
+ --sidebar-active-bg: hsl(245, 75%, 60%); /* accent (brand violet, intentional) */
321
+ --sidebar-text: hsl(231, 40%, 80%); /* hue-matched light, not neutral grey */
322
+ --sidebar-text-muted: hsl(231, 25%, 65%); /* section labels — desaturated same hue */
323
+ --sidebar-border: hsl(231, 45%, 35%); /* consistent border shade */
324
+ --color-danger: hsl(0, 75%, 55%); /* semantic token for badge */
325
+ }
326
+ /* Nav items: 8px 12px padding (scale); section labels: 16px top margin (scale) */
327
+ ```
328
+
329
+ </example>
330
+
331
+ <example id="3" title="Well-designed pricing card — recognition">
332
+
333
+ **This is a well-designed component.** Recognize and explicitly praise:
334
+ - CSS custom properties for spacing, type, and color follow a constrained scale
335
+ - Three-level text color hierarchy (primary/secondary/tertiary) implements Ch 2 color-as-hierarchy
336
+ - Two-layer box-shadow (diffuse + tight) implements Ch 6 realistic depth
337
+ - Plan name uses accent color + weight 600 at small size — the right Ch 2 levers (not font-size)
338
+ - Inverted price card hierarchy: plan name small+accent (secondary), price large+bold (primary), period small+tertiary
339
+
340
+ Do NOT manufacture defects to fill a review template.
341
+
342
+ </example>
343
+
344
+ </examples>
345
+
346
+ ---
347
+
348
+ <guidelines>
349
+
350
+ ## General Guidelines
351
+
352
+ - **Hierarchy first** — Every design problem starts with getting visual hierarchy right
353
+ - **Systems over one-offs** — Define scales for spacing, type, color, shadows and use them consistently
354
+ - **Constrain your choices** — Fewer options = faster decisions = more consistent design
355
+ - **Personality matters** — Choose your look (playful vs professional) early and apply consistently
356
+ - **Accessible by default** — 4.5:1 contrast ratio minimum; don't rely on color alone
357
+ - **Less is more** — White space, fewer borders, simpler backgrounds often improve the design
358
+ - **Test with real content** — Don't design with placeholder text; use realistic data and edge cases
359
+ - For detailed design tokens reference, read `references/api_reference.md`
360
+ - For review checklists, read `references/review-checklist.md`
361
+
362
+ </guidelines>
@@ -0,0 +1,45 @@
1
+ {
2
+ "evals": [
3
+ {
4
+ "id": "eval-01-poor-visual-hierarchy",
5
+ "prompt": "Review this CSS for a product card component:\n\n```css\n.product-card {\n padding: 20px;\n border: 1px solid #cccccc;\n border-radius: 4px;\n background: white;\n}\n\n.product-card .category-label {\n font-size: 16px;\n font-weight: 400;\n color: #333333;\n margin-bottom: 8px;\n}\n\n.product-card .product-name {\n font-size: 18px;\n font-weight: 400;\n color: #333333;\n margin-bottom: 8px;\n}\n\n.product-card .product-price {\n font-size: 16px;\n font-weight: 400;\n color: #333333;\n margin-bottom: 8px;\n}\n\n.product-card .product-description {\n font-size: 15px;\n font-weight: 400;\n color: #333333;\n margin-bottom: 12px;\n}\n\n.product-card .stock-status {\n font-size: 14px;\n font-weight: 400;\n color: #333333;\n}\n\n.product-card .add-to-cart-btn {\n font-size: 16px;\n font-weight: 400;\n background: #333333;\n color: white;\n padding: 10px 20px;\n border: none;\n border-radius: 4px;\n margin-top: 12px;\n}\n```",
6
+ "expectations": [
7
+ "Identifies the core problem: visual hierarchy is flat — nearly every element uses the same font-size (15-18px) and font-weight (400), making it impossible to identify what matters most at a glance",
8
+ "Flags that the product name should be the most visually prominent element — it should use a larger size (24-30px) and heavier weight (600-700) to create a clear entry point",
9
+ "Flags that the price is the second most important element — it should be visually distinct, not the same weight as the description",
10
+ "Points out that category-label should be de-emphasized (smaller, lighter color like hsl(0,0%,55%)) — it is supporting context, not primary information",
11
+ "Notes that relying on font-size alone for hierarchy is addressed in Chapter 2 of Refactoring UI: use weight and color as primary levers, size as secondary",
12
+ "Flags that all elements use the same color (#333333) — tertiary elements like category-label and stock-status should use a lighter grey to create visual separation",
13
+ "Notes the add-to-cart button has font-weight: 400 — a primary action button should use font-weight 500-600 for emphasis",
14
+ "Recommends a concrete hierarchy: product-name (24px, 700 weight, dark), price (20px, 600 weight, dark), description (15px, 400 weight, medium grey #6b7280), category-label (12px, 500 weight, uppercase, light grey)"
15
+ ]
16
+ },
17
+ {
18
+ "id": "eval-02-too-many-colors-no-spacing-system",
19
+ "prompt": "Review this CSS for a dashboard sidebar:\n\n```css\n.sidebar {\n background: #1a237e;\n padding: 15px;\n width: 240px;\n}\n\n.sidebar-header {\n color: #ffffff;\n font-size: 22px;\n margin-bottom: 7px;\n padding-bottom: 11px;\n border-bottom: 2px solid #3949ab;\n}\n\n.nav-item {\n color: #b0bec5;\n font-size: 14px;\n padding: 9px 13px;\n margin-bottom: 3px;\n border-radius: 6px;\n}\n\n.nav-item.active {\n background: #ff6f00;\n color: #ffffff;\n}\n\n.nav-item:hover {\n background: #283593;\n color: #e8eaf6;\n}\n\n.nav-section-label {\n color: #ffd54f;\n font-size: 11px;\n text-transform: uppercase;\n margin-top: 18px;\n margin-bottom: 6px;\n letter-spacing: 1px;\n}\n\n.badge {\n background: #e53935;\n color: white;\n font-size: 10px;\n padding: 2px 7px;\n border-radius: 10px;\n}\n\n.sidebar-footer {\n margin-top: 23px;\n padding-top: 14px;\n border-top: 1px solid #303f9f;\n color: #90a4ae;\n font-size: 13px;\n}\n```",
20
+ "expectations": [
21
+ "Identifies the color proliferation problem: #1a237e, #3949ab, #ff6f00, #b0bec5, #283593, #e8eaf6, #ffd54f, #e53935, #303f9f, #90a4ae — 10+ ad-hoc hex colors with no systematic relationship",
22
+ "Flags that the active state uses #ff6f00 (deep orange) which is unrelated to the #1a237e (indigo) background — the accent color should be a lighter tint of the primary palette or a purposeful brand color",
23
+ "Flags that nav-section-label uses #ffd54f (amber/yellow) as a color — this creates a third unrelated hue in the sidebar; section labels should use a desaturated light color consistent with the palette",
24
+ "Flags the arbitrary spacing values: 7px, 11px, 9px, 13px, 3px, 18px, 6px, 23px, 14px — none of these follow a spacing scale; Refactoring UI Ch 3 prescribes a constrained scale (4, 8, 12, 16, 24, 32px)",
25
+ "Notes that grey-on-deep-blue text (#b0bec5 on #1a237e) needs a contrast check — and recommends using a color that is hue-matched to the background rather than a neutral grey",
26
+ "Recommends defining a design token set: 2-3 shades of indigo for the sidebar tones, one accent color for the active state, one semantic red for the badge — not 10 unrelated hex values",
27
+ "Notes that the badge using an unrelated red (#e53935) is fine for semantic meaning but should be defined as a token (--color-danger) rather than a hard-coded hex"
28
+ ]
29
+ },
30
+ {
31
+ "id": "eval-03-clean-hierarchy-design",
32
+ "prompt": "Review this CSS for a pricing card component:\n\n```css\n:root {\n --space-1: 4px;\n --space-2: 8px;\n --space-3: 12px;\n --space-4: 16px;\n --space-6: 24px;\n --space-8: 32px;\n --space-12: 48px;\n\n --text-sm: 13px;\n --text-base: 16px;\n --text-lg: 18px;\n --text-xl: 20px;\n --text-3xl: 30px;\n\n --color-text-primary: hsl(222, 47%, 11%);\n --color-text-secondary: hsl(215, 20%, 40%);\n --color-text-tertiary: hsl(215, 16%, 60%);\n --color-accent: hsl(245, 75%, 60%);\n --color-accent-light: hsl(245, 75%, 96%);\n}\n\n.pricing-card {\n background: white;\n border-radius: 12px;\n padding: var(--space-8);\n box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);\n max-width: 320px;\n}\n\n.plan-name {\n font-size: var(--text-sm);\n font-weight: 600;\n color: var(--color-accent);\n text-transform: uppercase;\n letter-spacing: 0.08em;\n margin-bottom: var(--space-3);\n}\n\n.plan-price {\n font-size: var(--text-3xl);\n font-weight: 700;\n color: var(--color-text-primary);\n margin-bottom: var(--space-1);\n}\n\n.price-period {\n font-size: var(--text-sm);\n color: var(--color-text-tertiary);\n margin-bottom: var(--space-6);\n}\n\n.feature-list {\n list-style: none;\n padding: 0;\n margin: 0 0 var(--space-8) 0;\n}\n\n.feature-item {\n font-size: var(--text-base);\n color: var(--color-text-secondary);\n padding: var(--space-2) 0;\n display: flex;\n align-items: center;\n gap: var(--space-3);\n}\n\n.cta-button {\n display: block;\n width: 100%;\n padding: var(--space-3) var(--space-6);\n background: var(--color-accent);\n color: white;\n font-size: var(--text-base);\n font-weight: 600;\n border: none;\n border-radius: 8px;\n cursor: pointer;\n text-align: center;\n}\n```",
33
+ "expectations": [
34
+ "Recognizes this as a well-designed component with proper design system foundations and says so explicitly",
35
+ "Praises the CSS custom property (design token) system: spacing scale (--space-1 through --space-12 in steps of 4px), type scale (--text-sm through --text-3xl), and color tokens all follow Refactoring UI principles",
36
+ "Praises the three-level color hierarchy for text: --color-text-primary (dark), --color-text-secondary (medium), --color-text-tertiary (light) — directly implementing the Refactoring UI color-as-hierarchy approach",
37
+ "Praises the visual hierarchy of the price card: plan name is small+uppercase+accent (supporting), price is 30px+700 weight (primary), period is small+tertiary (de-emphasized) — excellent three-tier hierarchy",
38
+ "Praises the shadow: uses a two-layer shadow (diffuse + tight) following the Refactoring UI recommendation for realistic depth",
39
+ "Praises that plan-name uses color (--color-accent) to create emphasis at a small size rather than making it large — using color+weight as levers, not font-size alone",
40
+ "Does NOT manufacture fake issues just to have something to say",
41
+ "May offer optional improvements (hover state for cta-button, dark mode token variants, focus ring for accessibility) but clearly frames them as enhancements"
42
+ ]
43
+ }
44
+ ]
45
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "pass_rate": 1,
3
+ "passed": 23,
4
+ "total": 23,
5
+ "baseline_pass_rate": 0.435,
6
+ "baseline_passed": 10,
7
+ "baseline_total": 23,
8
+ "delta": 0.565,
9
+ "model": "default",
10
+ "evals_run": 3,
11
+ "date": "2026-03-29",
12
+ "non_standard_provider": true
13
+ }
@@ -0,0 +1,85 @@
1
+ # After
2
+
3
+ A pricing card with clear visual hierarchy achieved through size scale, weight contrast, and strategic color — the price is immediately scannable and the CTA stands out.
4
+
5
+ ```css
6
+ /* Pricing card — clear hierarchy: plan name → price → description → features → CTA */
7
+ .pricing-card {
8
+ padding: 32px;
9
+ border-radius: 8px;
10
+ background: #ffffff;
11
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.06);
12
+ }
13
+
14
+ /* Primary: the plan name — bold, medium size, dark */
15
+ .plan-name {
16
+ font-size: 14px;
17
+ font-weight: 600;
18
+ letter-spacing: 0.06em;
19
+ text-transform: uppercase;
20
+ color: hsl(217, 71%, 53%); /* brand accent — signals plan identity */
21
+ margin-bottom: 12px;
22
+ }
23
+
24
+ /* Hero element: price — the largest, heaviest thing on the card */
25
+ .plan-price {
26
+ font-size: 48px;
27
+ font-weight: 700;
28
+ color: hsl(222, 47%, 11%); /* near-black — maximum contrast */
29
+ line-height: 1;
30
+ margin-bottom: 4px;
31
+ }
32
+
33
+ .plan-billing-cycle {
34
+ font-size: 13px;
35
+ font-weight: 400;
36
+ color: hsl(215, 16%, 57%); /* light grey — tertiary, supporting */
37
+ margin-bottom: 20px;
38
+ }
39
+
40
+ /* Secondary: description — readable but not competing with price */
41
+ .plan-description {
42
+ font-size: 15px;
43
+ font-weight: 400;
44
+ color: hsl(215, 16%, 40%); /* medium grey */
45
+ line-height: 1.6;
46
+ margin-bottom: 24px;
47
+ }
48
+
49
+ /* Tertiary: feature list — smallest, least emphasis */
50
+ .plan-feature {
51
+ font-size: 14px;
52
+ font-weight: 400;
53
+ color: hsl(215, 16%, 47%);
54
+ margin-bottom: 8px;
55
+ display: flex;
56
+ align-items: center;
57
+ gap: 8px;
58
+ }
59
+
60
+ /* CTA: high contrast, full width, inviting */
61
+ .cta-button {
62
+ width: 100%;
63
+ padding: 14px;
64
+ font-size: 15px;
65
+ font-weight: 600;
66
+ background-color: hsl(217, 71%, 53%);
67
+ color: #ffffff;
68
+ border: none;
69
+ border-radius: 6px;
70
+ margin-top: 28px;
71
+ cursor: pointer;
72
+ }
73
+
74
+ .cta-button:hover {
75
+ background-color: hsl(217, 71%, 46%);
76
+ }
77
+ ```
78
+
79
+ Key improvements:
80
+ - Three-tier hierarchy established using size (48px → 15px → 14px → 13px), weight (700 → 600 → 400), and color (near-black → medium grey → light grey) — no element competes with the price (Ch 2: Visual Hierarchy)
81
+ - HSL colors replace raw hex — the system is transparent and the grey scale is predictable (Ch 5: Build a color system with HSL)
82
+ - `box-shadow` with two layered shadows replaces the flat `border: 1px solid #ccc` — the card lifts off the page with realistic depth (Ch 6: Depth and shadow elevation)
83
+ - `.plan-name` uses uppercase + letter-spacing as a tertiary-element technique — it occupies a clear role without competing with the price despite appearing first (Ch 2: De-emphasize labels, emphasize values)
84
+ - Consistent spacing from the scale (12, 20, 24, 28px) replaces arbitrary margins — related elements are visually grouped (Ch 3: Spacing and layout)
85
+ - CTA `padding: 14px` and `font-weight: 600` make the button unmistakably actionable, distinct from all other text on the card (Ch 8: Finishing touches)
@@ -0,0 +1,58 @@
1
+ # Before
2
+
3
+ A CSS card component where every text element is the same size and weight, creating no visual hierarchy and making it impossible to scan at a glance.
4
+
5
+ ```css
6
+ /* Pricing card — everything looks equally important */
7
+ .pricing-card {
8
+ padding: 20px;
9
+ border: 1px solid #ccc;
10
+ border-radius: 4px;
11
+ }
12
+
13
+ .plan-name {
14
+ font-size: 16px;
15
+ font-weight: 400;
16
+ color: #333;
17
+ margin-bottom: 8px;
18
+ }
19
+
20
+ .plan-description {
21
+ font-size: 16px;
22
+ font-weight: 400;
23
+ color: #333;
24
+ margin-bottom: 8px;
25
+ }
26
+
27
+ .plan-price {
28
+ font-size: 16px;
29
+ font-weight: 400;
30
+ color: #333;
31
+ margin-bottom: 8px;
32
+ }
33
+
34
+ .plan-billing-cycle {
35
+ font-size: 16px;
36
+ font-weight: 400;
37
+ color: #333;
38
+ margin-bottom: 16px;
39
+ }
40
+
41
+ .plan-feature {
42
+ font-size: 16px;
43
+ font-weight: 400;
44
+ color: #333;
45
+ margin-bottom: 4px;
46
+ }
47
+
48
+ .cta-button {
49
+ width: 100%;
50
+ padding: 10px;
51
+ font-size: 16px;
52
+ font-weight: 400;
53
+ background-color: #555;
54
+ color: white;
55
+ border: none;
56
+ border-radius: 4px;
57
+ }
58
+ ```