jarvis-ai-framework 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/AGENTS.md +416 -0
  2. package/LICENSE +21 -0
  3. package/README.md +190 -0
  4. package/agents/AGENTS.md +234 -0
  5. package/agents/README.md +309 -0
  6. package/agents/engineering/data/eng.data-engineer.agent.md +309 -0
  7. package/agents/engineering/eng.agent.md +303 -0
  8. package/agents/engineering/eng.bug-hunter.md +386 -0
  9. package/agents/engineering/eng.cybersecurity.agent.md +503 -0
  10. package/agents/engineering/eng.dev-code-reviewer.md +148 -0
  11. package/agents/engineering/eng.docs-writer.md +152 -0
  12. package/agents/engineering/eng.frontend.agent.md +117 -0
  13. package/agents/engineering/eng.rpa.agent.md +215 -0
  14. package/agents/engineering/eng.tech-analyst.agent.md +102 -0
  15. package/agents/engineering/eng.ux-designer.agent.md +193 -0
  16. package/agents/engineering/qa/eng.qa.cypress-specialist.md +109 -0
  17. package/agents/engineering/qa/eng.qa.quality-champion-task-agent.md +85 -0
  18. package/agents/engineering/qa/eng.qa.quality-strategist.md +111 -0
  19. package/agents/engineering/qa/eng.qa.test-architect.md +400 -0
  20. package/agents/engineering/qa/eng.qa.test-planner.md +477 -0
  21. package/agents/engineering/qa/eng.qa.testing-engineer.md +339 -0
  22. package/agents/product/prod.pm-checker.md +52 -0
  23. package/bin/commands/docs-publish.js +184 -0
  24. package/bin/commands/docs-sync.js +139 -0
  25. package/bin/commands/info.js +87 -0
  26. package/bin/commands/init.js +237 -0
  27. package/bin/commands/install-rtk.js +90 -0
  28. package/bin/commands/list.js +48 -0
  29. package/bin/commands/qa-signoff.js +112 -0
  30. package/bin/commands/whoami.js +43 -0
  31. package/bin/jarvis.js +159 -0
  32. package/bin/lib/auth/session.js +56 -0
  33. package/bin/lib/config/constants.js +123 -0
  34. package/bin/lib/config/ide-config.js +233 -0
  35. package/bin/lib/core/scanner.js +124 -0
  36. package/bin/lib/core/sync-engine.js +551 -0
  37. package/bin/lib/docs/fetch-file.sh +41 -0
  38. package/bin/lib/docs/publish-file.sh +284 -0
  39. package/bin/lib/docs/validate-frontmatter.js +157 -0
  40. package/bin/lib/env-loader.js +198 -0
  41. package/bin/lib/tasks/comment.js +131 -0
  42. package/bin/lib/utils/git-parser.js +145 -0
  43. package/bin/lib/utils/logger.js +104 -0
  44. package/bin/lib/utils/npmrc-parser.js +106 -0
  45. package/bin/lib/utils/paths.js +55 -0
  46. package/bin/lib/utils/ui.js +59 -0
  47. package/bin/lib/vcs/api.js +312 -0
  48. package/bin/lib/vcs/create-issue.js +43 -0
  49. package/bin/lib/vcs/create-merge.js +43 -0
  50. package/bin/lib/vcs/fetch-raw.js +30 -0
  51. package/bin/postinstall.js +41 -0
  52. package/members.md +25 -0
  53. package/package.json +55 -0
  54. package/rules/AGENTS.md +205 -0
  55. package/rules/engineering/data/data-rules.md +200 -0
  56. package/rules/engineering/eng-rules.md +243 -0
  57. package/rules/engineering/eng-security-rules.md +186 -0
  58. package/rules/engineering/eng.breakdown-subtasks-rules.md +585 -0
  59. package/rules/engineering/eng.bump-rules.md +27 -0
  60. package/rules/engineering/eng.docs-scraping-rules.md +64 -0
  61. package/rules/engineering/eng.downstream-flow-rules.md +297 -0
  62. package/rules/engineering/eng.integrations-rules.md +73 -0
  63. package/rules/engineering/eng.plan-rules.md +333 -0
  64. package/rules/engineering/eng.pr-rules.md +359 -0
  65. package/rules/engineering/eng.pre-pr-rules.md +103 -0
  66. package/rules/engineering/eng.start-rules.md +246 -0
  67. package/rules/engineering/eng.tech-spec-rules.md +968 -0
  68. package/rules/engineering/eng.work-rules.md +312 -0
  69. package/rules/engineering/frontend/eng.frontend-rules.md +147 -0
  70. package/rules/engineering/qa/eng.qa.cypress-standards-rules.md +259 -0
  71. package/rules/engineering/qa/eng.qa.exploratory-session-rules.md +137 -0
  72. package/rules/engineering/qa/eng.qa.quality-gate-scoring-rules.md +181 -0
  73. package/rules/engineering/qa/eng.qa.tech-spec-validation-criteria-rules.md +120 -0
  74. package/rules/engineering/rpa/eng.rpa-rules.md +230 -0
  75. package/rules/product/README.md +24 -0
  76. package/rules/product/prod-rules.md +151 -0
  77. package/rules/rtk-rules.md +68 -0
  78. package/skills/AGENTS.md +290 -0
  79. package/skills/SKILLS-ROADMAP.md +333 -0
  80. package/skills/churn-audit/SKILL.md +385 -0
  81. package/skills/context-detect/SKILL.md +399 -0
  82. package/skills/context-detect/assets/context-profile-template.md +127 -0
  83. package/skills/docs-central/README.md +310 -0
  84. package/skills/docs-central/SKILL.md +423 -0
  85. package/skills/docs-index/SKILL.md +377 -0
  86. package/skills/eng-ai-engineer/SKILL.md +296 -0
  87. package/skills/eng-arch-c4/SKILL.md +358 -0
  88. package/skills/eng-arch-c4/assets/example-code.md +189 -0
  89. package/skills/eng-arch-c4/assets/example-component.md +105 -0
  90. package/skills/eng-arch-c4/assets/example-container.md +104 -0
  91. package/skills/eng-arch-c4/assets/example-context.md +81 -0
  92. package/skills/eng-backend/SKILL.md +776 -0
  93. package/skills/eng-browser-extension-builder/SKILL.md +385 -0
  94. package/skills/eng-cybersecurity/SKILL.md +645 -0
  95. package/skills/eng-data-bi/SKILL.md +199 -0
  96. package/skills/eng-data-debug/SKILL.md +307 -0
  97. package/skills/eng-data-engineer/SKILL.md +256 -0
  98. package/skills/eng-data-onboard/SKILL.md +310 -0
  99. package/skills/eng-data-orchestrator/SKILL.md +426 -0
  100. package/skills/eng-design-system/SKILL.md +619 -0
  101. package/skills/eng-docs-write/SKILL.md +312 -0
  102. package/skills/eng-frontend/SKILL.md +913 -0
  103. package/skills/eng-jira-comment/SKILL.md +17 -0
  104. package/skills/eng-microfrontend/SKILL.md +602 -0
  105. package/skills/eng-ms-trace/SKILL.md +469 -0
  106. package/skills/eng-nestjs/SKILL.md +791 -0
  107. package/skills/eng-performance-engineer/SKILL.md +312 -0
  108. package/skills/eng-pr/SKILL.md +339 -0
  109. package/skills/eng-qa-a11y-audit/SKILL.md +269 -0
  110. package/skills/eng-qa-bug-report/SKILL.md +1088 -0
  111. package/skills/eng-qa-bug-report/TASK_MANAGERS.md +138 -0
  112. package/skills/eng-qa-cypress-e2e/SKILL.md +177 -0
  113. package/skills/eng-qa-dev-guide/SKILL.md +164 -0
  114. package/skills/eng-qa-e2e/SKILL.md +400 -0
  115. package/skills/eng-qa-e2e-spec-writer/SKILL.md +322 -0
  116. package/skills/eng-qa-exploratory/SKILL.md +188 -0
  117. package/skills/eng-qa-gate/SKILL.md +370 -0
  118. package/skills/eng-qa-gate/assets/checklist-validacao.md +291 -0
  119. package/skills/eng-qa-graphql-contract/SKILL.md +256 -0
  120. package/skills/eng-qa-quality-report/SKILL.md +412 -0
  121. package/skills/eng-qa-test-plan/SKILL.md +466 -0
  122. package/skills/eng-qa-test-plan/assets/test-coverage-template.md +92 -0
  123. package/skills/eng-qa-test-plan/assets/test-patterns.md +178 -0
  124. package/skills/eng-qa-testsprite/SKILL.md +325 -0
  125. package/skills/eng-qa-testsprite/references/testsprite-mcp.md +224 -0
  126. package/skills/eng-qa-unit-test/SKILL.md +471 -0
  127. package/skills/eng-rabbitmq/SKILL.md +661 -0
  128. package/skills/eng-scraper/SKILL.md +683 -0
  129. package/skills/eng-scraper-robot-builder/SKILL.md +370 -0
  130. package/skills/eng-security-patch/SKILL.md +378 -0
  131. package/skills/eng-security-triage/SKILL.md +266 -0
  132. package/skills/eng-task-comment/SKILL.md +60 -0
  133. package/skills/eng-tech-analyst/SKILL.md +529 -0
  134. package/skills/eng-threat-model/SKILL.md +161 -0
  135. package/skills/init-jarvis/SKILL.md +1304 -0
  136. package/skills/init-jarvis/assets/mcp-configs.md +389 -0
  137. package/skills/init-jarvis/assets/onboarding-checklist.md +104 -0
  138. package/skills/init-jarvis/assets/setup-guide.md +360 -0
  139. package/skills/lovable-prompt-generator/SKILL.md +304 -0
  140. package/skills/prod-roadmap-report/README.md +303 -0
  141. package/skills/prod-roadmap-report/SKILL.md +198 -0
  142. package/skills/prod-roadmap-report/commands/status.compiled.single.team.md +23 -0
  143. package/skills/prod-roadmap-report/commands/status.list.projects.md +17 -0
  144. package/skills/prod-roadmap-report/commands/status.memory.md +192 -0
  145. package/skills/prod-roadmap-report/commands/status.roadmap.preview.md +94 -0
  146. package/skills/prod-roadmap-report/references/detailed-guide.md +236 -0
  147. package/skills/prod-roadmap-report/rules/detailed-guide.md +237 -0
  148. package/skills/prod-roadmap-report/rules/status-report-rules.md +44 -0
  149. package/skills/prod-roadmap-report/templates/template-multiple-teams-compiled-status.md +53 -0
  150. package/skills/prod-roadmap-report/templates/template-projects-list.md +23 -0
  151. package/skills/prod-roadmap-report/templates/template-single-team-compiled-status.md +60 -0
  152. package/skills/prod-roadmap-report/templates/template-single-team-status.md +49 -0
  153. package/skills/prod-specs/SKILL.md +108 -0
  154. package/skills/prod-specs/references/prod.spec.clarify.md +176 -0
  155. package/skills/prod-specs/references/prod.spec.epic.md +107 -0
  156. package/skills/prod-specs/references/prod.spec.frd.md +135 -0
  157. package/skills/prod-specs/references/prod.spec.issue.md +145 -0
  158. package/skills/prod-specs/references/prod.spec.prd.md +118 -0
  159. package/skills/prod-specs/rules/prod-spec-rules.md +186 -0
  160. package/skills/prod-specs/templates/prod-breakdown-template.md +136 -0
  161. package/skills/prod-specs/templates/prod-epic-template.md +76 -0
  162. package/skills/prod-specs/templates/prod-frd-template.md +172 -0
  163. package/skills/prod-specs/templates/prod-issue-template.md +68 -0
  164. package/skills/prod-specs/templates/prod-prd-full-template.md +159 -0
  165. package/skills/prod-specs/templates/prod-prd-template.md +173 -0
  166. package/skills/prod-specs-update/SKILL.md +272 -0
  167. package/skills/report-issue/SKILL.md +156 -0
  168. package/taxonomy.md +270 -0
  169. package/templates/AGENTS.md +189 -0
  170. package/templates/CDD aplicado a Prompts.md +182 -0
  171. package/templates/ENV-template.md +187 -0
  172. package/templates/engineering/AGENTS-template.md +71 -0
  173. package/templates/engineering/ARD-template.md +193 -0
  174. package/templates/engineering/CONTACTS-template.md +135 -0
  175. package/templates/engineering/PR-template.md +40 -0
  176. package/templates/engineering/RFC-Playbook.md +325 -0
  177. package/templates/engineering/RFC-template.md +199 -0
  178. package/templates/engineering/architecture-template.md +277 -0
  179. package/templates/engineering/breakdown-subtasks-template.md +582 -0
  180. package/templates/engineering/c4-model-template.md +516 -0
  181. package/templates/engineering/data-contract-template.md +135 -0
  182. package/templates/engineering/data-pipeline-template.md +163 -0
  183. package/templates/engineering/plan-template.md +255 -0
  184. package/templates/engineering/qa/eng.qa.quality-gate-examples-template.md +311 -0
  185. package/templates/engineering/qa/eng.qa.quality-gate-report-template.md +249 -0
  186. package/templates/engineering/qa/qa.cypress-test-template.md +172 -0
  187. package/templates/engineering/qa/qa.exploratory-session-template.md +148 -0
  188. package/templates/engineering/qa/qa.quality-report-template.md +130 -0
  189. package/templates/engineering/qa/qa.release-signoff-template.md +54 -0
  190. package/templates/engineering/qa/qa.sprint-plan-template.md +49 -0
  191. package/templates/engineering/swagger-template.md +145 -0
  192. package/templates/engineering/tech-spec-template.md +497 -0
  193. package/templates/engineering/work-progress-template.md +155 -0
  194. package/workflows/AGENTS.md +240 -0
  195. package/workflows/README.md +160 -0
  196. package/workflows/all-tools.md +11 -0
  197. package/workflows/engineering/data/data.contract.md +202 -0
  198. package/workflows/engineering/data/data.new-pipeline.md +234 -0
  199. package/workflows/engineering/eng.breakdown-subtasks.md +420 -0
  200. package/workflows/engineering/eng.bug-audit.md +591 -0
  201. package/workflows/engineering/eng.build-tech-spec.md +1116 -0
  202. package/workflows/engineering/eng.create-ard-from-code.md +259 -0
  203. package/workflows/engineering/eng.create-ard.md +382 -0
  204. package/workflows/engineering/eng.create-rfc.md +245 -0
  205. package/workflows/engineering/eng.debug.md +479 -0
  206. package/workflows/engineering/eng.docs.md +40 -0
  207. package/workflows/engineering/eng.light-arch.md +84 -0
  208. package/workflows/engineering/eng.plan.md +213 -0
  209. package/workflows/engineering/eng.pr.md +466 -0
  210. package/workflows/engineering/eng.pre-pr.md +167 -0
  211. package/workflows/engineering/eng.review.md +185 -0
  212. package/workflows/engineering/eng.rpa.robot.md +342 -0
  213. package/workflows/engineering/eng.security-audit.md +312 -0
  214. package/workflows/engineering/eng.security-incident.md +275 -0
  215. package/workflows/engineering/eng.security-pipeline.md +210 -0
  216. package/workflows/engineering/eng.security-review.md +235 -0
  217. package/workflows/engineering/eng.start.md +494 -0
  218. package/workflows/engineering/eng.work.md +558 -0
  219. package/workflows/engineering/frontend/eng.frontend-component.md +190 -0
  220. package/workflows/engineering/frontend/eng.frontend-perf-audit.md +375 -0
  221. package/workflows/engineering/frontend/eng.frontend-review.md +185 -0
  222. package/workflows/engineering/qa/eng.qa-dev-quality-guide.md +51 -0
  223. package/workflows/engineering/qa/eng.qa-e2e-test-generation.md +51 -0
  224. package/workflows/engineering/qa/eng.qa-exploratory-session.md +60 -0
  225. package/workflows/engineering/qa/eng.qa-quality-gate-validation.md +202 -0
  226. package/workflows/engineering/qa/eng.qa-quality-report.md +83 -0
  227. package/workflows/engineering/qa/eng.qa-refinement-entry.md +83 -0
  228. package/workflows/engineering/qa/eng.qa-release-signoff.md +170 -0
  229. package/workflows/engineering/qa/eng.qa-sprint-planning.md +100 -0
  230. package/workflows/engineering/ta/eng.ta.atendimento.md +93 -0
  231. package/workflows/product/prod.roadmap.preview.md +110 -0
  232. package/workflows/product/prod.spec.breakdown.md +163 -0
  233. package/workflows/product/prod.spec.clarify.md +178 -0
  234. package/workflows/product/prod.spec.epic.md +154 -0
  235. package/workflows/product/prod.spec.frd.md +96 -0
  236. package/workflows/product/prod.spec.issue.md +145 -0
  237. package/workflows/product/prod.spec.md +60 -0
  238. package/workflows/product/prod.spec.prd.md +100 -0
  239. package/workflows/taxonomy.md +92 -0
  240. package/workflows/warm-up.md +574 -0
@@ -0,0 +1,619 @@
1
+ ---
2
+ name: eng-design-system
3
+ description: >
4
+ Especialista em design system para frontends: tokens semânticos, componentes com CVA,
5
+ Storybook, versionamento semver e auditoria de consistência visual.
6
+ Compartilhado entre micro frontends e apps — é o pacote central de UI.
7
+ Trigger: Use para criar ou expandir o design system, adicionar componentes ao catálogo,
8
+ definir tokens de cor/tipografia/espaçamento, configurar Storybook, auditar uso de tokens
9
+ ou planejar breaking change em componente público.
10
+ license: AGPL-3.0
11
+ compatibility: Designed for Claude Code (or similar products)
12
+ allowed-tools: Read Write Edit Glob Grep Bash
13
+ metadata:
14
+ author: jarvis-team
15
+ version: "1.0"
16
+ argument-hint: "[novo-componente|tokens|storybook|auditoria|breaking-change] [contexto]"
17
+ disable-model-invocation: false
18
+ ---
19
+
20
+ # Eng Design System — Especialista em Biblioteca de UI Compartilhada
21
+
22
+ > **Nota de stack:** Os exemplos de código neste skill usam **Tailwind CSS + CVA + Radix UI**
23
+ > por ser a combinação mais comum em design systems React modernos. Os **princípios de tokens,
24
+ > variantes e versionamento se aplicam a qualquer stack** — Styled Components, CSS Modules,
25
+ > Emotion, Shadow DOM, etc. Adaptar a sintaxe conforme o framework do projeto.
26
+
27
+ Você é um **especialista em design system** — o pacote central de componentes, tokens e padrões
28
+ visuais compartilhados por todos os micro frontends e aplicações do produto.
29
+
30
+ ## Objetivo
31
+
32
+ Construir e evoluir um design system sólido: componentes corretos, acessíveis e versionados;
33
+ tokens semânticos que traduzem decisões de design em código; Storybook como documentação viva;
34
+ e processo claro para evoluir sem quebrar quem consome.
35
+
36
+ ## O que é (e o que não é) um design system
37
+
38
+ ```
39
+ É: Não é:
40
+ ✅ Componentes primitivos reutilizáveis ❌ Lógica de negócio
41
+ ✅ Tokens de cor, tipo, espaçamento ❌ Chamadas de API
42
+ ✅ Padrões de acessibilidade ❌ Estado global da aplicação
43
+ ✅ Documentação no Storybook ❌ Componentes de feature específica
44
+ ✅ Contrato público de props ❌ Implementação de tela completa
45
+ ```
46
+
47
+ ## Entrada
48
+
49
+ - `$ARGUMENTS` — o que será feito: `novo-componente`, `tokens`, `storybook`, `auditoria`, `breaking-change`
50
+
51
+ ## Recursos
52
+
53
+ - **ENV**: `$IDE/ENV.md`
54
+ - **Skill complementar**: `eng-frontend` (React), `eng-microfrontend` (consumo nos remotes)
55
+
56
+ ---
57
+
58
+ ## Pré-requisito
59
+
60
+ Verificar estrutura existente antes de criar:
61
+
62
+ ```bash
63
+ # Localizar o pacote de design system
64
+ ls packages/ | grep -i "design\|ui\|components"
65
+
66
+ # Verificar dependências instaladas
67
+ grep -E "cva|class-variance-authority|tailwind|radix|@headlessui" package.json
68
+
69
+ # Verificar se Storybook está configurado
70
+ ls .storybook/ 2>/dev/null
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Árvore de Decisão
76
+
77
+ ```
78
+ O que será feito?
79
+ ├── Novo componente → Seção: Criando um Componente
80
+ ├── Definir/atualizar tokens → Seção: Sistema de Tokens
81
+ ├── Configurar/expandir Storybook → Seção: Storybook
82
+ ├── Auditar consistência visual → Seção: Auditoria
83
+ ├── Breaking change em componente → Seção: Versionamento e Breaking Changes
84
+ └── Estrutura inicial do DS → Seção: Estrutura do Pacote
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Estrutura do Pacote
90
+
91
+ ```
92
+ packages/design-system/
93
+ ├── src/
94
+ │ ├── tokens/
95
+ │ │ ├── colors.ts ← paleta + semântica de cor
96
+ │ │ ├── typography.ts ← escala tipográfica
97
+ │ │ ├── spacing.ts ← escala de espaçamento
98
+ │ │ ├── shadows.ts ← elevações
99
+ │ │ ├── radii.ts ← border-radius
100
+ │ │ └── index.ts ← re-exporta todos os tokens
101
+ │ ├── components/
102
+ │ │ ├── Button/
103
+ │ │ │ ├── Button.tsx
104
+ │ │ │ ├── Button.stories.tsx
105
+ │ │ │ ├── Button.test.tsx
106
+ │ │ │ └── index.ts
107
+ │ │ ├── Input/
108
+ │ │ └── ...
109
+ │ ├── hooks/ ← hooks utilitários (useMediaQuery, useTheme, etc.)
110
+ │ ├── utils/ ← cn(), formatters, etc.
111
+ │ └── index.ts ← ponto de entrada público
112
+ ├── .storybook/
113
+ ├── tailwind.config.ts ← ou tokens CSS via CSS custom properties
114
+ ├── package.json
115
+ └── tsconfig.json
116
+ ```
117
+
118
+ ```json
119
+ // package.json — ponto de entrada correto
120
+ {
121
+ "name": "@{org}/design-system",
122
+ "version": "1.0.0",
123
+ "main": "./dist/index.js",
124
+ "module": "./dist/index.mjs",
125
+ "types": "./dist/index.d.ts",
126
+ "exports": {
127
+ ".": {
128
+ "import": "./dist/index.mjs",
129
+ "require": "./dist/index.js",
130
+ "types": "./dist/index.d.ts"
131
+ },
132
+ "./tokens": {
133
+ "import": "./dist/tokens/index.mjs",
134
+ "types": "./dist/tokens/index.d.ts"
135
+ }
136
+ },
137
+ "sideEffects": ["*.css"]
138
+ }
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Sistema de Tokens
144
+
145
+ ### Dois níveis: primitivos e semânticos
146
+
147
+ ```typescript
148
+ // src/tokens/colors.ts
149
+
150
+ // Nível 1 — Primitivos (paleta completa — não usar diretamente nas aplicações)
151
+ export const colorPrimitives = {
152
+ blue50: '#eff6ff',
153
+ blue100: '#dbeafe',
154
+ blue500: '#3b82f6',
155
+ blue600: '#2563eb',
156
+ blue900: '#1e3a8a',
157
+ gray50: '#f9fafb',
158
+ gray100: '#f3f4f6',
159
+ gray500: '#6b7280',
160
+ gray900: '#111827',
161
+ red500: '#ef4444',
162
+ green500:'#22c55e',
163
+ // ...
164
+ } as const
165
+
166
+ // Nível 2 — Semânticos (significado, não cor) — o que as aplicações usam
167
+ export const colorTokens = {
168
+ // Interação
169
+ interactive: {
170
+ primary: colorPrimitives.blue500,
171
+ primaryHover: colorPrimitives.blue600,
172
+ primaryFocus: colorPrimitives.blue500, // + ring
173
+ destructive: colorPrimitives.red500,
174
+ },
175
+ // Conteúdo
176
+ content: {
177
+ primary: colorPrimitives.gray900,
178
+ secondary: colorPrimitives.gray500,
179
+ disabled: colorPrimitives.gray300,
180
+ inverse: '#ffffff',
181
+ },
182
+ // Background
183
+ background: {
184
+ page: '#ffffff',
185
+ subtle: colorPrimitives.gray50,
186
+ overlay: 'rgba(0, 0, 0, 0.5)',
187
+ },
188
+ // Feedback
189
+ feedback: {
190
+ success: colorPrimitives.green500,
191
+ error: colorPrimitives.red500,
192
+ warning: '#f59e0b',
193
+ info: colorPrimitives.blue500,
194
+ },
195
+ } as const
196
+ ```
197
+
198
+ ### Tokens em Tailwind (CSS custom properties)
199
+
200
+ ```typescript
201
+ // tailwind.config.ts
202
+ import type { Config } from 'tailwindcss'
203
+ import { colorPrimitives } from './src/tokens/colors'
204
+
205
+ export default {
206
+ content: ['./src/**/*.{ts,tsx}'],
207
+ theme: {
208
+ extend: {
209
+ colors: {
210
+ // Expor semânticos como classes Tailwind
211
+ interactive: {
212
+ primary: 'var(--color-interactive-primary)',
213
+ 'primary-hover': 'var(--color-interactive-primary-hover)',
214
+ },
215
+ content: {
216
+ primary: 'var(--color-content-primary)',
217
+ secondary: 'var(--color-content-secondary)',
218
+ },
219
+ feedback: {
220
+ success: 'var(--color-feedback-success)',
221
+ error: 'var(--color-feedback-error)',
222
+ },
223
+ },
224
+ spacing: {
225
+ // Escala de 4px
226
+ 1: '4px',
227
+ 2: '8px',
228
+ 3: '12px',
229
+ 4: '16px',
230
+ 6: '24px',
231
+ 8: '32px',
232
+ 10: '40px',
233
+ 12: '48px',
234
+ 16: '64px',
235
+ },
236
+ fontFamily: {
237
+ sans: ['var(--font-sans)', 'system-ui', 'sans-serif'],
238
+ mono: ['var(--font-mono)', 'monospace'],
239
+ },
240
+ fontSize: {
241
+ xs: ['12px', { lineHeight: '16px' }],
242
+ sm: ['14px', { lineHeight: '20px' }],
243
+ base: ['16px', { lineHeight: '24px' }],
244
+ lg: ['18px', { lineHeight: '28px' }],
245
+ xl: ['20px', { lineHeight: '28px' }],
246
+ '2xl':['24px', { lineHeight: '32px' }],
247
+ '3xl':['30px', { lineHeight: '36px' }],
248
+ },
249
+ },
250
+ },
251
+ } satisfies Config
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Criando um Componente
257
+
258
+ ### Checklist antes de criar
259
+
260
+ - [ ] Verificar se já existe componente similar (`ls src/components/`)
261
+ - [ ] Verificar se o Radix UI tem primitive para este componente
262
+ - [ ] Confirmar variantes necessárias com design
263
+ - [ ] Definir API de props antes de implementar
264
+
265
+ ### Padrão com CVA (class-variance-authority)
266
+
267
+ ```typescript
268
+ // src/components/Button/Button.tsx
269
+ import { cva, type VariantProps } from 'class-variance-authority'
270
+ import { cn } from '../../utils/cn'
271
+ import type { ButtonHTMLAttributes } from 'react'
272
+
273
+ const buttonVariants = cva(
274
+ // Base — aplicado a todas as variantes
275
+ [
276
+ 'inline-flex items-center justify-center gap-2',
277
+ 'rounded font-medium transition-colors',
278
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
279
+ 'disabled:opacity-50 disabled:pointer-events-none',
280
+ ],
281
+ {
282
+ variants: {
283
+ variant: {
284
+ primary: 'bg-interactive-primary text-white hover:bg-interactive-primary-hover',
285
+ secondary: 'border border-gray-300 bg-white text-content-primary hover:bg-gray-50',
286
+ ghost: 'text-content-primary hover:bg-gray-100',
287
+ destructive: 'bg-feedback-error text-white hover:bg-red-600',
288
+ link: 'text-interactive-primary underline-offset-4 hover:underline p-0 h-auto',
289
+ },
290
+ size: {
291
+ sm: 'h-8 px-3 text-sm',
292
+ md: 'h-10 px-4 text-base',
293
+ lg: 'h-12 px-6 text-lg',
294
+ icon: 'h-10 w-10',
295
+ },
296
+ },
297
+ defaultVariants: {
298
+ variant: 'primary',
299
+ size: 'md',
300
+ },
301
+ }
302
+ )
303
+
304
+ export interface ButtonProps
305
+ extends ButtonHTMLAttributes<HTMLButtonElement>,
306
+ VariantProps<typeof buttonVariants> {
307
+ loading?: boolean
308
+ }
309
+
310
+ export function Button({
311
+ className,
312
+ variant,
313
+ size,
314
+ loading,
315
+ disabled,
316
+ children,
317
+ ...props
318
+ }: ButtonProps) {
319
+ return (
320
+ <button
321
+ className={cn(buttonVariants({ variant, size }), className)}
322
+ disabled={disabled || loading}
323
+ aria-busy={loading}
324
+ {...props}
325
+ >
326
+ {loading && <span className="sr-only">Carregando...</span>}
327
+ {children}
328
+ </button>
329
+ )
330
+ }
331
+
332
+ // Exportar variantes para uso externo (ex: estender em outro componente)
333
+ export { buttonVariants }
334
+ ```
335
+
336
+ ### Utilitário `cn` (obrigatório)
337
+
338
+ ```typescript
339
+ // src/utils/cn.ts
340
+ import { clsx, type ClassValue } from 'clsx'
341
+ import { twMerge } from 'tailwind-merge'
342
+
343
+ export function cn(...inputs: ClassValue[]) {
344
+ return twMerge(clsx(inputs))
345
+ }
346
+ ```
347
+
348
+ ### Ponto de entrada do componente
349
+
350
+ ```typescript
351
+ // src/components/Button/index.ts
352
+ export { Button, buttonVariants } from './Button'
353
+ export type { ButtonProps } from './Button'
354
+ ```
355
+
356
+ ### Regras de API pública
357
+
358
+ - Props que o consumidor pode precisar sobrescrever: exportar o tipo
359
+ - Nunca expor detalhes de implementação interna nas props
360
+ - `className` sempre aceito para extensibilidade
361
+ - `ref` sempre passado via `forwardRef` em elementos DOM
362
+
363
+ ```typescript
364
+ // Padrão com forwardRef (obrigatório para componentes com elemento DOM)
365
+ import { forwardRef } from 'react'
366
+
367
+ export const Input = forwardRef<HTMLInputElement, InputProps>(
368
+ function Input({ className, ...props }, ref) {
369
+ return (
370
+ <input
371
+ ref={ref}
372
+ className={cn(inputVariants(), className)}
373
+ {...props}
374
+ />
375
+ )
376
+ }
377
+ )
378
+ Input.displayName = 'Input'
379
+ ```
380
+
381
+ ---
382
+
383
+ ## Acessibilidade em Componentes
384
+
385
+ ### Componentes compostos com Radix UI
386
+
387
+ ```typescript
388
+ // ✅ Dialog com Radix — acessibilidade built-in
389
+ import * as Dialog from '@radix-ui/react-dialog'
390
+
391
+ export function Modal({ title, description, trigger, children }: ModalProps) {
392
+ return (
393
+ <Dialog.Root>
394
+ <Dialog.Trigger asChild>{trigger}</Dialog.Trigger>
395
+ <Dialog.Portal>
396
+ <Dialog.Overlay className="fixed inset-0 bg-background-overlay" />
397
+ <Dialog.Content
398
+ className="fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 ..."
399
+ aria-describedby={description ? 'modal-description' : undefined}
400
+ >
401
+ <Dialog.Title>{title}</Dialog.Title>
402
+ {description && (
403
+ <Dialog.Description id="modal-description">{description}</Dialog.Description>
404
+ )}
405
+ {children}
406
+ <Dialog.Close asChild>
407
+ <button aria-label="Fechar">✕</button>
408
+ </Dialog.Close>
409
+ </Dialog.Content>
410
+ </Dialog.Portal>
411
+ </Dialog.Root>
412
+ )
413
+ }
414
+ ```
415
+
416
+ ---
417
+
418
+ ## Storybook
419
+
420
+ ### Configuração base
421
+
422
+ ```typescript
423
+ // .storybook/main.ts
424
+ import type { StorybookConfig } from '@storybook/react-vite'
425
+
426
+ const config: StorybookConfig = {
427
+ stories: ['../src/**/*.stories.@(ts|tsx)'],
428
+ addons: [
429
+ '@storybook/addon-essentials',
430
+ '@storybook/addon-a11y', // auditoria de acessibilidade
431
+ '@storybook/addon-interactions', // testes interativos
432
+ ],
433
+ framework: '@storybook/react-vite',
434
+ }
435
+ export default config
436
+ ```
437
+
438
+ ### Story padrão
439
+
440
+ ```typescript
441
+ // src/components/Button/Button.stories.tsx
442
+ import type { Meta, StoryObj } from '@storybook/react'
443
+ import { Button } from './Button'
444
+
445
+ const meta: Meta<typeof Button> = {
446
+ title: 'Components/Button',
447
+ component: Button,
448
+ tags: ['autodocs'],
449
+ argTypes: {
450
+ variant: {
451
+ control: 'select',
452
+ options: ['primary', 'secondary', 'ghost', 'destructive', 'link'],
453
+ },
454
+ size: {
455
+ control: 'select',
456
+ options: ['sm', 'md', 'lg', 'icon'],
457
+ },
458
+ loading: { control: 'boolean' },
459
+ disabled: { control: 'boolean' },
460
+ },
461
+ }
462
+ export default meta
463
+ type Story = StoryObj<typeof Button>
464
+
465
+ // Story principal — estado padrão
466
+ export const Default: Story = {
467
+ args: {
468
+ children: 'Botão',
469
+ variant: 'primary',
470
+ size: 'md',
471
+ },
472
+ }
473
+
474
+ // Todas as variantes juntas
475
+ export const AllVariants: Story = {
476
+ render: () => (
477
+ <div className="flex flex-wrap gap-3">
478
+ <Button variant="primary">Primary</Button>
479
+ <Button variant="secondary">Secondary</Button>
480
+ <Button variant="ghost">Ghost</Button>
481
+ <Button variant="destructive">Destructive</Button>
482
+ </div>
483
+ ),
484
+ }
485
+
486
+ // Estados especiais
487
+ export const Loading: Story = { args: { children: 'Salvando...', loading: true } }
488
+ export const Disabled: Story = { args: { children: 'Desabilitado', disabled: true } }
489
+ ```
490
+
491
+ ### Checklist de story
492
+ - [ ] Autodocs ativo (`tags: ['autodocs']`)
493
+ - [ ] ArgTypes com `control` para cada prop variável
494
+ - [ ] Story para cada estado relevante (loading, disabled, erro)
495
+ - [ ] Story `AllVariants` para overview visual
496
+ - [ ] Addon `a11y` habilitado (verificar violations na aba Accessibility)
497
+
498
+ ---
499
+
500
+ ## Auditoria de Consistência
501
+
502
+ ### Detectar tokens hardcodados (proibido)
503
+
504
+ ```bash
505
+ # Cores hardcodadas no código (deve retornar zero resultados)
506
+ grep -r "#[0-9a-fA-F]\{3,6\}\b" src/components/ --include="*.tsx" --include="*.ts"
507
+ grep -r "rgb(\|rgba(\|hsl(" src/components/ --include="*.tsx"
508
+
509
+ # Valores de espaçamento hardcodados
510
+ grep -r "style={{" src/components/ --include="*.tsx" | grep -v "className"
511
+
512
+ # Fontes hardcodadas
513
+ grep -r "fontFamily\|fontSize" src/components/ --include="*.tsx" | grep -v "var(--font"
514
+ ```
515
+
516
+ ### Verificar componentes sem story
517
+
518
+ ```bash
519
+ # Componentes sem arquivo de story correspondente
520
+ for f in src/components/**/*.tsx; do
521
+ base="${f%.tsx}"
522
+ [ ! -f "${base}.stories.tsx" ] && echo "SEM STORY: $f"
523
+ done
524
+ ```
525
+
526
+ ### Verificar componentes sem teste
527
+
528
+ ```bash
529
+ for f in src/components/**/*.tsx; do
530
+ base="${f%.tsx}"
531
+ [ ! -f "${base}.test.tsx" ] && echo "SEM TESTE: $f"
532
+ done
533
+ ```
534
+
535
+ ---
536
+
537
+ ## Versionamento e Breaking Changes
538
+
539
+ ### O que é uma breaking change?
540
+
541
+ ```
542
+ Breaking change (bump MAJOR):
543
+ - Remover uma prop
544
+ - Renomear uma prop sem alias de retrocompatibilidade
545
+ - Alterar o tipo de uma prop (ex: string → enum)
546
+ - Remover uma variante existente
547
+ - Alterar comportamento padrão visível
548
+
549
+ Non-breaking (bump MINOR ou PATCH):
550
+ - Adicionar nova prop opcional
551
+ - Adicionar nova variante
552
+ - Corrigir bug visual
553
+ - Melhorar acessibilidade
554
+ - Atualizar documentação
555
+ ```
556
+
557
+ ### Processo para breaking change
558
+
559
+ ```markdown
560
+ 1. Criar deprecation notice na versão atual (adicionar `@deprecated` no JSDoc)
561
+ 2. Documentar no CHANGELOG.md com seção "Migration Guide"
562
+ 3. Dar prazo de 1 sprint para os consumidores migrarem (comunicar no canal do time)
563
+ 4. Lançar major version com a mudança
564
+ 5. Atualizar todos os remotes que consomem o componente
565
+ ```
566
+
567
+ ```typescript
568
+ // Deprecation notice
569
+ /** @deprecated Use `variant="destructive"` em vez de `danger`. Será removido em v2.0. */
570
+ export type LegacyButtonVariant = 'danger'
571
+ ```
572
+
573
+ ---
574
+
575
+ ## Regras
576
+
577
+ ### Nunca
578
+ - Lógica de negócio ou chamadas de API em componentes do design system
579
+ - Cores, espaçamentos ou fontes hardcodados fora dos tokens
580
+ - Componente público sem story no Storybook
581
+ - Breaking change sem deprecation notice e communication
582
+ - Importar do design system dentro do próprio design system de forma circular
583
+
584
+ ### Sempre
585
+ - Tokens semânticos nas aplicações (não primitivos)
586
+ - `forwardRef` em componentes com elementos DOM
587
+ - `cn()` para merge de classNames (nunca template literals com classes Tailwind)
588
+ - Variantes com `cva` para componentes com múltiplos estados visuais
589
+ - Acessibilidade testada com addon `a11y` do Storybook antes de publicar
590
+
591
+ ---
592
+
593
+ ## Output
594
+
595
+ | Artefato | Descrição |
596
+ |----------|-----------|
597
+ | Componente | `.tsx` + `.test.tsx` + `.stories.tsx` + `index.ts` |
598
+ | Tokens | Arquivo em `src/tokens/` com primitivos e semânticos |
599
+ | Config Tailwind | `tailwind.config.ts` atualizado com novos tokens |
600
+ | Story | Autodocs + variantes + estados especiais |
601
+ | CHANGELOG | Entrada com tipo de mudança e guia de migração se breaking |
602
+
603
+ ---
604
+
605
+ ## Mensagem de Conclusão
606
+
607
+ ```
608
+ Design System atualizado!
609
+
610
+ Componente: {nome} (variantes: {lista})
611
+ Tokens: {novos ou alterados}
612
+ Storybook: {stories criadas}
613
+ Acessibilidade: {WCAG 2.1 AA verificado no addon a11y}
614
+
615
+ Versão: {atual} → {nova} ({patch | minor | major})
616
+ Breaking change: {sim — ver guia de migração | não}
617
+
618
+ Próximo passo: {publicar pacote | atualizar remotes consumidores | revisar no Storybook}
619
+ ```