@wazir-dev/cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (629) hide show
  1. package/AGENTS.md +111 -0
  2. package/CHANGELOG.md +14 -0
  3. package/CONTRIBUTING.md +101 -0
  4. package/LICENSE +21 -0
  5. package/README.md +314 -0
  6. package/assets/composition-engine.mmd +34 -0
  7. package/assets/demo-script.sh +17 -0
  8. package/assets/logo-dark.svg +14 -0
  9. package/assets/logo.svg +14 -0
  10. package/assets/pipeline.mmd +39 -0
  11. package/assets/record-demo.sh +51 -0
  12. package/docs/README.md +51 -0
  13. package/docs/adapters/context-mode.md +60 -0
  14. package/docs/concepts/architecture.md +87 -0
  15. package/docs/concepts/artifact-model.md +60 -0
  16. package/docs/concepts/composition-engine.md +36 -0
  17. package/docs/concepts/indexing-and-recall.md +160 -0
  18. package/docs/concepts/observability.md +41 -0
  19. package/docs/concepts/roles-and-workflows.md +59 -0
  20. package/docs/concepts/terminology-policy.md +27 -0
  21. package/docs/getting-started/01-installation.md +78 -0
  22. package/docs/getting-started/02-first-run.md +102 -0
  23. package/docs/getting-started/03-adding-to-project.md +15 -0
  24. package/docs/getting-started/04-host-setup.md +15 -0
  25. package/docs/guides/ci-integration.md +15 -0
  26. package/docs/guides/creating-skills.md +15 -0
  27. package/docs/guides/expertise-module-authoring.md +15 -0
  28. package/docs/guides/hook-development.md +15 -0
  29. package/docs/guides/memory-and-learnings.md +34 -0
  30. package/docs/guides/multi-host-export.md +15 -0
  31. package/docs/guides/troubleshooting.md +101 -0
  32. package/docs/guides/writing-custom-roles.md +15 -0
  33. package/docs/plans/2026-03-15-cli-pipeline-integration-design.md +592 -0
  34. package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +598 -0
  35. package/docs/plans/2026-03-15-docs-enforcement-plan.md +238 -0
  36. package/docs/readmes/INDEX.md +99 -0
  37. package/docs/readmes/features/expertise/README.md +171 -0
  38. package/docs/readmes/features/exports/README.md +222 -0
  39. package/docs/readmes/features/hooks/README.md +103 -0
  40. package/docs/readmes/features/hooks/loop-cap-guard.md +133 -0
  41. package/docs/readmes/features/hooks/post-tool-capture.md +121 -0
  42. package/docs/readmes/features/hooks/post-tool-lint.md +130 -0
  43. package/docs/readmes/features/hooks/pre-compact-summary.md +122 -0
  44. package/docs/readmes/features/hooks/pre-tool-capture-route.md +100 -0
  45. package/docs/readmes/features/hooks/protected-path-write-guard.md +128 -0
  46. package/docs/readmes/features/hooks/session-start.md +119 -0
  47. package/docs/readmes/features/hooks/stop-handoff-harvest.md +125 -0
  48. package/docs/readmes/features/roles/README.md +157 -0
  49. package/docs/readmes/features/roles/clarifier.md +152 -0
  50. package/docs/readmes/features/roles/content-author.md +190 -0
  51. package/docs/readmes/features/roles/designer.md +193 -0
  52. package/docs/readmes/features/roles/executor.md +184 -0
  53. package/docs/readmes/features/roles/learner.md +210 -0
  54. package/docs/readmes/features/roles/planner.md +182 -0
  55. package/docs/readmes/features/roles/researcher.md +164 -0
  56. package/docs/readmes/features/roles/reviewer.md +184 -0
  57. package/docs/readmes/features/roles/specifier.md +162 -0
  58. package/docs/readmes/features/roles/verifier.md +215 -0
  59. package/docs/readmes/features/schemas/README.md +178 -0
  60. package/docs/readmes/features/skills/README.md +63 -0
  61. package/docs/readmes/features/skills/brainstorming.md +96 -0
  62. package/docs/readmes/features/skills/debugging.md +148 -0
  63. package/docs/readmes/features/skills/design.md +120 -0
  64. package/docs/readmes/features/skills/prepare-next.md +109 -0
  65. package/docs/readmes/features/skills/run-audit.md +159 -0
  66. package/docs/readmes/features/skills/scan-project.md +109 -0
  67. package/docs/readmes/features/skills/self-audit.md +176 -0
  68. package/docs/readmes/features/skills/tdd.md +137 -0
  69. package/docs/readmes/features/skills/using-skills.md +92 -0
  70. package/docs/readmes/features/skills/verification.md +120 -0
  71. package/docs/readmes/features/skills/writing-plans.md +104 -0
  72. package/docs/readmes/features/tooling/README.md +320 -0
  73. package/docs/readmes/features/workflows/README.md +186 -0
  74. package/docs/readmes/features/workflows/author.md +181 -0
  75. package/docs/readmes/features/workflows/clarify.md +154 -0
  76. package/docs/readmes/features/workflows/design-review.md +171 -0
  77. package/docs/readmes/features/workflows/design.md +169 -0
  78. package/docs/readmes/features/workflows/discover.md +162 -0
  79. package/docs/readmes/features/workflows/execute.md +173 -0
  80. package/docs/readmes/features/workflows/learn.md +167 -0
  81. package/docs/readmes/features/workflows/plan-review.md +165 -0
  82. package/docs/readmes/features/workflows/plan.md +170 -0
  83. package/docs/readmes/features/workflows/prepare-next.md +167 -0
  84. package/docs/readmes/features/workflows/review.md +169 -0
  85. package/docs/readmes/features/workflows/run-audit.md +191 -0
  86. package/docs/readmes/features/workflows/spec-challenge.md +159 -0
  87. package/docs/readmes/features/workflows/specify.md +160 -0
  88. package/docs/readmes/features/workflows/verify.md +177 -0
  89. package/docs/readmes/packages/README.md +50 -0
  90. package/docs/readmes/packages/ajv.md +117 -0
  91. package/docs/readmes/packages/context-mode.md +118 -0
  92. package/docs/readmes/packages/gray-matter.md +116 -0
  93. package/docs/readmes/packages/node-test.md +137 -0
  94. package/docs/readmes/packages/yaml.md +112 -0
  95. package/docs/reference/configuration-reference.md +159 -0
  96. package/docs/reference/expertise-index.md +52 -0
  97. package/docs/reference/git-flow.md +43 -0
  98. package/docs/reference/hooks.md +87 -0
  99. package/docs/reference/host-exports.md +50 -0
  100. package/docs/reference/launch-checklist.md +172 -0
  101. package/docs/reference/marketplace-listings.md +76 -0
  102. package/docs/reference/release-process.md +34 -0
  103. package/docs/reference/roles-reference.md +77 -0
  104. package/docs/reference/skills.md +33 -0
  105. package/docs/reference/templates.md +29 -0
  106. package/docs/reference/tooling-cli.md +94 -0
  107. package/docs/truth-claims.yaml +222 -0
  108. package/expertise/PROGRESS.md +63 -0
  109. package/expertise/README.md +18 -0
  110. package/expertise/antipatterns/PROGRESS.md +56 -0
  111. package/expertise/antipatterns/backend/api-design-antipatterns.md +1271 -0
  112. package/expertise/antipatterns/backend/auth-antipatterns.md +1195 -0
  113. package/expertise/antipatterns/backend/caching-antipatterns.md +622 -0
  114. package/expertise/antipatterns/backend/database-antipatterns.md +1038 -0
  115. package/expertise/antipatterns/backend/index.md +24 -0
  116. package/expertise/antipatterns/backend/microservices-antipatterns.md +850 -0
  117. package/expertise/antipatterns/code/architecture-antipatterns.md +919 -0
  118. package/expertise/antipatterns/code/async-antipatterns.md +622 -0
  119. package/expertise/antipatterns/code/code-smells.md +1186 -0
  120. package/expertise/antipatterns/code/dependency-antipatterns.md +1209 -0
  121. package/expertise/antipatterns/code/error-handling-antipatterns.md +1360 -0
  122. package/expertise/antipatterns/code/index.md +27 -0
  123. package/expertise/antipatterns/code/naming-and-abstraction.md +1118 -0
  124. package/expertise/antipatterns/code/state-management-antipatterns.md +1076 -0
  125. package/expertise/antipatterns/code/testing-antipatterns.md +1053 -0
  126. package/expertise/antipatterns/design/accessibility-antipatterns.md +1136 -0
  127. package/expertise/antipatterns/design/dark-patterns.md +1121 -0
  128. package/expertise/antipatterns/design/index.md +22 -0
  129. package/expertise/antipatterns/design/ui-antipatterns.md +1202 -0
  130. package/expertise/antipatterns/design/ux-antipatterns.md +680 -0
  131. package/expertise/antipatterns/frontend/css-layout-antipatterns.md +691 -0
  132. package/expertise/antipatterns/frontend/flutter-antipatterns.md +1827 -0
  133. package/expertise/antipatterns/frontend/index.md +23 -0
  134. package/expertise/antipatterns/frontend/mobile-antipatterns.md +573 -0
  135. package/expertise/antipatterns/frontend/react-antipatterns.md +1128 -0
  136. package/expertise/antipatterns/frontend/spa-antipatterns.md +1235 -0
  137. package/expertise/antipatterns/index.md +31 -0
  138. package/expertise/antipatterns/performance/index.md +20 -0
  139. package/expertise/antipatterns/performance/performance-antipatterns.md +1013 -0
  140. package/expertise/antipatterns/performance/premature-optimization.md +623 -0
  141. package/expertise/antipatterns/performance/scaling-antipatterns.md +785 -0
  142. package/expertise/antipatterns/process/ai-coding-antipatterns.md +853 -0
  143. package/expertise/antipatterns/process/code-review-antipatterns.md +656 -0
  144. package/expertise/antipatterns/process/deployment-antipatterns.md +920 -0
  145. package/expertise/antipatterns/process/index.md +23 -0
  146. package/expertise/antipatterns/process/technical-debt-antipatterns.md +647 -0
  147. package/expertise/antipatterns/security/index.md +20 -0
  148. package/expertise/antipatterns/security/secrets-antipatterns.md +849 -0
  149. package/expertise/antipatterns/security/security-theater.md +843 -0
  150. package/expertise/antipatterns/security/vulnerability-patterns.md +801 -0
  151. package/expertise/architecture/PROGRESS.md +70 -0
  152. package/expertise/architecture/data/caching-architecture.md +671 -0
  153. package/expertise/architecture/data/data-consistency.md +574 -0
  154. package/expertise/architecture/data/data-modeling.md +536 -0
  155. package/expertise/architecture/data/event-streams-and-queues.md +634 -0
  156. package/expertise/architecture/data/index.md +25 -0
  157. package/expertise/architecture/data/search-architecture.md +663 -0
  158. package/expertise/architecture/data/sql-vs-nosql.md +708 -0
  159. package/expertise/architecture/decisions/architecture-decision-records.md +640 -0
  160. package/expertise/architecture/decisions/build-vs-buy.md +616 -0
  161. package/expertise/architecture/decisions/index.md +23 -0
  162. package/expertise/architecture/decisions/monolith-to-microservices.md +790 -0
  163. package/expertise/architecture/decisions/technology-selection.md +616 -0
  164. package/expertise/architecture/distributed/cap-theorem-and-tradeoffs.md +800 -0
  165. package/expertise/architecture/distributed/circuit-breaker-bulkhead.md +741 -0
  166. package/expertise/architecture/distributed/consensus-and-coordination.md +796 -0
  167. package/expertise/architecture/distributed/distributed-systems-fundamentals.md +564 -0
  168. package/expertise/architecture/distributed/idempotency-and-retry.md +796 -0
  169. package/expertise/architecture/distributed/index.md +25 -0
  170. package/expertise/architecture/distributed/saga-pattern.md +797 -0
  171. package/expertise/architecture/foundations/architectural-thinking.md +460 -0
  172. package/expertise/architecture/foundations/coupling-and-cohesion.md +770 -0
  173. package/expertise/architecture/foundations/design-principles-solid.md +649 -0
  174. package/expertise/architecture/foundations/domain-driven-design.md +719 -0
  175. package/expertise/architecture/foundations/index.md +25 -0
  176. package/expertise/architecture/foundations/separation-of-concerns.md +472 -0
  177. package/expertise/architecture/foundations/twelve-factor-app.md +797 -0
  178. package/expertise/architecture/index.md +34 -0
  179. package/expertise/architecture/integration/api-design-graphql.md +638 -0
  180. package/expertise/architecture/integration/api-design-grpc.md +804 -0
  181. package/expertise/architecture/integration/api-design-rest.md +892 -0
  182. package/expertise/architecture/integration/index.md +25 -0
  183. package/expertise/architecture/integration/third-party-integration.md +795 -0
  184. package/expertise/architecture/integration/webhooks-and-callbacks.md +1152 -0
  185. package/expertise/architecture/integration/websockets-realtime.md +791 -0
  186. package/expertise/architecture/mobile-architecture/index.md +22 -0
  187. package/expertise/architecture/mobile-architecture/mobile-app-architecture.md +780 -0
  188. package/expertise/architecture/mobile-architecture/mobile-backend-for-frontend.md +670 -0
  189. package/expertise/architecture/mobile-architecture/offline-first.md +719 -0
  190. package/expertise/architecture/mobile-architecture/push-and-sync.md +782 -0
  191. package/expertise/architecture/patterns/cqrs-event-sourcing.md +717 -0
  192. package/expertise/architecture/patterns/event-driven.md +797 -0
  193. package/expertise/architecture/patterns/hexagonal-clean-architecture.md +870 -0
  194. package/expertise/architecture/patterns/index.md +27 -0
  195. package/expertise/architecture/patterns/layered-architecture.md +736 -0
  196. package/expertise/architecture/patterns/microservices.md +753 -0
  197. package/expertise/architecture/patterns/modular-monolith.md +692 -0
  198. package/expertise/architecture/patterns/monolith.md +626 -0
  199. package/expertise/architecture/patterns/plugin-architecture.md +735 -0
  200. package/expertise/architecture/patterns/serverless.md +780 -0
  201. package/expertise/architecture/scaling/database-scaling.md +615 -0
  202. package/expertise/architecture/scaling/feature-flags-and-rollouts.md +757 -0
  203. package/expertise/architecture/scaling/horizontal-vs-vertical.md +606 -0
  204. package/expertise/architecture/scaling/index.md +24 -0
  205. package/expertise/architecture/scaling/multi-tenancy.md +800 -0
  206. package/expertise/architecture/scaling/stateless-design.md +787 -0
  207. package/expertise/backend/embedded-firmware.md +625 -0
  208. package/expertise/backend/go.md +853 -0
  209. package/expertise/backend/index.md +24 -0
  210. package/expertise/backend/java-spring.md +448 -0
  211. package/expertise/backend/node-typescript.md +625 -0
  212. package/expertise/backend/python-fastapi.md +724 -0
  213. package/expertise/backend/rust.md +458 -0
  214. package/expertise/backend/solidity.md +711 -0
  215. package/expertise/composition-map.yaml +443 -0
  216. package/expertise/content/foundations/content-modeling.md +395 -0
  217. package/expertise/content/foundations/editorial-standards.md +449 -0
  218. package/expertise/content/foundations/index.md +24 -0
  219. package/expertise/content/foundations/microcopy.md +455 -0
  220. package/expertise/content/foundations/terminology-governance.md +509 -0
  221. package/expertise/content/index.md +34 -0
  222. package/expertise/content/patterns/accessibility-copy.md +518 -0
  223. package/expertise/content/patterns/index.md +24 -0
  224. package/expertise/content/patterns/notification-content.md +433 -0
  225. package/expertise/content/patterns/sample-content.md +486 -0
  226. package/expertise/content/patterns/state-copy.md +439 -0
  227. package/expertise/design/PROGRESS.md +58 -0
  228. package/expertise/design/disciplines/dark-mode-theming.md +577 -0
  229. package/expertise/design/disciplines/design-systems.md +595 -0
  230. package/expertise/design/disciplines/index.md +25 -0
  231. package/expertise/design/disciplines/information-architecture.md +800 -0
  232. package/expertise/design/disciplines/interaction-design.md +788 -0
  233. package/expertise/design/disciplines/responsive-design.md +552 -0
  234. package/expertise/design/disciplines/usability-testing.md +516 -0
  235. package/expertise/design/disciplines/user-research.md +792 -0
  236. package/expertise/design/foundations/accessibility-design.md +796 -0
  237. package/expertise/design/foundations/color-theory.md +797 -0
  238. package/expertise/design/foundations/iconography.md +795 -0
  239. package/expertise/design/foundations/index.md +26 -0
  240. package/expertise/design/foundations/motion-and-animation.md +653 -0
  241. package/expertise/design/foundations/rtl-design.md +585 -0
  242. package/expertise/design/foundations/spacing-and-layout.md +607 -0
  243. package/expertise/design/foundations/typography.md +800 -0
  244. package/expertise/design/foundations/visual-hierarchy.md +761 -0
  245. package/expertise/design/index.md +32 -0
  246. package/expertise/design/patterns/authentication-flows.md +474 -0
  247. package/expertise/design/patterns/content-consumption.md +789 -0
  248. package/expertise/design/patterns/data-display.md +618 -0
  249. package/expertise/design/patterns/e-commerce.md +1494 -0
  250. package/expertise/design/patterns/feedback-and-states.md +642 -0
  251. package/expertise/design/patterns/forms-and-input.md +819 -0
  252. package/expertise/design/patterns/gamification.md +801 -0
  253. package/expertise/design/patterns/index.md +31 -0
  254. package/expertise/design/patterns/microinteractions.md +449 -0
  255. package/expertise/design/patterns/navigation.md +800 -0
  256. package/expertise/design/patterns/notifications.md +705 -0
  257. package/expertise/design/patterns/onboarding.md +700 -0
  258. package/expertise/design/patterns/search-and-filter.md +601 -0
  259. package/expertise/design/patterns/settings-and-preferences.md +768 -0
  260. package/expertise/design/patterns/social-and-community.md +748 -0
  261. package/expertise/design/platforms/desktop-native.md +612 -0
  262. package/expertise/design/platforms/index.md +25 -0
  263. package/expertise/design/platforms/mobile-android.md +825 -0
  264. package/expertise/design/platforms/mobile-cross-platform.md +983 -0
  265. package/expertise/design/platforms/mobile-ios.md +699 -0
  266. package/expertise/design/platforms/tablet.md +794 -0
  267. package/expertise/design/platforms/web-dashboard.md +790 -0
  268. package/expertise/design/platforms/web-responsive.md +550 -0
  269. package/expertise/design/psychology/behavioral-nudges.md +449 -0
  270. package/expertise/design/psychology/cognitive-load.md +1191 -0
  271. package/expertise/design/psychology/error-psychology.md +778 -0
  272. package/expertise/design/psychology/index.md +22 -0
  273. package/expertise/design/psychology/persuasive-design.md +736 -0
  274. package/expertise/design/psychology/user-mental-models.md +623 -0
  275. package/expertise/design/tooling/open-pencil.md +266 -0
  276. package/expertise/frontend/angular.md +1073 -0
  277. package/expertise/frontend/desktop-electron.md +546 -0
  278. package/expertise/frontend/flutter.md +782 -0
  279. package/expertise/frontend/index.md +27 -0
  280. package/expertise/frontend/native-android.md +409 -0
  281. package/expertise/frontend/native-ios.md +490 -0
  282. package/expertise/frontend/react-native.md +1160 -0
  283. package/expertise/frontend/react.md +808 -0
  284. package/expertise/frontend/vue.md +1089 -0
  285. package/expertise/humanize/domain-rules-code.md +79 -0
  286. package/expertise/humanize/domain-rules-content.md +67 -0
  287. package/expertise/humanize/domain-rules-technical-docs.md +56 -0
  288. package/expertise/humanize/index.md +35 -0
  289. package/expertise/humanize/self-audit-checklist.md +87 -0
  290. package/expertise/humanize/sentence-patterns.md +218 -0
  291. package/expertise/humanize/vocabulary-blacklist.md +105 -0
  292. package/expertise/i18n/PROGRESS.md +65 -0
  293. package/expertise/i18n/advanced/accessibility-and-i18n.md +28 -0
  294. package/expertise/i18n/advanced/bidirectional-text-algorithm.md +38 -0
  295. package/expertise/i18n/advanced/complex-scripts.md +30 -0
  296. package/expertise/i18n/advanced/performance-and-i18n.md +27 -0
  297. package/expertise/i18n/advanced/testing-i18n.md +28 -0
  298. package/expertise/i18n/content/content-adaptation.md +23 -0
  299. package/expertise/i18n/content/locale-specific-formatting.md +23 -0
  300. package/expertise/i18n/content/machine-translation-integration.md +28 -0
  301. package/expertise/i18n/content/translation-management.md +29 -0
  302. package/expertise/i18n/foundations/date-time-calendars.md +67 -0
  303. package/expertise/i18n/foundations/i18n-architecture.md +272 -0
  304. package/expertise/i18n/foundations/locale-and-language-tags.md +79 -0
  305. package/expertise/i18n/foundations/numbers-currency-units.md +61 -0
  306. package/expertise/i18n/foundations/pluralization-and-gender.md +109 -0
  307. package/expertise/i18n/foundations/string-externalization.md +236 -0
  308. package/expertise/i18n/foundations/text-direction-bidi.md +241 -0
  309. package/expertise/i18n/foundations/unicode-and-encoding.md +86 -0
  310. package/expertise/i18n/index.md +38 -0
  311. package/expertise/i18n/platform/backend-i18n.md +31 -0
  312. package/expertise/i18n/platform/flutter-i18n.md +148 -0
  313. package/expertise/i18n/platform/native-android-i18n.md +36 -0
  314. package/expertise/i18n/platform/native-ios-i18n.md +36 -0
  315. package/expertise/i18n/platform/react-i18n.md +103 -0
  316. package/expertise/i18n/platform/web-css-i18n.md +81 -0
  317. package/expertise/i18n/rtl/arabic-specific.md +175 -0
  318. package/expertise/i18n/rtl/hebrew-specific.md +149 -0
  319. package/expertise/i18n/rtl/rtl-animations-and-transitions.md +111 -0
  320. package/expertise/i18n/rtl/rtl-forms-and-input.md +161 -0
  321. package/expertise/i18n/rtl/rtl-fundamentals.md +211 -0
  322. package/expertise/i18n/rtl/rtl-icons-and-images.md +181 -0
  323. package/expertise/i18n/rtl/rtl-layout-mirroring.md +252 -0
  324. package/expertise/i18n/rtl/rtl-navigation-and-gestures.md +107 -0
  325. package/expertise/i18n/rtl/rtl-testing-and-qa.md +147 -0
  326. package/expertise/i18n/rtl/rtl-typography.md +160 -0
  327. package/expertise/index.md +113 -0
  328. package/expertise/index.yaml +216 -0
  329. package/expertise/infrastructure/cloud-aws.md +597 -0
  330. package/expertise/infrastructure/cloud-gcp.md +599 -0
  331. package/expertise/infrastructure/cybersecurity.md +816 -0
  332. package/expertise/infrastructure/database-mongodb.md +447 -0
  333. package/expertise/infrastructure/database-postgres.md +400 -0
  334. package/expertise/infrastructure/devops-cicd.md +787 -0
  335. package/expertise/infrastructure/index.md +27 -0
  336. package/expertise/performance/PROGRESS.md +50 -0
  337. package/expertise/performance/backend/api-latency.md +1204 -0
  338. package/expertise/performance/backend/background-jobs.md +506 -0
  339. package/expertise/performance/backend/connection-pooling.md +1209 -0
  340. package/expertise/performance/backend/database-query-optimization.md +515 -0
  341. package/expertise/performance/backend/index.md +23 -0
  342. package/expertise/performance/backend/rate-limiting-and-throttling.md +971 -0
  343. package/expertise/performance/foundations/algorithmic-complexity.md +954 -0
  344. package/expertise/performance/foundations/caching-strategies.md +489 -0
  345. package/expertise/performance/foundations/concurrency-and-parallelism.md +847 -0
  346. package/expertise/performance/foundations/index.md +24 -0
  347. package/expertise/performance/foundations/measuring-and-profiling.md +440 -0
  348. package/expertise/performance/foundations/memory-management.md +964 -0
  349. package/expertise/performance/foundations/performance-budgets.md +1314 -0
  350. package/expertise/performance/index.md +31 -0
  351. package/expertise/performance/infrastructure/auto-scaling.md +1059 -0
  352. package/expertise/performance/infrastructure/cdn-and-edge.md +1081 -0
  353. package/expertise/performance/infrastructure/index.md +22 -0
  354. package/expertise/performance/infrastructure/load-balancing.md +1081 -0
  355. package/expertise/performance/infrastructure/observability.md +1079 -0
  356. package/expertise/performance/mobile/index.md +23 -0
  357. package/expertise/performance/mobile/mobile-animations.md +544 -0
  358. package/expertise/performance/mobile/mobile-memory-battery.md +416 -0
  359. package/expertise/performance/mobile/mobile-network.md +452 -0
  360. package/expertise/performance/mobile/mobile-rendering.md +599 -0
  361. package/expertise/performance/mobile/mobile-startup-time.md +505 -0
  362. package/expertise/performance/platform-specific/flutter-performance.md +647 -0
  363. package/expertise/performance/platform-specific/index.md +22 -0
  364. package/expertise/performance/platform-specific/node-performance.md +1307 -0
  365. package/expertise/performance/platform-specific/postgres-performance.md +1366 -0
  366. package/expertise/performance/platform-specific/react-performance.md +1403 -0
  367. package/expertise/performance/web/bundle-optimization.md +1239 -0
  368. package/expertise/performance/web/image-and-media.md +636 -0
  369. package/expertise/performance/web/index.md +24 -0
  370. package/expertise/performance/web/network-optimization.md +1133 -0
  371. package/expertise/performance/web/rendering-performance.md +1098 -0
  372. package/expertise/performance/web/ssr-and-hydration.md +918 -0
  373. package/expertise/performance/web/web-vitals.md +1374 -0
  374. package/expertise/quality/accessibility.md +985 -0
  375. package/expertise/quality/evidence-based-verification.md +499 -0
  376. package/expertise/quality/index.md +24 -0
  377. package/expertise/quality/ml-model-audit.md +614 -0
  378. package/expertise/quality/performance.md +600 -0
  379. package/expertise/quality/testing-api.md +891 -0
  380. package/expertise/quality/testing-mobile.md +496 -0
  381. package/expertise/quality/testing-web.md +849 -0
  382. package/expertise/security/PROGRESS.md +54 -0
  383. package/expertise/security/agentic-identity.md +540 -0
  384. package/expertise/security/compliance-frameworks.md +601 -0
  385. package/expertise/security/data/data-encryption.md +364 -0
  386. package/expertise/security/data/data-privacy-gdpr.md +692 -0
  387. package/expertise/security/data/database-security.md +1171 -0
  388. package/expertise/security/data/index.md +22 -0
  389. package/expertise/security/data/pii-handling.md +531 -0
  390. package/expertise/security/foundations/authentication.md +1041 -0
  391. package/expertise/security/foundations/authorization.md +603 -0
  392. package/expertise/security/foundations/cryptography.md +1001 -0
  393. package/expertise/security/foundations/index.md +25 -0
  394. package/expertise/security/foundations/owasp-top-10.md +1354 -0
  395. package/expertise/security/foundations/secrets-management.md +1217 -0
  396. package/expertise/security/foundations/secure-sdlc.md +700 -0
  397. package/expertise/security/foundations/supply-chain-security.md +698 -0
  398. package/expertise/security/index.md +31 -0
  399. package/expertise/security/infrastructure/cloud-security-aws.md +1296 -0
  400. package/expertise/security/infrastructure/cloud-security-gcp.md +1376 -0
  401. package/expertise/security/infrastructure/container-security.md +721 -0
  402. package/expertise/security/infrastructure/incident-response.md +1295 -0
  403. package/expertise/security/infrastructure/index.md +24 -0
  404. package/expertise/security/infrastructure/logging-and-monitoring.md +1618 -0
  405. package/expertise/security/infrastructure/network-security.md +1337 -0
  406. package/expertise/security/mobile/index.md +23 -0
  407. package/expertise/security/mobile/mobile-android-security.md +1218 -0
  408. package/expertise/security/mobile/mobile-binary-protection.md +1229 -0
  409. package/expertise/security/mobile/mobile-data-storage.md +1265 -0
  410. package/expertise/security/mobile/mobile-ios-security.md +1401 -0
  411. package/expertise/security/mobile/mobile-network-security.md +1520 -0
  412. package/expertise/security/smart-contract-security.md +594 -0
  413. package/expertise/security/testing/index.md +22 -0
  414. package/expertise/security/testing/penetration-testing.md +1258 -0
  415. package/expertise/security/testing/security-code-review.md +1765 -0
  416. package/expertise/security/testing/threat-modeling.md +1074 -0
  417. package/expertise/security/testing/vulnerability-scanning.md +1062 -0
  418. package/expertise/security/web/api-security.md +586 -0
  419. package/expertise/security/web/cors-and-headers.md +433 -0
  420. package/expertise/security/web/csrf.md +562 -0
  421. package/expertise/security/web/file-upload.md +1477 -0
  422. package/expertise/security/web/index.md +25 -0
  423. package/expertise/security/web/injection.md +1375 -0
  424. package/expertise/security/web/session-management.md +1101 -0
  425. package/expertise/security/web/xss.md +1158 -0
  426. package/exports/README.md +17 -0
  427. package/exports/hosts/claude/.claude/agents/clarifier.md +42 -0
  428. package/exports/hosts/claude/.claude/agents/content-author.md +63 -0
  429. package/exports/hosts/claude/.claude/agents/designer.md +55 -0
  430. package/exports/hosts/claude/.claude/agents/executor.md +55 -0
  431. package/exports/hosts/claude/.claude/agents/learner.md +51 -0
  432. package/exports/hosts/claude/.claude/agents/planner.md +53 -0
  433. package/exports/hosts/claude/.claude/agents/researcher.md +43 -0
  434. package/exports/hosts/claude/.claude/agents/reviewer.md +54 -0
  435. package/exports/hosts/claude/.claude/agents/specifier.md +47 -0
  436. package/exports/hosts/claude/.claude/agents/verifier.md +71 -0
  437. package/exports/hosts/claude/.claude/commands/author.md +42 -0
  438. package/exports/hosts/claude/.claude/commands/clarify.md +38 -0
  439. package/exports/hosts/claude/.claude/commands/design-review.md +46 -0
  440. package/exports/hosts/claude/.claude/commands/design.md +44 -0
  441. package/exports/hosts/claude/.claude/commands/discover.md +37 -0
  442. package/exports/hosts/claude/.claude/commands/execute.md +48 -0
  443. package/exports/hosts/claude/.claude/commands/learn.md +38 -0
  444. package/exports/hosts/claude/.claude/commands/plan-review.md +42 -0
  445. package/exports/hosts/claude/.claude/commands/plan.md +39 -0
  446. package/exports/hosts/claude/.claude/commands/prepare-next.md +37 -0
  447. package/exports/hosts/claude/.claude/commands/review.md +40 -0
  448. package/exports/hosts/claude/.claude/commands/run-audit.md +41 -0
  449. package/exports/hosts/claude/.claude/commands/spec-challenge.md +41 -0
  450. package/exports/hosts/claude/.claude/commands/specify.md +38 -0
  451. package/exports/hosts/claude/.claude/commands/verify.md +37 -0
  452. package/exports/hosts/claude/.claude/settings.json +34 -0
  453. package/exports/hosts/claude/CLAUDE.md +19 -0
  454. package/exports/hosts/claude/export.manifest.json +38 -0
  455. package/exports/hosts/claude/host-package.json +67 -0
  456. package/exports/hosts/codex/AGENTS.md +19 -0
  457. package/exports/hosts/codex/export.manifest.json +38 -0
  458. package/exports/hosts/codex/host-package.json +41 -0
  459. package/exports/hosts/cursor/.cursor/hooks.json +16 -0
  460. package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +19 -0
  461. package/exports/hosts/cursor/export.manifest.json +38 -0
  462. package/exports/hosts/cursor/host-package.json +42 -0
  463. package/exports/hosts/gemini/GEMINI.md +19 -0
  464. package/exports/hosts/gemini/export.manifest.json +38 -0
  465. package/exports/hosts/gemini/host-package.json +41 -0
  466. package/hooks/README.md +18 -0
  467. package/hooks/definitions/loop_cap_guard.yaml +21 -0
  468. package/hooks/definitions/post_tool_capture.yaml +24 -0
  469. package/hooks/definitions/pre_compact_summary.yaml +19 -0
  470. package/hooks/definitions/pre_tool_capture_route.yaml +19 -0
  471. package/hooks/definitions/protected_path_write_guard.yaml +19 -0
  472. package/hooks/definitions/session_start.yaml +19 -0
  473. package/hooks/definitions/stop_handoff_harvest.yaml +20 -0
  474. package/hooks/loop-cap-guard +17 -0
  475. package/hooks/post-tool-lint +36 -0
  476. package/hooks/protected-path-write-guard +17 -0
  477. package/hooks/session-start +41 -0
  478. package/llms-full.txt +2355 -0
  479. package/llms.txt +43 -0
  480. package/package.json +79 -0
  481. package/roles/README.md +20 -0
  482. package/roles/clarifier.md +42 -0
  483. package/roles/content-author.md +63 -0
  484. package/roles/designer.md +55 -0
  485. package/roles/executor.md +55 -0
  486. package/roles/learner.md +51 -0
  487. package/roles/planner.md +53 -0
  488. package/roles/researcher.md +43 -0
  489. package/roles/reviewer.md +54 -0
  490. package/roles/specifier.md +47 -0
  491. package/roles/verifier.md +71 -0
  492. package/schemas/README.md +24 -0
  493. package/schemas/accepted-learning.schema.json +20 -0
  494. package/schemas/author-artifact.schema.json +156 -0
  495. package/schemas/clarification.schema.json +19 -0
  496. package/schemas/design-artifact.schema.json +80 -0
  497. package/schemas/docs-claim.schema.json +18 -0
  498. package/schemas/export-manifest.schema.json +20 -0
  499. package/schemas/hook.schema.json +67 -0
  500. package/schemas/host-export-package.schema.json +18 -0
  501. package/schemas/implementation-plan.schema.json +19 -0
  502. package/schemas/proposed-learning.schema.json +19 -0
  503. package/schemas/research.schema.json +18 -0
  504. package/schemas/review.schema.json +29 -0
  505. package/schemas/run-manifest.schema.json +18 -0
  506. package/schemas/spec-challenge.schema.json +18 -0
  507. package/schemas/spec.schema.json +20 -0
  508. package/schemas/usage.schema.json +102 -0
  509. package/schemas/verification-proof.schema.json +29 -0
  510. package/schemas/wazir-manifest.schema.json +173 -0
  511. package/skills/README.md +40 -0
  512. package/skills/brainstorming/SKILL.md +77 -0
  513. package/skills/debugging/SKILL.md +50 -0
  514. package/skills/design/SKILL.md +61 -0
  515. package/skills/dispatching-parallel-agents/SKILL.md +128 -0
  516. package/skills/executing-plans/SKILL.md +70 -0
  517. package/skills/finishing-a-development-branch/SKILL.md +169 -0
  518. package/skills/humanize/SKILL.md +123 -0
  519. package/skills/init-pipeline/SKILL.md +124 -0
  520. package/skills/prepare-next/SKILL.md +20 -0
  521. package/skills/receiving-code-review/SKILL.md +123 -0
  522. package/skills/requesting-code-review/SKILL.md +105 -0
  523. package/skills/requesting-code-review/code-reviewer.md +108 -0
  524. package/skills/run-audit/SKILL.md +197 -0
  525. package/skills/scan-project/SKILL.md +41 -0
  526. package/skills/self-audit/SKILL.md +153 -0
  527. package/skills/subagent-driven-development/SKILL.md +154 -0
  528. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  529. package/skills/subagent-driven-development/implementer-prompt.md +102 -0
  530. package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  531. package/skills/tdd/SKILL.md +23 -0
  532. package/skills/using-git-worktrees/SKILL.md +163 -0
  533. package/skills/using-skills/SKILL.md +95 -0
  534. package/skills/verification/SKILL.md +22 -0
  535. package/skills/wazir/SKILL.md +463 -0
  536. package/skills/writing-plans/SKILL.md +30 -0
  537. package/skills/writing-skills/SKILL.md +157 -0
  538. package/skills/writing-skills/anthropic-best-practices.md +122 -0
  539. package/skills/writing-skills/persuasion-principles.md +50 -0
  540. package/templates/README.md +20 -0
  541. package/templates/artifacts/README.md +10 -0
  542. package/templates/artifacts/accepted-learning.md +19 -0
  543. package/templates/artifacts/accepted-learning.template.json +12 -0
  544. package/templates/artifacts/author.md +74 -0
  545. package/templates/artifacts/author.template.json +19 -0
  546. package/templates/artifacts/clarification.md +21 -0
  547. package/templates/artifacts/clarification.template.json +12 -0
  548. package/templates/artifacts/execute-notes.md +19 -0
  549. package/templates/artifacts/implementation-plan.md +21 -0
  550. package/templates/artifacts/implementation-plan.template.json +11 -0
  551. package/templates/artifacts/learning-proposal.md +19 -0
  552. package/templates/artifacts/next-run-handoff.md +21 -0
  553. package/templates/artifacts/plan-review.md +19 -0
  554. package/templates/artifacts/proposed-learning.template.json +12 -0
  555. package/templates/artifacts/research.md +21 -0
  556. package/templates/artifacts/research.template.json +12 -0
  557. package/templates/artifacts/review-findings.md +19 -0
  558. package/templates/artifacts/review.template.json +11 -0
  559. package/templates/artifacts/run-manifest.template.json +8 -0
  560. package/templates/artifacts/spec-challenge.md +19 -0
  561. package/templates/artifacts/spec-challenge.template.json +11 -0
  562. package/templates/artifacts/spec.md +21 -0
  563. package/templates/artifacts/spec.template.json +12 -0
  564. package/templates/artifacts/verification-proof.md +19 -0
  565. package/templates/artifacts/verification-proof.template.json +11 -0
  566. package/templates/examples/accepted-learning.example.json +14 -0
  567. package/templates/examples/author.example.json +152 -0
  568. package/templates/examples/clarification.example.json +15 -0
  569. package/templates/examples/docs-claim.example.json +8 -0
  570. package/templates/examples/export-manifest.example.json +7 -0
  571. package/templates/examples/host-export-package.example.json +11 -0
  572. package/templates/examples/implementation-plan.example.json +17 -0
  573. package/templates/examples/proposed-learning.example.json +13 -0
  574. package/templates/examples/research.example.json +15 -0
  575. package/templates/examples/research.example.md +6 -0
  576. package/templates/examples/review.example.json +17 -0
  577. package/templates/examples/run-manifest.example.json +9 -0
  578. package/templates/examples/spec-challenge.example.json +14 -0
  579. package/templates/examples/spec.example.json +21 -0
  580. package/templates/examples/verification-proof.example.json +21 -0
  581. package/templates/examples/wazir-manifest.example.yaml +65 -0
  582. package/templates/task-definition-schema.md +99 -0
  583. package/tooling/README.md +20 -0
  584. package/tooling/src/adapters/context-mode.js +50 -0
  585. package/tooling/src/capture/command.js +376 -0
  586. package/tooling/src/capture/store.js +99 -0
  587. package/tooling/src/capture/usage.js +270 -0
  588. package/tooling/src/checks/branches.js +50 -0
  589. package/tooling/src/checks/brand-truth.js +110 -0
  590. package/tooling/src/checks/changelog.js +231 -0
  591. package/tooling/src/checks/command-registry.js +36 -0
  592. package/tooling/src/checks/commits.js +102 -0
  593. package/tooling/src/checks/docs-drift.js +103 -0
  594. package/tooling/src/checks/docs-truth.js +201 -0
  595. package/tooling/src/checks/runtime-surface.js +156 -0
  596. package/tooling/src/cli.js +116 -0
  597. package/tooling/src/command-options.js +56 -0
  598. package/tooling/src/commands/validate.js +320 -0
  599. package/tooling/src/doctor/command.js +91 -0
  600. package/tooling/src/export/command.js +77 -0
  601. package/tooling/src/export/compiler.js +498 -0
  602. package/tooling/src/guards/loop-cap-guard.js +52 -0
  603. package/tooling/src/guards/protected-path-write-guard.js +67 -0
  604. package/tooling/src/index/command.js +152 -0
  605. package/tooling/src/index/storage.js +1061 -0
  606. package/tooling/src/index/summarizers.js +261 -0
  607. package/tooling/src/loaders.js +18 -0
  608. package/tooling/src/project-root.js +22 -0
  609. package/tooling/src/recall/command.js +225 -0
  610. package/tooling/src/schema-validator.js +30 -0
  611. package/tooling/src/state-root.js +40 -0
  612. package/tooling/src/status/command.js +71 -0
  613. package/wazir.manifest.yaml +135 -0
  614. package/workflows/README.md +19 -0
  615. package/workflows/author.md +42 -0
  616. package/workflows/clarify.md +38 -0
  617. package/workflows/design-review.md +46 -0
  618. package/workflows/design.md +44 -0
  619. package/workflows/discover.md +37 -0
  620. package/workflows/execute.md +48 -0
  621. package/workflows/learn.md +38 -0
  622. package/workflows/plan-review.md +42 -0
  623. package/workflows/plan.md +39 -0
  624. package/workflows/prepare-next.md +37 -0
  625. package/workflows/review.md +40 -0
  626. package/workflows/run-audit.md +41 -0
  627. package/workflows/spec-challenge.md +41 -0
  628. package/workflows/specify.md +38 -0
  629. package/workflows/verify.md +37 -0
@@ -0,0 +1,800 @@
1
+ # Typography -- Design Foundation Module
2
+
3
+ > **Category:** Design Foundation
4
+ > **Applies to:** All platforms -- Web, iOS, Android, Desktop
5
+ > **Last updated:** 2026-03-07
6
+ > **Sources:** Material Design 3, Apple HIG, Ant Design, WCAG 2.2, Butterick's Practical Typography, Smashing Magazine, Baymard Institute, Nielsen Norman Group
7
+
8
+ Typography is the single most impactful design decision in any interface. Text constitutes
9
+ 80-90% of most UI surfaces. Getting it right creates hierarchy, guides attention, and
10
+ builds trust before the user consciously registers anything.
11
+
12
+ ---
13
+
14
+ ## 1. Core Principles
15
+
16
+ ### 1.1 Type Scales and Modular Scales
17
+
18
+ A modular type scale is a series of font sizes where each step increases by a consistent ratio,
19
+ creating mathematically harmonious relationships between sizes. The ratio you choose determines
20
+ the contrast between hierarchy levels.
21
+
22
+ **Common Ratios:**
23
+
24
+ | Ratio Name | Value | Use Case |
25
+ |-----------------|-------|-------------------------------------------------|
26
+ | Minor Second | 1.067 | Dense data UIs, dashboards (minimal contrast) |
27
+ | Major Second | 1.125 | Compact apps, admin panels |
28
+ | Minor Third | 1.200 | General-purpose apps, balanced hierarchy |
29
+ | Major Third | 1.250 | Content-heavy sites, editorial, marketing |
30
+ | Perfect Fourth | 1.333 | Landing pages, bold hierarchy |
31
+ | Augmented Fourth| 1.414 | High-impact marketing, hero-driven layouts |
32
+ | Perfect Fifth | 1.500 | Presentations, very dramatic contrast |
33
+ | Golden Ratio | 1.618 | Editorial, artistic layouts (often too extreme) |
34
+
35
+ **Choosing a ratio:**
36
+ - **Dashboards and data-dense UIs:** Minor Second (1.067) or Major Second (1.125). You need
37
+ many levels of text but small jumps between them.
38
+ - **General product UIs (SaaS, mobile apps):** Minor Third (1.200) or Major Third (1.250).
39
+ Provides clear hierarchy without wasting vertical space.
40
+ - **Marketing and landing pages:** Perfect Fourth (1.333) or higher. Dramatic contrast between
41
+ headings and body drives scanning and conversion.
42
+
43
+ **Example -- Major Third (1.250) scale from 16px base:**
44
+
45
+ ```
46
+ Base: 16px (Body)
47
+ Step 1: 20px (Large Body / Subtitle)
48
+ Step 2: 25px (H3)
49
+ Step 3: 31px (H2)
50
+ Step 4: 39px (H1)
51
+ Step 5: 49px (Display)
52
+ Step 6: 61px (Hero)
53
+ ```
54
+
55
+ **Real-world design system scales:**
56
+
57
+ Material Design 3 type scale (15 tokens, Roboto, Regular/Medium weights):
58
+
59
+ | Role | Size | Line Height | Weight | Tracking |
60
+ |----------------|-------|-------------|---------|----------|
61
+ | Display Large | 57px | 64px | 400 | -0.25px |
62
+ | Display Medium | 45px | 52px | 400 | 0 |
63
+ | Display Small | 36px | 44px | 400 | 0 |
64
+ | Headline Large | 32px | 40px | 400 | 0 |
65
+ | Headline Medium| 28px | 36px | 400 | 0 |
66
+ | Headline Small | 24px | 32px | 400 | 0 |
67
+ | Title Large | 22px | 28px | 400 | 0 |
68
+ | Title Medium | 16px | 24px | 500 | 0.15px |
69
+ | Title Small | 14px | 20px | 500 | 0.1px |
70
+ | Body Large | 16px | 24px | 400 | 0.5px |
71
+ | Body Medium | 14px | 20px | 400 | 0.25px |
72
+ | Body Small | 12px | 16px | 400 | 0.4px |
73
+ | Label Large | 14px | 20px | 500 | 0.1px |
74
+ | Label Medium | 12px | 16px | 500 | 0.5px |
75
+ | Label Small | 11px | 16px | 500 | 0.5px |
76
+
77
+ Ant Design font scale (base 14px, natural logarithm progression):
78
+
79
+ ```
80
+ fontSizeSM: 12px
81
+ fontSize: 14px (base)
82
+ fontSizeLG: 16px
83
+ fontSizeXL: 20px
84
+ fontSizeHeading5: 16px
85
+ fontSizeHeading4: 20px
86
+ fontSizeHeading3: 24px
87
+ fontSizeHeading2: 30px
88
+ fontSizeHeading1: 38px
89
+ ```
90
+
91
+ The Ant Design scale uses a natural logarithm curve rather than a strict modular ratio,
92
+ resulting in sizes that feel slightly more compressed at the top end. Their base of 14px
93
+ (with 22px line height) reflects data-dense enterprise UI conventions.
94
+
95
+ ### 1.2 Font Selection Criteria
96
+
97
+ **Readability factors:**
98
+ - **x-height:** Fonts with a tall x-height (the height of lowercase letters relative to
99
+ capitals) are more legible at small sizes. Inter, Roboto, and SF Pro all have generous
100
+ x-heights.
101
+ - **Open counters:** Letters like `a`, `e`, `g`, `s` should have clearly open interior
102
+ spaces. Closed or narrow counters reduce legibility, especially at 12-14px.
103
+ - **Distinct letterforms:** Check for clear differentiation between `I` (capital i),
104
+ `l` (lowercase L), and `1` (number one). Also check `0` vs `O`, `rn` vs `m`.
105
+ - **Character set coverage:** Verify the font covers all needed languages and includes
106
+ tabular (monospaced) figures for data-heavy UIs.
107
+
108
+ **Personality and brand alignment:**
109
+
110
+ | Classification | Examples | Personality | Best For |
111
+ |--------------------|---------------------------------|-----------------------------------|------------------------------|
112
+ | Geometric sans | Futura, Poppins, Montserrat | Modern, clean, slightly cold | Tech products, portfolios |
113
+ | Humanist sans | Inter, Open Sans, Noto Sans | Warm, readable, approachable | General product UI |
114
+ | Neo-grotesque | Helvetica, Roboto, SF Pro | Neutral, professional | Platform defaults, corporate |
115
+ | Serif | Georgia, Merriweather, Source Serif | Authority, tradition, editorial | Long-form, news, finance |
116
+ | Monospace | JetBrains Mono, Fira Code, SF Mono | Technical, precise | Code, terminal, tabular data |
117
+
118
+ **Technical considerations:**
119
+ - **Variable fonts** are now best practice (2025-2026). A single variable font file replaces
120
+ multiple static weight files, reducing payload by up to 80%. Inter Variable, for example,
121
+ covers weights 100-900 and italic in one ~300KB WOFF2 file vs ~1.2MB for equivalent
122
+ static files.
123
+ - **Optical sizing:** Some variable fonts (e.g., SF Pro, Roboto Flex) include an optical
124
+ size axis that adjusts stroke contrast and spacing for different point sizes. This matters:
125
+ SF Pro Text is optimized for below 20pt, SF Pro Display for 20pt and above.
126
+ - **WOFF2 format:** Always serve WOFF2. It offers 30% better compression than WOFF and is
127
+ supported by 97%+ of browsers (Chrome 36+, Firefox 39+, Safari 12+, Edge 14+).
128
+
129
+ ### 1.3 Line Height (Leading)
130
+
131
+ Line height controls vertical rhythm and directly impacts readability. The rules differ
132
+ for body text versus headings.
133
+
134
+ **Body text:** 1.4 to 1.6 times the font size.
135
+ - 16px body text should have 22-26px line height (1.375-1.625).
136
+ - The sweet spot for most sans-serif body text at 14-18px is **1.5** (150%).
137
+ - Longer line lengths demand more line height. At 75+ characters per line, push toward 1.6.
138
+ - Shorter line lengths (mobile, narrow columns) can use 1.4.
139
+
140
+ **Headings:** 1.1 to 1.3 times the font size.
141
+ - Large display text (36px+) should use tight line heights: 1.1 to 1.2.
142
+ - Medium headings (24-32px): 1.2 to 1.25.
143
+ - Small headings (18-22px): 1.25 to 1.3.
144
+ - Headings rarely wrap, so tight line height maintains visual density.
145
+
146
+ **Captions, labels, and small text (11-12px):** 1.3 to 1.5.
147
+ - Small text paradoxically needs proportionally more leading because the eye struggles
148
+ to track back to the next line at small sizes.
149
+
150
+ **WCAG 2.2 requirement (SC 1.4.12, Level AA):** Content must remain readable and functional
151
+ when line height is set to at least 1.5 times the font size. Your default should meet or
152
+ exceed this.
153
+
154
+ ### 1.4 Line Length (Measure)
155
+
156
+ **Optimal range:** 45-75 characters per line, with **66 characters** as the typographic
157
+ ideal for sustained reading (Bringhurst, Elements of Typographic Style).
158
+
159
+ - **Below 45 characters:** Too many line breaks. The eye constantly jumps to the next
160
+ line, disrupting reading flow. Common on overly narrow mobile layouts.
161
+ - **Above 75 characters:** The eye loses its place when scanning back to the start of
162
+ the next line. Baymard Institute research found that product descriptions wider than
163
+ 80 characters per line were skipped 41% more often than those in the 60-70 range.
164
+ - **Mobile screens:** 35-50 characters is acceptable given physical constraints. Use
165
+ generous line height (1.5+) to compensate.
166
+
167
+ **Implementation:** Use `max-width: 65ch` (the `ch` unit equals the width of "0") on
168
+ text containers. For mobile-first: `max-width: min(65ch, 100% - 2rem)`.
169
+
170
+ ### 1.5 Letter Spacing (Tracking)
171
+
172
+ Letter spacing adjusts the uniform space between all characters in a block of text.
173
+ Use em-based values so spacing scales with font size.
174
+
175
+ **Guidelines:**
176
+ - **Body text (14-18px):** Leave at default (0) or use minimal tracking (0 to 0.02em).
177
+ Most well-designed body fonts have optimal built-in spacing. Adding tracking to body
178
+ text typically reduces readability.
179
+ - **Headings (24px+):** Slightly negative tracking (-0.01em to -0.02em) tightens large
180
+ text for visual cohesion. Material Design 3 uses -0.25px on Display Large (57px).
181
+ - **ALL CAPS text:** Always add 5-12% tracking (0.05em to 0.12em). Uppercase letters
182
+ are designed to begin words, not sit adjacent to other capitals. Without extra spacing,
183
+ all-caps text becomes a dense, illegible block.
184
+ - **Small caps:** Similar to all-caps, add 0.05em to 0.1em tracking.
185
+ - **Label and caption text (11-12px):** Slight positive tracking (0.02em to 0.05em)
186
+ improves legibility at small sizes. M3 uses 0.5px tracking on its 11-12px labels.
187
+
188
+ **WCAG 2.2 (SC 1.4.12):** Content must remain usable when letter spacing is increased to
189
+ at least 0.12em. Design with this tolerance in mind -- do not use fixed-width containers
190
+ that overflow when spacing increases.
191
+
192
+ ### 1.6 Word Spacing
193
+
194
+ Less commonly adjusted than letter spacing, but important for accessibility:
195
+ - Default word spacing works for most cases.
196
+ - For all-caps text or wide-tracked text, increase word spacing proportionally (0.05em
197
+ to 0.16em) so words remain distinguishable.
198
+ - **WCAG 2.2 (SC 1.4.12):** Content must function when word spacing is set to 0.16em.
199
+
200
+ ### 1.7 Font Weight Hierarchy
201
+
202
+ Use weight to create emphasis hierarchy. Limit yourself to 2-3 weights per typeface
203
+ in a single interface.
204
+
205
+ | Weight | CSS Value | Typical Use |
206
+ |---------|-----------|------------------------------------------|
207
+ | Thin | 100 | Decorative display text only (40px+) |
208
+ | Light | 300 | Large display headings, stylistic choice |
209
+ | Regular | 400 | Body text, descriptions, default |
210
+ | Medium | 500 | Subheadings, emphasized body, nav items |
211
+ | Semibold| 600 | Section headings, buttons, key labels |
212
+ | Bold | 700 | Primary headings, strong emphasis |
213
+ | Black | 900 | Hero text, display sizes only (36px+) |
214
+
215
+ **Rules:**
216
+ - Never use Thin (100) or Light (300) below 20px. Thin strokes disappear on low-DPI
217
+ screens and are unreadable for users with low vision.
218
+ - The minimum recommended contrast between weight levels is 200 units (e.g., 400 vs 600).
219
+ A jump from Regular (400) to Medium (500) is often too subtle to create clear hierarchy.
220
+ - **Ant Design's recommendation:** Regular (400) and Medium (500) are sufficient for most
221
+ UIs; Semibold (600) for English bold text. This restraint prevents visual noise.
222
+
223
+ ### 1.8 Web Font Loading Strategies
224
+
225
+ Custom fonts create a performance tension: beautiful typography vs fast rendering.
226
+ Three phenomena to understand:
227
+
228
+ - **FOIT (Flash of Invisible Text):** Browser hides text until the custom font loads.
229
+ Text is invisible for up to 3 seconds on slow connections. Terrible for usability.
230
+ - **FOUT (Flash of Unstyled Text):** Browser shows fallback font immediately, then swaps
231
+ to custom font when loaded. Causes a visible text reflow but text is always readable.
232
+ - **FOFT (Flash of Faux Text):** Load a minimal subset (Roman/Regular) first, then load
233
+ additional weights/styles. Most advanced strategy.
234
+
235
+ **The `font-display` CSS property:**
236
+
237
+ ```css
238
+ @font-face {
239
+ font-family: 'Inter';
240
+ src: url('/fonts/inter-var.woff2') format('woff2');
241
+ font-display: swap; /* Show fallback immediately, swap when loaded */
242
+ }
243
+ ```
244
+
245
+ | Value | Behavior | When to Use |
246
+ |------------|----------------------------------------|-------------------------------------|
247
+ | `auto` | Browser decides (usually FOIT) | Never use explicitly |
248
+ | `block` | Invisible for ~3s, then fallback | Icon fonts only |
249
+ | `swap` | Fallback immediately, swap when ready | Most text fonts (default choice) |
250
+ | `fallback` | 100ms invisible, then fallback stays | Body text where layout shift is bad |
251
+ | `optional` | Instant fallback; font used only if | Performance-critical pages |
252
+ | | already cached | |
253
+
254
+ **Best practice stack (2025-2026):**
255
+ 1. Use `font-display: swap` or `font-display: fallback` for body fonts.
256
+ 2. Preload the critical font file: `<link rel="preload" href="/fonts/inter-var.woff2"
257
+ as="font" type="font/woff2" crossorigin>`.
258
+ 3. Combine `rel="preload"` with `font-display: optional` to eliminate layout shifts entirely
259
+ (supported since Chrome 83).
260
+ 4. Subset fonts to include only needed character ranges (Latin, Latin Extended) to reduce
261
+ file size by 50-70%.
262
+ 5. Self-host fonts instead of using Google Fonts CDN -- avoids third-party DNS lookup,
263
+ connection overhead, and privacy issues (GDPR).
264
+
265
+ ### 1.9 System Font Stacks vs Custom Fonts
266
+
267
+ **System font stacks** use fonts already installed on the user's OS:
268
+
269
+ ```css
270
+ /* Modern system font stack */
271
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
272
+ /* Neo-Grotesque (includes Inter if installed) */
273
+ font-family: Inter, Roboto, 'Helvetica Neue', 'Arial Nova', 'Nimbus Sans', Arial, sans-serif;
274
+ ```
275
+
276
+ **When to use system fonts:** Performance-critical apps, dashboards, admin panels,
277
+ internal tools, anything that should feel native. Zero network requests, no FOUT/FOIT.
278
+
279
+ **When to use custom fonts:** Consumer-facing products where brand identity matters,
280
+ marketing sites, editorial content, or when specific typographic features are needed.
281
+
282
+ **Hybrid approach (recommended):** System font stack for body text (performance) plus
283
+ a single custom font for headings/display only (brand expression with minimal cost).
284
+
285
+ ---
286
+
287
+ ## 2. Do's and Don'ts
288
+
289
+ ### Do's
290
+
291
+ 1. **Do use 16px (1rem) as your minimum body text size on all platforms.** The browser
292
+ default is 16px for a reason. Research consistently shows that 16px is the threshold
293
+ below which reading speed decreases measurably. On mobile, 16px also prevents iOS
294
+ Safari from auto-zooming on input focus (which occurs below 16px).
295
+
296
+ 2. **Do limit your type scale to 5-7 distinct sizes.** Ant Design recommends 3-5 sizes
297
+ for most interfaces. Material Design 3 uses 15 tokens but groups them into 5 roles.
298
+ More sizes means more decisions, more inconsistency, and more cognitive load.
299
+
300
+ 3. **Do set line height in unitless values, not px.** Use `line-height: 1.5` not
301
+ `line-height: 24px`. Unitless values scale proportionally when font size changes
302
+ (via user preferences or responsive scaling).
303
+
304
+ 4. **Do use `rem` for font sizes and `em` for letter/word spacing.** `rem` respects
305
+ user browser settings. `em` scales spacing relative to the current font size. Avoid
306
+ `px` for font sizes -- it overrides user accessibility preferences.
307
+
308
+ 5. **Do constrain text containers to 65ch max-width.** The `ch` unit maps to the width
309
+ of the "0" character. `65ch` yields approximately 65-70 characters per line -- within
310
+ the optimal readability range.
311
+
312
+ 6. **Do test typography at 200% zoom.** WCAG 2.2 SC 1.4.4 (Level AA) requires content
313
+ to be readable and functional at 200% zoom. If your layout breaks or text overflows
314
+ at 2x, your typography system is fragile.
315
+
316
+ 7. **Do add 5-12% letter spacing to all-caps text.** Set `letter-spacing: 0.05em` to
317
+ `0.12em` on any `text-transform: uppercase` element. Without it, uppercase text
318
+ becomes a dense, illegible wall.
319
+
320
+ 8. **Do pair fonts with contrasting characteristics.** If combining two typefaces, pair
321
+ a serif heading font with a sans-serif body font (or vice versa). Two fonts from the
322
+ same classification (e.g., two geometric sans-serifs) look like a mistake, not a choice.
323
+
324
+ 9. **Do use variable fonts for any font loaded over the network.** A single variable
325
+ font file replaces 4-8 static files, reducing payload by 50-80% and HTTP requests.
326
+ Inter Variable, Roboto Flex, and Source Sans 3 VF are excellent free options.
327
+
328
+ 10. **Do implement fluid typography with `clamp()` for responsive headings.**
329
+ ```css
330
+ h1 { font-size: clamp(2rem, 5vw + 1rem, 3.5rem); }
331
+ h2 { font-size: clamp(1.5rem, 3vw + 0.75rem, 2.5rem); }
332
+ ```
333
+ This creates smooth scaling between a minimum and maximum size, eliminating abrupt
334
+ breakpoint jumps.
335
+
336
+ 11. **Do define a vertical rhythm unit and stick to it.** If your base line height is
337
+ 24px (16px * 1.5), all spacing (margins, padding) should be multiples of that 24px
338
+ unit (or 4px/8px subdivisions). This creates a consistent visual cadence.
339
+
340
+ 12. **Do preload your primary font file.** Add `<link rel="preload">` for the single
341
+ most critical font file (usually the body Regular weight). This shaves 100-300ms
342
+ off font load time.
343
+
344
+ 13. **Do support Dynamic Type on iOS and scalable `sp` units on Android.** Hard-coded
345
+ pixel sizes break accessibility settings. Users who increase their system font size
346
+ are doing so because they need to -- respect that preference.
347
+
348
+ 14. **Do test with real content, not lorem ipsum.** Lorem ipsum hides line-length
349
+ problems, orphan/widow issues, and awkward hyphenation. Use representative text in
350
+ the target language.
351
+
352
+ ### Don'ts
353
+
354
+ 1. **Don't use body text smaller than 14px on desktop or 16px on mobile.** Below 14px,
355
+ readability drops approximately 40% for users over 40 (age-related presbyopia).
356
+ Material Design's smallest body token (Body Small) is 12px but is intended for
357
+ captions and supplementary text, not sustained reading.
358
+
359
+ 2. **Don't use more than 2 typeface families in a single interface.** One for headings,
360
+ one for body. A third (monospace) is acceptable for code. More than two custom
361
+ families creates visual chaos and doubles font loading costs.
362
+
363
+ 3. **Don't use Thin (100) or Light (300) weights below 20px.** At small sizes, thin
364
+ strokes disappear on non-retina screens and become unreadable for low-vision users.
365
+ Light weights below 16px fail WCAG contrast requirements in many color combinations.
366
+
367
+ 4. **Don't set line height in fixed pixel values on text that can scale.** `line-height:
368
+ 24px` on text that grows to 20px at larger breakpoints produces cramped, overlapping
369
+ lines. Always use unitless multipliers.
370
+
371
+ 5. **Don't center-align paragraphs longer than 3 lines.** Centered text creates ragged
372
+ left edges that the eye cannot track consistently. Center alignment is acceptable
373
+ for short headings, pull quotes, and single-line captions only.
374
+
375
+ 6. **Don't justify text on the web without hyphenation.** `text-align: justify` without
376
+ `hyphens: auto` creates ugly, irregular word spacing (rivers of white space). Even
377
+ with hyphenation, justified text is problematic on narrow mobile columns.
378
+
379
+ 7. **Don't use color alone to convey typographic hierarchy.** A gray label vs a black
380
+ heading looks identical to someone with low contrast sensitivity. Combine color
381
+ differences with size and/or weight differences.
382
+
383
+ 8. **Don't load more than 3 font files (weights/styles) without a performance budget.**
384
+ Each additional font file adds 20-50KB (WOFF2) and a network request. Total custom
385
+ font budget should stay under 150KB for performance-sensitive applications.
386
+
387
+ 9. **Don't use `px` for font sizes in CSS.** Pixel values override user browser font-size
388
+ preferences, breaking accessibility. A user who sets their browser default to 20px
389
+ (for low vision) gets 16px anyway if you hard-code `font-size: 16px`. Use `rem`.
390
+
391
+ 10. **Don't apply letter-spacing to body text unless the font specifically requires it.**
392
+ Most professional body fonts have carefully tuned default spacing. Adding tracking
393
+ to body text at 14-18px typically reduces reading speed by 5-10%.
394
+
395
+ 11. **Don't use decorative or display fonts for body text.** Display fonts (Playfair
396
+ Display, Lobster, Pacifico) are designed for large sizes (36px+). At body sizes,
397
+ their stylistic flourishes become noise that impedes reading.
398
+
399
+ 12. **Don't ignore font fallback matching.** When your custom font loads after a system
400
+ fallback, mismatched metrics (x-height, character width) cause layout shift.
401
+ Use `size-adjust`, `ascent-override`, and `descent-override` in `@font-face` to
402
+ match fallback metrics:
403
+ ```css
404
+ @font-face {
405
+ font-family: 'Inter Fallback';
406
+ src: local('Arial');
407
+ size-adjust: 107%;
408
+ ascent-override: 90%;
409
+ descent-override: 22%;
410
+ }
411
+ ```
412
+
413
+ 13. **Don't use line lengths above 80 characters on any viewport.** Even on wide desktop
414
+ screens, unconstrained text width destroys readability. Always set `max-width` on
415
+ text containers.
416
+
417
+ 14. **Don't mix font-size specification methods.** If your design system uses `rem`,
418
+ use `rem` everywhere. Mixing `px`, `rem`, `em`, and `vw` for font sizes creates
419
+ unpredictable scaling behavior and maintenance nightmares.
420
+
421
+ ---
422
+
423
+ ## 3. Platform Variations
424
+
425
+ ### 3.1 iOS
426
+
427
+ **System font:** SF Pro (variable font with weight, width, optical size, and grade axes).
428
+ - SF Pro Text: Optimized for sizes below 20pt (more open spacing, slightly wider).
429
+ - SF Pro Display: Optimized for 20pt and above (tighter spacing, refined details).
430
+ - SF Pro Rounded: Alternative with rounded terminals for friendly UIs.
431
+
432
+ **Minimum size:** 11pt. Apple considers this the absolute floor for legible text. In
433
+ practice, use 13pt as the effective minimum for non-caption text.
434
+
435
+ **Default body size:** 17pt. This is the standard `body` text style in UIKit and SwiftUI.
436
+
437
+ **Dynamic Type:** Mandatory for App Store approval in spirit, strongly recommended in
438
+ practice. Dynamic Type defines text sizes across 12 levels:
439
+ - Standard sizes: xSmall through xxxLarge (7 levels)
440
+ - Accessibility sizes: AX1 through AX5 (5 levels, for users with significant vision needs)
441
+
442
+ Implementation requires using Apple's text styles (`UIFont.TextStyle`): `.largeTitle`,
443
+ `.title1`, `.title2`, `.title3`, `.headline`, `.subheadline`, `.body`, `.callout`,
444
+ `.footnote`, `.caption1`, `.caption2`.
445
+
446
+ **Key iOS-specific rules:**
447
+ - Never hard-code point sizes. Use text styles that respond to the user's Dynamic Type
448
+ setting.
449
+ - Test at the largest accessibility size (AX5). Layouts must scroll, not truncate.
450
+ - SF Pro automatically applies optical sizing -- you do not need to manually switch
451
+ between Text and Display variants in code.
452
+
453
+ ### 3.2 Android
454
+
455
+ **System font:** Roboto (Regular and Medium weights in M3 baseline).
456
+ - Material Design 3 uses Roboto as the default for all 15 type scale tokens.
457
+ - Variable font version (Roboto Flex) available with weight, width, and optical size axes.
458
+
459
+ **Minimum size:** 12sp. The `sp` (scale-independent pixel) unit respects user accessibility
460
+ font-size settings. Never use `dp` for text -- it does not scale with user preferences.
461
+
462
+ **Material Design 3 type scale roles:**
463
+ - **Display:** Hero and feature text (57/45/36sp). Used sparingly.
464
+ - **Headline:** Section and screen titles (32/28/24sp).
465
+ - **Title:** Subsection headers and emphasized navigation (22/16/14sp).
466
+ - **Body:** Paragraphs and general content (16/14/12sp).
467
+ - **Label:** Buttons, tabs, navigation, chips (14/12/11sp).
468
+
469
+ **Key Android-specific rules:**
470
+ - Use `sp` units for all text sizes.
471
+ - Support font scaling up to 200% (Android 14+ allows non-linear font scaling where
472
+ large text scales less aggressively than small text).
473
+ - Test on devices with 120dpi (ldpi) through 640dpi (xxxhdpi).
474
+ - Use `MaterialTheme.typography` tokens in Jetpack Compose rather than raw sp values.
475
+
476
+ ### 3.3 Web
477
+
478
+ **System font stack (zero network cost):**
479
+ ```css
480
+ body {
481
+ font-family: system-ui, -apple-system, BlinkMacSystemFont,
482
+ 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans',
483
+ sans-serif;
484
+ }
485
+ ```
486
+
487
+ This renders SF Pro on macOS/iOS, Segoe UI on Windows, and Roboto on Android/ChromeOS.
488
+
489
+ **Responsive typography with `clamp()`:**
490
+ ```css
491
+ /* Fluid type scale -- no media queries needed */
492
+ :root {
493
+ --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem); /* 12-14px */
494
+ --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem); /* 14-16px */
495
+ --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem); /* 16-18px */
496
+ --text-lg: clamp(1.125rem, 1rem + 0.6vw, 1.25rem); /* 18-20px */
497
+ --text-xl: clamp(1.25rem, 1rem + 1.2vw, 1.75rem); /* 20-28px */
498
+ --text-2xl: clamp(1.5rem, 1rem + 2vw, 2.25rem); /* 24-36px */
499
+ --text-3xl: clamp(1.875rem, 1rem + 3.5vw, 3rem); /* 30-48px */
500
+ --text-4xl: clamp(2.25rem, 1rem + 5vw, 3.75rem); /* 36-60px */
501
+ }
502
+
503
+ body {
504
+ font-size: var(--text-base);
505
+ line-height: 1.5;
506
+ }
507
+
508
+ h1 { font-size: var(--text-4xl); line-height: 1.1; }
509
+ h2 { font-size: var(--text-3xl); line-height: 1.15; }
510
+ h3 { font-size: var(--text-2xl); line-height: 1.2; }
511
+ h4 { font-size: var(--text-xl); line-height: 1.25; }
512
+ ```
513
+
514
+ **USWDS (U.S. Web Design System) approach:** Defines a 10-step normalized scale (3xs
515
+ through 3xl) mapped to specific rem values, with responsive overrides per breakpoint.
516
+
517
+ **Key web-specific rules:**
518
+ - Always set `font-size` on `<html>` as a percentage (e.g., `font-size: 100%`) not
519
+ pixels, to respect user browser defaults.
520
+ - Use `rem` for all font sizes. Reserve `em` for spacing properties (margins, padding)
521
+ that should scale relative to their local font size.
522
+ - Test at browser zoom levels of 100%, 150%, and 200%.
523
+ - Test with browser minimum font size set to 16px and 24px.
524
+ - Use `@media (prefers-reduced-motion)` to disable any typographic animations.
525
+
526
+ ### 3.4 Desktop (Native)
527
+
528
+ **Windows:** Segoe UI Variable (Windows 11+), Segoe UI (Windows 10). Default body size
529
+ is 14px (9pt at 96 DPI). Minimum recommended: 12px.
530
+
531
+ **macOS:** SF Pro via system API. Default body size is 13pt. The macOS typography scale
532
+ uses different defaults than iOS due to typical viewing distance (arm's length vs
533
+ handheld).
534
+
535
+ **Linux:** Varies by distribution. Noto Sans, DejaVu Sans, and Ubuntu are common. Design
536
+ for fallback robustness.
537
+
538
+ **Key desktop rules:**
539
+ - Desktop users sit further from the screen than mobile users. Slightly smaller body
540
+ text (14px vs 16px) is acceptable because viewing distance compensates.
541
+ - High-DPI (Retina, 4K) displays render thin font weights better than standard DPI.
542
+ Account for both in your weight choices.
543
+ - Honor system-level font size and scaling preferences. Both Windows and macOS allow
544
+ users to increase system text size.
545
+
546
+ ---
547
+
548
+ ## 4. Common Mistakes in AI-Generated Designs
549
+
550
+ AI design tools (Midjourney, DALL-E, Figma AI, and code-generating LLMs) produce
551
+ typography that looks plausible in mockups but fails in implementation. Here are the
552
+ most common errors and how to detect and fix them.
553
+
554
+ ### 4.1 Too Many Font Sizes
555
+
556
+ **The problem:** AI tools generate unique font sizes for every text element, producing
557
+ 8-15 distinct sizes in a single screen. This prevents systematic implementation and
558
+ creates visual noise.
559
+
560
+ **How to detect:** Export the design and list all unique font sizes. If there are more
561
+ than 6-7 distinct values, the scale is inconsistent.
562
+
563
+ **How to fix:** Map every AI-generated size to the nearest step in your type scale.
564
+ Round 15px to 14px, 19px to 20px, 27px to 28px. If a size doesn't fit the scale, it
565
+ shouldn't exist.
566
+
567
+ ### 4.2 Inconsistent Line Heights
568
+
569
+ **The problem:** AI generates different line-height ratios for text at the same size.
570
+ One 16px paragraph has 24px line height (1.5) while another has 20px (1.25). Or worse,
571
+ large headings have more proportional line height than body text (inverted hierarchy).
572
+
573
+ **How to detect:** Calculate the line-height ratio for every text block. Body text ratios
574
+ should be 1.4-1.6, heading ratios should be 1.1-1.3. Flag any body text below 1.4 or
575
+ headings above 1.35.
576
+
577
+ **How to fix:** Define line-height tokens paired to each font-size token in your design
578
+ system. Every font size gets exactly one line height.
579
+
580
+ ### 4.3 Wrong Font Weight Usage
581
+
582
+ **The problem:** AI often uses Regular (400) and Bold (700) exclusively, missing the
583
+ middle weights (Medium 500, Semibold 600) that create nuanced hierarchy. Or it uses
584
+ Light (300) for body text, which is illegible on non-retina screens.
585
+
586
+ **How to detect:** Audit all font weights used. If only 400 and 700 appear, the hierarchy
587
+ is too blunt. If 100-300 appears below 20px, it's unreadable.
588
+
589
+ **How to fix:** Introduce Medium (500) for subheadings and navigation, Semibold (600)
590
+ for section headings. Reserve Bold (700) for primary headings only.
591
+
592
+ ### 4.4 Variable Font Axis Violations
593
+
594
+ **The problem:** AI tools sometimes generate weight values outside a font's supported
595
+ range, or use arbitrary values like weight 450 on a font that only has 400 and 700.
596
+ Some tools misinterpret "medium" as weight 500 when the font's optical medium is
597
+ 420-460.
598
+
599
+ **How to detect:** Check the font's axis ranges (available in the font file metadata
600
+ or on Google Fonts). Flag any weight values outside the font's min/max.
601
+
602
+ **How to fix:** Map generated values to the font's actual supported weight stops. Test
603
+ at extremes (especially width below 60% and weight above 900) to catch glyph collapse.
604
+
605
+ ### 4.5 Missing Responsive Considerations
606
+
607
+ **The problem:** AI designs a single viewport (usually desktop at 1440px) and the type
608
+ scale doesn't adapt to mobile. 48px headings that work on desktop are absurdly large
609
+ on a 375px phone.
610
+
611
+ **How to detect:** Preview the design at 375px width. If headings wrap to 3+ lines or
612
+ text overflows, the typography is not responsive.
613
+
614
+ **How to fix:** Define minimum and maximum sizes for each token. Implement with
615
+ `clamp()` on web, Dynamic Type on iOS, or sp-based scaling on Android.
616
+
617
+ ### 4.6 Decorative Choices Over Readability
618
+
619
+ **The problem:** AI loves stylistic choices: ultra-thin weights, all-caps body text,
620
+ extreme letter spacing, decorative fonts for UI labels.
621
+
622
+ **How to detect:** Read 200 words of the body text at actual size. If you have to
623
+ squint or slow down, it's too stylized.
624
+
625
+ **How to fix:** Reserve decorative treatment for display text (hero headings, marketing
626
+ callouts). All functional text (body, labels, navigation, forms) should use a neutral,
627
+ highly legible typeface at Regular or Medium weight.
628
+
629
+ ---
630
+
631
+ ## 5. Decision Framework
632
+
633
+ ### 5.1 Serif vs Sans-Serif vs Monospace
634
+
635
+ | Factor | Serif | Sans-Serif | Monospace |
636
+ |--------------------|--------------------------------|--------------------------------|-------------------------|
637
+ | **Readability** | Equal on HD screens; | Slightly better on | Poor for prose; |
638
+ | | better for long-form print | low-res screens | good for code |
639
+ | **Personality** | Authority, tradition, | Modern, clean, | Technical, |
640
+ | | editorial, luxury | approachable | precise, raw |
641
+ | **Best for** | News, editorial, legal, | Product UI, SaaS, | Code, data tables, |
642
+ | | finance, publishing | mobile apps, dashboards | terminal output |
643
+ | **Avoid for** | Dense data UIs at small | Long-form editorial | Any body text |
644
+ | | sizes on low-DPI screens | (can feel sterile) | (too wide, too uniform) |
645
+ | **Screen quality** | Needs high-res to render | Works on any screen | Works on any screen |
646
+ | | serifs crisply | quality | |
647
+
648
+ **Decision rule:** If the primary content is long-form reading (articles, documentation),
649
+ consider a serif. For everything else, default to sans-serif. Use monospace exclusively
650
+ for code and fixed-width data.
651
+
652
+ Nielsen Norman Group's research (2024) confirms that on modern high-resolution screens,
653
+ the readability difference between serif and sans-serif is negligible. Context, spacing,
654
+ and contrast matter more than serif presence.
655
+
656
+ ### 5.2 System Fonts vs Custom Fonts
657
+
658
+ | Factor | System Fonts | Custom Fonts |
659
+ |--------------------|--------------------------------|--------------------------------|
660
+ | **Performance** | Zero load time, no CLS | 20-150KB payload, FOUT/CLS |
661
+ | **Brand** | Generic, platform-native feel | Unique brand identity |
662
+ | **Maintenance** | Zero -- OS handles updates | Must manage licensing, hosting |
663
+ | **Consistency** | Different on each OS | Identical cross-platform |
664
+ | **Cost** | Free | Licensing fees (or free via GF) |
665
+ | **Accessibility** | Respected by OS settings | May fight OS font preferences |
666
+
667
+ **Decision rule:** Start with system fonts. Move to a custom font only when brand
668
+ identity is a primary product requirement AND you have a performance budget for it.
669
+ A single variable font file (WOFF2, subset to Latin) typically adds 30-80KB -- acceptable
670
+ for most products.
671
+
672
+ ### 5.3 Trade-offs Matrix
673
+
674
+ | Priority | Optimize for | Sacrifice |
675
+ |-------------------|----------------------------------------|-----------------------------------|
676
+ | **Performance** | System fonts, font-display: optional | Brand uniqueness |
677
+ | **Brand** | Custom variable font, distinctive scale| 30-80KB payload, potential CLS |
678
+ | **Readability** | 16px+ body, 1.5 line height, 65ch max | Compact layouts, information density|
679
+ | **Density** | 13-14px body, 1.35 line height | Readability for older/impaired users|
680
+ | **Accessibility** | rem units, Dynamic Type, 200% zoom | Pixel-perfect control |
681
+
682
+ ---
683
+
684
+ ## 6. Quick Reference Checklist
685
+
686
+ Use this checklist to audit typography in any design or implementation. Every item should
687
+ be verified before shipping.
688
+
689
+ ### Scale and Sizing
690
+ - [ ] **Type scale uses 5-7 distinct sizes maximum** (not counting responsive variants)
691
+ - [ ] **Base body text is at least 16px (1rem) on mobile, at least 14px on desktop**
692
+ - [ ] **Font sizes use `rem` (web), `sp` (Android), or text styles with Dynamic Type (iOS)**
693
+ - [ ] **Display/hero text does not exceed 7 distinct sizes in the full scale**
694
+ - [ ] **Heading sizes decrease in a consistent ratio (no arbitrary jumps)**
695
+
696
+ ### Line Height and Spacing
697
+ - [ ] **Body text line height is 1.4-1.6 (unitless)**
698
+ - [ ] **Heading line height is 1.1-1.3 (unitless)**
699
+ - [ ] **Line length is 45-75 characters (use `max-width: 65ch` on text containers)**
700
+ - [ ] **All-caps text has letter-spacing of 0.05em-0.12em**
701
+ - [ ] **Vertical spacing follows a consistent rhythm (multiples of base line height)**
702
+
703
+ ### Font Loading and Performance
704
+ - [ ] **Total custom font payload is under 150KB (WOFF2)**
705
+ - [ ] **Primary font is preloaded via `<link rel="preload">`**
706
+ - [ ] **`font-display: swap` or `fallback` is set on all `@font-face` rules**
707
+ - [ ] **Fallback font metrics are matched with `size-adjust` to minimize CLS**
708
+ - [ ] **Variable fonts are used instead of multiple static weight files**
709
+
710
+ ### Accessibility
711
+ - [ ] **No text below 11px/11pt on any platform**
712
+ - [ ] **Layout survives 200% browser zoom without overflow or truncation**
713
+ - [ ] **Layout survives WCAG 1.4.12 text spacing overrides (1.5x line height, 0.12em letter spacing, 0.16em word spacing, 2x paragraph spacing)**
714
+ - [ ] **Font weight of body text is Regular (400) or Medium (500) -- never Thin/Light for functional text below 20px**
715
+ - [ ] **Color is not the only differentiator in the type hierarchy (size or weight also differs)**
716
+
717
+ ### Platform Compliance
718
+ - [ ] **iOS: Dynamic Type is implemented; text styles used instead of hard-coded sizes**
719
+ - [ ] **Android: sp units used for all text; tested with system font scaling at 200%**
720
+ - [ ] **Web: `<html>` font-size is percentage-based (not px); tested at multiple zoom levels**
721
+ - [ ] **Cross-platform: typography tokens are defined in a shared design system, not ad hoc per screen**
722
+
723
+ ---
724
+
725
+ ## Appendix: Reference Values at a Glance
726
+
727
+ ### Minimum Font Sizes by Platform
728
+
729
+ | Platform | Absolute Minimum | Recommended Body Minimum |
730
+ |----------------|------------------|--------------------------|
731
+ | iOS | 11pt | 17pt (system default) |
732
+ | Android | 12sp | 14sp (M3 Body Medium) |
733
+ | Web (mobile) | 12px | 16px (1rem) |
734
+ | Web (desktop) | 12px | 14px (0.875rem) |
735
+ | macOS | 10pt | 13pt (system default) |
736
+ | Windows | 9pt | 14px (Segoe UI default) |
737
+
738
+ ### WCAG 2.2 Text Spacing Requirements (SC 1.4.12, Level AA)
739
+
740
+ | Property | Minimum Value |
741
+ |--------------------|-----------------------------|
742
+ | Line height | 1.5x font size |
743
+ | Paragraph spacing | 2x font size |
744
+ | Letter spacing | 0.12x font size (0.12em) |
745
+ | Word spacing | 0.16x font size (0.16em) |
746
+
747
+ Content must remain readable and functional when users apply these overrides.
748
+ Do not use fixed-height containers or `overflow: hidden` on text blocks.
749
+
750
+ ### Recommended Font Pairings
751
+
752
+ | Heading Font | Body Font | Style |
753
+ |-------------------------|--------------------------|--------------------------|
754
+ | SF Pro Display | SF Pro Text | Native iOS/macOS |
755
+ | Roboto | Roboto | Native Android / M3 |
756
+ | Inter (600-700) | Inter (400) | Modern product UI |
757
+ | Source Serif 4 | Source Sans 3 | Editorial / documentation|
758
+ | Playfair Display | Lato | Luxury / lifestyle |
759
+ | Space Grotesk | Inter | Tech / developer tools |
760
+ | Fraunces | Commissioner | Warm editorial |
761
+
762
+ ### CSS Fluid Typography Starter
763
+
764
+ ```css
765
+ :root { font-size: clamp(100%, 90% + 0.5vw, 112.5%); }
766
+ body {
767
+ font-family: system-ui, -apple-system, BlinkMacSystemFont,
768
+ 'Segoe UI', Roboto, sans-serif;
769
+ font-size: 1rem; line-height: 1.5;
770
+ -webkit-font-smoothing: antialiased;
771
+ text-rendering: optimizeLegibility;
772
+ }
773
+ h1 { font-size: clamp(2rem, 1rem + 4vw, 3.5rem); line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
774
+ h2 { font-size: clamp(1.5rem, 0.75rem + 3vw, 2.5rem); line-height: 1.15; font-weight: 700; }
775
+ h3 { font-size: clamp(1.25rem, 0.75rem + 2vw, 1.75rem); line-height: 1.2; font-weight: 600; }
776
+ p, li, dd { max-width: 65ch; line-height: 1.5; }
777
+ small, .caption { font-size: 0.875rem; line-height: 1.4; }
778
+ .all-caps { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
779
+ code, pre { font-family: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', Consolas, monospace; font-size: 0.875em; }
780
+ ```
781
+
782
+ ---
783
+
784
+ **Sources:**
785
+
786
+ - [Material Design 3 -- Typography Type Scale Tokens](https://m3.material.io/styles/typography/type-scale-tokens)
787
+ - [Apple Human Interface Guidelines -- Typography](https://developer.apple.com/design/human-interface-guidelines/typography)
788
+ - [Ant Design -- Font Specification](https://ant.design/docs/spec/font/)
789
+ - [WCAG 2.2 -- Understanding SC 1.4.12: Text Spacing](https://www.w3.org/WAI/WCAG22/Understanding/text-spacing.html)
790
+ - [Smashing Magazine -- Modern Fluid Typography Using CSS Clamp](https://www.smashingmagazine.com/2022/01/modern-fluid-typography-css-clamp/)
791
+ - [Baymard Institute -- Line Length Readability](https://baymard.com/blog/line-length-readability)
792
+ - [Nielsen Norman Group -- Serif vs Sans-Serif Fonts for HD Screens](https://www.nngroup.com/articles/serif-vs-sans-serif-fonts-hd-screens/)
793
+ - [Butterick's Practical Typography -- Line Length](https://practicaltypography.com/line-length.html)
794
+ - [CSS-Tricks -- Keeping Track of Letter-Spacing Guidelines](https://css-tricks.com/keeping-track-letter-spacing-guidelines/)
795
+ - [Modern Font Stacks](https://modernfontstacks.com)
796
+ - [Zachleat -- Comprehensive Guide to Font Loading Strategies](https://www.zachleat.com/web/comprehensive-webfonts)
797
+ - [web.dev -- Responsive and Fluid Typography with Baseline CSS Features](https://web.dev/articles/baseline-in-action-fluid-type)
798
+ - [Material Web -- Typography Theming](https://material-web.dev/theming/typography/)
799
+ - [Learn UI Design -- iOS Font Size Guidelines](https://www.learnui.design/blog/ios-font-size-guidelines.html)
800
+ - [Learn UI Design -- Android/Material Design Font Size Guidelines](https://www.learnui.design/blog/android-material-design-font-size-guidelines.html)