@nextsparkjs/ai-workflow 0.1.0-beta.100

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 (272) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +115 -0
  3. package/claude/_docs/workflows-optimizations.md +359 -0
  4. package/claude/agents/api-tester.md +634 -0
  5. package/claude/agents/architecture-supervisor.md +1351 -0
  6. package/claude/agents/backend-developer.md +997 -0
  7. package/claude/agents/backend-validator.md +417 -0
  8. package/claude/agents/bdd-docs-writer.md +737 -0
  9. package/claude/agents/block-developer.md +677 -0
  10. package/claude/agents/code-reviewer.md +1432 -0
  11. package/claude/agents/db-developer.md +721 -0
  12. package/claude/agents/db-validator.md +407 -0
  13. package/claude/agents/demo-video-generator.md +493 -0
  14. package/claude/agents/documentation-writer.md +1268 -0
  15. package/claude/agents/frontend-developer.md +1234 -0
  16. package/claude/agents/frontend-validator.md +777 -0
  17. package/claude/agents/functional-validator.md +630 -0
  18. package/claude/agents/mock-analyst.md +387 -0
  19. package/claude/agents/product-manager.md +963 -0
  20. package/claude/agents/qa-automation.md +1762 -0
  21. package/claude/agents/release-manager.md +634 -0
  22. package/claude/agents/selectors-translator.md +262 -0
  23. package/claude/agents/unit-test-writer.md +785 -0
  24. package/claude/agents/visual-comparator.md +329 -0
  25. package/claude/agents/workflow-maintainer.md +352 -0
  26. package/claude/commands/do/README.md +88 -0
  27. package/claude/commands/do/create-api.md +64 -0
  28. package/claude/commands/do/create-entity.md +66 -0
  29. package/claude/commands/do/create-migration.md +64 -0
  30. package/claude/commands/do/create-plugin.md +56 -0
  31. package/claude/commands/do/create-theme.md +70 -0
  32. package/claude/commands/do/mock-data.md +67 -0
  33. package/claude/commands/do/reset-db.md +71 -0
  34. package/claude/commands/do/setup-scheduled-action.md +75 -0
  35. package/claude/commands/do/sync-code-review.md +117 -0
  36. package/claude/commands/do/update-selectors.md +112 -0
  37. package/claude/commands/do/use-skills.md +90 -0
  38. package/claude/commands/do/validate-blocks.md +69 -0
  39. package/claude/commands/how-to/README.md +261 -0
  40. package/claude/commands/how-to/add-metadata.md +692 -0
  41. package/claude/commands/how-to/add-taxonomies.md +806 -0
  42. package/claude/commands/how-to/add-translations.md +571 -0
  43. package/claude/commands/how-to/create-api.md +577 -0
  44. package/claude/commands/how-to/create-block.md +575 -0
  45. package/claude/commands/how-to/create-child-entities.md +771 -0
  46. package/claude/commands/how-to/create-entity.md +597 -0
  47. package/claude/commands/how-to/create-migrations.md +605 -0
  48. package/claude/commands/how-to/create-plugin.md +654 -0
  49. package/claude/commands/how-to/customize-app.md +481 -0
  50. package/claude/commands/how-to/customize-dashboard.md +553 -0
  51. package/claude/commands/how-to/customize-theme.md +438 -0
  52. package/claude/commands/how-to/define-features-flows.md +632 -0
  53. package/claude/commands/how-to/deploy.md +507 -0
  54. package/claude/commands/how-to/handle-file-uploads.md +746 -0
  55. package/claude/commands/how-to/implement-search.md +1001 -0
  56. package/claude/commands/how-to/install-plugins.md +352 -0
  57. package/claude/commands/how-to/manage-test-coverage.md +984 -0
  58. package/claude/commands/how-to/run-tests.md +400 -0
  59. package/claude/commands/how-to/set-app-languages.md +601 -0
  60. package/claude/commands/how-to/set-plans-and-permissions.md +575 -0
  61. package/claude/commands/how-to/set-scheduled-actions.md +527 -0
  62. package/claude/commands/how-to/set-user-roles-and-permissions.md +550 -0
  63. package/claude/commands/how-to/setup-authentication.md +388 -0
  64. package/claude/commands/how-to/setup-claude-code.md +440 -0
  65. package/claude/commands/how-to/setup-database.md +274 -0
  66. package/claude/commands/how-to/setup-email-providers.md +598 -0
  67. package/claude/commands/how-to/setup-mobile-dev.md +627 -0
  68. package/claude/commands/how-to/start.md +500 -0
  69. package/claude/commands/how-to/use-devtools.md +639 -0
  70. package/claude/commands/how-to/use-superadmin.md +622 -0
  71. package/claude/commands/session/README.md +193 -0
  72. package/claude/commands/session/block-create.md +190 -0
  73. package/claude/commands/session/block-list.md +203 -0
  74. package/claude/commands/session/block-update.md +192 -0
  75. package/claude/commands/session/block-validate.md +218 -0
  76. package/claude/commands/session/changelog.md +115 -0
  77. package/claude/commands/session/close.md +225 -0
  78. package/claude/commands/session/commit.md +174 -0
  79. package/claude/commands/session/db-entity.md +206 -0
  80. package/claude/commands/session/db-fix.md +212 -0
  81. package/claude/commands/session/db-sample.md +206 -0
  82. package/claude/commands/session/demo.md +178 -0
  83. package/claude/commands/session/doc-bdd.md +207 -0
  84. package/claude/commands/session/doc-feature.md +218 -0
  85. package/claude/commands/session/doc-read.md +225 -0
  86. package/claude/commands/session/execute.md +204 -0
  87. package/claude/commands/session/explain.md +202 -0
  88. package/claude/commands/session/fix-bug.md +210 -0
  89. package/claude/commands/session/fix-build.md +182 -0
  90. package/claude/commands/session/fix-test.md +189 -0
  91. package/claude/commands/session/pending.md +232 -0
  92. package/claude/commands/session/refine.md +188 -0
  93. package/claude/commands/session/resume.md +192 -0
  94. package/claude/commands/session/review.md +192 -0
  95. package/claude/commands/session/scope-change.md +181 -0
  96. package/claude/commands/session/start-blocks.md +347 -0
  97. package/claude/commands/session/start.md +604 -0
  98. package/claude/commands/session/status.md +169 -0
  99. package/claude/commands/session/test-fix.md +221 -0
  100. package/claude/commands/session/test-run.md +203 -0
  101. package/claude/commands/session/test-write.md +242 -0
  102. package/claude/commands/session/validate.md +162 -0
  103. package/claude/config/context.json +40 -0
  104. package/claude/config/github.json +69 -0
  105. package/claude/config/github.schema.json +106 -0
  106. package/claude/config/team.json +46 -0
  107. package/claude/config/team.schema.json +106 -0
  108. package/claude/config/workspace.json +43 -0
  109. package/claude/config/workspace.schema.json +75 -0
  110. package/claude/skills/README.md +228 -0
  111. package/claude/skills/accessibility/SKILL.md +573 -0
  112. package/claude/skills/api-bypass-layers/SKILL.md +550 -0
  113. package/claude/skills/asana-integration/SKILL.md +499 -0
  114. package/claude/skills/better-auth/SKILL.md +666 -0
  115. package/claude/skills/billing-subscriptions/SKILL.md +660 -0
  116. package/claude/skills/block-decision-matrix/SKILL.md +359 -0
  117. package/claude/skills/clickup-integration/SKILL.md +434 -0
  118. package/claude/skills/core-theme-responsibilities/SKILL.md +485 -0
  119. package/claude/skills/create-plugin/SKILL.md +425 -0
  120. package/claude/skills/create-theme/SKILL.md +331 -0
  121. package/claude/skills/cypress-api/SKILL.md +511 -0
  122. package/claude/skills/cypress-api/scripts/generate-api-controller.py +329 -0
  123. package/claude/skills/cypress-api/scripts/generate-api-test.py +930 -0
  124. package/claude/skills/cypress-e2e/SKILL.md +526 -0
  125. package/claude/skills/cypress-e2e/scripts/extract-selectors.py +383 -0
  126. package/claude/skills/cypress-e2e/scripts/generate-uat-test.py +788 -0
  127. package/claude/skills/cypress-selectors/SKILL.md +309 -0
  128. package/claude/skills/cypress-selectors/scripts/extract-missing.py +243 -0
  129. package/claude/skills/cypress-selectors/scripts/generate-block-selectors.py +283 -0
  130. package/claude/skills/cypress-selectors/scripts/validate-selectors.py +145 -0
  131. package/claude/skills/database-migrations/SKILL.md +335 -0
  132. package/claude/skills/database-migrations/scripts/generate-sample-data.py +284 -0
  133. package/claude/skills/database-migrations/scripts/validate-migration.py +323 -0
  134. package/claude/skills/design-system/SKILL.md +682 -0
  135. package/claude/skills/documentation/SKILL.md +540 -0
  136. package/claude/skills/entity-api/SKILL.md +482 -0
  137. package/claude/skills/entity-system/SKILL.md +635 -0
  138. package/claude/skills/entity-system/scripts/generate-child-migration.py +298 -0
  139. package/claude/skills/entity-system/scripts/generate-metas-migration.py +233 -0
  140. package/claude/skills/entity-system/scripts/generate-migration.py +382 -0
  141. package/claude/skills/entity-system/scripts/generate-sample-data.py +418 -0
  142. package/claude/skills/entity-system/scripts/scaffold-entity.py +661 -0
  143. package/claude/skills/github/SKILL.md +467 -0
  144. package/claude/skills/i18n-nextintl/SKILL.md +302 -0
  145. package/claude/skills/i18n-nextintl/scripts/add-translation.py +243 -0
  146. package/claude/skills/i18n-nextintl/scripts/extract-hardcoded.py +246 -0
  147. package/claude/skills/i18n-nextintl/scripts/validate-translations.py +260 -0
  148. package/claude/skills/impact-analysis/SKILL.md +203 -0
  149. package/claude/skills/jest-unit/SKILL.md +306 -0
  150. package/claude/skills/jest-unit/references/component-testing.md +371 -0
  151. package/claude/skills/jest-unit/references/mocking-patterns.md +380 -0
  152. package/claude/skills/jest-unit/references/service-hook-testing.md +454 -0
  153. package/claude/skills/jira-integration/SKILL.md +539 -0
  154. package/claude/skills/media-library/SKILL.md +743 -0
  155. package/claude/skills/mock-analysis/SKILL.md +276 -0
  156. package/claude/skills/monorepo-architecture/SKILL.md +162 -0
  157. package/claude/skills/nextjs-api-development/SKILL.md +364 -0
  158. package/claude/skills/nextjs-api-development/scripts/generate-crud-tests.py +456 -0
  159. package/claude/skills/nextjs-api-development/scripts/scaffold-endpoint.py +481 -0
  160. package/claude/skills/nextjs-api-development/scripts/validate-api.py +283 -0
  161. package/claude/skills/notion-integration/SKILL.md +641 -0
  162. package/claude/skills/npm-development-workflow/SKILL.md +480 -0
  163. package/claude/skills/page-builder-blocks/SKILL.md +530 -0
  164. package/claude/skills/page-builder-blocks/scripts/scaffold-block.py +444 -0
  165. package/claude/skills/permissions-system/SKILL.md +619 -0
  166. package/claude/skills/plugins/SKILL.md +340 -0
  167. package/claude/skills/plugins/references/plugin-templates.md +414 -0
  168. package/claude/skills/plugins/references/plugin-testing.md +353 -0
  169. package/claude/skills/plugins/references/plugin-types.md +198 -0
  170. package/claude/skills/plugins/scripts/scaffold-plugin.py +443 -0
  171. package/claude/skills/pom-patterns/SKILL.md +452 -0
  172. package/claude/skills/pom-patterns/scripts/generate-pom.py +392 -0
  173. package/claude/skills/rate-limiting/SKILL.md +342 -0
  174. package/claude/skills/react-best-practices/AGENTS.md +2410 -0
  175. package/claude/skills/react-best-practices/README.md +123 -0
  176. package/claude/skills/react-best-practices/SKILL.md +125 -0
  177. package/claude/skills/react-best-practices/metadata.json +15 -0
  178. package/claude/skills/react-best-practices/rules/_sections.md +46 -0
  179. package/claude/skills/react-best-practices/rules/_template.md +28 -0
  180. package/claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  181. package/claude/skills/react-best-practices/rules/advanced-use-latest.md +49 -0
  182. package/claude/skills/react-best-practices/rules/async-api-routes.md +38 -0
  183. package/claude/skills/react-best-practices/rules/async-defer-await.md +80 -0
  184. package/claude/skills/react-best-practices/rules/async-dependencies.md +36 -0
  185. package/claude/skills/react-best-practices/rules/async-parallel.md +28 -0
  186. package/claude/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
  187. package/claude/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
  188. package/claude/skills/react-best-practices/rules/bundle-conditional.md +31 -0
  189. package/claude/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
  190. package/claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  191. package/claude/skills/react-best-practices/rules/bundle-preload.md +50 -0
  192. package/claude/skills/react-best-practices/rules/client-event-listeners.md +74 -0
  193. package/claude/skills/react-best-practices/rules/client-localstorage-schema.md +71 -0
  194. package/claude/skills/react-best-practices/rules/client-passive-event-listeners.md +48 -0
  195. package/claude/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
  196. package/claude/skills/react-best-practices/rules/js-batch-dom-css.md +82 -0
  197. package/claude/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
  198. package/claude/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
  199. package/claude/skills/react-best-practices/rules/js-cache-storage.md +70 -0
  200. package/claude/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
  201. package/claude/skills/react-best-practices/rules/js-early-exit.md +50 -0
  202. package/claude/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
  203. package/claude/skills/react-best-practices/rules/js-index-maps.md +37 -0
  204. package/claude/skills/react-best-practices/rules/js-length-check-first.md +49 -0
  205. package/claude/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
  206. package/claude/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
  207. package/claude/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
  208. package/claude/skills/react-best-practices/rules/rendering-activity.md +26 -0
  209. package/claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  210. package/claude/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
  211. package/claude/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
  212. package/claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  213. package/claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  214. package/claude/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
  215. package/claude/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
  216. package/claude/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
  217. package/claude/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
  218. package/claude/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
  219. package/claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  220. package/claude/skills/react-best-practices/rules/rerender-memo.md +44 -0
  221. package/claude/skills/react-best-practices/rules/rerender-transitions.md +40 -0
  222. package/claude/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
  223. package/claude/skills/react-best-practices/rules/server-cache-lru.md +41 -0
  224. package/claude/skills/react-best-practices/rules/server-cache-react.md +76 -0
  225. package/claude/skills/react-best-practices/rules/server-parallel-fetching.md +83 -0
  226. package/claude/skills/react-best-practices/rules/server-serialization.md +38 -0
  227. package/claude/skills/react-patterns/SKILL.md +688 -0
  228. package/claude/skills/registry-system/SKILL.md +331 -0
  229. package/claude/skills/scheduled-actions/SKILL.md +671 -0
  230. package/claude/skills/scope-enforcement/SKILL.md +542 -0
  231. package/claude/skills/scope-enforcement/scripts/validate-scope.py +357 -0
  232. package/claude/skills/server-actions/SKILL.md +493 -0
  233. package/claude/skills/service-layer/SKILL.md +587 -0
  234. package/claude/skills/session-management/SKILL.md +266 -0
  235. package/claude/skills/session-management/scripts/create-session.py +166 -0
  236. package/claude/skills/session-management/scripts/iteration-close.sh +105 -0
  237. package/claude/skills/session-management/scripts/iteration-init.sh +180 -0
  238. package/claude/skills/session-management/scripts/session-archive.sh +87 -0
  239. package/claude/skills/session-management/scripts/session-close.sh +133 -0
  240. package/claude/skills/session-management/scripts/session-init.sh +225 -0
  241. package/claude/skills/session-management/scripts/session-list.sh +163 -0
  242. package/claude/skills/session-management/scripts/split-plan.sh +116 -0
  243. package/claude/skills/shadcn-components/SKILL.md +586 -0
  244. package/claude/skills/shadcn-theming/SKILL.md +446 -0
  245. package/claude/skills/suspense-loading/SKILL.md +280 -0
  246. package/claude/skills/tailwind-theming/SKILL.md +507 -0
  247. package/claude/skills/tanstack-query/SKILL.md +608 -0
  248. package/claude/skills/test-coverage/SKILL.md +239 -0
  249. package/claude/skills/web-design-guidelines/SKILL.md +39 -0
  250. package/claude/skills/zod-validation/SKILL.md +537 -0
  251. package/claude/templates/blocks/progress.md +86 -0
  252. package/claude/templates/iteration/changes.md +61 -0
  253. package/claude/templates/iteration/progress.md +55 -0
  254. package/claude/templates/log.md +31 -0
  255. package/claude/templates/story/context.md +77 -0
  256. package/claude/templates/story/pendings.md +37 -0
  257. package/claude/templates/story/plan.md +299 -0
  258. package/claude/templates/story/requirements.md +109 -0
  259. package/claude/templates/story/scope.json +10 -0
  260. package/claude/templates/story/tests.md +91 -0
  261. package/claude/templates/task/progress.md +58 -0
  262. package/claude/templates/task/requirements.md +54 -0
  263. package/claude/workflows/README.md +154 -0
  264. package/claude/workflows/blocks.md +614 -0
  265. package/claude/workflows/story.md +1207 -0
  266. package/claude/workflows/task.md +927 -0
  267. package/claude/workflows/tweak.md +527 -0
  268. package/cursor/.gitkeep +0 -0
  269. package/package.json +35 -0
  270. package/scripts/postinstall.mjs +198 -0
  271. package/scripts/setup.mjs +282 -0
  272. package/scripts/sync.mjs +209 -0
@@ -0,0 +1,682 @@
1
+ ---
2
+ name: design-system
3
+ description: |
4
+ Theme-aware design system analysis and token mapping.
5
+ Covers extracting theme tokens, mapping mock values, and gap analysis.
6
+ CRITICAL: All values are EXAMPLES - always read actual theme globals.css.
7
+ allowed-tools: Read, Glob, Grep
8
+ version: 1.0.0
9
+ ---
10
+
11
+ # Design System Skill
12
+
13
+ Patterns for analyzing design tokens and mapping between mocks and NextSpark themes.
14
+
15
+ ## Fundamental Principle
16
+
17
+ **THE DESIGN SYSTEM IS THEME-DEPENDENT.**
18
+
19
+ All values in this skill are EXAMPLES from the default theme.
20
+ You MUST read the actual theme's `globals.css` to get real values.
21
+
22
+ ```bash
23
+ # Determine active theme
24
+ grep "NEXT_PUBLIC_ACTIVE_THEME" .env .env.local
25
+
26
+ # Read theme tokens
27
+ cat contents/themes/{THEME}/styles/globals.css
28
+ ```
29
+
30
+ ## Theme Token Locations
31
+
32
+ ```
33
+ contents/themes/{THEME}/
34
+ ├── styles/
35
+ │ ├── globals.css # CSS variables (:root and .dark)
36
+ │ └── components.css # Component-specific styles
37
+ ├── config/
38
+ │ └── theme.config.ts # Theme metadata
39
+ ```
40
+
41
+ ## CSS Variable Structure
42
+
43
+ ### Light Mode (:root)
44
+
45
+ ```css
46
+ :root {
47
+ /* Surface Colors */
48
+ --background: oklch(1 0 0); /* Page background */
49
+ --foreground: oklch(0.145 0 0); /* Primary text */
50
+ --card: oklch(1 0 0); /* Card surfaces */
51
+ --card-foreground: oklch(0.145 0 0); /* Card text */
52
+ --popover: oklch(1 0 0); /* Dropdowns */
53
+ --popover-foreground: oklch(0.145 0 0);
54
+
55
+ /* Interactive Colors */
56
+ --primary: oklch(0.205 0 0); /* Primary actions */
57
+ --primary-foreground: oklch(0.985 0 0);
58
+ --secondary: oklch(0.97 0 0); /* Secondary actions */
59
+ --secondary-foreground: oklch(0.205 0 0);
60
+ --accent: oklch(0.97 0 0); /* Highlights */
61
+ --accent-foreground: oklch(0.205 0 0);
62
+
63
+ /* State Colors */
64
+ --muted: oklch(0.97 0 0); /* Muted backgrounds */
65
+ --muted-foreground: oklch(0.556 0 0); /* Placeholder text */
66
+ --destructive: oklch(0.577 0.245 27); /* Error/danger */
67
+ --destructive-foreground: oklch(1 0 0);
68
+
69
+ /* Border & Input */
70
+ --border: oklch(0.922 0 0);
71
+ --input: oklch(0.922 0 0);
72
+ --ring: oklch(0.708 0 0); /* Focus rings */
73
+
74
+ /* Radius */
75
+ --radius: 0.5rem;
76
+ }
77
+ ```
78
+
79
+ ### Dark Mode (.dark)
80
+
81
+ ```css
82
+ .dark {
83
+ --background: oklch(0.145 0 0); /* Inverted */
84
+ --foreground: oklch(0.985 0 0);
85
+ --card: oklch(0.145 0 0);
86
+ --card-foreground: oklch(0.985 0 0);
87
+
88
+ --primary: oklch(0.922 0 0); /* Adjusted for dark */
89
+ --primary-foreground: oklch(0.205 0 0);
90
+
91
+ --muted: oklch(0.269 0 0);
92
+ --muted-foreground: oklch(0.708 0 0);
93
+
94
+ --border: oklch(0.269 0 0);
95
+ --input: oklch(0.269 0 0);
96
+ }
97
+ ```
98
+
99
+ ## Color Format Conversion
100
+
101
+ Mocks often use HEX/RGB, themes use OKLCH.
102
+
103
+ ### HEX to OKLCH Mapping
104
+
105
+ | Mock (HEX) | Approximate OKLCH | Notes |
106
+ |------------|-------------------|-------|
107
+ | `#ffffff` | `oklch(1 0 0)` | Pure white |
108
+ | `#000000` | `oklch(0 0 0)` | Pure black |
109
+ | `#137fec` | `oklch(0.55 0.2 250)` | Blue primary |
110
+ | `#101922` | `oklch(0.15 0.02 260)` | Dark background |
111
+ | `#00d4ff` | `oklch(0.75 0.15 200)` | Cyan accent |
112
+
113
+ ### Similarity Calculation
114
+
115
+ Compare colors by:
116
+ 1. **Lightness** (L) - Most important, weight 0.5
117
+ 2. **Chroma** (C) - Saturation, weight 0.3
118
+ 3. **Hue** (H) - Color angle, weight 0.2
119
+
120
+ ```
121
+ similarity = 1 - (
122
+ 0.5 * |L1 - L2| +
123
+ 0.3 * |C1 - C2| / maxChroma +
124
+ 0.2 * |H1 - H2| / 360
125
+ )
126
+ ```
127
+
128
+ ## Token Categories
129
+
130
+ ### Background Tokens
131
+
132
+ | Token | Tailwind Class | Usage |
133
+ |-------|----------------|-------|
134
+ | `--background` | `bg-background` | Page background |
135
+ | `--card` | `bg-card` | Card surfaces |
136
+ | `--popover` | `bg-popover` | Dropdowns, menus |
137
+ | `--muted` | `bg-muted` | Subtle backgrounds |
138
+ | `--accent` | `bg-accent` | Hover states |
139
+ | `--primary` | `bg-primary` | Primary buttons |
140
+ | `--secondary` | `bg-secondary` | Secondary buttons |
141
+ | `--destructive` | `bg-destructive` | Error states |
142
+
143
+ ### Foreground Tokens
144
+
145
+ | Token | Tailwind Class | Usage |
146
+ |-------|----------------|-------|
147
+ | `--foreground` | `text-foreground` | Primary text |
148
+ | `--card-foreground` | `text-card-foreground` | Card text |
149
+ | `--muted-foreground` | `text-muted-foreground` | Secondary text |
150
+ | `--primary-foreground` | `text-primary-foreground` | On primary bg |
151
+ | `--destructive-foreground` | `text-destructive-foreground` | On error bg |
152
+
153
+ ### Border Tokens
154
+
155
+ | Token | Tailwind Class | Usage |
156
+ |-------|----------------|-------|
157
+ | `--border` | `border-border` | Default borders |
158
+ | `--input` | `border-input` | Input borders |
159
+ | `--ring` | `ring-ring` | Focus rings |
160
+
161
+ ## Mapping Process
162
+
163
+ ### Step 1: Extract Mock Tokens
164
+
165
+ From Tailwind config or inline styles:
166
+ ```javascript
167
+ // From mock's tailwind.config
168
+ const mockTokens = {
169
+ colors: {
170
+ primary: '#137fec',
171
+ 'bg-dark': '#101922',
172
+ accent: '#00d4ff'
173
+ }
174
+ }
175
+ ```
176
+
177
+ ### Step 2: Read Theme Tokens
178
+
179
+ ```bash
180
+ # Extract all CSS variables
181
+ grep -E "^\s*--" contents/themes/{theme}/styles/globals.css
182
+ ```
183
+
184
+ ### Step 3: Create Mapping
185
+
186
+ For each mock token:
187
+ 1. Check exact match (hex → hex)
188
+ 2. Check semantic match (primary → --primary)
189
+ 3. Calculate color similarity
190
+ 4. Flag gaps if no good match
191
+
192
+ ### Step 4: Document Gaps
193
+
194
+ ```json
195
+ {
196
+ "gaps": [
197
+ {
198
+ "mockValue": "#ff5722",
199
+ "mockUsage": "accent icons",
200
+ "closestToken": "--destructive",
201
+ "similarity": 0.72,
202
+ "recommendation": "USE_CLOSEST or ADD_TOKEN"
203
+ }
204
+ ]
205
+ }
206
+ ```
207
+
208
+ ## Output Format: ds-mapping.json
209
+
210
+ ```json
211
+ {
212
+ "theme": "default",
213
+ "themeGlobalsPath": "contents/themes/default/styles/globals.css",
214
+ "analyzedAt": "2025-01-09T12:00:00Z",
215
+
216
+ "themeTokens": {
217
+ "colors": {
218
+ "--background": "oklch(1 0 0)",
219
+ "--foreground": "oklch(0.145 0 0)",
220
+ "--primary": "oklch(0.205 0 0)",
221
+ "--secondary": "oklch(0.97 0 0)",
222
+ "--accent": "oklch(0.97 0 0)",
223
+ "--muted": "oklch(0.97 0 0)",
224
+ "--destructive": "oklch(0.577 0.245 27.325)"
225
+ },
226
+ "radius": "0.5rem",
227
+ "fonts": {
228
+ "sans": "var(--font-sans)",
229
+ "mono": "var(--font-mono)"
230
+ }
231
+ },
232
+
233
+ "mockTokens": {
234
+ "colors": {
235
+ "primary": "#137fec",
236
+ "background-dark": "#101922",
237
+ "accent": "#00d4ff",
238
+ "text-light": "#ffffff",
239
+ "text-muted": "#94a3b8"
240
+ }
241
+ },
242
+
243
+ "colorMapping": [
244
+ {
245
+ "id": "color-1",
246
+ "mockValue": "#137fec",
247
+ "mockName": "primary",
248
+ "mockUsage": ["buttons", "links", "focus rings"],
249
+ "themeToken": "--primary",
250
+ "themeValue": "oklch(0.205 0 0)",
251
+ "tailwindClass": "bg-primary text-primary-foreground",
252
+ "matchType": "semantic",
253
+ "similarity": 0.65,
254
+ "notes": "Theme primary is darker, mock is more vibrant blue"
255
+ },
256
+ {
257
+ "id": "color-2",
258
+ "mockValue": "#101922",
259
+ "mockName": "background-dark",
260
+ "mockUsage": ["hero background", "footer"],
261
+ "themeToken": "--background",
262
+ "themeValue": "oklch(0.145 0 0)",
263
+ "tailwindClass": "bg-background",
264
+ "matchType": "closest",
265
+ "similarity": 0.88,
266
+ "notes": "Use dark mode or bg-gray-900"
267
+ }
268
+ ],
269
+
270
+ "typographyMapping": [
271
+ {
272
+ "mockFont": "Inter",
273
+ "themeToken": "--font-sans",
274
+ "tailwindClass": "font-sans",
275
+ "matchType": "exact"
276
+ }
277
+ ],
278
+
279
+ "spacingMapping": [
280
+ {
281
+ "mockValue": "24px",
282
+ "tailwindClass": "p-6",
283
+ "matchType": "exact"
284
+ }
285
+ ],
286
+
287
+ "radiusMapping": [
288
+ {
289
+ "mockValue": "8px",
290
+ "themeToken": "--radius",
291
+ "themeValue": "0.5rem",
292
+ "tailwindClass": "rounded-lg",
293
+ "matchType": "exact"
294
+ }
295
+ ],
296
+
297
+ "gaps": [
298
+ {
299
+ "type": "color",
300
+ "mockValue": "#00d4ff",
301
+ "mockName": "accent",
302
+ "mockUsage": ["terminal prompt", "code highlights"],
303
+ "closestToken": "--primary",
304
+ "similarity": 0.45,
305
+ "recommendations": [
306
+ {
307
+ "option": "A",
308
+ "action": "Use --primary",
309
+ "impact": "Loses cyan accent, uses theme primary"
310
+ },
311
+ {
312
+ "option": "B",
313
+ "action": "Add --accent-cyan to theme",
314
+ "impact": "Requires theme modification"
315
+ },
316
+ {
317
+ "option": "C",
318
+ "action": "Use inline text-[#00d4ff]",
319
+ "impact": "Not recommended, breaks theming"
320
+ }
321
+ ]
322
+ }
323
+ ],
324
+
325
+ "summary": {
326
+ "totalMockTokens": 12,
327
+ "mapped": 10,
328
+ "gaps": 2,
329
+ "overallCompatibility": 0.83,
330
+ "recommendation": "PROCEED_WITH_GAPS"
331
+ }
332
+ }
333
+ ```
334
+
335
+ ## Output Format: block-plan.json (BLOCKS workflow only)
336
+
337
+ For the BLOCKS workflow, an additional output is generated to guide block development:
338
+
339
+ ```json
340
+ {
341
+ "mockPath": "mocks/",
342
+ "analyzedAt": "2026-01-12T12:00:00Z",
343
+ "workflow": "BLOCKS",
344
+
345
+ "existingBlocks": [
346
+ {
347
+ "name": "hero-simple",
348
+ "similarity": 0.85,
349
+ "matchReason": "Similar layout and components"
350
+ },
351
+ {
352
+ "name": "hero-centered",
353
+ "similarity": 0.72,
354
+ "matchReason": "Centered text, different background"
355
+ }
356
+ ],
357
+
358
+ "decision": {
359
+ "type": "new" | "variant" | "existing",
360
+ "blockName": "hero-terminal",
361
+ "baseBlock": "hero-simple",
362
+ "reasoning": "Requires custom terminal animation component not in existing blocks"
363
+ },
364
+
365
+ "blockSpec": {
366
+ "name": "hero-terminal",
367
+ "category": "hero",
368
+ "fields": [
369
+ {"name": "title", "type": "text", "required": true},
370
+ {"name": "subtitle", "type": "text", "required": false},
371
+ {"name": "primaryCta", "type": "link", "required": true},
372
+ {"name": "secondaryCta", "type": "link", "required": false},
373
+ {"name": "terminalContent", "type": "textarea", "required": true}
374
+ ],
375
+ "customComponents": ["TerminalAnimation"],
376
+ "estimatedComplexity": "medium"
377
+ },
378
+
379
+ "developmentNotes": [
380
+ "Terminal animation requires custom React component",
381
+ "Use existing Button component for CTAs",
382
+ "Background gradient matches theme --background token"
383
+ ]
384
+ }
385
+ ```
386
+
387
+ ### Decision Types
388
+
389
+ | Type | When to Use | Action |
390
+ |------|-------------|--------|
391
+ | `existing` | Mock matches existing block 90%+ | Use existing block, no changes |
392
+ | `variant` | Mock matches but needs minor additions | Extend existing block with new variant |
393
+ | `new` | Mock requires significant new functionality | Create new block from scratch |
394
+
395
+ ## Workflow Integration
396
+
397
+ | Workflow | ds-mapping.json | block-plan.json | When Generated |
398
+ |----------|-----------------|-----------------|----------------|
399
+ | **BLOCKS** | Yes | Yes | Phase 1 (Mock Analysis) |
400
+ | **TASK** | Yes (if mock) | No | Phase 0.6 (if mock selected) |
401
+ | **STORY** | Yes (if mock) | No | Phase 0.6 (if mock selected) |
402
+ | **TWEAK** | No | No | N/A |
403
+
404
+ ## Reusability
405
+
406
+ This skill applies to ANY design-to-code conversion:
407
+ - Landing pages (mocks → blocks)
408
+ - Email templates (design → HTML)
409
+ - PDF templates (design → React-PDF)
410
+ - Marketing materials
411
+
412
+ ---
413
+
414
+ ## Generating globals.css from Mock (One-Time Setup)
415
+
416
+ Use this section when initializing a theme from a design mock. This is typically a **one-time setup task** during theme creation.
417
+
418
+ ### When to Use
419
+
420
+ - New theme creation from design mock
421
+ - Theme initialization via `how-to:customize-theme` command
422
+ - Converting a purchased template to NextSpark theme
423
+
424
+ ### Step 1: Convert HEX to OKLCH
425
+
426
+ For each color in mock's Tailwind config, convert from HEX to OKLCH:
427
+
428
+ ```javascript
429
+ function hexToOklch(hex) {
430
+ // Remove # if present
431
+ hex = hex.replace('#', '')
432
+
433
+ // Parse RGB
434
+ const r = parseInt(hex.substr(0, 2), 16) / 255
435
+ const g = parseInt(hex.substr(2, 2), 16) / 255
436
+ const b = parseInt(hex.substr(4, 2), 16) / 255
437
+
438
+ // Convert to linear RGB
439
+ const rL = r <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4)
440
+ const gL = g <= 0.04045 ? g / 12.92 : Math.pow((g + 0.055) / 1.055, 2.4)
441
+ const bL = b <= 0.04045 ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4)
442
+
443
+ // Approximate OKLCH
444
+ const L = 0.4122 * rL + 0.5363 * gL + 0.0514 * bL
445
+ const lightness = Math.cbrt(L)
446
+
447
+ // Chroma and hue calculation
448
+ const max = Math.max(r, g, b)
449
+ const min = Math.min(r, g, b)
450
+ const chroma = (max - min) * 0.3
451
+
452
+ let hue = 0
453
+ if (max !== min) {
454
+ if (max === r) hue = 60 * (((g - b) / (max - min)) % 6)
455
+ else if (max === g) hue = 60 * ((b - r) / (max - min) + 2)
456
+ else hue = 60 * ((r - g) / (max - min) + 4)
457
+ if (hue < 0) hue += 360
458
+ }
459
+
460
+ return `oklch(${lightness.toFixed(4)} ${chroma.toFixed(4)} ${hue.toFixed(0)})`
461
+ }
462
+ ```
463
+
464
+ ### Step 2: Generate Dark Mode (Invert Lightness)
465
+
466
+ For dark mode, invert the lightness (L) value:
467
+
468
+ ```javascript
469
+ function invertLightnessOklch(oklchValue) {
470
+ // Parse oklch(L C H)
471
+ const match = oklchValue.match(/oklch\(([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\)/)
472
+ if (!match) return oklchValue
473
+
474
+ const L = parseFloat(match[1])
475
+ const C = parseFloat(match[2])
476
+ const H = parseFloat(match[3])
477
+
478
+ // Invert lightness: L' = 1 - L
479
+ const invertedL = 1 - L
480
+
481
+ return `oklch(${invertedL.toFixed(4)} ${C.toFixed(4)} ${H.toFixed(0)})`
482
+ }
483
+ ```
484
+
485
+ **Which tokens to invert:**
486
+ - `--background` ↔ `--foreground` (swap)
487
+ - `--card` ↔ `--card-foreground` (swap)
488
+ - `--popover` ↔ `--popover-foreground` (swap)
489
+ - `--muted` → invert
490
+ - `--muted-foreground` → invert
491
+ - `--border`, `--input` → invert
492
+ - `--primary`, `--secondary`, `--accent` → typically keep similar or slightly adjust
493
+
494
+ ### Step 3: globals.css Template
495
+
496
+ ```css
497
+ /**
498
+ * Theme: {theme}
499
+ * Generated from mock: {mockPath}
500
+ * Date: {timestamp}
501
+ *
502
+ * NOTE: Dark mode was auto-generated by inverting lightness values.
503
+ * Review and adjust .dark {} section as needed for your brand.
504
+ */
505
+
506
+ :root {
507
+ /* Surface Colors */
508
+ --background: {oklch from mock};
509
+ --foreground: {oklch from mock};
510
+ --card: {oklch from mock or default};
511
+ --card-foreground: {oklch from mock or default};
512
+ --popover: {oklch from mock or default};
513
+ --popover-foreground: {oklch from mock or default};
514
+
515
+ /* Interactive Colors */
516
+ --primary: {oklch from mock};
517
+ --primary-foreground: {calculated contrast};
518
+ --secondary: {oklch from mock or default};
519
+ --secondary-foreground: {calculated contrast};
520
+ --accent: {oklch from mock or default};
521
+ --accent-foreground: {calculated contrast};
522
+
523
+ /* State Colors */
524
+ --muted: {oklch from mock or default};
525
+ --muted-foreground: {oklch from mock or default};
526
+ --destructive: oklch(0.577 0.245 27.325);
527
+ --destructive-foreground: oklch(1 0 0);
528
+
529
+ /* Border & Input */
530
+ --border: {oklch from mock or default};
531
+ --input: {oklch from mock or default};
532
+ --ring: {oklch from mock or default};
533
+
534
+ /* Chart Colors */
535
+ --chart-1: oklch(0.81 0.1 252);
536
+ --chart-2: oklch(0.62 0.19 260);
537
+ --chart-3: oklch(0.55 0.22 263);
538
+ --chart-4: oklch(0.49 0.22 264);
539
+ --chart-5: oklch(0.42 0.18 266);
540
+
541
+ /* Sidebar */
542
+ --sidebar: {based on background};
543
+ --sidebar-foreground: {based on foreground};
544
+ --sidebar-primary: {based on primary};
545
+ --sidebar-primary-foreground: {based on primary-foreground};
546
+ --sidebar-accent: {based on accent};
547
+ --sidebar-accent-foreground: {based on accent-foreground};
548
+ --sidebar-border: {based on border};
549
+ --sidebar-ring: {based on ring};
550
+
551
+ /* Typography */
552
+ --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
553
+ --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
554
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
555
+
556
+ /* Design Tokens */
557
+ --radius: 0.625rem;
558
+ --spacing: 0.25rem;
559
+
560
+ /* Shadows */
561
+ --shadow-2xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
562
+ --shadow-xs: 0 1px 3px 0px hsl(0 0% 0% / 0.05);
563
+ --shadow-sm: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
564
+ --shadow: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 1px 2px -1px hsl(0 0% 0% / 0.10);
565
+ --shadow-md: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 2px 4px -1px hsl(0 0% 0% / 0.10);
566
+ --shadow-lg: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 4px 6px -1px hsl(0 0% 0% / 0.10);
567
+ --shadow-xl: 0 1px 3px 0px hsl(0 0% 0% / 0.10), 0 8px 10px -1px hsl(0 0% 0% / 0.10);
568
+ --shadow-2xl: 0 1px 3px 0px hsl(0 0% 0% / 0.25);
569
+ }
570
+
571
+ /* =============================================
572
+ DARK MODE (Auto-generated by inverting lightness)
573
+ Review and adjust as needed for your brand
574
+ ============================================= */
575
+
576
+ .dark {
577
+ --background: {inverted};
578
+ --foreground: {inverted};
579
+ --card: {inverted};
580
+ --card-foreground: {inverted};
581
+ --popover: {inverted};
582
+ --popover-foreground: {inverted};
583
+ --primary: {adjusted for dark};
584
+ --primary-foreground: {adjusted for dark};
585
+ --secondary: {inverted};
586
+ --secondary-foreground: {inverted};
587
+ --muted: {inverted};
588
+ --muted-foreground: {inverted};
589
+ --accent: {inverted};
590
+ --accent-foreground: {inverted};
591
+ --destructive: oklch(0.704 0.191 22.216);
592
+ --destructive-foreground: oklch(0.985 0 0);
593
+ --border: {inverted};
594
+ --input: {inverted};
595
+ --ring: {inverted};
596
+ --sidebar: {inverted};
597
+ --sidebar-foreground: {inverted};
598
+ --sidebar-primary: {adjusted};
599
+ --sidebar-primary-foreground: {adjusted};
600
+ --sidebar-accent: {inverted};
601
+ --sidebar-accent-foreground: {inverted};
602
+ --sidebar-border: {inverted};
603
+ --sidebar-ring: {inverted};
604
+ }
605
+
606
+ /* =============================================
607
+ TAILWIND v4 THEME MAPPING
608
+ ============================================= */
609
+
610
+ @theme inline {
611
+ --color-background: var(--background);
612
+ --color-foreground: var(--foreground);
613
+ --color-card: var(--card);
614
+ --color-card-foreground: var(--card-foreground);
615
+ --color-popover: var(--popover);
616
+ --color-popover-foreground: var(--popover-foreground);
617
+ --color-primary: var(--primary);
618
+ --color-primary-foreground: var(--primary-foreground);
619
+ --color-secondary: var(--secondary);
620
+ --color-secondary-foreground: var(--secondary-foreground);
621
+ --color-muted: var(--muted);
622
+ --color-muted-foreground: var(--muted-foreground);
623
+ --color-accent: var(--accent);
624
+ --color-accent-foreground: var(--accent-foreground);
625
+ --color-destructive: var(--destructive);
626
+ --color-destructive-foreground: var(--destructive-foreground);
627
+ --color-border: var(--border);
628
+ --color-input: var(--input);
629
+ --color-ring: var(--ring);
630
+ --color-chart-1: var(--chart-1);
631
+ --color-chart-2: var(--chart-2);
632
+ --color-chart-3: var(--chart-3);
633
+ --color-chart-4: var(--chart-4);
634
+ --color-chart-5: var(--chart-5);
635
+ --color-sidebar: var(--sidebar);
636
+ --color-sidebar-foreground: var(--sidebar-foreground);
637
+ --color-sidebar-primary: var(--sidebar-primary);
638
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
639
+ --color-sidebar-accent: var(--sidebar-accent);
640
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
641
+ --color-sidebar-border: var(--sidebar-border);
642
+ --color-sidebar-ring: var(--sidebar-ring);
643
+
644
+ --font-sans: var(--font-sans);
645
+ --font-mono: var(--font-mono);
646
+ --font-serif: var(--font-serif);
647
+
648
+ --radius-sm: calc(var(--radius) - 4px);
649
+ --radius-md: calc(var(--radius) - 2px);
650
+ --radius-lg: var(--radius);
651
+ --radius-xl: calc(var(--radius) + 4px);
652
+
653
+ --shadow-2xs: var(--shadow-2xs);
654
+ --shadow-xs: var(--shadow-xs);
655
+ --shadow-sm: var(--shadow-sm);
656
+ --shadow: var(--shadow);
657
+ --shadow-md: var(--shadow-md);
658
+ --shadow-lg: var(--shadow-lg);
659
+ --shadow-xl: var(--shadow-xl);
660
+ --shadow-2xl: var(--shadow-2xl);
661
+ }
662
+ ```
663
+
664
+ ### Generation Checklist
665
+
666
+ - [ ] All mock colors converted to OKLCH
667
+ - [ ] Dark mode generated with inverted lightness
668
+ - [ ] Complete @theme inline section included
669
+ - [ ] Font stacks included
670
+ - [ ] Shadow definitions included
671
+ - [ ] Clear comment indicating dark mode was auto-generated
672
+ - [ ] Complete, valid CSS output
673
+
674
+ ---
675
+
676
+ ## Related Skills
677
+
678
+ - `tailwind-theming` - Detailed Tailwind CSS patterns
679
+ - `shadcn-theming` - shadcn/ui theme customization
680
+ - `mock-analysis` - For extracting mock tokens
681
+ - `page-builder-blocks` - For applying tokens to blocks
682
+ - `block-decision-matrix` - For block new/variant/existing decisions