@fprad0/skill-master-mcp 0.0.9 → 0.0.10

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 (195) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +16 -2
  3. package/VERSION.md +3 -3
  4. package/bin/lib/menu-core.mjs +651 -16
  5. package/bin/skill-master-bootstrap-global.mjs +14 -1
  6. package/bin/skill-master-doctor.mjs +168 -0
  7. package/bin/skill-master-install-global-skills.mjs +30 -10
  8. package/bin/skill-master-menu.mjs +184 -36
  9. package/bin/skill-master-register-clients.mjs +26 -3
  10. package/dist/index.js +30 -5
  11. package/dist/index.js.map +1 -1
  12. package/docs/skill-candidates/v0.0.10/cli-creator/LICENSE.txt +201 -0
  13. package/docs/skill-candidates/v0.0.10/cli-creator/SKILL.md +160 -0
  14. package/docs/skill-candidates/v0.0.10/cli-creator/agents/openai.yaml +4 -0
  15. package/docs/skill-candidates/v0.0.10/cli-creator/references/agent-cli-patterns.md +154 -0
  16. package/docs/skill-candidates/v0.0.10/developer-workstation-ops/SKILL.md +32 -0
  17. package/docs/skill-candidates/v0.0.10/figma/LICENSE.txt +2 -0
  18. package/docs/skill-candidates/v0.0.10/figma/SKILL.md +42 -0
  19. package/docs/skill-candidates/v0.0.10/figma/agents/openai.yaml +14 -0
  20. package/docs/skill-candidates/v0.0.10/figma/assets/figma-small.svg +3 -0
  21. package/docs/skill-candidates/v0.0.10/figma/assets/figma.png +0 -0
  22. package/docs/skill-candidates/v0.0.10/figma/assets/icon.svg +28 -0
  23. package/docs/skill-candidates/v0.0.10/figma/references/figma-mcp-config.md +35 -0
  24. package/docs/skill-candidates/v0.0.10/figma/references/figma-tools-and-prompts.md +34 -0
  25. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/LICENSE.TXT +2 -0
  26. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/SKILL.md +349 -0
  27. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/agents/openai.yaml +14 -0
  28. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/assets/figma-small.svg +3 -0
  29. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/assets/figma.png +0 -0
  30. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/assets/icon.svg +28 -0
  31. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/references/mapping-checklist.md +7 -0
  32. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/scripts/normalize_node_id.py +25 -0
  33. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/LICENSE.TXT +2 -0
  34. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/SKILL.md +537 -0
  35. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/agents/openai.yaml +14 -0
  36. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/assets/figma-small.svg +3 -0
  37. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/assets/figma.png +0 -0
  38. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/assets/icon.svg +28 -0
  39. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/references/rule-template.md +15 -0
  40. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/scripts/check_agents_md.sh +9 -0
  41. package/docs/skill-candidates/v0.0.10/figma-generate-design/LICENSE.TXT +2 -0
  42. package/docs/skill-candidates/v0.0.10/figma-generate-design/SKILL.md +341 -0
  43. package/docs/skill-candidates/v0.0.10/figma-generate-design/agents/openai.yaml +14 -0
  44. package/docs/skill-candidates/v0.0.10/figma-generate-design/assets/figma-small.svg +3 -0
  45. package/docs/skill-candidates/v0.0.10/figma-generate-design/assets/figma.png +0 -0
  46. package/docs/skill-candidates/v0.0.10/figma-generate-design/assets/icon.svg +28 -0
  47. package/docs/skill-candidates/v0.0.10/figma-generate-design/maintainers.yml +1 -0
  48. package/docs/skill-candidates/v0.0.10/figma-generate-library/LICENSE.TXT +2 -0
  49. package/docs/skill-candidates/v0.0.10/figma-generate-library/SKILL.md +314 -0
  50. package/docs/skill-candidates/v0.0.10/figma-generate-library/agents/openai.yaml +14 -0
  51. package/docs/skill-candidates/v0.0.10/figma-generate-library/assets/figma-small.svg +3 -0
  52. package/docs/skill-candidates/v0.0.10/figma-generate-library/assets/figma.png +0 -0
  53. package/docs/skill-candidates/v0.0.10/figma-generate-library/assets/icon.svg +28 -0
  54. package/docs/skill-candidates/v0.0.10/figma-generate-library/maintainers.yml +3 -0
  55. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/code-connect-setup.md +260 -0
  56. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/component-creation.md +1014 -0
  57. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/discovery-phase.md +518 -0
  58. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/documentation-creation.md +834 -0
  59. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/error-recovery.md +540 -0
  60. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/naming-conventions.md +527 -0
  61. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/token-creation.md +962 -0
  62. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/bindVariablesToComponent.js +110 -0
  63. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/cleanupOrphans.js +127 -0
  64. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/createComponentWithVariants.js +148 -0
  65. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/createDocumentationPage.js +139 -0
  66. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/createSemanticTokens.js +108 -0
  67. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/createVariableCollection.js +49 -0
  68. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/inspectFileStructure.js +121 -0
  69. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/rehydrateState.js +92 -0
  70. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/validateCreation.js +83 -0
  71. package/docs/skill-candidates/v0.0.10/figma-implement-design/LICENSE.txt +2 -0
  72. package/docs/skill-candidates/v0.0.10/figma-implement-design/SKILL.md +258 -0
  73. package/docs/skill-candidates/v0.0.10/figma-implement-design/agents/openai.yaml +14 -0
  74. package/docs/skill-candidates/v0.0.10/figma-implement-design/assets/figma-small.svg +3 -0
  75. package/docs/skill-candidates/v0.0.10/figma-implement-design/assets/figma.png +0 -0
  76. package/docs/skill-candidates/v0.0.10/figma-implement-design/assets/icon.svg +28 -0
  77. package/docs/skill-candidates/v0.0.10/figma-use/LICENSE.TXT +2 -0
  78. package/docs/skill-candidates/v0.0.10/figma-use/SKILL.md +233 -0
  79. package/docs/skill-candidates/v0.0.10/figma-use/agents/openai.yaml +14 -0
  80. package/docs/skill-candidates/v0.0.10/figma-use/assets/figma-small.svg +3 -0
  81. package/docs/skill-candidates/v0.0.10/figma-use/assets/figma.png +0 -0
  82. package/docs/skill-candidates/v0.0.10/figma-use/assets/icon.svg +28 -0
  83. package/docs/skill-candidates/v0.0.10/figma-use/maintainers.yml +1 -0
  84. package/docs/skill-candidates/v0.0.10/figma-use/references/api-reference.md +301 -0
  85. package/docs/skill-candidates/v0.0.10/figma-use/references/common-patterns.md +512 -0
  86. package/docs/skill-candidates/v0.0.10/figma-use/references/component-patterns.md +488 -0
  87. package/docs/skill-candidates/v0.0.10/figma-use/references/effect-style-patterns.md +123 -0
  88. package/docs/skill-candidates/v0.0.10/figma-use/references/gotchas.md +599 -0
  89. package/docs/skill-candidates/v0.0.10/figma-use/references/maintainers.yml +12 -0
  90. package/docs/skill-candidates/v0.0.10/figma-use/references/plugin-api-patterns.md +513 -0
  91. package/docs/skill-candidates/v0.0.10/figma-use/references/plugin-api-standalone.d.ts +11293 -0
  92. package/docs/skill-candidates/v0.0.10/figma-use/references/plugin-api-standalone.index.md +441 -0
  93. package/docs/skill-candidates/v0.0.10/figma-use/references/text-style-patterns.md +203 -0
  94. package/docs/skill-candidates/v0.0.10/figma-use/references/validation-and-recovery.md +109 -0
  95. package/docs/skill-candidates/v0.0.10/figma-use/references/variable-patterns.md +354 -0
  96. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/maintainers.yml +9 -0
  97. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-components--creating.md +17 -0
  98. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-components--using.md +17 -0
  99. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-components.md +50 -0
  100. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-effect-styles.md +52 -0
  101. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-text-styles.md +90 -0
  102. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-variables--creating.md +13 -0
  103. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-variables--using.md +13 -0
  104. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-variables.md +64 -0
  105. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds.md +41 -0
  106. package/docs/skill-candidates/v0.0.10/frontend-design/LICENSE.txt +177 -0
  107. package/docs/skill-candidates/v0.0.10/frontend-design/SKILL.md +55 -0
  108. package/docs/skill-candidates/v0.0.10/frontend-ui-ux-systems/SKILL.md +32 -0
  109. package/docs/skill-candidates/v0.0.10/github/SKILL.md +74 -0
  110. package/docs/skill-candidates/v0.0.10/github/agents/openai.yaml +6 -0
  111. package/docs/skill-candidates/v0.0.10/github/assets/github-small.svg +3 -0
  112. package/docs/skill-candidates/v0.0.10/github/assets/github.png +0 -0
  113. package/docs/skill-candidates/v0.0.10/image-graphic-design-rendering/SKILL.md +28 -0
  114. package/docs/skill-candidates/v0.0.10/language-quality-pt-en-fr-it-ru/SKILL.md +28 -0
  115. package/docs/skill-candidates/v0.0.10/math-physics-reasoning/SKILL.md +28 -0
  116. package/docs/skill-candidates/v0.0.10/mcp-builder/LICENSE.txt +202 -0
  117. package/docs/skill-candidates/v0.0.10/mcp-builder/SKILL.md +236 -0
  118. package/docs/skill-candidates/v0.0.10/mcp-builder/reference/evaluation.md +602 -0
  119. package/docs/skill-candidates/v0.0.10/mcp-builder/reference/mcp_best_practices.md +249 -0
  120. package/docs/skill-candidates/v0.0.10/mcp-builder/reference/node_mcp_server.md +970 -0
  121. package/docs/skill-candidates/v0.0.10/mcp-builder/reference/python_mcp_server.md +719 -0
  122. package/docs/skill-candidates/v0.0.10/mcp-builder/scripts/connections.py +151 -0
  123. package/docs/skill-candidates/v0.0.10/mcp-builder/scripts/evaluation.py +373 -0
  124. package/docs/skill-candidates/v0.0.10/mcp-builder/scripts/example_evaluation.xml +22 -0
  125. package/docs/skill-candidates/v0.0.10/mcp-builder/scripts/requirements.txt +2 -0
  126. package/docs/skill-candidates/v0.0.10/mcp-client-readiness/SKILL.md +31 -0
  127. package/docs/skill-candidates/v0.0.10/openai-docs/LICENSE.txt +201 -0
  128. package/docs/skill-candidates/v0.0.10/openai-docs/SKILL.md +161 -0
  129. package/docs/skill-candidates/v0.0.10/openai-docs/agents/openai.yaml +14 -0
  130. package/docs/skill-candidates/v0.0.10/openai-docs/assets/openai-small.svg +3 -0
  131. package/docs/skill-candidates/v0.0.10/openai-docs/assets/openai.png +0 -0
  132. package/docs/skill-candidates/v0.0.10/openai-docs/references/latest-model.md +37 -0
  133. package/docs/skill-candidates/v0.0.10/openai-docs/references/prompting-guide.md +244 -0
  134. package/docs/skill-candidates/v0.0.10/openai-docs/references/upgrade-guide.md +181 -0
  135. package/docs/skill-candidates/v0.0.10/openai-docs/scripts/fetch-codex-manual.mjs +598 -0
  136. package/docs/skill-candidates/v0.0.10/openai-docs/scripts/resolve-latest-model-info.js +147 -0
  137. package/docs/skill-candidates/v0.0.10/playwright/LICENSE.txt +201 -0
  138. package/docs/skill-candidates/v0.0.10/playwright/NOTICE.txt +14 -0
  139. package/docs/skill-candidates/v0.0.10/playwright/SKILL.md +147 -0
  140. package/docs/skill-candidates/v0.0.10/playwright/agents/openai.yaml +6 -0
  141. package/docs/skill-candidates/v0.0.10/playwright/assets/playwright-small.svg +3 -0
  142. package/docs/skill-candidates/v0.0.10/playwright/assets/playwright.png +0 -0
  143. package/docs/skill-candidates/v0.0.10/playwright/references/cli.md +116 -0
  144. package/docs/skill-candidates/v0.0.10/playwright/references/workflows.md +95 -0
  145. package/docs/skill-candidates/v0.0.10/playwright/scripts/playwright_cli.sh +25 -0
  146. package/docs/skill-candidates/v0.0.10/polyglot-backend-engineering/SKILL.md +32 -0
  147. package/docs/skill-candidates/v0.0.10/screenshot/LICENSE.txt +201 -0
  148. package/docs/skill-candidates/v0.0.10/screenshot/SKILL.md +267 -0
  149. package/docs/skill-candidates/v0.0.10/screenshot/agents/openai.yaml +6 -0
  150. package/docs/skill-candidates/v0.0.10/screenshot/assets/screenshot-small.svg +5 -0
  151. package/docs/skill-candidates/v0.0.10/screenshot/assets/screenshot.png +0 -0
  152. package/docs/skill-candidates/v0.0.10/screenshot/scripts/ensure_macos_permissions.sh +54 -0
  153. package/docs/skill-candidates/v0.0.10/screenshot/scripts/macos_display_info.swift +22 -0
  154. package/docs/skill-candidates/v0.0.10/screenshot/scripts/macos_permissions.swift +40 -0
  155. package/docs/skill-candidates/v0.0.10/screenshot/scripts/macos_window_info.swift +126 -0
  156. package/docs/skill-candidates/v0.0.10/screenshot/scripts/take_screenshot.ps1 +163 -0
  157. package/docs/skill-candidates/v0.0.10/screenshot/scripts/take_screenshot.py +585 -0
  158. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/SKILL.md +62 -0
  159. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/agents/openai.yaml +4 -0
  160. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/references/activation-policy.md +77 -0
  161. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/references/human-approval-policy.md +83 -0
  162. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/references/persona-dev-senior-master.md +46 -0
  163. package/docs/skill-candidates/v0.0.10/terminal-menu-operations/SKILL.md +30 -0
  164. package/docs/skill-candidates/v0.0.10/terminal-pixel-art-tui/SKILL.md +43 -0
  165. package/docs/skill-candidates/v0.0.10/webapp-testing/LICENSE.txt +202 -0
  166. package/docs/skill-candidates/v0.0.10/webapp-testing/SKILL.md +96 -0
  167. package/docs/skill-candidates/v0.0.10/webapp-testing/examples/console_logging.py +35 -0
  168. package/docs/skill-candidates/v0.0.10/webapp-testing/examples/element_discovery.py +40 -0
  169. package/docs/skill-candidates/v0.0.10/webapp-testing/examples/static_html_automation.py +33 -0
  170. package/docs/skill-candidates/v0.0.10/webapp-testing/scripts/with_server.py +106 -0
  171. package/docs/skill-candidates/v0.0.10/winui-app/LICENSE.txt +202 -0
  172. package/docs/skill-candidates/v0.0.10/winui-app/SKILL.md +94 -0
  173. package/docs/skill-candidates/v0.0.10/winui-app/agents/openai.yaml +5 -0
  174. package/docs/skill-candidates/v0.0.10/winui-app/assets/winui.png +0 -0
  175. package/docs/skill-candidates/v0.0.10/winui-app/config.yaml +50 -0
  176. package/docs/skill-candidates/v0.0.10/winui-app/references/_sections.md +96 -0
  177. package/docs/skill-candidates/v0.0.10/winui-app/references/accessibility-input-and-localization.md +51 -0
  178. package/docs/skill-candidates/v0.0.10/winui-app/references/build-run-and-launch-verification.md +72 -0
  179. package/docs/skill-candidates/v0.0.10/winui-app/references/community-toolkit-controls-and-helpers.md +57 -0
  180. package/docs/skill-candidates/v0.0.10/winui-app/references/controls-layout-and-adaptive-ui.md +84 -0
  181. package/docs/skill-candidates/v0.0.10/winui-app/references/foundation-environment-audit-and-remediation.md +82 -0
  182. package/docs/skill-candidates/v0.0.10/winui-app/references/foundation-setup-and-project-selection.md +67 -0
  183. package/docs/skill-candidates/v0.0.10/winui-app/references/foundation-template-first-recovery.md +62 -0
  184. package/docs/skill-candidates/v0.0.10/winui-app/references/foundation-winui-app-structure.md +62 -0
  185. package/docs/skill-candidates/v0.0.10/winui-app/references/motion-animations-and-polish.md +45 -0
  186. package/docs/skill-candidates/v0.0.10/winui-app/references/performance-diagnostics-and-responsiveness.md +46 -0
  187. package/docs/skill-candidates/v0.0.10/winui-app/references/sample-source-map.md +37 -0
  188. package/docs/skill-candidates/v0.0.10/winui-app/references/shell-navigation-and-windowing.md +67 -0
  189. package/docs/skill-candidates/v0.0.10/winui-app/references/styling-theming-materials-and-icons.md +71 -0
  190. package/docs/skill-candidates/v0.0.10/winui-app/references/testing-debugging-and-review-checklists.md +77 -0
  191. package/docs/skill-candidates/v0.0.10/winui-app/references/windows-app-sdk-lifecycle-notifications-and-deployment.md +52 -0
  192. package/manifests/channels/beta.json +7 -7
  193. package/manifests/channels/stable.json +8 -8
  194. package/network/unapproved-skill-candidates.json +34 -1
  195. package/package.json +2 -1
@@ -0,0 +1,518 @@
1
+ > Part of the [figma-generate-library skill](../SKILL.md).
2
+
3
+ # Discovery Phase Reference
4
+
5
+ This document covers everything needed for Phase 0 of a design system build: analyzing the codebase for tokens, inspecting the Figma file for existing conventions, searching subscribed libraries, building the plan, and resolving conflicts before any write operations begin.
6
+
7
+ ---
8
+
9
+ ## 1. Codebase Analysis — Finding Token Sources
10
+
11
+ ### Search Priority Order
12
+
13
+ Look for token sources in this order. Stop as soon as you find a definitive source; multiple formats can coexist:
14
+
15
+ 1. Design token files: `*.tokens.json`, `tokens/*.json`, `src/tokens/**`
16
+ 2. CSS variable files: `variables.css`, `tokens.css`, `theme.css`, `global.css`
17
+ 3. Tailwind config: `tailwind.config.js`, `tailwind.config.ts`
18
+ 4. CSS-in-JS theme objects: `theme.ts`, `createTheme`, `ThemeProvider`
19
+ 5. Platform-specific: iOS Asset catalogs (`.xcassets`), Android `themes.xml`, `colors.xml`
20
+
21
+ ### CSS Custom Properties (Most Common for Web)
22
+
23
+ **What to search for:**
24
+
25
+ ```
26
+ :root { ... }
27
+ @theme { ... } ← Tailwind v4
28
+ --color-*, --spacing-*, --radius-*, --shadow-*, --font-*
29
+ ```
30
+
31
+ **Pattern:** `/--[\w-]+:\s*[^;]+/g`
32
+
33
+ **Common file locations:** `src/styles/tokens.css`, `src/styles/variables.css`, `src/theme/*.css`
34
+
35
+ **Extraction and naming translation:**
36
+
37
+ | CSS Property | Figma Variable Name | Figma Type | WEB Code Syntax |
38
+ |---|---|---|---|
39
+ | `--color-bg-primary: #fff` | `color/bg/primary` | COLOR | `var(--color-bg-primary)` |
40
+ | `--color-text-secondary: #757575` | `color/text/secondary` | COLOR | `var(--color-text-secondary)` |
41
+ | `--spacing-sm: 8px` | `spacing/sm` | FLOAT | `var(--spacing-sm)` |
42
+ | `--radius-md: 8px` | `radius/md` | FLOAT | `var(--radius-md)` |
43
+ | `--font-body: "Inter"` | `typography/body/font-family` | STRING | `var(--font-body)` |
44
+
45
+ **Naming rule:** Replace hyphens with slashes at category boundaries. Keep hyphens within the final path segment: `--color-bg-primary` → `color/bg/primary`, but `--color-bg-primary-hover` → `color/bg/primary-hover`.
46
+
47
+ **Always store the original CSS variable name** as the code syntax value — never derive it from the Figma variable name. If the codebase uses `--sds-color-background-brand-default`, use exactly that string in `setVariableCodeSyntax('WEB', '--sds-color-background-brand-default')`.
48
+
49
+ ### Tailwind Configuration
50
+
51
+ **What to look for in `tailwind.config.js` or `tailwind.config.ts`:**
52
+
53
+ ```javascript
54
+ // theme.extend.colors → Figma color variables
55
+ { primary: { DEFAULT: '#3366FF', light: '#6699FF', dark: '#0033CC' } }
56
+ // → color/primary/default, color/primary/light, color/primary/dark
57
+
58
+ // theme.extend.spacing → Figma FLOAT variables
59
+ { 'xs': '4px', 'sm': '8px', 'md': '16px' }
60
+ // → spacing/xs = 4, spacing/sm = 8, spacing/md = 16
61
+
62
+ // theme.extend.borderRadius → Figma FLOAT variables
63
+ { 'sm': '4px', 'md': '8px', 'lg': '16px' }
64
+ // → radius/sm = 4, radius/md = 8, radius/lg = 16
65
+ ```
66
+
67
+ Tailwind utility class names (`bg-blue-500`, `p-4`) are not tokens — extract values from the config object, not the class names.
68
+
69
+ ### Design Token Community Group (DTCG) Format
70
+
71
+ **Pattern:** `*.tokens.json` or `tokens/*.json`. Find source files, not generated outputs from Style Dictionary or Tokens Studio.
72
+
73
+ ```json
74
+ {
75
+ "color": {
76
+ "bg": {
77
+ "primary": { "$type": "color", "$value": "#ffffff" },
78
+ "secondary": { "$type": "color", "$value": "#f5f5f5" }
79
+ }
80
+ },
81
+ "spacing": {
82
+ "sm": { "$type": "dimension", "$value": "8px" }
83
+ }
84
+ }
85
+ ```
86
+
87
+ Nested keys map to slash-separated Figma names: `color.bg.primary` → `color/bg/primary`.
88
+
89
+ ### CSS-in-JS / Theme Objects
90
+
91
+ **What to search for:** `createTheme`, `ThemeProvider`, `theme = {}`, styled-components, Emotion, Stitches, vanilla-extract
92
+
93
+ ```typescript
94
+ // theme.colors.bg.primary → Figma variable: color/bg/primary
95
+ // theme.spacing.sm → Figma variable: spacing/sm
96
+ // Multiple theme objects (lightTheme, darkTheme) → modes in the same collection
97
+ ```
98
+
99
+ ### iOS Token Sources
100
+
101
+ ```swift
102
+ // Asset catalog colors in .xcassets/Colors.xcassets
103
+ // extension Color { static let bgPrimary = Color("bg-primary") }
104
+ // Look for traitCollection.userInterfaceStyle for dark mode detection
105
+ ```
106
+
107
+ ### Android Token Sources
108
+
109
+ ```kotlin
110
+ // res/values/colors.xml <color name="primary">#3366FF</color>
111
+ // res/values-night/colors.xml (dark mode overrides)
112
+ // MaterialTheme.colorScheme.primary in Compose
113
+ // val Primary = Color(0xFF3366FF)
114
+ ```
115
+
116
+ ### Detecting Dark Mode
117
+
118
+ | Platform | Signal |
119
+ |---|---|
120
+ | Web (CSS) | `@media (prefers-color-scheme: dark)`, `.dark { }`, `[data-theme="dark"]` |
121
+ | Web (Tailwind) | `darkMode: 'class'` or `darkMode: 'media'` in config |
122
+ | Web (JS) | Separate `darkTheme` object alongside `lightTheme` |
123
+ | iOS | `Color(uiColor:)` with `traitCollection.userInterfaceStyle`, dual-appearance asset catalog |
124
+ | Android | `themes.xml` with `Theme.*.Night`, `isSystemInDarkTheme()` in Compose, `values-night/` folder |
125
+
126
+ **Figma mapping:** If dark mode exists → minimum 2 modes (Light/Dark) in the semantic color collection. Primitive collections stay single-mode.
127
+
128
+ ### Shadow/Elevation Extraction
129
+
130
+ Shadows cannot be Figma variables — they become **Effect Styles**.
131
+
132
+ ```css
133
+ /* Look for: box-shadow, --shadow-* */
134
+ --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
135
+ --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.10);
136
+ --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.10);
137
+ ```
138
+
139
+ CSS `0 4px 6px -1px rgba(0,0,0,0.1)` → Figma:
140
+ ```
141
+ { type: "DROP_SHADOW", offset: {x:0, y:4}, radius: 6, spread: -1, color: {r:0, g:0, b:0, a:0.1} }
142
+ ```
143
+
144
+ ### Typography Extraction
145
+
146
+ | Code token | Maps to |
147
+ |---|---|
148
+ | `font-size: 16px` | FLOAT variable (scope `FONT_SIZE`) or Text Style `fontSize` |
149
+ | `line-height: 1.5` | Text Style `lineHeight: {value: 24, unit: "PIXELS"}` |
150
+ | `font-weight: 600` | Text Style `fontName: {family: "Inter", style: "Semi Bold"}` |
151
+ | `letter-spacing: -0.02em` | Text Style `letterSpacing: {value: -2, unit: "PERCENT"}` |
152
+ | `font-family: "Inter"` | STRING variable (scope `FONT_FAMILY`) or Text Style `fontName.family` |
153
+
154
+ Composite text styles (all properties bundled) → Figma Text Styles. Individual properties → Figma variables with appropriate scopes.
155
+
156
+ ### Component Extraction
157
+
158
+ For each component, extract:
159
+
160
+ 1. **Name** → Figma component set name
161
+ 2. **Union-type props** → VARIANT properties
162
+ 3. **String content props** → TEXT properties
163
+ 4. **Boolean props** → BOOLEAN properties (and VARIANT State when combined with interaction states)
164
+ 5. **Child/slot props** → INSTANCE_SWAP properties
165
+
166
+ ```typescript
167
+ // React example:
168
+ interface ButtonProps {
169
+ size: 'sm' | 'md' | 'lg'; // → VARIANT: Size = sm|md|lg
170
+ variant: 'primary' | 'secondary'; // → VARIANT: Style = primary|secondary
171
+ disabled?: boolean; // → VARIANT: State (combine: default|hover|pressed|disabled)
172
+ label: string; // → TEXT: Label
173
+ icon?: ReactNode; // → INSTANCE_SWAP: Icon + BOOLEAN: Show Icon
174
+ }
175
+ // → Component Set "Button", variant count: 3 sizes × 2 styles × 4 states = 24
176
+ ```
177
+
178
+ ---
179
+
180
+ ## 2. Figma File Inspection
181
+
182
+ Run these `use_figma` snippets at the start of every build. All are read-only and safe to run before any user checkpoint.
183
+
184
+ ### List All Pages
185
+
186
+ ```javascript
187
+ (async () => {
188
+ try {
189
+ const pages = figma.root.children.map((p, i) => ({
190
+ index: i,
191
+ name: p.name,
192
+ id: p.id,
193
+ childCount: p.children.length
194
+ }));
195
+ figma.closePlugin(JSON.stringify({ pages }));
196
+ } catch(e) { figma.closePluginWithFailure(e.toString()); }
197
+ })();
198
+ ```
199
+
200
+ Interpret: note page names for naming convention (are they PascalCase? sentence case?), count separator pages (`---`), identify existing component pages vs foundations pages.
201
+
202
+ ### List Variable Collections With Modes
203
+
204
+ ```javascript
205
+ (async () => {
206
+ try {
207
+ const collections = await figma.variables.getLocalVariableCollectionsAsync();
208
+ const result = collections.map(c => ({
209
+ id: c.id,
210
+ name: c.name,
211
+ modes: c.modes, // [{modeId, name}, ...]
212
+ variableCount: c.variableIds.length,
213
+ defaultModeId: c.defaultModeId
214
+ }));
215
+ figma.closePlugin(JSON.stringify({ collections: result }));
216
+ } catch(e) { figma.closePluginWithFailure(e.toString()); }
217
+ })();
218
+ ```
219
+
220
+ Interpret: identify existing primitive/semantic split, note mode names (do they use "Light/Dark" or "SDS Light/SDS Dark"?), count variables to understand scope.
221
+
222
+ ### List Variables in a Collection (with names, types, scopes, and sample values)
223
+
224
+ ```javascript
225
+ (async () => {
226
+ try {
227
+ const collections = await figma.variables.getLocalVariableCollectionsAsync();
228
+ const targetName = "Color"; // change to the collection you want to inspect
229
+ const coll = collections.find(c => c.name === targetName);
230
+ if (!coll) { figma.closePlugin(JSON.stringify({ error: `Collection "${targetName}" not found` })); return; }
231
+
232
+ const allVars = await figma.variables.getLocalVariablesAsync();
233
+ const vars = allVars.filter(v => v.variableCollectionId === coll.id);
234
+
235
+ const result = vars.map(v => ({
236
+ id: v.id,
237
+ name: v.name,
238
+ resolvedType: v.resolvedType,
239
+ scopes: v.scopes,
240
+ codeSyntax: v.codeSyntax,
241
+ // First mode value only, for a sample
242
+ sampleValue: v.valuesByMode[coll.defaultModeId]
243
+ }));
244
+
245
+ figma.closePlugin(JSON.stringify({ collection: coll.name, variableCount: result.length, variables: result }));
246
+ } catch(e) { figma.closePluginWithFailure(e.toString()); }
247
+ })();
248
+ ```
249
+
250
+ Interpret: check if variables use `ALL_SCOPES` (bad), check naming convention (slash-separated hierarchy?), check if code syntax is set, identify alias chains.
251
+
252
+ ### List Component Sets with Properties
253
+
254
+ ```javascript
255
+ (async () => {
256
+ try {
257
+ await figma.setCurrentPageAsync(figma.currentPage); // ensures page context
258
+ const componentSets = figma.currentPage.findAll(n => n.type === 'COMPONENT_SET');
259
+ const result = componentSets.map(cs => ({
260
+ id: cs.id,
261
+ name: cs.name,
262
+ variantCount: cs.children.length,
263
+ properties: Object.entries(cs.componentPropertyDefinitions).map(([key, def]) => ({
264
+ name: key,
265
+ type: def.type,
266
+ variantOptions: def.variantOptions || null,
267
+ defaultValue: def.defaultValue
268
+ }))
269
+ }));
270
+ figma.closePlugin(JSON.stringify({ componentSets: result, count: result.length }));
271
+ } catch(e) { figma.closePluginWithFailure(e.toString()); }
272
+ })();
273
+ ```
274
+
275
+ Note: to search ALL pages, iterate `figma.root.children` and `setCurrentPageAsync` for each.
276
+
277
+ ### List All Styles
278
+
279
+ ```javascript
280
+ (async () => {
281
+ try {
282
+ const [textStyles, effectStyles, paintStyles] = await Promise.all([
283
+ figma.getLocalTextStylesAsync(),
284
+ figma.getLocalEffectStylesAsync(),
285
+ figma.getLocalPaintStylesAsync()
286
+ ]);
287
+
288
+ figma.closePlugin(JSON.stringify({
289
+ textStyles: textStyles.map(s => ({ id: s.id, name: s.name, fontSize: s.fontSize, fontName: s.fontName })),
290
+ effectStyles: effectStyles.map(s => ({ id: s.id, name: s.name, effectCount: s.effects.length })),
291
+ paintStyles: paintStyles.map(s => ({ id: s.id, name: s.name })),
292
+ counts: { text: textStyles.length, effect: effectStyles.length, paint: paintStyles.length }
293
+ }));
294
+ } catch(e) { figma.closePluginWithFailure(e.toString()); }
295
+ })();
296
+ ```
297
+
298
+ ### Check Naming Conventions on an Existing Component
299
+
300
+ ```javascript
301
+ (async () => {
302
+ try {
303
+ // Replace with the node ID of an existing component to analyze
304
+ const node = await figma.getNodeByIdAsync("YOUR_NODE_ID");
305
+ if (!node) { figma.closePlugin(JSON.stringify({ error: "Node not found" })); return; }
306
+
307
+ // Check fills for variable bindings
308
+ const fillInfo = [];
309
+ if ('fills' in node && Array.isArray(node.fills)) {
310
+ for (const fill of node.fills) {
311
+ if (fill.type === 'SOLID' && fill.boundVariables?.color) {
312
+ fillInfo.push({ type: 'variable_alias', id: fill.boundVariables.color.id });
313
+ } else if (fill.type === 'SOLID') {
314
+ fillInfo.push({ type: 'hardcoded', r: fill.color.r, g: fill.color.g, b: fill.color.b });
315
+ }
316
+ }
317
+ }
318
+
319
+ figma.closePlugin(JSON.stringify({
320
+ name: node.name,
321
+ type: node.type,
322
+ fills: fillInfo,
323
+ pluginData: node.getPluginData('dsb_key') || null
324
+ }));
325
+ } catch(e) { figma.closePluginWithFailure(e.toString()); }
326
+ })();
327
+ ```
328
+
329
+ ---
330
+
331
+ ## 3. Using search_design_system
332
+
333
+ ### What It Searches
334
+
335
+ `search_design_system` runs three parallel searches against **subscribed design libraries** for the given file:
336
+
337
+ 1. **Components** — published library components, searched by name/description via a recommendation engine (relevance-ranked, not exact match)
338
+ 2. **Variables** — design tokens (colors, spacing, etc.) across subscribed libraries
339
+ 3. **Styles** — paint styles, text styles, and effect styles
340
+
341
+ Only libraries the file has subscribed to are searched. If results are empty, the file may not be subscribed to any design system libraries.
342
+
343
+ ### Input
344
+
345
+ ```
346
+ search_design_system({
347
+ query: "button", // required — text query
348
+ fileKey: "abc123", // required — your file key
349
+ includeComponents: true, // default true
350
+ includeVariables: true, // default true
351
+ includeStyles: true // default true
352
+ })
353
+ ```
354
+
355
+ ### What It Returns
356
+
357
+ ```json
358
+ {
359
+ "components": [
360
+ {
361
+ "name": "Button",
362
+ "libraryName": "Design System",
363
+ "assetType": "component_set",
364
+ "componentKey": "abc123def",
365
+ "description": "Primary action button"
366
+ }
367
+ ],
368
+ "variables": [
369
+ {
370
+ "name": "colors/primary/500",
371
+ "variableType": "COLOR",
372
+ "variableSetKey": "set1key",
373
+ "key": "var1key",
374
+ "scopes": ["FILL_COLOR"],
375
+ "variableCollectionName": "Colors"
376
+ }
377
+ ],
378
+ "styles": [
379
+ {
380
+ "name": "Heading/H1",
381
+ "styleType": "TEXT",
382
+ "key": "style1key"
383
+ }
384
+ ]
385
+ }
386
+ ```
387
+
388
+ ### How to Interpret Results
389
+
390
+ **Components:** The `componentKey` can be used in `use_figma` to import the component:
391
+ ```javascript
392
+ const component = await figma.importComponentByKeyAsync("abc123def");
393
+ // or for component sets:
394
+ const componentSet = await figma.importComponentSetByKeyAsync("abc123def");
395
+ ```
396
+
397
+ **Variables:** The `variableSetKey` is the collection key. The `key` is the variable key. Use these to understand what naming conventions are in use, and what tokens are available to alias from.
398
+
399
+ **Styles:** The `key` is usable with `figma.importStyleByKeyAsync(key)` to import into the current file.
400
+
401
+ ### When to Search
402
+
403
+ - **Phase 0, step 0c**: Search broadly (`query: "button"`, `query: "color"`, `query: "spacing"`) before planning anything. This establishes the reuse baseline.
404
+ - **Immediately before each component creation**: Search for the specific component name before writing any `use_figma` creation code.
405
+
406
+ **Reuse decision:**
407
+
408
+ | Condition | Decision |
409
+ |---|---|
410
+ | Found component with matching variant API, same token model | Import and reuse |
411
+ | Found component but wrong variant properties or hardcoded values | Rebuild |
412
+ | Found component that matches visually but API is incompatible | Wrap: nest as instance inside a new wrapper component |
413
+
414
+ ---
415
+
416
+ ## 4. Building the Plan
417
+
418
+ After codebase analysis and Figma inspection, produce a mapping table and present it to the user.
419
+
420
+ ### Token → Variable Mapping Table
421
+
422
+ For each token found in code, record:
423
+
424
+ | Code Token | CSS Name | Raw Value | Figma Collection | Figma Variable Name | Figma Type | Mode(s) |
425
+ |---|---|---|---|---|---|---|
426
+ | `theme.colors.blue[500]` | `--color-blue-500` | `#3B82F6` | Primitives | `blue/500` | COLOR | Value |
427
+ | `theme.colors.bg.primary` | `--color-bg-primary` | (light: blue/50, dark: gray/900) | Color | `color/bg/primary` | COLOR | Light, Dark |
428
+ | `theme.spacing.sm` | `--spacing-sm` | `8px` | Spacing | `spacing/sm` | FLOAT | Value |
429
+ | `theme.radii.md` | `--radius-md` | `8px` | Spacing | `radius/md` | FLOAT | Value |
430
+ | `theme.shadows.md` | `--shadow-md` | `0 4px 6px rgba(0,0,0,0.1)` | — | — | Effect Style | — |
431
+
432
+ ### Component → Component Set Mapping Table
433
+
434
+ | Code Component | Props → Variant Axes | Variant Count | Figma Page | Reuse? |
435
+ |---|---|---|---|---|
436
+ | `Button` | size (sm/md/lg) × variant (primary/secondary) × state (default/hover/disabled) | 18 | Buttons | Search first |
437
+ | `Avatar` | size (sm/md/lg) × type (image/initials/icon) | 9 | Avatars | Search first |
438
+
439
+ ### Gap Identification
440
+
441
+ Compare what was found in code vs what already exists in Figma:
442
+
443
+ - **New:** tokens or components that exist in code but not in Figma → create
444
+ - **Existing:** tokens or components already in Figma with matching names → verify scope/code-syntax, skip or update
445
+ - **Conflict:** same name, different value → escalate to user (see section 5)
446
+ - **Figma-only:** exists in Figma but not in code → flag for user, likely skip
447
+
448
+ ### User-Facing Checkpoint Message Template
449
+
450
+ Present this message before proceeding. Never begin Phase 1 without explicit user approval.
451
+
452
+ ```
453
+ Here's what I found and what I plan to build:
454
+
455
+ CODEBASE ANALYSIS
456
+ Colors: {N} primitives ({families}), {M} semantic tokens ({light/dark if applicable})
457
+ Spacing: {N} tokens ({range})
458
+ Typography: {N} text styles, {M} individual scale tokens
459
+ Shadows: {N} levels → will become Effect Styles
460
+ Components: {list of component names}
461
+
462
+ EXISTING FIGMA FILE
463
+ Collections: {N} existing collections
464
+ Variables: {M} existing variables
465
+ Styles: {K} text, {L} effect, {J} paint styles
466
+ Components: {list}
467
+
468
+ PLAN
469
+ New collections: {list with mode counts}
470
+ New variables: ~{N} ({breakdown by collection})
471
+ New styles: {N} text, {M} effect
472
+ New components: {list}
473
+ Libraries to search before each component: {list}
474
+
475
+ GAPS / CONFLICTS NEEDING DECISIONS
476
+ ⚠ {conflict description} — Code says X, Figma already has Y. Which wins?
477
+
478
+ WHAT I WON'T BUILD (and why)
479
+ - {item}: already exists in Figma with matching conventions
480
+ - {item}: not supported as a Figma variable (e.g. z-index, animation timing)
481
+
482
+ Shall I proceed?
483
+ ```
484
+
485
+ ---
486
+
487
+ ## 5. Conflict Resolution — When Code and Figma Disagree
488
+
489
+ When the same token/component exists in both code and Figma but with different values, names, or structures, **always ask the user**. Never silently pick one.
490
+
491
+ ### Decision Framework
492
+
493
+ | Scenario | Ask the user |
494
+ |---|---|
495
+ | Same CSS name, different hex value (e.g., `--color-accent` is `#3366FF` in code but `#5B7FFF` in Figma) | "Code says `#3366FF`, Figma currently has `#5B7FFF` for `color/accent/default`. Which is correct?" |
496
+ | Same component name, different variant axes (code has `size: sm/md/lg`, Figma has `Size: Small/Large`) | "Code uses 3 sizes (sm/md/lg) but Figma has 2 (Small/Large). Should I add Medium, or rename to match code?" |
497
+ | Code has a semantic token with no primitive layer; Figma already has a fully-layered system | "The codebase uses a flat single-layer token model. The Figma file uses a primitive/semantic split. Should I match the Figma architecture or the code architecture?" |
498
+ | Figma variable exists but has `ALL_SCOPES` (incorrect per best practice) | "I found `color/bg/primary` already exists but it uses ALL_SCOPES. I recommend changing it to `FRAME_FILL, SHAPE_FILL`. May I update the scope?" |
499
+ | Code uses camelCase (`backgroundColor`), Figma uses slash-separated (`color/bg/default`) | "The codebase uses camelCase naming. The Figma file uses slash-separated hierarchy. For new variables, should I use slash-separated (Figma standard) and map via code syntax?" |
500
+
501
+ ### Code Wins
502
+
503
+ Default to code as the source of truth for:
504
+ - Hex values (code is the live production value)
505
+ - Token naming (the CSS variable names become code syntax)
506
+ - Mode values (light/dark split comes from code)
507
+
508
+ ### Figma Wins
509
+
510
+ Default to Figma as the source of truth for:
511
+ - Collection architecture (if a well-structured system already exists, extend it rather than replace it)
512
+ - Variable naming hierarchy (if designers are already using the system with specific names)
513
+ - Page structure (match the existing page organization pattern)
514
+
515
+ ### Neither: Negotiate
516
+
517
+ When neither is clearly correct, propose a resolution and ask:
518
+ > "I'd suggest [option]. This way both the code token name and the Figma naming convention are preserved. Does that work?"