@maestro-ai/cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/README.md +59 -0
  2. package/content/guides/Cat/303/241logo de Stacks para Cloud Moderna.md" +119 -0
  3. package/content/guides/Cat/303/241logo de Stacks para Hospedagem Compartilhada.md" +147 -0
  4. package/content/guides/Checklist Mestre de Entrega.md +68 -0
  5. package/content/guides/Gates de Qualidade.md +209 -0
  6. package/content/guides/Guia de Adi/303/247/303/243o de Novas Funcionalidades.md" +355 -0
  7. package/content/guides/Guia de Chaos Engineering.md +267 -0
  8. package/content/guides/Guia de Debugging com IA.md +135 -0
  9. package/content/guides/Guia de Estrat/303/251gias de Cache.md" +352 -0
  10. package/content/guides/Guia de Migrations Zero-Downtime.md +311 -0
  11. package/content/guides/Guia de Multi-tenancy.md +368 -0
  12. package/content/guides/Guia de Otimiza/303/247/303/243o de Custos Cloud.md" +195 -0
  13. package/content/guides/Guia de Refatora/303/247/303/243o de C/303/263digo Legado com IA.md" +162 -0
  14. package/content/guides/Guia de SLOs e Error Budgets.md +315 -0
  15. package/content/guides/M/303/251tricas de Efici/303/252ncia do Desenvolvimento com IA.md" +93 -0
  16. package/content/guides/Rules base.md +90 -0
  17. package/content/prompts/README.md +203 -0
  18. package/content/prompts/acessibilidade/analise-acessibilidade.md +257 -0
  19. package/content/prompts/apis/design-api-rest.md +303 -0
  20. package/content/prompts/apis/idempotencia.md +254 -0
  21. package/content/prompts/apis/versionamento.md +313 -0
  22. package/content/prompts/arquitetura/arquitetura-c4-completo.md +190 -0
  23. package/content/prompts/arquitetura/clean-architecture.md +151 -0
  24. package/content/prompts/arquitetura/ddd-bounded-contexts.md +183 -0
  25. package/content/prompts/arquitetura/ddd-cqrs.md +176 -0
  26. package/content/prompts/arquitetura/modelo-dominio.md +207 -0
  27. package/content/prompts/arquitetura/multi-tenancy.md +235 -0
  28. package/content/prompts/database/migrations-zero-downtime.md +192 -0
  29. package/content/prompts/database/otimizacao-queries.md +296 -0
  30. package/content/prompts/desenvolvimento/code-review.md +301 -0
  31. package/content/prompts/desenvolvimento/gerar-servico.md +271 -0
  32. package/content/prompts/devops/docker-compose.md +336 -0
  33. package/content/prompts/devops/feature-flags.md +374 -0
  34. package/content/prompts/devops/kubernetes-deploy.md +460 -0
  35. package/content/prompts/devops/pipeline-cicd.md +358 -0
  36. package/content/prompts/devops/terraform-iac.md +502 -0
  37. package/content/prompts/escalabilidade/analise-performance.md +240 -0
  38. package/content/prompts/escalabilidade/analise-performance.txt +94 -0
  39. package/content/prompts/escalabilidade/caching.md +255 -0
  40. package/content/prompts/observabilidade/chaos-testing.md +237 -0
  41. package/content/prompts/observabilidade/estrategia-observabilidade.md +263 -0
  42. package/content/prompts/observabilidade/estrategia-observabilidade.txt +134 -0
  43. package/content/prompts/observabilidade/slos.md +215 -0
  44. package/content/prompts/produto/discovery-inicial.md +203 -0
  45. package/content/prompts/produto/discovery-inicial.txt +33 -0
  46. package/content/prompts/requisitos/refinar-requisitos.md +232 -0
  47. package/content/prompts/requisitos/refinar-requisitos.txt +40 -0
  48. package/content/prompts/seguranca/analise-seguranca.md +243 -0
  49. package/content/prompts/seguranca/pentest-checklist.md +333 -0
  50. package/content/prompts/seguranca/rate-limiting.md +356 -0
  51. package/content/prompts/seguranca/revisao-lgpd.md +227 -0
  52. package/content/prompts/seguranca/threat-modeling.md +224 -0
  53. package/content/prompts/testes/contract-testing.md +340 -0
  54. package/content/prompts/testes/gerar-testes-unitarios.md +474 -0
  55. package/content/prompts/testes/testes-e2e.md +460 -0
  56. package/content/prompts/testes/testes-integracao.md +418 -0
  57. package/content/prompts/testes/testes-performance.md +458 -0
  58. package/content/prompts/ux/gerar-ui-stitch.md +151 -0
  59. package/content/skills/api-patterns/SKILL.md +81 -0
  60. package/content/skills/api-patterns/api-style.md +42 -0
  61. package/content/skills/api-patterns/auth.md +24 -0
  62. package/content/skills/api-patterns/documentation.md +26 -0
  63. package/content/skills/api-patterns/graphql.md +41 -0
  64. package/content/skills/api-patterns/rate-limiting.md +31 -0
  65. package/content/skills/api-patterns/response.md +37 -0
  66. package/content/skills/api-patterns/rest.md +40 -0
  67. package/content/skills/api-patterns/scripts/api_validator.py +211 -0
  68. package/content/skills/api-patterns/security-testing.md +122 -0
  69. package/content/skills/api-patterns/trpc.md +41 -0
  70. package/content/skills/api-patterns/versioning.md +22 -0
  71. package/content/skills/app-builder/SKILL.md +75 -0
  72. package/content/skills/app-builder/agent-coordination.md +71 -0
  73. package/content/skills/app-builder/feature-building.md +53 -0
  74. package/content/skills/app-builder/project-detection.md +34 -0
  75. package/content/skills/app-builder/scaffolding.md +118 -0
  76. package/content/skills/app-builder/tech-stack.md +40 -0
  77. package/content/skills/app-builder/templates/SKILL.md +39 -0
  78. package/content/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  79. package/content/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  80. package/content/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  81. package/content/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  82. package/content/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  83. package/content/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  84. package/content/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  85. package/content/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
  86. package/content/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
  87. package/content/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
  88. package/content/skills/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
  89. package/content/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  90. package/content/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
  91. package/content/skills/architecture/SKILL.md +55 -0
  92. package/content/skills/architecture/context-discovery.md +43 -0
  93. package/content/skills/architecture/examples.md +94 -0
  94. package/content/skills/architecture/pattern-selection.md +68 -0
  95. package/content/skills/architecture/patterns-reference.md +50 -0
  96. package/content/skills/architecture/trade-off-analysis.md +77 -0
  97. package/content/skills/bash-linux/SKILL.md +199 -0
  98. package/content/skills/behavioral-modes/SKILL.md +242 -0
  99. package/content/skills/brainstorming/SKILL.md +163 -0
  100. package/content/skills/brainstorming/dynamic-questioning.md +350 -0
  101. package/content/skills/clean-code/SKILL.md +201 -0
  102. package/content/skills/code-review-checklist/SKILL.md +109 -0
  103. package/content/skills/database-design/SKILL.md +52 -0
  104. package/content/skills/database-design/database-selection.md +43 -0
  105. package/content/skills/database-design/indexing.md +39 -0
  106. package/content/skills/database-design/migrations.md +48 -0
  107. package/content/skills/database-design/optimization.md +36 -0
  108. package/content/skills/database-design/orm-selection.md +30 -0
  109. package/content/skills/database-design/schema-design.md +56 -0
  110. package/content/skills/database-design/scripts/schema_validator.py +172 -0
  111. package/content/skills/deployment-procedures/SKILL.md +241 -0
  112. package/content/skills/doc.md +177 -0
  113. package/content/skills/documentation-templates/SKILL.md +194 -0
  114. package/content/skills/frontend-design/SKILL.md +396 -0
  115. package/content/skills/frontend-design/animation-guide.md +331 -0
  116. package/content/skills/frontend-design/color-system.md +311 -0
  117. package/content/skills/frontend-design/decision-trees.md +418 -0
  118. package/content/skills/frontend-design/motion-graphics.md +306 -0
  119. package/content/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  120. package/content/skills/frontend-design/scripts/ux_audit.py +722 -0
  121. package/content/skills/frontend-design/typography-system.md +345 -0
  122. package/content/skills/frontend-design/ux-psychology.md +541 -0
  123. package/content/skills/frontend-design/visual-effects.md +383 -0
  124. package/content/skills/game-development/2d-games/SKILL.md +119 -0
  125. package/content/skills/game-development/3d-games/SKILL.md +135 -0
  126. package/content/skills/game-development/SKILL.md +167 -0
  127. package/content/skills/game-development/game-art/SKILL.md +185 -0
  128. package/content/skills/game-development/game-audio/SKILL.md +190 -0
  129. package/content/skills/game-development/game-design/SKILL.md +129 -0
  130. package/content/skills/game-development/mobile-games/SKILL.md +108 -0
  131. package/content/skills/game-development/multiplayer/SKILL.md +132 -0
  132. package/content/skills/game-development/pc-games/SKILL.md +144 -0
  133. package/content/skills/game-development/vr-ar/SKILL.md +123 -0
  134. package/content/skills/game-development/web-games/SKILL.md +150 -0
  135. package/content/skills/geo-fundamentals/SKILL.md +156 -0
  136. package/content/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
  137. package/content/skills/i18n-localization/SKILL.md +154 -0
  138. package/content/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  139. package/content/skills/intelligent-routing/SKILL.md +334 -0
  140. package/content/skills/lint-and-validate/SKILL.md +45 -0
  141. package/content/skills/lint-and-validate/scripts/lint_runner.py +172 -0
  142. package/content/skills/lint-and-validate/scripts/type_coverage.py +173 -0
  143. package/content/skills/mcp-builder/SKILL.md +176 -0
  144. package/content/skills/mobile-design/SKILL.md +394 -0
  145. package/content/skills/mobile-design/decision-trees.md +516 -0
  146. package/content/skills/mobile-design/mobile-backend.md +491 -0
  147. package/content/skills/mobile-design/mobile-color-system.md +420 -0
  148. package/content/skills/mobile-design/mobile-debugging.md +122 -0
  149. package/content/skills/mobile-design/mobile-design-thinking.md +357 -0
  150. package/content/skills/mobile-design/mobile-navigation.md +458 -0
  151. package/content/skills/mobile-design/mobile-performance.md +767 -0
  152. package/content/skills/mobile-design/mobile-testing.md +356 -0
  153. package/content/skills/mobile-design/mobile-typography.md +433 -0
  154. package/content/skills/mobile-design/platform-android.md +666 -0
  155. package/content/skills/mobile-design/platform-ios.md +561 -0
  156. package/content/skills/mobile-design/scripts/mobile_audit.py +670 -0
  157. package/content/skills/mobile-design/touch-psychology.md +537 -0
  158. package/content/skills/nextjs-best-practices/SKILL.md +203 -0
  159. package/content/skills/nodejs-best-practices/SKILL.md +333 -0
  160. package/content/skills/parallel-agents/SKILL.md +175 -0
  161. package/content/skills/performance-profiling/SKILL.md +143 -0
  162. package/content/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
  163. package/content/skills/plan-writing/SKILL.md +152 -0
  164. package/content/skills/powershell-windows/SKILL.md +167 -0
  165. package/content/skills/python-patterns/SKILL.md +441 -0
  166. package/content/skills/react-patterns/SKILL.md +198 -0
  167. package/content/skills/red-team-tactics/SKILL.md +199 -0
  168. package/content/skills/seo-fundamentals/SKILL.md +129 -0
  169. package/content/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
  170. package/content/skills/server-management/SKILL.md +161 -0
  171. package/content/skills/systematic-debugging/SKILL.md +109 -0
  172. package/content/skills/tailwind-patterns/SKILL.md +269 -0
  173. package/content/skills/tdd-workflow/SKILL.md +149 -0
  174. package/content/skills/testing-patterns/SKILL.md +178 -0
  175. package/content/skills/testing-patterns/scripts/test_runner.py +219 -0
  176. package/content/skills/vulnerability-scanner/SKILL.md +276 -0
  177. package/content/skills/vulnerability-scanner/checklists.md +121 -0
  178. package/content/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  179. package/content/skills/webapp-testing/SKILL.md +187 -0
  180. package/content/skills/webapp-testing/scripts/playwright_runner.py +173 -0
  181. package/content/specialists/Especialista em Acessibilidade.md +266 -0
  182. package/content/specialists/Especialista em An/303/241lise de Testes.md" +434 -0
  183. package/content/specialists/Especialista em Arquitetura Avan/303/247ada.md" +358 -0
  184. package/content/specialists/Especialista em Arquitetura de Software.md +177 -0
  185. package/content/specialists/Especialista em Banco de Dados.md +260 -0
  186. package/content/specialists/Especialista em Contrato de API.md +172 -0
  187. package/content/specialists/Especialista em Dados e Analytics com IA.md +246 -0
  188. package/content/specialists/Especialista em Debugging e Troubleshooting.md +191 -0
  189. package/content/specialists/Especialista em Desenvolvimento Frontend.md +477 -0
  190. package/content/specialists/Especialista em Desenvolvimento Mobile.md +241 -0
  191. package/content/specialists/Especialista em Desenvolvimento e Vibe Coding Estruturado.md +417 -0
  192. package/content/specialists/Especialista em DevOps e Infraestrutura.md +294 -0
  193. package/content/specialists/Especialista em Documenta/303/247/303/243o T/303/251cnica.md" +227 -0
  194. package/content/specialists/Especialista em Engenharia de Requisitos com IA.md +299 -0
  195. package/content/specialists/Especialista em Explora/303/247/303/243o de Codebase.md" +179 -0
  196. package/content/specialists/Especialista em Gest/303/243o de Produto.md" +179 -0
  197. package/content/specialists/Especialista em Migra/303/247/303/243o e Moderniza/303/247/303/243o.md" +410 -0
  198. package/content/specialists/Especialista em Modelagem e Arquitetura de Dom/303/255nio com IA.md" +248 -0
  199. package/content/specialists/Especialista em Observabilidade.md +415 -0
  200. package/content/specialists/Especialista em Performance e Escalabilidade.md +373 -0
  201. package/content/specialists/Especialista em Plano de Execu/303/247/303/243o com IA.md" +341 -0
  202. package/content/specialists/Especialista em Prototipagem R/303/241pida com Google Stitch.md" +419 -0
  203. package/content/specialists/Especialista em Seguran/303/247a da Informa/303/247/303/243o.md" +508 -0
  204. package/content/specialists/Especialista em UX Design.md +453 -0
  205. package/content/specialists/INDEX.md +43 -0
  206. package/content/templates/PRD.md +165 -0
  207. package/content/templates/README.md +65 -0
  208. package/content/templates/adr.md +103 -0
  209. package/content/templates/arquitetura.md +279 -0
  210. package/content/templates/backlog.md +185 -0
  211. package/content/templates/checklist-seguranca.md +180 -0
  212. package/content/templates/contexto.md +120 -0
  213. package/content/templates/criterios-aceite.md +99 -0
  214. package/content/templates/design-banco.md +270 -0
  215. package/content/templates/design-doc.md +240 -0
  216. package/content/templates/feature.md +88 -0
  217. package/content/templates/historia-backend.md +84 -0
  218. package/content/templates/historia-frontend.md +75 -0
  219. package/content/templates/historia-usuario.md +125 -0
  220. package/content/templates/mapa-navegacao.md +133 -0
  221. package/content/templates/matriz-rastreabilidade.md +121 -0
  222. package/content/templates/modelo-dominio.md +219 -0
  223. package/content/templates/plano-testes.md +199 -0
  224. package/content/templates/prototipo-stitch.md +138 -0
  225. package/content/templates/requisitos.md +162 -0
  226. package/content/templates/slo-sli.md +197 -0
  227. package/content/workflows/README-MCP.md +363 -0
  228. package/content/workflows/brainstorm.md +113 -0
  229. package/content/workflows/create.md +59 -0
  230. package/content/workflows/debug.md +103 -0
  231. package/content/workflows/deploy.md +176 -0
  232. package/content/workflows/enhance.md +63 -0
  233. package/content/workflows/mcp-debug.md +506 -0
  234. package/content/workflows/mcp-feature.md +385 -0
  235. package/content/workflows/mcp-gate.md +413 -0
  236. package/content/workflows/mcp-next.md +388 -0
  237. package/content/workflows/mcp-refactor.md +600 -0
  238. package/content/workflows/mcp-start.md +304 -0
  239. package/content/workflows/mcp-status.md +400 -0
  240. package/content/workflows/orchestrate.md +237 -0
  241. package/content/workflows/plan.md +89 -0
  242. package/content/workflows/preview.md +81 -0
  243. package/content/workflows/status.md +86 -0
  244. package/content/workflows/test.md +144 -0
  245. package/content/workflows/ui-ux-pro-max.md +296 -0
  246. package/dist/commands/init.d.ts +6 -0
  247. package/dist/commands/init.js +138 -0
  248. package/dist/commands/update.d.ts +5 -0
  249. package/dist/commands/update.js +50 -0
  250. package/dist/index.d.ts +2 -0
  251. package/dist/index.js +21 -0
  252. package/package.json +48 -0
@@ -0,0 +1,336 @@
1
+ # Prompt: Configuração Docker Compose
2
+
3
+ > **Quando usar**: Ao containerizar aplicação para desenvolvimento ou produção simples
4
+ > **Especialista**: [DevOps e Infraestrutura](../../02-especialistas/Especialista%20em%20DevOps%20e%20Infraestrutura.md)
5
+ > **Nível**: Simples a Médio
6
+
7
+ ---
8
+
9
+ ## Fluxo de Contexto
10
+
11
+ Antes de usar este prompt, tenha em mãos:
12
+ - `docs/CONTEXTO.md` - Entendimento do projeto
13
+ - `docs/05-arquitetura/arquitetura.md` - Stack e componentes
14
+
15
+ Após gerar, salve o resultado em:
16
+ - `docker-compose.yml` (raiz do projeto)
17
+ - `docker-compose.dev.yml` (override de desenvolvimento)
18
+ - `docker-compose.prod.yml` (override de produção)
19
+
20
+ ---
21
+
22
+ ## Prompt Completo
23
+
24
+ ```text
25
+ Atue como especialista em Docker e containerização.
26
+
27
+ ## Contexto do Projeto
28
+
29
+ [COLE O CONTEÚDO DE docs/CONTEXTO.md]
30
+
31
+ ## Stack Tecnológica
32
+
33
+ - Backend: [Framework/Linguagem]
34
+ - Frontend: [Framework]
35
+ - Banco de dados: [PostgreSQL/MySQL/MongoDB]
36
+ - Cache: [Redis/Memcached/Nenhum]
37
+ - Message broker: [RabbitMQ/Kafka/Nenhum]
38
+ - Outros serviços: [ElasticSearch, MinIO, etc]
39
+
40
+ ## Ambientes Necessários
41
+
42
+ - [ ] Desenvolvimento local
43
+ - [ ] Staging
44
+ - [ ] Produção
45
+
46
+ ## Requisitos Específicos
47
+
48
+ - Hot reload em desenvolvimento: [Sim/Não]
49
+ - Volumes persistentes: [quais dados]
50
+ - Variáveis de ambiente: [como gerenciar]
51
+ - Múltiplos serviços: [monolito/microsserviços]
52
+
53
+ ---
54
+
55
+ ## Sua Missão
56
+
57
+ Gere configuração Docker Compose completa:
58
+
59
+ ### 1. Dockerfiles
60
+
61
+ #### Backend
62
+ ```dockerfile
63
+ # Dockerfile para [linguagem]
64
+ # Multi-stage build para produção
65
+ # Stage 1: Build
66
+ FROM [base-image] AS builder
67
+ # ...
68
+
69
+ # Stage 2: Production
70
+ FROM [slim-image] AS production
71
+ # ...
72
+
73
+ # Stage 3: Development (opcional)
74
+ FROM builder AS development
75
+ # Hot reload setup
76
+ ```
77
+
78
+ Inclua:
79
+ - [ ] Multi-stage build
80
+ - [ ] Non-root user
81
+ - [ ] Healthcheck
82
+ - [ ] Otimização de layers
83
+ - [ ] .dockerignore
84
+
85
+ #### Frontend (se aplicável)
86
+ ```dockerfile
87
+ # Build estático ou SSR
88
+ ```
89
+
90
+ ### 2. Docker Compose Base
91
+
92
+ ```yaml
93
+ # docker-compose.yml
94
+ version: '3.8'
95
+
96
+ services:
97
+ backend:
98
+ build:
99
+ context: .
100
+ dockerfile: Dockerfile
101
+ target: production
102
+ ports:
103
+ - "3000:3000"
104
+ environment:
105
+ - NODE_ENV=production
106
+ depends_on:
107
+ db:
108
+ condition: service_healthy
109
+ healthcheck:
110
+ test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
111
+ interval: 30s
112
+ timeout: 10s
113
+ retries: 3
114
+ restart: unless-stopped
115
+
116
+ db:
117
+ image: postgres:15-alpine
118
+ volumes:
119
+ - postgres_data:/var/lib/postgresql/data
120
+ environment:
121
+ POSTGRES_DB: ${DB_NAME}
122
+ POSTGRES_USER: ${DB_USER}
123
+ POSTGRES_PASSWORD: ${DB_PASSWORD}
124
+ healthcheck:
125
+ test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
126
+ interval: 10s
127
+ timeout: 5s
128
+ retries: 5
129
+
130
+ volumes:
131
+ postgres_data:
132
+
133
+ networks:
134
+ default:
135
+ name: [project]-network
136
+ ```
137
+
138
+ ### 3. Override de Desenvolvimento
139
+
140
+ ```yaml
141
+ # docker-compose.dev.yml
142
+ version: '3.8'
143
+
144
+ services:
145
+ backend:
146
+ build:
147
+ target: development
148
+ volumes:
149
+ - .:/app
150
+ - /app/node_modules # Evita sobrescrever node_modules
151
+ environment:
152
+ - NODE_ENV=development
153
+ - DEBUG=*
154
+ ports:
155
+ - "9229:9229" # Debug port
156
+ command: npm run dev
157
+
158
+ # Serviços extras de desenvolvimento
159
+ mailhog:
160
+ image: mailhog/mailhog
161
+ ports:
162
+ - "1025:1025"
163
+ - "8025:8025"
164
+ ```
165
+
166
+ ### 4. Override de Produção
167
+
168
+ ```yaml
169
+ # docker-compose.prod.yml
170
+ version: '3.8'
171
+
172
+ services:
173
+ backend:
174
+ deploy:
175
+ replicas: 2
176
+ resources:
177
+ limits:
178
+ cpus: '0.5'
179
+ memory: 512M
180
+ logging:
181
+ driver: json-file
182
+ options:
183
+ max-size: "10m"
184
+ max-file: "3"
185
+
186
+ # Nginx como reverse proxy
187
+ nginx:
188
+ image: nginx:alpine
189
+ ports:
190
+ - "80:80"
191
+ - "443:443"
192
+ volumes:
193
+ - ./nginx.conf:/etc/nginx/nginx.conf:ro
194
+ - ./certs:/etc/nginx/certs:ro
195
+ depends_on:
196
+ - backend
197
+ ```
198
+
199
+ ### 5. Arquivo .env Template
200
+
201
+ ```env
202
+ # .env.example
203
+ # Copie para .env e preencha
204
+
205
+ # Database
206
+ DB_HOST=db
207
+ DB_PORT=5432
208
+ DB_NAME=myapp
209
+ DB_USER=myuser
210
+ DB_PASSWORD=changeme
211
+
212
+ # Application
213
+ APP_PORT=3000
214
+ APP_SECRET=generate-a-secure-secret
215
+ NODE_ENV=development
216
+
217
+ # Redis (se aplicável)
218
+ REDIS_URL=redis://redis:6379
219
+
220
+ # External services
221
+ SMTP_HOST=mailhog
222
+ SMTP_PORT=1025
223
+ ```
224
+
225
+ ### 6. Scripts de Conveniência
226
+
227
+ ```makefile
228
+ # Makefile
229
+ .PHONY: dev prod build logs
230
+
231
+ dev:
232
+ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build
233
+
234
+ prod:
235
+ docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build
236
+
237
+ build:
238
+ docker-compose build --no-cache
239
+
240
+ logs:
241
+ docker-compose logs -f
242
+
243
+ shell:
244
+ docker-compose exec backend sh
245
+
246
+ db-shell:
247
+ docker-compose exec db psql -U $${DB_USER} -d $${DB_NAME}
248
+
249
+ clean:
250
+ docker-compose down -v --remove-orphans
251
+ ```
252
+
253
+ ### 7. .dockerignore
254
+
255
+ ```
256
+ # .dockerignore
257
+ node_modules
258
+ npm-debug.log
259
+ .git
260
+ .env
261
+ .env.*
262
+ *.md
263
+ .vscode
264
+ .idea
265
+ coverage
266
+ dist
267
+ .next
268
+ ```
269
+
270
+ ### 8. Comandos Úteis
271
+
272
+ ```bash
273
+ # Desenvolvimento
274
+ docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build
275
+
276
+ # Produção
277
+ docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
278
+
279
+ # Ver logs
280
+ docker-compose logs -f [service]
281
+
282
+ # Rebuild específico
283
+ docker-compose build --no-cache [service]
284
+
285
+ # Shell no container
286
+ docker-compose exec [service] sh
287
+
288
+ # Limpar tudo
289
+ docker-compose down -v --remove-orphans
290
+ ```
291
+ ```
292
+
293
+ ---
294
+
295
+ ## Exemplo de Uso
296
+
297
+ ```text
298
+ Atue como especialista em Docker e containerização.
299
+
300
+ ## Contexto
301
+
302
+ API de e-commerce com NestJS.
303
+
304
+ ## Stack
305
+
306
+ - Backend: NestJS (Node 20)
307
+ - Banco: PostgreSQL 15
308
+ - Cache: Redis 7
309
+ - Queue: Bull (Redis-based)
310
+
311
+ ## Ambientes
312
+
313
+ - [x] Desenvolvimento local
314
+ - [x] Produção
315
+
316
+ ## Requisitos
317
+
318
+ - Hot reload com npm run start:dev
319
+ - Prisma como ORM
320
+ - Migrations automáticas em dev
321
+ ```
322
+
323
+ ---
324
+
325
+ ## Checklist Pós-Geração
326
+
327
+ - [ ] Dockerfile com multi-stage build
328
+ - [ ] docker-compose.yml base criado
329
+ - [ ] docker-compose.dev.yml com hot reload
330
+ - [ ] docker-compose.prod.yml com limites de recursos
331
+ - [ ] .env.example documentado
332
+ - [ ] .dockerignore configurado
333
+ - [ ] Healthchecks configurados
334
+ - [ ] Volumes para persistência
335
+ - [ ] Non-root user no container
336
+ - [ ] Makefile ou scripts de conveniência
@@ -0,0 +1,374 @@
1
+ # Prompt: Feature Flags
2
+
3
+ > **Prioridade**: 🟡 MÉDIA
4
+ > **Aplicável a**: Projetos com deploys frequentes, rollouts graduais, experimentação
5
+
6
+ ---
7
+
8
+ ## O que são Feature Flags?
9
+
10
+ Feature flags (ou feature toggles) permitem:
11
+ - **Rollout gradual** de features (1% → 10% → 50% → 100%)
12
+ - **Desligar features** rapidamente sem deploy
13
+ - **A/B testing** em produção
14
+ - **Trunk-based development** (merge código incompleto)
15
+ - **Kill switch** para features problemáticas
16
+
17
+ ---
18
+
19
+ ## Tipos de Feature Flags
20
+
21
+ | Tipo | Duração | Uso |
22
+ |------|---------|-----|
23
+ | **Release Flag** | Dias/semanas | Rollout gradual de nova feature |
24
+ | **Experiment Flag** | Semanas | A/B testing |
25
+ | **Ops Flag** | Permanente | Kill switches, manutenção |
26
+ | **Permission Flag** | Permanente | Features por tier/plano |
27
+
28
+ ---
29
+
30
+ ## Prompt Base: Implementar Feature Flags
31
+
32
+ ```text
33
+ Atue como engenheiro de software sênior.
34
+
35
+ Preciso implementar feature flags para:
36
+ - Stack: [ex. Node.js + React / Java + Spring]
37
+ - Escala: [ex. 10k DAU, 100 req/s]
38
+ - Use cases: [ex. rollout gradual, A/B testing, kill switches]
39
+
40
+ Ferramenta escolhida: [LaunchDarkly / Unleash / Flagsmith / Caseiro com Redis]
41
+
42
+ Gere uma implementação com:
43
+
44
+ 1. **Setup da Ferramenta**
45
+ - Instalação e configuração
46
+ - SDK client e server-side
47
+
48
+ 2. **Tipos de Flags**
49
+ - Boolean simples
50
+ - Percentage rollout
51
+ - User targeting (por ID, email, etc)
52
+ - Multivariate (A/B/C testing)
53
+
54
+ 3. **Código de Integração**
55
+ - Wrapper/service para acessar flags
56
+ - Uso em backend
57
+ - Uso em frontend
58
+ - Defaults seguros (fallback)
59
+
60
+ 4. **Boas Práticas**
61
+ - Naming convention
62
+ - Documentação de flags
63
+ - Lifecycle (criar → usar → remover)
64
+ - Limpeza de flags antigas
65
+
66
+ 5. **Observabilidade**
67
+ - Logs de qual variant foi servida
68
+ - Métricas por flag
69
+ - Alertas se flag falhar
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Prompt: Feature Flag Caseiro (Redis)
75
+
76
+ ```text
77
+ Não quero usar uma ferramenta externa para feature flags.
78
+ Preciso de uma solução simples com Redis.
79
+
80
+ Requisitos:
81
+ - Boolean flags
82
+ - Percentage rollout (0-100%)
83
+ - User targeting básico
84
+ - Admin UI simples para gerenciar
85
+
86
+ Stack: [DESCREVA]
87
+
88
+ Gere:
89
+ 1. Schema Redis para flags
90
+ 2. Service para avaliar flags
91
+ 3. API para CRUD de flags
92
+ 4. Middleware/HOC para usar em código
93
+ 5. Exemplo de uso em feature real
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Prompt: Migrar para Feature Flags
99
+
100
+ ```text
101
+ Tenho código com lógica condicional hardcoded:
102
+ [COLE CÓDIGO COM IFs PARA FEATURES]
103
+
104
+ Quero migrar para feature flags para:
105
+ - Controlar remotamente
106
+ - Fazer rollout gradual
107
+ - Ter fallback rápido
108
+
109
+ Refatore o código para:
110
+ 1. Usar feature flag service
111
+ 2. Manter defaults seguros
112
+ 3. Documentar a flag
113
+ 4. Incluir limpeza futura
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Exemplo: Feature Flag Service (TypeScript)
119
+
120
+ ```typescript
121
+ // src/services/featureFlags.ts
122
+ import Redis from 'ioredis';
123
+
124
+ interface Flag {
125
+ name: string;
126
+ enabled: boolean;
127
+ percentage?: number; // 0-100 para rollout
128
+ allowedUsers?: string[]; // targeting específico
129
+ allowedGroups?: string[]; // ex: 'beta-testers', 'employees'
130
+ variants?: Record<string, number>; // A/B testing: { 'control': 50, 'treatment': 50 }
131
+ }
132
+
133
+ interface EvaluationContext {
134
+ userId?: string;
135
+ email?: string;
136
+ groups?: string[];
137
+ attributes?: Record<string, any>;
138
+ }
139
+
140
+ class FeatureFlagService {
141
+ private redis: Redis;
142
+ private cache: Map<string, Flag> = new Map();
143
+ private cacheRefreshInterval = 30000; // 30 segundos
144
+
145
+ constructor(redis: Redis) {
146
+ this.redis = redis;
147
+ this.startCacheRefresh();
148
+ }
149
+
150
+ async isEnabled(flagName: string, context: EvaluationContext = {}): Promise<boolean> {
151
+ const flag = await this.getFlag(flagName);
152
+
153
+ if (!flag) return false; // Default: desligado se não existe
154
+ if (!flag.enabled) return false;
155
+
156
+ // User targeting
157
+ if (flag.allowedUsers?.includes(context.userId || '')) {
158
+ return true;
159
+ }
160
+
161
+ // Group targeting
162
+ if (flag.allowedGroups && context.groups) {
163
+ const hasGroup = flag.allowedGroups.some(g => context.groups!.includes(g));
164
+ if (hasGroup) return true;
165
+ }
166
+
167
+ // Percentage rollout
168
+ if (flag.percentage !== undefined) {
169
+ const hash = this.hashUser(context.userId || 'anonymous', flagName);
170
+ return hash < flag.percentage;
171
+ }
172
+
173
+ return true;
174
+ }
175
+
176
+ async getVariant(flagName: string, context: EvaluationContext = {}): Promise<string> {
177
+ const flag = await this.getFlag(flagName);
178
+
179
+ if (!flag || !flag.variants) return 'control';
180
+ if (!flag.enabled) return 'control';
181
+
182
+ const hash = this.hashUser(context.userId || 'anonymous', flagName);
183
+ let cumulative = 0;
184
+
185
+ for (const [variant, percentage] of Object.entries(flag.variants)) {
186
+ cumulative += percentage;
187
+ if (hash < cumulative) {
188
+ return variant;
189
+ }
190
+ }
191
+
192
+ return 'control';
193
+ }
194
+
195
+ private hashUser(userId: string, flagName: string): number {
196
+ // Hash determinístico para consistência
197
+ const str = `${userId}:${flagName}`;
198
+ let hash = 0;
199
+ for (let i = 0; i < str.length; i++) {
200
+ hash = ((hash << 5) - hash) + str.charCodeAt(i);
201
+ hash = hash & hash;
202
+ }
203
+ return Math.abs(hash) % 100;
204
+ }
205
+
206
+ private async getFlag(name: string): Promise<Flag | null> {
207
+ if (this.cache.has(name)) {
208
+ return this.cache.get(name)!;
209
+ }
210
+
211
+ const data = await this.redis.hget('feature_flags', name);
212
+ if (!data) return null;
213
+
214
+ const flag = JSON.parse(data) as Flag;
215
+ this.cache.set(name, flag);
216
+ return flag;
217
+ }
218
+
219
+ private startCacheRefresh() {
220
+ setInterval(async () => {
221
+ const flags = await this.redis.hgetall('feature_flags');
222
+ this.cache.clear();
223
+ for (const [name, data] of Object.entries(flags)) {
224
+ this.cache.set(name, JSON.parse(data));
225
+ }
226
+ }, this.cacheRefreshInterval);
227
+ }
228
+
229
+ // Admin methods
230
+ async createFlag(flag: Flag): Promise<void> {
231
+ await this.redis.hset('feature_flags', flag.name, JSON.stringify(flag));
232
+ }
233
+
234
+ async updateFlag(name: string, updates: Partial<Flag>): Promise<void> {
235
+ const existing = await this.getFlag(name);
236
+ if (!existing) throw new Error(`Flag ${name} not found`);
237
+
238
+ const updated = { ...existing, ...updates };
239
+ await this.redis.hset('feature_flags', name, JSON.stringify(updated));
240
+ this.cache.delete(name);
241
+ }
242
+
243
+ async deleteFlag(name: string): Promise<void> {
244
+ await this.redis.hdel('feature_flags', name);
245
+ this.cache.delete(name);
246
+ }
247
+
248
+ async listFlags(): Promise<Flag[]> {
249
+ const flags = await this.redis.hgetall('feature_flags');
250
+ return Object.values(flags).map(f => JSON.parse(f));
251
+ }
252
+ }
253
+
254
+ export const featureFlags = new FeatureFlagService(new Redis());
255
+ ```
256
+
257
+ ---
258
+
259
+ ## Uso no Código
260
+
261
+ ### Backend
262
+
263
+ ```typescript
264
+ // Em um controller
265
+ app.get('/api/checkout', async (req, res) => {
266
+ const userId = req.user.id;
267
+
268
+ const useNewCheckout = await featureFlags.isEnabled('new_checkout_flow', {
269
+ userId,
270
+ groups: req.user.groups
271
+ });
272
+
273
+ if (useNewCheckout) {
274
+ return handleNewCheckout(req, res);
275
+ }
276
+
277
+ return handleLegacyCheckout(req, res);
278
+ });
279
+ ```
280
+
281
+ ### Frontend (React)
282
+
283
+ ```typescript
284
+ // hooks/useFeatureFlag.ts
285
+ import { useEffect, useState } from 'react';
286
+
287
+ export function useFeatureFlag(flagName: string) {
288
+ const [enabled, setEnabled] = useState(false);
289
+ const [loading, setLoading] = useState(true);
290
+
291
+ useEffect(() => {
292
+ fetch(`/api/feature-flags/${flagName}`)
293
+ .then(res => res.json())
294
+ .then(data => {
295
+ setEnabled(data.enabled);
296
+ setLoading(false);
297
+ });
298
+ }, [flagName]);
299
+
300
+ return { enabled, loading };
301
+ }
302
+
303
+ // Uso no componente
304
+ function CheckoutButton() {
305
+ const { enabled: showNewButton, loading } = useFeatureFlag('new_checkout_button');
306
+
307
+ if (loading) return <Skeleton />;
308
+
309
+ return showNewButton ? <NewCheckoutButton /> : <LegacyCheckoutButton />;
310
+ }
311
+ ```
312
+
313
+ ---
314
+
315
+ ## Naming Convention
316
+
317
+ ```
318
+ {scope}_{feature}_{detail}
319
+
320
+ Exemplos:
321
+ - checkout_new_flow
322
+ - checkout_express_enabled
323
+ - payment_pix_enabled
324
+ - experiment_homepage_hero
325
+ - ops_maintenance_mode
326
+ - tier_premium_analytics
327
+ ```
328
+
329
+ ---
330
+
331
+ ## Lifecycle de uma Flag
332
+
333
+ ```mermaid
334
+ graph LR
335
+ A[Criar Flag] -->|disabled| B[Testar em Dev]
336
+ B -->|enabled + targeting| C[Beta Users]
337
+ C -->|percentage 10%| D[Rollout Gradual]
338
+ D -->|percentage 100%| E[GA]
339
+ E -->|remover condicionais| F[Cleanup]
340
+ F --> G[Deletar Flag]
341
+ ```
342
+
343
+ ---
344
+
345
+ ## Checklist
346
+
347
+ - [ ] Ferramenta/implementação escolhida
348
+ - [ ] SDK integrado no backend e frontend
349
+ - [ ] Defaults seguros (fallback se flag não existir)
350
+ - [ ] Naming convention definida
351
+ - [ ] Documentação de cada flag (propósito, owner, prazo)
352
+ - [ ] Processo de limpeza de flags antigas
353
+ - [ ] Logs de avaliação para debugging
354
+ - [ ] Alertas se serviço de flags falhar
355
+
356
+ ---
357
+
358
+ ## Ferramentas Populares
359
+
360
+ | Ferramenta | Tipo | Prós | Contras |
361
+ |------------|------|------|---------|
362
+ | **LaunchDarkly** | SaaS | Completo, robusto | Custo |
363
+ | **Unleash** | Open Source | Self-hosted, simples | Menos features |
364
+ | **Flagsmith** | Híbrido | Open core, UI boa | Algumas features pagas |
365
+ | **ConfigCat** | SaaS | Simples, barato | Menos targeting |
366
+ | **Caseiro (Redis)** | DIY | Controle total | Manutenção |
367
+
368
+ ---
369
+
370
+ ## Referências
371
+
372
+ - [Feature Toggles (Martin Fowler)](https://martinfowler.com/articles/feature-toggles.html)
373
+ - [LaunchDarkly Best Practices](https://launchdarkly.com/blog/best-practices-for-feature-flags/)
374
+ - [Unleash Documentation](https://docs.getunleash.io/)