contextos-agents 1.7.0 → 2.0.0-beta.3

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 (313) hide show
  1. package/.agents/AGENTS.md +16 -50
  2. package/.agents/adapters/aider/export.js +117 -99
  3. package/.agents/adapters/claude/export.js +68 -26
  4. package/.agents/adapters/copilot/export.js +90 -53
  5. package/.agents/adapters/cursor/export.js +100 -104
  6. package/.agents/adapters/drift-detector.js +196 -0
  7. package/.agents/adapters/gemini/export.js +76 -45
  8. package/.agents/adapters/pure-compiler.js +443 -0
  9. package/.agents/adapters/zed/export.js +104 -96
  10. package/.agents/compiled/registry.v2.json +504 -0
  11. package/.agents/compiled/registry.v2.sha256 +1 -0
  12. package/.agents/compiler/manifest-compiler.js +963 -0
  13. package/.agents/compiler/vendor/yaml.LICENSE.txt +13 -0
  14. package/.agents/compiler/vendor/yaml.SBOM.json +6 -0
  15. package/.agents/compiler/vendor/yaml.js +139 -0
  16. package/.agents/core/profiles/init.yaml +25 -0
  17. package/.agents/core/skills/context-manager/skill.yaml +3 -5
  18. package/.agents/core/skills/context-os/SKILL.md +3 -6
  19. package/.agents/core/skills/context-os/skill.yaml +3 -8
  20. package/.agents/core/skills/engineering-workflow/skill.yaml +1 -7
  21. package/.agents/core/skills/gemini-precision/skill.yaml +1 -6
  22. package/.agents/core/skills/gstack-roles/skill.yaml +3 -6
  23. package/.agents/core/skills/ponytail-mindset/skill.yaml +1 -7
  24. package/.agents/core/skills/security/skill.yaml +15 -3
  25. package/.agents/ctx.js +537 -112
  26. package/.agents/customization-dx.js +282 -0
  27. package/.agents/doctor.js +855 -66
  28. package/.agents/filesystem/index.js +71 -0
  29. package/.agents/filesystem/journaled-transaction.js +451 -0
  30. package/.agents/filesystem/lockfile-v2.js +275 -0
  31. package/.agents/filesystem/platform-hardening.js +222 -0
  32. package/.agents/filesystem/project-lock.js +218 -0
  33. package/.agents/filesystem/safe-path.js +256 -0
  34. package/.agents/generated/claude/skills/context-os/SKILL.md +1 -1
  35. package/.agents/generated/gemini/skills/context-os/SKILL.md +2 -2
  36. package/.agents/plugins/contextos/plugin.json +1 -1
  37. package/.agents/plugins.js +278 -64
  38. package/.agents/profiles.js +486 -51
  39. package/.agents/resolver/canonical-resolver.js +1348 -0
  40. package/.agents/resolver.js +50 -534
  41. package/.agents/rules/rule-catalog.js +525 -0
  42. package/.agents/schemas/attestation.review.v1.json +111 -0
  43. package/.agents/schemas/attestation.verification.v1.json +85 -0
  44. package/.agents/schemas/lockfile.v2.schema.json +134 -0
  45. package/.agents/schemas/profile.v2.schema.json +114 -0
  46. package/.agents/schemas/runtime.thread.v1.json +192 -0
  47. package/.agents/schemas/skill.manifest.v2.json +177 -0
  48. package/.agents/schemas/verification.spec.v1.json +39 -0
  49. package/.agents/schemas/workspace.graph.schema.json +106 -0
  50. package/.agents/skills-index.json +6 -166
  51. package/.agents/stats.js +9 -9
  52. package/.agents/transaction-core/event-store.js +288 -0
  53. package/.agents/transaction-core/idempotency.js +129 -0
  54. package/.agents/transaction-core/ipc-lock.js +311 -0
  55. package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
  56. package/.agents/validate.js +44 -1
  57. package/.agents/watch.js +354 -102
  58. package/.agents/workspace/workspace-graph.js +778 -0
  59. package/README.md +59 -387
  60. package/benchmarks/v2/analysis/statistics.js +140 -0
  61. package/benchmarks/v2/analysis/stats.js +69 -0
  62. package/benchmarks/v2/arms/arm-definitions.js +79 -0
  63. package/benchmarks/v2/dataset.schema.json +34 -0
  64. package/benchmarks/v2/evaluators/index.js +25 -0
  65. package/benchmarks/v2/evaluators/verified-success.js +116 -0
  66. package/benchmarks/v2/harness/runner.js +88 -0
  67. package/benchmarks/v2/pilot-tasks.json +392 -0
  68. package/bin/commands/recover.js +88 -0
  69. package/bin/commands/update.js +80 -17
  70. package/bin/commands.js +62 -25
  71. package/bin/index.js +138 -81
  72. package/bin/lib/lockfile.js +5 -3
  73. package/bin/lib/safe-writer.js +34 -3
  74. package/package.json +87 -72
  75. package/registry.json +2 -2
  76. package/registry.v2.schema.json +86 -0
  77. package/.agents/core/profiles/backend.yaml +0 -47
  78. package/.agents/core/profiles/enterprise.yaml +0 -46
  79. package/.agents/core/profiles/frontend.yaml +0 -46
  80. package/.agents/core/profiles/hackathon.yaml +0 -45
  81. package/.agents/core/profiles/mvp.yaml +0 -44
  82. package/.agents/core/profiles/startup.yaml +0 -48
  83. package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
  84. package/.agents/core/skills/adapters/SKILL.md +0 -105
  85. package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
  86. package/.agents/core/skills/adapters/VALIDATION.json +0 -12
  87. package/.agents/core/skills/adapters/skill.yaml +0 -16
  88. package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
  89. package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
  90. package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -12
  91. package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
  92. package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
  93. package/.agents/core/skills/brutalist-design/skill.yaml +0 -12
  94. package/.agents/core/skills/database/EXAMPLES.md +0 -74
  95. package/.agents/core/skills/database/SKILL.md +0 -101
  96. package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
  97. package/.agents/core/skills/database/VALIDATION.json +0 -11
  98. package/.agents/core/skills/database/skill.yaml +0 -31
  99. package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
  100. package/.agents/core/skills/ddd/SKILL.md +0 -247
  101. package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
  102. package/.agents/core/skills/ddd/VALIDATION.json +0 -12
  103. package/.agents/core/skills/ddd/ddd.md +0 -178
  104. package/.agents/core/skills/ddd/skill.yaml +0 -17
  105. package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
  106. package/.agents/core/skills/decisions/SKILL.md +0 -90
  107. package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
  108. package/.agents/core/skills/decisions/VALIDATION.json +0 -12
  109. package/.agents/core/skills/decisions/skill.yaml +0 -16
  110. package/.agents/core/skills/docker/EXAMPLES.md +0 -56
  111. package/.agents/core/skills/docker/SKILL.md +0 -63
  112. package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
  113. package/.agents/core/skills/docker/VALIDATION.json +0 -11
  114. package/.agents/core/skills/docker/skill.yaml +0 -29
  115. package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
  116. package/.agents/core/skills/fastapi/SKILL.md +0 -148
  117. package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
  118. package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
  119. package/.agents/core/skills/fastapi/fastapi.md +0 -112
  120. package/.agents/core/skills/fastapi/skill.yaml +0 -17
  121. package/.agents/core/skills/generators/EXAMPLES.md +0 -19
  122. package/.agents/core/skills/generators/SKILL.md +0 -112
  123. package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
  124. package/.agents/core/skills/generators/VALIDATION.json +0 -12
  125. package/.agents/core/skills/generators/skill.yaml +0 -25
  126. package/.agents/core/skills/generators/templates/API.md +0 -77
  127. package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
  128. package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
  129. package/.agents/core/skills/generators/templates/DECISION.md +0 -46
  130. package/.agents/core/skills/generators/templates/PRD.md +0 -67
  131. package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
  132. package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
  133. package/.agents/core/skills/generators/templates/TASKS.md +0 -43
  134. package/.agents/core/skills/generators/templates/UI.md +0 -73
  135. package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
  136. package/.agents/core/skills/graphify/SKILL.md +0 -130
  137. package/.agents/core/skills/graphify/VALIDATION.json +0 -12
  138. package/.agents/core/skills/graphify/skill.yaml +0 -18
  139. package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
  140. package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
  141. package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
  142. package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
  143. package/.agents/core/skills/impeccable-design/skill.yaml +0 -20
  144. package/.agents/core/skills/interview-me/SKILL.md +0 -97
  145. package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
  146. package/.agents/core/skills/interview-me/skill.yaml +0 -12
  147. package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
  148. package/.agents/core/skills/microservices/SKILL.md +0 -164
  149. package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
  150. package/.agents/core/skills/microservices/VALIDATION.json +0 -12
  151. package/.agents/core/skills/microservices/microservices.md +0 -119
  152. package/.agents/core/skills/microservices/skill.yaml +0 -17
  153. package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
  154. package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
  155. package/.agents/core/skills/minimalist-design/skill.yaml +0 -12
  156. package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
  157. package/.agents/core/skills/nestjs/SKILL.md +0 -139
  158. package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
  159. package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
  160. package/.agents/core/skills/nestjs/nestjs.md +0 -103
  161. package/.agents/core/skills/nestjs/skill.yaml +0 -17
  162. package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
  163. package/.agents/core/skills/nextjs/SKILL.md +0 -163
  164. package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
  165. package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
  166. package/.agents/core/skills/nextjs/nextjs.md +0 -67
  167. package/.agents/core/skills/nextjs/skill.yaml +0 -17
  168. package/.agents/core/skills/node/EXAMPLES.md +0 -80
  169. package/.agents/core/skills/node/SKILL.md +0 -128
  170. package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
  171. package/.agents/core/skills/node/VALIDATION.json +0 -12
  172. package/.agents/core/skills/node/node.md +0 -87
  173. package/.agents/core/skills/node/skill.yaml +0 -17
  174. package/.agents/core/skills/performance/EXAMPLES.md +0 -30
  175. package/.agents/core/skills/performance/SKILL.md +0 -75
  176. package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
  177. package/.agents/core/skills/performance/VALIDATION.json +0 -12
  178. package/.agents/core/skills/performance/performance.md +0 -52
  179. package/.agents/core/skills/performance/skill.yaml +0 -17
  180. package/.agents/core/skills/react/EXAMPLES.md +0 -79
  181. package/.agents/core/skills/react/SKILL.md +0 -132
  182. package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
  183. package/.agents/core/skills/react/VALIDATION.json +0 -12
  184. package/.agents/core/skills/react/react.md +0 -93
  185. package/.agents/core/skills/react/skill.yaml +0 -17
  186. package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
  187. package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
  188. package/.agents/core/skills/react-best-practices/skill.yaml +0 -14
  189. package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
  190. package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
  191. package/.agents/core/skills/redesign-audit/skill.yaml +0 -12
  192. package/.agents/core/skills/soft-design/SKILL.md +0 -108
  193. package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
  194. package/.agents/core/skills/soft-design/skill.yaml +0 -12
  195. package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
  196. package/.agents/core/skills/state-management/SKILL.md +0 -48
  197. package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
  198. package/.agents/core/skills/state-management/VALIDATION.json +0 -11
  199. package/.agents/core/skills/state-management/skill.yaml +0 -28
  200. package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -117
  201. package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
  202. package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -12
  203. package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
  204. package/.agents/core/skills/system-design/SKILL.md +0 -419
  205. package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
  206. package/.agents/core/skills/system-design/VALIDATION.json +0 -12
  207. package/.agents/core/skills/system-design/skill.yaml +0 -20
  208. package/.agents/core/skills/system-design/system-design.md +0 -112
  209. package/.agents/core/skills/testing/EXAMPLES.md +0 -71
  210. package/.agents/core/skills/testing/SKILL.md +0 -70
  211. package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
  212. package/.agents/core/skills/testing/VALIDATION.json +0 -11
  213. package/.agents/core/skills/testing/skill.yaml +0 -32
  214. package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
  215. package/.agents/core/skills/typescript/SKILL.md +0 -112
  216. package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
  217. package/.agents/core/skills/typescript/VALIDATION.json +0 -12
  218. package/.agents/core/skills/typescript/skill.yaml +0 -17
  219. package/.agents/core/skills/typescript/typescript.md +0 -71
  220. package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
  221. package/.agents/core/skills/ui-design/SKILL.md +0 -124
  222. package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
  223. package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
  224. package/.agents/core/skills/ui-design/skill.yaml +0 -17
  225. package/.agents/core/skills/ui-design/ui.md +0 -88
  226. package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
  227. package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
  228. package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
  229. package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
  230. package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -19
  231. package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
  232. package/.agents/core/skills/ux-design/SKILL.md +0 -116
  233. package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
  234. package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
  235. package/.agents/core/skills/ux-design/skill.yaml +0 -17
  236. package/.agents/core/skills/ux-design/ux.md +0 -80
  237. package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
  238. package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
  239. package/.agents/core/skills/vercel-optimize/scripts/collect-signals.mjs +0 -131
  240. package/.agents/core/skills/vercel-optimize/scripts/gate-investigations.mjs +0 -142
  241. package/.agents/core/skills/vercel-optimize/scripts/merge-signals.mjs +0 -143
  242. package/.agents/core/skills/vercel-optimize/scripts/scan-codebase.mjs +0 -174
  243. package/.agents/core/skills/vercel-optimize/skill.yaml +0 -18
  244. package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
  245. package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
  246. package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
  247. package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
  248. package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
  249. package/.agents/core/skills/web-accessibility/skill.yaml +0 -17
  250. package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
  251. package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
  252. package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
  253. package/.agents/generated/claude/skills/database/SKILL.md +0 -191
  254. package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
  255. package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
  256. package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
  257. package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
  258. package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
  259. package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
  260. package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
  261. package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
  262. package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
  263. package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
  264. package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
  265. package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
  266. package/.agents/generated/claude/skills/node/SKILL.md +0 -224
  267. package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
  268. package/.agents/generated/claude/skills/react/SKILL.md +0 -227
  269. package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
  270. package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
  271. package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
  272. package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
  273. package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -110
  274. package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
  275. package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
  276. package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
  277. package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
  278. package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
  279. package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
  280. package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
  281. package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
  282. package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
  283. package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
  284. package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
  285. package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
  286. package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
  287. package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
  288. package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
  289. package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
  290. package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
  291. package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
  292. package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
  293. package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
  294. package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
  295. package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
  296. package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
  297. package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
  298. package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
  299. package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
  300. package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
  301. package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
  302. package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
  303. package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
  304. package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
  305. package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -116
  306. package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
  307. package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
  308. package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
  309. package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
  310. package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
  311. package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
  312. package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
  313. package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
@@ -1,121 +0,0 @@
1
- # Web Performance & Core Web Vitals
2
-
3
- ## Overview
4
-
5
- Enforces high-efficiency frontend and full-stack performance standards to achieve exceptional Core Web Vitals: Largest Contentful Paint (LCP < 2.5s), Interaction to Next Paint (INP < 200ms), and Cumulative Layout Shift (CLS < 0.1).
6
-
7
- ## When to Use
8
-
9
- Activate whenever analyzing, profiling, writing, or optimizing page loading speeds, network waterfalls, script bundling, animation frame rates, or data caching.
10
-
11
- ## Negative Constraints (What NOT to Do)
12
-
13
- 1. **NEVER introduce async waterfalls**: Do not chain sequential `await` calls when requests can be executed concurrently via `Promise.all()`.
14
- 2. **NEVER import large full libraries when only a utility is needed**: Never `import _ from 'lodash'`; use `import debounce from 'lodash/debounce'` or native alternatives.
15
- 3. **NEVER render images or videos without explicit aspect ratios**: Always provide `width` and `height` or `aspect-ratio` to avoid Cumulative Layout Shift (CLS).
16
- 4. **NEVER trigger synchronous layout thrashing**: Do not alternate between reading layout properties (`offsetHeight`, `getBoundingClientRect`) and writing styles in loops.
17
- 5. **NEVER animate non-composited properties**: Animate only GPU-composited CSS properties (`transform`, `opacity`). Never animate `width`, `height`, `top`, `left`, or `margin`.
18
-
19
- ## Rules & Patterns
20
-
21
- ### 1. Vercel Optimization Hierarchy by Impact
22
-
23
- | Priority | Category | Key Optimization Target | Expected Impact |
24
- |:---|:---|:---|:---|
25
- | **1. CRITICAL** | **Eliminating Waterfalls** | Parallel data fetching (`Promise.all`), Suspense streaming | **30–60% faster LCP** |
26
- | **2. CRITICAL** | **Bundle Size Optimization** | Direct submodule imports, `next/dynamic`, deferring 3rd party scripts | **40–70% smaller initial JS** |
27
- | **3. HIGH** | **Server-Side & RSC Caching** | `React.cache()` request deduplication, edge SSR caching | **Lower TTFB & DB load** |
28
- | **4. MEDIUM-HIGH** | **Client Query Optimization** | SWR / TanStack Query stale-while-revalidate, deduplication | **Zero redundant network calls** |
29
- | **5. MEDIUM** | **Render & DOM Optimization** | Virtualization for large lists, state colocation, `:focus-visible` | **Smooth 60 FPS / INP < 100ms** |
30
-
31
- ### 2. Eliminating Network Waterfalls
32
-
33
- ```ts
34
- // [GOOD] Parallel execution
35
- const [user, notifications] = await Promise.all([
36
- fetchUser(),
37
- fetchNotifications(),
38
- ]);
39
- const posts = await fetchPosts(user.id);
40
- ```
41
-
42
- ### 3. Layout Shift & Visual Stability (CLS < 0.1)
43
-
44
- - **Images & Video**: Always supply `width`, `height`, and `sizes` or CSS `aspect-ratio: 16 / 9`.
45
- - **Dynamic Content**: Reserve layout space for dynamically loaded widgets with min-height placeholders or skeletons.
46
- - **Tabular Numbers**: Use `font-feature-settings: "tnum"` / `font-variant-numeric: tabular-nums` for counters, clocks, and tables to prevent number width jitter.
47
-
48
- ## Code Examples
49
-
50
- See `EXAMPLES.md` for detailed performance patterns and benchmark snippets.
51
-
52
- ## Validation Checklist
53
-
54
- - [ ] LCP target is < 2.5s with preloaded critical fonts and LCP image `priority`.
55
- - [ ] No sequential `await` waterfalls in API routes or Server Components.
56
- - [ ] All animated elements use only `transform` and `opacity`.
57
- - [ ] `prefers-reduced-motion` media queries are respected.
58
- - [ ] Large tables / lists (> 100 items) utilize virtualization.
59
-
60
- ## Common Mistakes
61
-
62
- - Chaining independent async requests instead of using `Promise.all`.
63
- - Animating layout-triggering properties (`height`, `width`, `top`) causing jank.
64
- - Missing image dimensions causing layout shift when images finish loading.
65
-
66
- ## Integration Notes
67
-
68
- - Pairs with `nextjs` and `react` for App Router caching and component lifecycle tuning.
69
- - Pairs with `ui-ux-pro` for smooth animations and responsive design tokens.
70
-
71
-
72
- # performance Examples — Anti-patterns vs ContextOS Standard
73
-
74
- ## Example 1: Dynamic Imports for Heavy Libraries
75
-
76
- ### Anti-pattern: Static Import of Heavy Visualizers in Initial Bundle
77
-
78
- ```typescript
79
- // BAD: Adds 800KB (Monaco editor or Three.js) to the critical first-paint bundle!
80
- import { CodeEditor } from '@/components/CodeEditor';
81
-
82
- export default function Page() {
83
- return <div><CodeEditor /></div>;
84
- }
85
- ```
86
-
87
- ### Best practice: ContextOS Standard (Lazy Load on Demand)
88
-
89
- ```typescript
90
- // GOOD: Dynamic import splits chunk, only downloads when component renders
91
- import dynamic from 'next/dynamic';
92
-
93
- const CodeEditor = dynamic(
94
- () => import('@/components/CodeEditor'),
95
- { loading: () => <EditorSkeleton />, ssr: false }
96
- );
97
-
98
- export default function Page() {
99
- return <div><CodeEditor /></div>;
100
- }
101
- ```
102
-
103
- # performance Troubleshooting & Common Mistakes
104
-
105
- ## 1. Cumulative Layout Shift (CLS) from Images & Fonts
106
-
107
- - **Symptom**: Page content jumps around as images and custom fonts load.
108
- - **Root Cause**: Missing width and height attributes on image tags and FOUT (Flash of Unstyled Text).
109
- - **Fix**: Always specify aspect-ratio or width/height on images, and use next/font to preload web fonts with fallback sizing.
110
-
111
- ## 2. High Interaction to Next Paint (INP)
112
-
113
- - **Symptom**: User clicks a button and the UI freezes for 200ms+ before responding.
114
- - **Root Cause**: Long task blocking the main thread during event dispatch.
115
- - **Fix**: Defer non-critical state updates using startTransition() or split heavy computation with Web Workers.
116
-
117
- ## 3. Unoptimized SVG / Icon Overload
118
-
119
- - **Symptom**: Huge DOM node count and slow initial render times.
120
- - **Root Cause**: Rendering 500 inline SVG icons with complex paths.
121
- - **Fix**: Use SVG sprite sheets, dynamic icon loaders, or lightweight canvas rendering for dense data visualizations.
@@ -1,227 +0,0 @@
1
- # React Engineering & Performance Best Practices
2
-
3
- ## Overview
4
-
5
- Enforces declarative, component-driven UI architecture with optimal re-render cycles, state colocation, responsive optimistic updates, and robust accessibility standards.
6
-
7
- ## When to Use
8
-
9
- Activate whenever creating, refactoring, or optimizing React functional components, custom hooks, context providers, or UI interaction states.
10
-
11
- ## Negative Constraints (What NOT to Do)
12
-
13
- 1. **NEVER use `useEffect` to synchronize or compute derived state**: Calculate derived state inline during render. Use `useMemo` only for computationally intensive derivations.
14
- 2. **NEVER use array indices as `key` props on dynamic or reorderable lists**: Always use stable, unique entity identifiers (`item.id`).
15
- 3. **NEVER mutate React state directly**: Always return new immutable references (`[...prev, newItem]` or `{ ...prev, key: value }`).
16
- 4. **NEVER declare subcomponents inside the render body of parent components**: Declare components at module scope or in dedicated files to prevent DOM node remounting and lost focus state.
17
- 5. **NEVER create memory leaks in `useEffect`**: Always provide clean-up functions for event listeners, `AbortController`, timers, and websocket subscriptions.
18
- 6. **NEVER lift state higher than necessary**: Colocate state to the nearest common ancestor or leaf component to prevent wasteful re-renders of unrelated subtrees.
19
-
20
- ## Rules & Patterns
21
-
22
- ### 1. State Colocation & Re-render Optimization
23
-
24
- - **State Colocation**: Keep state as close as possible to the components that consume it.
25
- - **Composition to Prevent Re-renders**: Pass expensive static subtrees as `children` to wrapper components holding state so the children do not re-render when the wrapper updates.
26
-
27
- ```tsx
28
- export function ExpandableCard({ title, children }: { title: string; children: React.ReactNode }) {
29
- const [isOpen, setIsOpen] = useState(false);
30
-
31
- return (
32
- <div className="rounded-xl border p-4">
33
- <button
34
- type="button"
35
- onClick={() => setIsOpen(v => !v)}
36
- className="flex w-full justify-between font-semibold"
37
- aria-expanded={isOpen}
38
- >
39
- <span>{title}</span>
40
- <span>{isOpen ? '−' : '+'}</span>
41
- </button>
42
- {isOpen && <div className="mt-3 pt-3 border-t">{children}</div>}
43
- </div>
44
- );
45
- }
46
- ```
47
-
48
- ### 2. Optimistic UI Updates & Concurrent Actions (`useOptimistic`, `useTransition`)
49
-
50
- - Provide instantaneous visual feedback for user actions without waiting for server network roundtrips.
51
-
52
- ```tsx
53
- import { useOptimistic, useTransition } from 'react';
54
-
55
- export function TodoList({ todos, onAdd }: { todos: Todo[]; onAdd: (text: string) => Promise<void> }) {
56
- const [isPending, startTransition] = useTransition();
57
- const [optimisticTodos, addOptimisticTodo] = useOptimistic(
58
- todos,
59
- (state, newText: string) => [...state, { id: 'temp-' + Date.now(), text: newText, isPending: true }]
60
- );
61
-
62
- const handleAction = async (formData: FormData) => {
63
- const text = formData.get('todo') as string;
64
- if (!text?.trim()) return;
65
-
66
- startTransition(async () => {
67
- addOptimisticTodo(text);
68
- await onAdd(text);
69
- });
70
- };
71
-
72
- return (
73
- <form action={handleAction} className="space-y-4">
74
- <input name="todo" placeholder="Add a new task..." className="border p-2 rounded" />
75
- <button type="submit" disabled={isPending} className="bg-primary text-white px-4 py-2 rounded">
76
- {isPending ? 'Saving...' : 'Add'}
77
- </button>
78
- <ul className="divide-y">
79
- {optimisticTodos.map(todo => (
80
- <li key={todo.id} className={todo.isPending ? 'opacity-50 italic' : ''}>
81
- {todo.text}
82
- </li>
83
- ))}
84
- </ul>
85
- </form>
86
- );
87
- }
88
- ```
89
-
90
- ### 3. Derived State vs. Effects Anti-Pattern
91
-
92
- ```tsx
93
- // [GOOD] Computed directly during render (or memoized if expensive)
94
- function SearchResults({ query, items }: { query: string; items: Item[] }) {
95
- const filtered = useMemo(() => {
96
- const q = query.trim().toLowerCase();
97
- if (!q) return items;
98
- return items.filter(i => i.title.toLowerCase().includes(q));
99
- }, [query, items]);
100
-
101
- return <List items={filtered} />;
102
- }
103
- ```
104
-
105
- ## Code Examples
106
-
107
- See `EXAMPLES.md` for detailed code examples and hook implementations.
108
-
109
- ## Validation Checklist
110
-
111
- - [ ] Zero `useEffect` hooks used for derived calculations.
112
- - [ ] Every list mapping has a unique, non-index entity ID key.
113
- - [ ] Subcomponents declared in parent render functions are extracted to top-level scope.
114
- - [ ] Effects with event listeners, timers, or abortable requests include clean-up returns.
115
- - [ ] Reusable components are composed cleanly via `children` or render props.
116
-
117
- ## Common Mistakes
118
-
119
- - Setting state inside `useEffect` based on prop changes rather than deriving values inline.
120
- - Declaring nested components within component bodies.
121
- - Using index keys causing input focus loss or animations breaking on list mutations.
122
-
123
- ## Integration Notes
124
-
125
- - Pairs with `typescript` for type safety on props, generics, and ref forwarding.
126
- - Pairs with `ui-ux-pro` and `web-accessibility` for UI tokens and ARIA standards.
127
-
128
-
129
- # React Examples — Anti-patterns vs ContextOS Standard
130
-
131
- ## Example 1: Derived State vs. useEffect
132
-
133
- ### Anti-pattern: Anti-pattern (Redundant state + extra render with useEffect)
134
-
135
- ```tsx
136
- // BAD: causes an unnecessary extra render cycle and potential state desync
137
- function OrderSummary({ items }: { items: CartItem[] }) {
138
- const [total, setTotal] = useState(0);
139
-
140
- useEffect(() => {
141
- const calculated = items.reduce((sum, item) => sum + item.price * item.quantity, 0);
142
- setTotal(calculated);
143
- }, [items]);
144
-
145
- return <div>Total: ${total}</div>;
146
- }
147
- ```
148
-
149
- ### Best practice: ContextOS Standard (Inline derived calculation / useMemo)
150
-
151
- ```tsx
152
- // GOOD: calculated instantly during render with zero extra render pass
153
- function OrderSummary({ items }: { items: CartItem[] }) {
154
- const total = useMemo(
155
- () => items.reduce((sum, item) => sum + item.price * item.quantity, 0),
156
- [items]
157
- );
158
-
159
- return <div>Total: ${total.toFixed(2)}</div>;
160
- }
161
- ```
162
-
163
- ---
164
-
165
- ## Example 2: Custom Hook Encapsulation
166
-
167
- ### Anti-pattern: Anti-pattern (Scattered listener logic inside component)
168
-
169
- ```tsx
170
- // BAD: window listener logic cluttering UI component
171
- function NavHeader() {
172
- const [isScrolled, setIsScrolled] = useState(false);
173
- useEffect(() => {
174
- const handleScroll = () => setIsScrolled(window.scrollY > 50);
175
- window.addEventListener('scroll', handleScroll);
176
- return () => window.removeEventListener('scroll', handleScroll);
177
- }, []);
178
- return <header className={isScrolled ? 'scrolled' : ''}>Header</header>;
179
- }
180
- ```
181
-
182
- ### Best practice: ContextOS Standard (Reusable Custom Hook)
183
-
184
- ```tsx
185
- // GOOD: extracted into a reusable, testable custom hook
186
- export function useScrollThreshold(threshold = 50): boolean {
187
- const [isPassed, setIsPassed] = useState(() => typeof window !== 'undefined' && window.scrollY > threshold);
188
-
189
- useEffect(() => {
190
- let ticking = false;
191
- const handleScroll = () => {
192
- if (!ticking) {
193
- window.requestAnimationFrame(() => {
194
- setIsPassed(window.scrollY > threshold);
195
- ticking = false;
196
- });
197
- ticking = true;
198
- }
199
- };
200
-
201
- window.addEventListener('scroll', handleScroll, { passive: true });
202
- return () => window.removeEventListener('scroll', handleScroll);
203
- }, [threshold]);
204
-
205
- return isPassed;
206
- }
207
- ```
208
-
209
- # react Troubleshooting & Common Mistakes
210
-
211
- ## 1. Infinite Render Loops in useEffect
212
-
213
- - **Symptom**: Browser freezes, "Maximum update depth exceeded" error.
214
- - **Root Cause**: Creating new object or array literals inside component body and passing them to useEffect dependency array.
215
- - **Fix**: Colocate state, compute derived state during render without useEffect, or use primitive dependency values.
216
-
217
- ## 2. Stale Closures in Callbacks
218
-
219
- - **Symptom**: Event handler or setTimeout accesses outdated state values.
220
- - **Root Cause**: Callback closing over initial state without updated dependency.
221
- - **Fix**: Use functional state updates (`setCount(c => c + 1)`) or `useRef` for mutable references.
222
-
223
- ## 3. Prop Drilling vs Context Performance
224
-
225
- - **Symptom**: Changing a small state variable causes the entire component tree to re-render.
226
- - **Root Cause**: Storing rapidly changing state in a single monolithic React Context.
227
- - **Fix**: Split contexts by domain or migrate client UI state to Zustand with granular selectors.
@@ -1,146 +0,0 @@
1
- # Vercel React Best Practices
2
-
3
- ## Overview
4
-
5
- Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 70 rules across 8 categories, prioritized by impact to guide automated refactoring, code generation, and production review.
6
-
7
- ## When to Use
8
-
9
- - When authoring new React functional components or Next.js App Router pages.
10
- - When implementing data fetching (client or server-side Server Actions, RSC).
11
- - When reviewing pull requests for rendering bottlenecks or memory leaks.
12
- - When optimizing bundle size, eliminating network waterfalls, or improving Core Web Vitals (LCP, INP, CLS).
13
-
14
- ## Rules & Patterns
15
-
16
- ### Rule Categories by Priority
17
-
18
- | Priority | Category | Impact | Prefix |
19
- |----------|----------|--------|--------|
20
- | 1 | Eliminating Waterfalls | CRITICAL | `async-` |
21
- | 2 | Bundle Size Optimization | CRITICAL | `bundle-` |
22
- | 3 | Server-Side Performance | HIGH | `server-` |
23
- | 4 | Client-Side Data Fetching | MEDIUM-HIGH | `client-` |
24
- | 5 | Re-render Optimization | MEDIUM | `rerender-` |
25
- | 6 | Rendering Performance | MEDIUM | `rendering-` |
26
- | 7 | JavaScript Performance | LOW-MEDIUM | `js-` |
27
- | 8 | Advanced Patterns | LOW | `advanced-` |
28
-
29
- ### 1. Eliminating Waterfalls (CRITICAL)
30
-
31
- - `async-cheap-condition-before-await` - Check cheap sync conditions before awaiting flags or remote values.
32
- - `async-defer-await` - Move await into branches where actually used.
33
- - `async-parallel` - Use `Promise.all()` for independent asynchronous operations.
34
- - `async-dependencies` - Use better-all for partial dependencies.
35
- - `async-api-routes` - Start promises early, await late in API routes.
36
- - `async-suspense-boundaries` - Use Suspense to stream content progressively.
37
-
38
- ### 2. Bundle Size Optimization (CRITICAL)
39
-
40
- - `bundle-barrel-imports` - Import directly from specific modules, avoid broad barrel files (`index.ts`).
41
- - `bundle-analyzable-paths` - Prefer statically analyzable import paths to avoid bloated traces.
42
- - `bundle-dynamic-imports` - Use `next/dynamic` or `React.lazy()` for heavy interactive components.
43
- - `bundle-defer-third-party` - Load analytics and logging scripts after hydration.
44
- - `bundle-conditional` - Load modules only when feature flags or user actions require them.
45
- - `bundle-preload` - Preload assets on hover or focus for perceived instant navigation.
46
-
47
- ### 3. Server-Side Performance (HIGH)
48
-
49
- - `server-auth-actions` - Always authenticate server actions like API routes.
50
- - `server-cache-react` - Use `React.cache()` for per-request deduplication.
51
- - `server-cache-lru` - Use LRU cache for cross-request caching.
52
- - `server-dedup-props` - Avoid duplicate serialization in RSC props.
53
- - `server-hoist-static-io` - Hoist static I/O to module level.
54
- - `server-no-shared-module-state` - Avoid module-level mutable request state in RSC/SSR.
55
- - `server-serialization` - Minimize data passed across the server-client boundary.
56
- - `server-parallel-fetching` - Restructure components to parallelize fetches.
57
- - `server-after-nonblocking` - Use `after()` for non-blocking operations like analytics logging.
58
-
59
- ### 4. Client-Side Data Fetching (MEDIUM-HIGH)
60
-
61
- - `client-swr-dedup` - Use SWR or TanStack Query for automatic request deduplication.
62
- - `client-event-listeners` - Deduplicate global event listeners.
63
- - `client-passive-event-listeners` - Use passive listeners for scroll and touch.
64
- - `client-localstorage-schema` - Version and minimize data stored in localStorage.
65
-
66
- ### 5. Re-render Optimization (MEDIUM)
67
-
68
- - `rerender-defer-reads` - Don't subscribe to state only used in callbacks.
69
- - `rerender-memo` - Extract expensive work into memoized components.
70
- - `rerender-memo-with-default-value` - Hoist default non-primitive props.
71
- - `rerender-dependencies` - Use primitive dependencies in effects and callbacks.
72
- - `rerender-derived-state` - Subscribe to derived booleans, not raw high-frequency values.
73
- - `rerender-derived-state-no-effect` - Derive state during render, never in `useEffect`.
74
- - `rerender-functional-setstate` - Use functional `setState` for stable callback references.
75
- - `rerender-lazy-state-init` - Pass initializer functions to `useState` for expensive computations.
76
- - `rerender-transitions` - Use `startTransition` for non-urgent state updates.
77
- - `rerender-use-deferred-value` - Defer expensive renders to keep input responsive.
78
- - `rerender-no-inline-components` - Never define subcomponents inside component render bodies.
79
-
80
- ### 6. Rendering Performance (MEDIUM)
81
-
82
- - `rendering-content-visibility` - Use `content-visibility: auto` for long offscreen lists.
83
- - `rendering-hoist-jsx` - Extract static JSX elements outside components.
84
- - `rendering-conditional-render` - Use ternary (`condition ? <Comp /> : null`), not `&&` to avoid 0 rendering.
85
- - `rendering-usetransition-loading` - Prefer `useTransition` for loading state indicators.
86
-
87
- ### 7. JavaScript Performance (LOW-MEDIUM)
88
-
89
- - `js-index-maps` - Build `Map` for repeated lookups instead of repeated array searches.
90
- - `js-cache-property-access` - Cache object properties in tight loops.
91
- - `js-early-exit` - Return early from functions to avoid nested complexity.
92
- - `js-hoist-regexp` - Hoist RegExp creation outside loops and functions.
93
- - `js-set-map-lookups` - Use `Set` / `Map` for O(1) lookups.
94
-
95
- ### 8. Advanced Patterns (LOW)
96
-
97
- - `advanced-effect-event-deps` - Don't put `useEffectEvent` results in effect deps.
98
- - `advanced-event-handler-refs` - Store event handlers in refs for stable listener attachments.
99
- - `advanced-init-once` - Initialize app singletons once per lifecycle.
100
-
101
- ## Code Examples
102
-
103
- ```tsx
104
- // [GOOD] Parallel server fetching without waterfall
105
- import { cache } from 'react';
106
-
107
- export const getUser = cache(async (id: string) => {
108
- return db.user.findUnique({ where: { id } });
109
- });
110
-
111
- export default async function UserPage({ params }: { params: { id: string } }) {
112
- // Parallel dispatch
113
- const userPromise = getUser(params.id);
114
- const postsPromise = getPosts(params.id);
115
-
116
- const [user, posts] = await Promise.all([userPromise, postsPromise]);
117
-
118
- return (
119
- <main>
120
- <h1>{user.name}</h1>
121
- <PostList posts={posts} />
122
- </main>
123
- );
124
- }
125
- ```
126
-
127
- ## Validation Checklist
128
-
129
- - [ ] All independent async fetches use `Promise.all()` instead of sequential `await`.
130
- - [ ] Direct imports used instead of barrel file imports for large libraries.
131
- - [ ] No `useEffect` used for deriving computed state from props or state.
132
- - [ ] Heavy interactive modals/drawers loaded dynamically via `next/dynamic`.
133
- - [ ] Server actions perform authentication checks before data mutations.
134
- - [ ] Zero subcomponents defined inside the body of parent components.
135
-
136
- ## Common Mistakes
137
-
138
- - Writing sequential `await fetchA(); await fetchB();` creating avoidable network waterfalls.
139
- - Importing from package root barrel files triggering full bundle inclusion.
140
- - Setting state inside `useEffect` in response to prop changes.
141
- - Serializing full database models with sensitive or unused fields to Client Components.
142
-
143
- ## Integration Notes
144
-
145
- - Pairs with `react` and `nextjs` skills for idiomatic App Router patterns.
146
- - Complements `performance` for Lighthouse and Core Web Vitals verification.
@@ -1,112 +0,0 @@
1
- # Redesign Skill & UI Audit
2
-
3
- ## Overview
4
-
5
- A systematic redesign and auditing protocol designed to elevate existing websites, dashboards, and web applications to world-class agency quality. It diagnoses and eradicates generic AI design fingerprints, sloppy typography, inconsistent palettes, and absent interaction states without breaking business logic or underlying component contracts.
6
-
7
- ## When to Use
8
-
9
- - When auditing an existing UI codebase for design quality, responsiveness, or accessibility.
10
- - When modernizing a legacy application or uplifting generic templates.
11
- - When tasked to "redesign", "clean up the layout", "audit UI", or "make it look expensive and modern".
12
-
13
- ## Rules & Patterns
14
-
15
- ### 1. Workflow: Scan → Diagnose → Fix
16
-
17
- 1. **Scan:** Read the codebase. Identify the framework, styling method (Tailwind v3/v4, vanilla CSS, CSS Modules), and established design tokens.
18
- 2. **Diagnose:** Run through the design audit categories. Catalog generic patterns, missing states, and optical alignment flaws.
19
- 3. **Fix:** Apply surgical, targeted upgrades working within the existing stack. Do not rewrite from scratch.
20
-
21
- ### 2. Design Audit Categories
22
-
23
- #### Typography
24
-
25
- - **Replace Browser Defaults:** Swap generic `Inter`, `Roboto`, or system fonts with expressive typefaces (`Geist`, `Outfit`, `Cabinet Grotesk`, `Satoshi`).
26
- - **Presence & Scale:** Increase display text size, tighten letter-spacing (`-0.02em` to `-0.04em`), reduce line-height on headlines.
27
- - **Reading Comfort:** Limit body text to 65 characters per line (`max-w-prose`), increase line-height to 1.6.
28
- - **Figures:** Enable tabular figures (`font-variant-numeric: tabular-nums`) for numbers in tables and data readouts.
29
- - **Orphan Prevention:** Apply `text-wrap: balance` on headlines and `text-wrap: pretty` on paragraphs.
30
-
31
- #### Color and Surfaces
32
-
33
- - **No Pure Black Backgrounds:** Replace `#000000` with tinted dark charcoal (`#0A0A0A`, `#121212`).
34
- - **Desaturate Accents:** Keep accent saturation below 80% so it blends harmoniously with neutrals.
35
- - **Single Accent Color:** Commit to one dominant accent hue; remove conflicting secondary tints.
36
- - **Tinted Shadows:** Tint shadows to match the background hue rather than harsh black opacity.
37
- - **Background Depth:** Prevent sterile flat sections by layering subtle noise overlays, ambient gradients, or masked imagery.
38
-
39
- #### Layout and Space
40
-
41
- - **Asymmetry & Bento Grids:** Break repetitive 3-column Bootstrap grids with asymmetrical spans or offset cards.
42
- - **Mobile Viewport Bug Fix:** Never use `height: 100vh`; always use `min-height: 100dvh`.
43
- - **Vertical Alignment:** Pin action buttons to the bottom of card groups (`mt-auto` or grid alignment) to maintain horizontal baseline harmony across differing text heights.
44
- - **Optical Centering:** Adjust icons, badges, and play buttons optically by 1-2px rather than relying solely on pure mathematical centering.
45
-
46
- #### Interactivity and States
47
-
48
- - **Interactive Feedback:** Add 200-300ms transitions, distinct hover shifts, and physical active presses (`scale(0.98)`).
49
- - **Visible Focus Rings:** Mandatory `:focus-visible` styling for keyboard navigation.
50
- - **States Completeness:** Always provide designed skeleton loaders, empty states, and inline error messages.
51
-
52
- #### Content & Code Quality
53
-
54
- - **Eradicate AI Clichés:** Remove buzzwords ("Elevate", "Seamless", "Unleash", "Next-Gen") and placeholder latin text.
55
- - **Semantic HTML:** Replace nested div containers with `<nav>`, `<main>`, `<article>`, `<section>`, `<aside>`.
56
- - **Relative Units:** Use `rem`, `%`, and CSS Grid rather than hardcoded pixel widths.
57
-
58
- ### 3. Fix Priority
59
-
60
- 1. **Font Swap:** Biggest instant aesthetic elevation with lowest regression risk.
61
- 2. **Palette Cleanup:** Eliminate clashing or oversaturated colors.
62
- 3. **States & Feedback:** Add hover, active, focus, loading, and empty states.
63
- 4. **Layout & Alignment:** Fix container widths, baseline alignment, and mobile viewport heights.
64
- 5. **Component Polish:** Replace generic cards and accordion boxes with modern minimal equivalents.
65
-
66
- ## Code Examples
67
-
68
- ```tsx
69
- // [BEFORE] Generic, misaligned card with generic shadow
70
- <div className="bg-white border rounded shadow p-4">
71
- <h2>{title}</h2>
72
- <p>{desc}</p>
73
- <button className="bg-blue-500 text-white p-2">Click</button>
74
- </div>
75
-
76
- // [AFTER] Polished card with optical baseline alignment, tinted surface, and micro-interaction
77
- <div className="flex flex-col bg-[#FFFFFF] dark:bg-[#121212] border border-black/5 dark:border-white/10 rounded-2xl p-6 hover:shadow-[0_4px_20px_rgba(0,0,0,0.04)] transition-all duration-200">
78
- <h3 className="font-semibold text-lg tracking-tight text-neutral-900 dark:text-neutral-100 text-balance mb-2">
79
- {title}
80
- </h3>
81
- <p className="text-sm text-neutral-600 dark:text-neutral-400 leading-relaxed text-pretty mb-6">
82
- {desc}
83
- </p>
84
- <button
85
- type="button"
86
- className="mt-auto inline-flex items-center justify-center font-medium text-sm px-4 py-2.5 rounded-xl bg-neutral-900 dark:bg-neutral-100 text-white dark:text-black hover:bg-neutral-800 active:scale-[0.98] transition-transform duration-150 focus-visible:ring-2 focus-visible:ring-neutral-400"
87
- >
88
- Continue
89
- </button>
90
- </div>
91
- ```
92
-
93
- ## Validation Checklist
94
-
95
- - [ ] All headings have `text-wrap: balance` and appropriate negative letter tracking.
96
- - [ ] No pure black `#000000` backgrounds or oversaturated accent colors (>80% saturation).
97
- - [ ] All interactive elements include `:hover`, `:active`, and `:focus-visible` styles.
98
- - [ ] Cards in side-by-side grids align primary CTA buttons along the same bottom baseline.
99
- - [ ] Viewport containers use `100dvh` instead of `100vh`.
100
- - [ ] All lists, tables, and feeds have a designed empty state.
101
-
102
- ## Common Mistakes
103
-
104
- - Rewriting components from scratch and breaking existing prop contracts or unit tests.
105
- - Forcing full-width sections without `max-w` constraints on ultra-wide screens.
106
- - Leaving action buttons at random heights inside differing text content cards.
107
- - Introducing external UI libraries without checking existing `package.json` dependencies.
108
-
109
- ## Integration Notes
110
-
111
- - Complements `impeccable-design` for hard 50-rule QA verification.
112
- - Works alongside `ui-ux-pro` for token generation and color theory.