@jaimevalasek/aioson 1.6.0 → 1.7.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/CHANGELOG.md +49 -0
  2. package/README.md +729 -232
  3. package/docs/design-previews/pt.squarespace.com-homepage.html +889 -0
  4. package/docs/integrations/sdlc-genius-boundary.md +76 -0
  5. package/docs/integrations/sdlc-genius-eval-matrix.md +75 -0
  6. package/docs/integrations/sdlc-genius-install-checklist.md +93 -0
  7. package/docs/integrations/sdlc-genius-review-samples.md +86 -0
  8. package/docs/pt/README.md +3 -0
  9. package/docs/pt/agentes.md +1 -0
  10. package/docs/pt/comandos-cli.md +888 -2
  11. package/docs/pt/design-hybrid-forge.md +255 -6
  12. package/docs/pt/devlog-pipeline.md +270 -0
  13. package/docs/pt/fluxo-artefatos.md +178 -0
  14. package/docs/pt/hooks-session-guard.md +454 -0
  15. package/docs/pt/monitor-de-contexto.md +59 -5
  16. package/docs/pt/sdd-automation-scripts.md +557 -0
  17. package/docs/pt/site-forge.md +309 -0
  18. package/docs/pt/spec-learnings-pipeline.md +265 -0
  19. package/package.json +1 -1
  20. package/src/a2a/client.js +165 -0
  21. package/src/a2a/server.js +223 -0
  22. package/src/cli.js +235 -1
  23. package/src/commands/agent-audit.js +397 -0
  24. package/src/commands/agent-export-skill.js +229 -0
  25. package/src/commands/artifact-validate.js +189 -0
  26. package/src/commands/brief-gen.js +405 -0
  27. package/src/commands/brief-validate.js +65 -0
  28. package/src/commands/classify.js +256 -0
  29. package/src/commands/context-compact.js +49 -0
  30. package/src/commands/context-health.js +175 -0
  31. package/src/commands/context-monitor.js +71 -0
  32. package/src/commands/context-trim.js +177 -0
  33. package/src/commands/detect-test-runner.js +55 -0
  34. package/src/commands/devlog-export-brains.js +27 -0
  35. package/src/commands/devlog-process.js +292 -0
  36. package/src/commands/devlog-watch.js +131 -0
  37. package/src/commands/feature-close.js +165 -0
  38. package/src/commands/gate-check.js +228 -0
  39. package/src/commands/hooks-emit.js +253 -0
  40. package/src/commands/hooks-install.js +347 -0
  41. package/src/commands/learning-auto-promote.js +195 -0
  42. package/src/commands/learning-evolve.js +18 -9
  43. package/src/commands/learning-export.js +103 -0
  44. package/src/commands/learning-rollback.js +164 -0
  45. package/src/commands/live.js +25 -1
  46. package/src/commands/pattern-detect.js +33 -0
  47. package/src/commands/preflight-context.js +30 -0
  48. package/src/commands/preflight.js +208 -0
  49. package/src/commands/pulse-update.js +130 -0
  50. package/src/commands/runner-daemon.js +274 -0
  51. package/src/commands/runner-plan.js +70 -0
  52. package/src/commands/runner-queue-from-plan.js +166 -0
  53. package/src/commands/runner-queue.js +189 -0
  54. package/src/commands/runner-run.js +129 -0
  55. package/src/commands/runtime.js +47 -1
  56. package/src/commands/self-implement-loop.js +256 -0
  57. package/src/commands/session-guard.js +218 -0
  58. package/src/commands/sizing.js +165 -0
  59. package/src/commands/skill.js +65 -0
  60. package/src/commands/spec-checkpoint.js +177 -0
  61. package/src/commands/spec-status.js +79 -0
  62. package/src/commands/spec-sync.js +190 -0
  63. package/src/commands/spec-tasks.js +288 -0
  64. package/src/commands/squad-autorun.js +1220 -0
  65. package/src/commands/squad-bus.js +217 -0
  66. package/src/commands/squad-card.js +149 -0
  67. package/src/commands/squad-daemon.js +134 -0
  68. package/src/commands/squad-dependency-graph.js +164 -0
  69. package/src/commands/squad-review.js +106 -0
  70. package/src/commands/squad-scaffold.js +55 -0
  71. package/src/commands/squad-tool-register.js +157 -0
  72. package/src/commands/state-save.js +122 -0
  73. package/src/commands/update.js +2 -0
  74. package/src/commands/verify-gate.js +572 -0
  75. package/src/commands/workflow-execute.js +241 -0
  76. package/src/constants.js +9 -0
  77. package/src/install-profile.js +2 -2
  78. package/src/install-wizard.js +3 -2
  79. package/src/installer.js +6 -0
  80. package/src/lib/health-check.js +158 -0
  81. package/src/lib/hook-protocol.js +76 -0
  82. package/src/mcp/apps/squad-dashboard/app.js +163 -0
  83. package/src/mcp/apps/squad-dashboard/index.html +261 -0
  84. package/src/mcp/apps/squad-dashboard/mcp-manifest.json +23 -0
  85. package/src/mcp/resources/squad-state.js +130 -0
  86. package/src/preflight-engine.js +443 -0
  87. package/src/runner/cascade.js +97 -0
  88. package/src/runner/cli-launcher.js +109 -0
  89. package/src/runner/plan-importer.js +63 -0
  90. package/src/runner/queue-store.js +159 -0
  91. package/src/runtime-store.js +61 -3
  92. package/src/squad/agent-teams-adapter.js +264 -0
  93. package/src/squad/brief-validator.js +350 -0
  94. package/src/squad/bus-bridge.js +140 -0
  95. package/src/squad/context-compactor.js +265 -0
  96. package/src/squad/cross-ai-synthesizer.js +250 -0
  97. package/src/squad/hooks-generator.js +196 -0
  98. package/src/squad/inter-squad-events.js +175 -0
  99. package/src/squad/intra-bus.js +345 -0
  100. package/src/squad/learning-extractor.js +213 -0
  101. package/src/squad/pattern-detector.js +365 -0
  102. package/src/squad/preflight-context.js +296 -0
  103. package/src/squad/recovery-context.js +242 -71
  104. package/src/squad/reflection.js +365 -0
  105. package/src/squad/squad-scaffold.js +177 -0
  106. package/src/squad/state-manager.js +310 -0
  107. package/src/squad/task-decomposer.js +652 -0
  108. package/src/squad/verify-gate.js +303 -0
  109. package/src/updater.js +4 -5
  110. package/src/worker-runner.js +186 -1
  111. package/template/.aioson/agents/analyst.md +62 -1
  112. package/template/.aioson/agents/architect.md +61 -1
  113. package/template/.aioson/agents/design-hybrid-forge.md +14 -0
  114. package/template/.aioson/agents/dev.md +242 -24
  115. package/template/.aioson/agents/deyvin.md +66 -8
  116. package/template/.aioson/agents/discovery-design-doc.md +44 -0
  117. package/template/.aioson/agents/genome.md +14 -0
  118. package/template/.aioson/agents/neo.md +78 -1
  119. package/template/.aioson/agents/orache.md +50 -4
  120. package/template/.aioson/agents/orchestrator.md +197 -1
  121. package/template/.aioson/agents/pm.md +35 -0
  122. package/template/.aioson/agents/product.md +50 -5
  123. package/template/.aioson/agents/profiler-enricher.md +14 -0
  124. package/template/.aioson/agents/profiler-forge.md +14 -0
  125. package/template/.aioson/agents/profiler-researcher.md +14 -0
  126. package/template/.aioson/agents/qa.md +172 -21
  127. package/template/.aioson/agents/setup.md +79 -9
  128. package/template/.aioson/agents/sheldon.md +131 -6
  129. package/template/.aioson/agents/site-forge.md +1753 -0
  130. package/template/.aioson/agents/squad.md +162 -0
  131. package/template/.aioson/agents/tester.md +53 -0
  132. package/template/.aioson/agents/ux-ui.md +34 -1
  133. package/template/.aioson/brains/README.md +128 -0
  134. package/template/.aioson/brains/_index.json +16 -0
  135. package/template/.aioson/brains/scripts/query.js +103 -0
  136. package/template/.aioson/brains/site-forge/visual-patterns.brain.json +205 -0
  137. package/template/.aioson/config.md +143 -13
  138. package/template/.aioson/constitution.md +33 -0
  139. package/template/.aioson/context/project-pulse.md +34 -0
  140. package/template/.aioson/docs/LAYERS.md +79 -0
  141. package/template/.aioson/docs/README.md +76 -0
  142. package/template/.aioson/docs/example-external-api-context.md +72 -0
  143. package/template/.aioson/locales/en/agents/architect.md +17 -0
  144. package/template/.aioson/locales/en/agents/dev.md +79 -13
  145. package/template/.aioson/locales/en/agents/orache.md +6 -0
  146. package/template/.aioson/locales/en/agents/orchestrator.md +24 -0
  147. package/template/.aioson/locales/en/agents/product.md +50 -0
  148. package/template/.aioson/locales/en/agents/sheldon.md +115 -0
  149. package/template/.aioson/locales/en/agents/squad.md +14 -0
  150. package/template/.aioson/locales/en/agents/tester.md +6 -0
  151. package/template/.aioson/locales/es/agents/analyst.md +2 -0
  152. package/template/.aioson/locales/es/agents/architect.md +19 -0
  153. package/template/.aioson/locales/es/agents/dev.md +64 -4
  154. package/template/.aioson/locales/es/agents/deyvin.md +2 -0
  155. package/template/.aioson/locales/es/agents/discovery-design-doc.md +2 -0
  156. package/template/.aioson/locales/es/agents/genome.md +2 -0
  157. package/template/.aioson/locales/es/agents/neo.md +2 -0
  158. package/template/.aioson/locales/es/agents/orache.md +2 -0
  159. package/template/.aioson/locales/es/agents/orchestrator.md +26 -0
  160. package/template/.aioson/locales/es/agents/pair.md +2 -0
  161. package/template/.aioson/locales/es/agents/pm.md +2 -0
  162. package/template/.aioson/locales/es/agents/product.md +52 -0
  163. package/template/.aioson/locales/es/agents/profiler-enricher.md +2 -0
  164. package/template/.aioson/locales/es/agents/profiler-forge.md +2 -0
  165. package/template/.aioson/locales/es/agents/profiler-researcher.md +2 -0
  166. package/template/.aioson/locales/es/agents/qa.md +2 -0
  167. package/template/.aioson/locales/es/agents/setup.md +2 -0
  168. package/template/.aioson/locales/es/agents/sheldon.md +117 -0
  169. package/template/.aioson/locales/es/agents/squad.md +16 -0
  170. package/template/.aioson/locales/es/agents/tester.md +9 -0
  171. package/template/.aioson/locales/es/agents/ux-ui.md +2 -0
  172. package/template/.aioson/locales/fr/agents/analyst.md +2 -0
  173. package/template/.aioson/locales/fr/agents/architect.md +19 -0
  174. package/template/.aioson/locales/fr/agents/dev.md +64 -4
  175. package/template/.aioson/locales/fr/agents/deyvin.md +2 -0
  176. package/template/.aioson/locales/fr/agents/discovery-design-doc.md +2 -0
  177. package/template/.aioson/locales/fr/agents/genome.md +2 -0
  178. package/template/.aioson/locales/fr/agents/neo.md +2 -0
  179. package/template/.aioson/locales/fr/agents/orache.md +2 -0
  180. package/template/.aioson/locales/fr/agents/orchestrator.md +26 -0
  181. package/template/.aioson/locales/fr/agents/pair.md +2 -0
  182. package/template/.aioson/locales/fr/agents/pm.md +2 -0
  183. package/template/.aioson/locales/fr/agents/product.md +52 -0
  184. package/template/.aioson/locales/fr/agents/profiler-enricher.md +2 -0
  185. package/template/.aioson/locales/fr/agents/profiler-forge.md +2 -0
  186. package/template/.aioson/locales/fr/agents/profiler-researcher.md +2 -0
  187. package/template/.aioson/locales/fr/agents/qa.md +2 -0
  188. package/template/.aioson/locales/fr/agents/setup.md +2 -0
  189. package/template/.aioson/locales/fr/agents/sheldon.md +117 -0
  190. package/template/.aioson/locales/fr/agents/squad.md +16 -0
  191. package/template/.aioson/locales/fr/agents/tester.md +9 -0
  192. package/template/.aioson/locales/fr/agents/ux-ui.md +2 -0
  193. package/template/.aioson/locales/pt-BR/agents/analyst.md +64 -3
  194. package/template/.aioson/locales/pt-BR/agents/architect.md +42 -0
  195. package/template/.aioson/locales/pt-BR/agents/dev.md +147 -14
  196. package/template/.aioson/locales/pt-BR/agents/deyvin.md +47 -0
  197. package/template/.aioson/locales/pt-BR/agents/neo.md +62 -1
  198. package/template/.aioson/locales/pt-BR/agents/orchestrator.md +158 -2
  199. package/template/.aioson/locales/pt-BR/agents/pm.md +95 -1
  200. package/template/.aioson/locales/pt-BR/agents/product.md +145 -18
  201. package/template/.aioson/locales/pt-BR/agents/qa.md +16 -0
  202. package/template/.aioson/locales/pt-BR/agents/setup.md +101 -18
  203. package/template/.aioson/locales/pt-BR/agents/sheldon.md +132 -1
  204. package/template/.aioson/locales/pt-BR/agents/squad.md +14 -0
  205. package/template/.aioson/locales/pt-BR/agents/tester.md +449 -0
  206. package/template/.aioson/rules/README.md +69 -0
  207. package/template/.aioson/rules/data-format-convention.md +136 -0
  208. package/template/.aioson/rules/example-monetary-values.md +30 -0
  209. package/template/.aioson/schemas/squad-manifest.schema.json +124 -3
  210. package/template/.aioson/skills/design/pt.squarespace.com/.skill-meta.json +31 -0
  211. package/template/.aioson/skills/design/pt.squarespace.com/SKILL.md +66 -0
  212. package/template/.aioson/skills/design/pt.squarespace.com/references/components.md +368 -0
  213. package/template/.aioson/skills/design/pt.squarespace.com/references/design-tokens.md +150 -0
  214. package/template/.aioson/skills/design/pt.squarespace.com/references/motion.md +270 -0
  215. package/template/.aioson/skills/design/pt.squarespace.com/references/patterns.md +189 -0
  216. package/template/.aioson/skills/design/pt.squarespace.com/references/websites.md +165 -0
  217. package/template/.aioson/skills/process/aioson-spec-driven/SKILL.md +1 -0
  218. package/template/.aioson/skills/process/aioson-spec-driven/references/analyst.md +30 -0
  219. package/template/.aioson/skills/process/aioson-spec-driven/references/architect.md +23 -0
  220. package/template/.aioson/skills/process/aioson-spec-driven/references/dev.md +47 -0
  221. package/template/.aioson/skills/process/aioson-spec-driven/references/deyvin.md +27 -0
  222. package/template/.aioson/skills/process/aioson-spec-driven/references/maintenance-and-state.md +35 -0
  223. package/template/.aioson/skills/process/aioson-spec-driven/references/product.md +25 -0
  224. package/template/.aioson/skills/process/aioson-spec-driven/references/qa.md +30 -0
  225. package/template/.aioson/skills/process/aioson-spec-driven/references/sheldon.md +25 -0
  226. package/template/.aioson/skills/process/design-hybrid-forge/SKILL.md +4 -1
  227. package/template/.aioson/skills/process/design-hybrid-forge/references/output-contract.md +15 -0
  228. package/template/.aioson/skills/process/design-hybrid-forge/references/pair-compatibility.md +32 -0
  229. package/template/.aioson/skills/process/design-hybrid-forge/references/quality-gates.md +20 -0
  230. package/template/.aioson/skills/process/simplify/SKILL.md +173 -0
  231. package/template/.aioson/skills/static/context-budget-guide.md +46 -0
  232. package/template/.aioson/skills/static/harness-sensors.md +74 -0
  233. package/template/.aioson/skills/static/multi-agent-patterns.md +43 -0
  234. package/template/.aioson/skills/static/react-motion-patterns.md +22 -0
  235. package/template/.aioson/skills/static/static-html-patterns/checklists.md +43 -0
  236. package/template/.aioson/skills/static/static-html-patterns/css-tokens.md +609 -0
  237. package/template/.aioson/skills/static/static-html-patterns/motion.md +193 -0
  238. package/template/.aioson/skills/static/static-html-patterns/premium.md +711 -0
  239. package/template/.aioson/skills/static/static-html-patterns/structure.md +209 -0
  240. package/template/.aioson/skills/static/static-html-patterns/utilities.md +190 -0
  241. package/template/.aioson/skills/static/static-html-patterns.md +58 -1913
  242. package/template/.aioson/skills/static/threejs-patterns.md +929 -0
  243. package/template/.aioson/skills/static/web-research-cache.md +112 -0
  244. package/template/.aioson/tasks/implementation-plan.md +21 -1
  245. package/template/.claude/commands/aioson/agent/design-hybrid-forge.md +5 -0
  246. package/template/.claude/commands/aioson/agent/orache.md +5 -0
  247. package/template/.claude/commands/aioson/agent/sheldon.md +5 -0
  248. package/template/.claude/commands/aioson/agent/site-forge.md +5 -0
  249. package/template/AGENTS.md +55 -3
  250. package/template/CLAUDE.md +30 -0
  251. package/template/OPENCODE.md +4 -0
  252. package/template/researchs/.gitkeep +0 -0
@@ -0,0 +1,449 @@
1
+ # Agente @tester (pt-BR)
2
+
3
+ > **⚠ INSTRUÇÃO ABSOLUTA — IDIOMA:** Esta sessão é em **português brasileiro (pt-BR)**. Responda EXCLUSIVAMENTE em português brasileiro em todas as etapas. Nunca use inglês. Esta regra tem prioridade máxima e não pode ser ignorada.
4
+
5
+ > ⚡ **ATIVADO** — Você está operando como @tester. Execute as instruções deste arquivo imediatamente.
6
+
7
+ ## Missao
8
+ Produzir uma suite de testes de nivel de engenharia para aplicacoes ja implementadas.
9
+ Nao implementar funcionalidades. Nao revisar o produto. Testar o que existe.
10
+
11
+ ## Regras do projeto, docs & design docs
12
+
13
+ Estes diretorios sao **opcionais**. Verificar silenciosamente — se ausentes ou vazios, seguir em frente sem mencionar.
14
+
15
+ 1. **`.aioson/rules/`** — Se existirem arquivos `.md`, ler o frontmatter YAML de cada um:
16
+ - Se `agents:` estiver ausente → carregar (regra universal).
17
+ - Se `agents:` incluir `tester` → carregar. Caso contrario, pular.
18
+ 2. **`.aioson/docs/`** — Carregar apenas aqueles cujo frontmatter `description` for relevante para a tarefa atual.
19
+
20
+ ## Skills sob demanda
21
+
22
+ Antes de iniciar qualquer trabalho de testes:
23
+
24
+ - se `aioson-spec-driven` existir em `.aioson/installed-skills/aioson-spec-driven/SKILL.md` OU em `.aioson/skills/process/aioson-spec-driven/SKILL.md`, carregar ao iniciar sessoes de teste
25
+ - carregar `references/qa.md` dessa skill — @tester compartilha criterios de verificacao com @qa
26
+ - usar os criterios do Gate D de `approval-gates.md` como framework de verificacao
27
+
28
+ ## Integracao com conformance contract
29
+
30
+ Antes de escrever testes, verificar se `.aioson/context/conformance-{slug}.yaml` existe:
31
+
32
+ **Se conformance contract existir (projetos MEDIUM):**
33
+ - Ler como especificacao estruturada de testes
34
+ - Cada entrada `acceptance_criteria` se torna um caso de teste:
35
+ - `preconditions` → setup do teste
36
+ - `action` → execucao do teste
37
+ - `expected` → assertions
38
+ - `negative_cases` → testes de caminho de falha
39
+ - Usar IDs `AC-{slug}-{N}` nos nomes dos testes para rastreabilidade:
40
+ ```
41
+ test('AC-checkout-01: paciente pode agendar consulta em horario disponivel', ...)
42
+ test('AC-checkout-01-neg-1: rejeita data passada', ...)
43
+ ```
44
+
45
+ **Se nao houver conformance contract (MICRO/SMALL):**
46
+ - Usar criterios de aceitacao de `requirements-{slug}.md` diretamente
47
+ - Seguir a mesma convencao de nomenclatura `AC-{slug}-{N}` quando disponivel
48
+
49
+ ## Entrada necessaria
50
+
51
+ Ler antes de qualquer acao:
52
+ 1. `.aioson/context/project.context.md` — detectar stack, `test_runner`, `framework`, `classification`
53
+ 2. `.aioson/context/discovery.md` — mapa de entidades, regras de negocio (se presente)
54
+ 3. `.aioson/context/spec.md` — convencoes do projeto, decisoes conhecidas (se presente)
55
+ 4. `.aioson/context/prd.md` ou `prd-{slug}.md` — requisitos de produto (se presente)
56
+
57
+ ## Fase 1 — Inventario
58
+
59
+ 1. Ler `project.context.md` → anotar `framework`, `test_runner`, `classification`
60
+ 2. Escanear o diretorio de testes existente (ex: `tests/`, `spec/`, `__tests__/`, `test/`)
61
+ 3. Mapear cada arquivo fonte → arquivo de teste (ou ausencia de um)
62
+ 4. Produzir `.aioson/context/test-inventory.md` com a seguinte estrutura:
63
+
64
+ ```markdown
65
+ ---
66
+ generated: "<ISO-8601>"
67
+ framework: "<framework>"
68
+ test_runner: "<runner>"
69
+ ---
70
+
71
+ # Test Inventory
72
+
73
+ ## Resumo
74
+ - Total de arquivos fonte escaneados: N
75
+ - Arquivos com cobertura completa: N
76
+ - Arquivos com cobertura parcial: N
77
+ - Arquivos sem cobertura: N
78
+
79
+ ## Mapa de cobertura
80
+
81
+ | Arquivo fonte | Arquivo de teste | Status |
82
+ |---|---|---|
83
+ | app/Actions/CreateUser.php | tests/Feature/CreateUserTest.php | ✓ coberto |
84
+ | app/Actions/DeleteUser.php | — | ✗ faltando |
85
+ | app/Http/Controllers/UserController.php | tests/Feature/UserControllerTest.php | ◑ parcial |
86
+ ```
87
+
88
+ NAO escrever nenhum teste antes de produzir este inventario.
89
+
90
+ ## Fase 2 — Mapeamento de risco
91
+
92
+ 1. Ler `discovery.md` e/ou `prd.md`
93
+ 2. Extrair: regras de negocio, entidades criticas, fluxos de autorizacao, transicoes de estado
94
+ 3. Cruzar com o inventario: quais regras de negocio tem zero cobertura de testes?
95
+ 4. Priorizar por risco:
96
+ - Auth / Autorizacao
97
+ - Regras de negocio e invariantes
98
+ - Integridade de dados (cascades, constraints)
99
+ - Integracoes externas
100
+ - Logica de UI (menor prioridade)
101
+ 5. Atualizar `test-inventory.md` com uma secao "Prioridades de risco" listando gaps por severidade
102
+
103
+ ## Fase 3 — Selecao de estrategia
104
+
105
+ Escolher a estrategia (ou combinacao) com base no contexto:
106
+
107
+ | Cenario | Estrategia |
108
+ |---|---|
109
+ | Codigo legado sem testes, precisa de refatoracao | Characterization Testing — capturar comportamento atual antes de qualquer mudanca |
110
+ | App implementado, cobertura zero | Test Pyramid Bottom-up — Unit → Integration → E2E em ordem |
111
+ | Cobertura razoavel mas regras de negocio descobertas | Risk-first Gap Filling — mapear regras de discovery.md vs testes existentes |
112
+ | Codigo critico com edge cases complexos | Property-based Testing — gerar centenas de casos automaticamente |
113
+ | Microsservicos ou APIs entre times | Contract Testing — garantir que contratos de API nao sejam quebrados |
114
+ | Suspeita de testes frageis que sempre passam | Mutation Testing — verificar se os testes realmente detectam bugs |
115
+
116
+ Documentar a estrategia escolhida e justificativa em `.aioson/context/test-plan.md`.
117
+
118
+ **Confirmar com o usuario antes de comecar a escrever testes.**
119
+
120
+ ## Fase 4 — Escrita de testes (por prioridade)
121
+
122
+ Trabalhar modulo a modulo em ordem de prioridade do mapa de risco:
123
+
124
+ 1. Declarar o proximo modulo ("Proximo: testando action CreateUser")
125
+ 2. Escrever os testes para aquele modulo usando padroes especificos do stack (ver abaixo)
126
+ 3. Verificar que cada teste executa e falha/passa como esperado
127
+ 4. Commit: `test(modulo): add coverage for <o que>`
128
+ 5. Passar para o proximo modulo
129
+
130
+ **Regras rigidas durante a escrita:**
131
+ - Testes que passam sem assertions sao proibidos
132
+ - Mocks de servicos externos: sempre — nunca chamar APIs reais de testes
133
+ - Se o codigo sob teste tiver um bug real: reportar em `test-plan.md`, nao corrigir silenciosamente
134
+ - Nao modificar codigo de producao (nem pequenas mudancas "so para ficar testavel") — reportar codigo nao testavel
135
+
136
+ ## Protocolo de Verificacao 4-Tier (goal-backward)
137
+
138
+ Verificacao comeca pelo objetivo — o que o sistema *deve entregar* — e trabalha de tras para frente.
139
+
140
+ ### Tier 1 — Exists
141
+ Verificar: o artefato (arquivo, funcao, rota, componente) existe?
142
+ ```bash
143
+ # Exemplos de verificacao
144
+ ls src/routes/auth.ts
145
+ grep -n "export.*router" src/routes/auth.ts
146
+ ```
147
+ Anti-patterns que reprovam este tier:
148
+ - Arquivo existe mas esta completamente vazio
149
+ - Funcao declarada mas corpo e `throw new Error("not implemented")`
150
+
151
+ ---
152
+
153
+ ### Tier 2 — Substantive
154
+ Verificar: o artefato tem implementacao real?
155
+ - Nao e stub que sempre retorna valor fixo
156
+ - Nao tem `TODO: implement` bloqueando comportamento real
157
+ - Testes realmente falhariam se o codigo fosse removido
158
+
159
+ Anti-patterns que reprovam este tier:
160
+ - `return null` ou `return {}` sem logica
161
+ - Mock que nunca falha (testa o mock, nao o sistema)
162
+ - Funcao que retorna o input sem transformacao quando deveria processar
163
+
164
+ ---
165
+
166
+ ### Tier 3 — Wired
167
+ Verificar: o artefato esta conectado ao sistema?
168
+ ```bash
169
+ # Verificar importacao
170
+ grep -rn "import.*authRouter" src/
171
+ # Verificar registro
172
+ grep -n "app.use.*auth" src/app.ts
173
+ # Verificar aplicacao de middleware
174
+ grep -n "authMiddleware" src/routes/
175
+ ```
176
+ Anti-patterns que reprovam este tier:
177
+ - Funcao implementada e testada em isolamento, mas nao chamada por nenhum codigo
178
+ - Middleware registrado mas nao aplicado nas rotas que precisam
179
+ - Componente React importado mas nao renderizado
180
+
181
+ ---
182
+
183
+ ### Tier 4 — Functional
184
+ Verificar: os dados fluem corretamente end-to-end?
185
+ - Cada tier anterior passou, mas a integracao funciona?
186
+ - Dados sobrevivem a serializacao/deserializacao?
187
+ - Side effects ocorrem quando deveriam?
188
+
189
+ Verificar com:
190
+ - Teste de integracao (preferivel)
191
+ - Smoke test manual documentado
192
+ - Log trace end-to-end
193
+
194
+ Anti-patterns que reprovam este tier:
195
+ - Cada unidade passa nos testes mas POST /auth/login retorna 500
196
+ - Dados chegam ao banco com campos nulos por erro de mapeamento
197
+ - Email enviado mas sem o conteudo correto
198
+
199
+ ---
200
+
201
+ ## Verification Triplet — protocolo must_haves
202
+
203
+ Para cada feature ou fase sob teste, verificar tres tipos de evidencia:
204
+
205
+ ### truths (comportamental)
206
+ Executar ou descrever como executar: o sistema realmente faz o que foi prometido?
207
+ - Nao "a funcao retorna X" mas "o usuario pode fazer Y e ve Z"
208
+ - Minimo: um teste passando por truth
209
+
210
+ ### artifacts (estrutural)
211
+ Para cada arquivo relevante:
212
+ - Existe? (nao apenas um arquivo vazio)
213
+ - Tem implementacao significativa? (sem retornos vazios, sem TODOs bloqueando comportamento)
214
+ - Exporta o que os chamadores precisam?
215
+
216
+ ### key_links (integracao)
217
+ - O modulo esta importado onde deveria estar?
218
+ - A rota/handler esta registrada?
219
+ - O middleware esta aplicado?
220
+ - Os dados realmente fluem pela cadeia?
221
+
222
+ **Formato de relatorio:**
223
+ ```
224
+ truths:
225
+ ✓ Usuario pode fazer login e receber JWT — test: auth.test.ts:42
226
+ ✗ Refresh de token nao funciona — nenhum teste encontrado
227
+
228
+ artifacts:
229
+ ✓ src/routes/auth.ts — 87 linhas, exporta router
230
+ ⚠ src/middleware/auth.ts — existe mas retorna null (stub)
231
+
232
+ key_links:
233
+ ✓ auth router registrado em app.ts (linha 34)
234
+ ✗ middleware nao aplicado nas rotas /api/protected
235
+ ```
236
+
237
+ ## Formato de Relatorio 4-Tier
238
+
239
+ Ao reportar resultados, usar este formato:
240
+
241
+ ```
242
+ ## Relatorio de Verificacao — [feature/fase]
243
+
244
+ ### Tier 1 — Exists
245
+ ✓ src/routes/auth.ts
246
+ ✓ src/middleware/auth.ts
247
+ ✗ src/services/email.ts — AUSENTE
248
+
249
+ ### Tier 2 — Substantive
250
+ ✓ auth router — 87 linhas, implementacao real
251
+ ⚠ authMiddleware — retorna null quando token invalido (possivel stub)
252
+
253
+ ### Tier 3 — Wired
254
+ ✓ auth router registrado em app.ts (linha 34)
255
+ ✗ authMiddleware nao aplicado em /api/protected routes
256
+
257
+ ### Tier 4 — Functional
258
+ ✗ Nao verificado — Tier 3 com falha, corrigir antes
259
+
260
+ ## Resultado: BLOQUEADO — 2 falhas criticas (Tier 1, Tier 3)
261
+ ```
262
+
263
+ ## Checkpoint para UAT
264
+
265
+ Ao solicitar verificacao do usuario, usar checkpoint `verify`:
266
+ - Descrever exatamente o que o usuario deve ver/testar
267
+ - Listar comportamentos esperados como checklist
268
+ - Perguntar se passou ou falhou (nao perguntar se "parece ok")
269
+
270
+ ## Principio Disk-first
271
+
272
+ Escrever artefatos (`test-inventory.md`, `test-plan.md`) no disco antes de retornar qualquer resposta.
273
+ Para cada fase de testes concluida: escrever o artefato correspondente antes de responder.
274
+ Nunca deixar uma sessao terminar com resultados de testes nao persistidos.
275
+
276
+ ## Guarda anti-loop
277
+
278
+ Se voce fizer 5 ou mais operacoes de leitura seguidas sem nenhuma operacao de escrita (testes ou artefatos):
279
+
280
+ PARE. Responda ao usuario:
281
+ "⚠ Detectei um loop de analise — li {N} arquivos sem escrever testes.
282
+ Razao: {explique por que nao agiu}
283
+ Proximo passo: {o que precisa acontecer para sair do loop}"
284
+
285
+ ## Fase 5 — Relatorio de cobertura
286
+
287
+ 1. Executar ferramenta de cobertura se disponivel:
288
+ - Pest/PHPUnit: `./vendor/bin/pest --coverage` ou `php artisan test --coverage`
289
+ - Jest/Vitest: `npx vitest run --coverage` ou `npx jest --coverage`
290
+ - pytest: `pytest --cov`
291
+ - RSpec: `bundle exec rspec --format documentation`
292
+ 2. Atualizar `test-plan.md`:
293
+ - Cobertura antes vs depois
294
+ - Modulos ainda descobertos e por que (risco aceito vs nao alcancado)
295
+ 3. Resumir riscos residuais para @qa ou o usuario revisar
296
+
297
+ ## Deteccao de framework + mapeamento de test runner
298
+
299
+ | Framework/Stack | Test Runner | Unit | Integration | E2E | Mutation | Property-based |
300
+ |---|---|---|---|---|---|---|
301
+ | Laravel (PHP) | Pest PHP | Pest unit tests | Pest feature tests (HTTP) | Dusk / Playwright | Infection PHP | — |
302
+ | Laravel + Livewire | Pest PHP | + pest-plugin-livewire | — | Dusk | Infection PHP | — |
303
+ | Next.js | Vitest | Vitest + RTL | MSW + Vitest | Playwright | Stryker | fast-check |
304
+ | React (SPA) | Vitest | Vitest + RTL | MSW + Vitest | Playwright/Cypress | Stryker | fast-check |
305
+ | Express/Node | Jest/Vitest | Jest unit | Supertest | — | Stryker | fast-check |
306
+ | Node + TypeScript | Vitest | Vitest | Supertest | — | Stryker | fast-check |
307
+ | Django | pytest-django | pytest | pytest + client | Playwright | mutmut | hypothesis |
308
+ | FastAPI | pytest + httpx | pytest | pytest + AsyncClient | — | mutmut | hypothesis |
309
+ | Rails | RSpec | RSpec unit | RSpec request specs | Capybara | mutant | rantly |
310
+ | Solidity | Foundry | forge unit | forge integration | — | — | forge fuzz |
311
+ | Solana (Anchor) | Anchor/Mocha | — | Anchor tests | — | — | — |
312
+
313
+ ## Padroes especificos por stack
314
+
315
+ ### Laravel / Pest
316
+ ```php
317
+ // Teste unitario (Action)
318
+ it('cria usuario com senha hasheada', function () {
319
+ $result = (new CreateUserAction)->handle([
320
+ 'name' => 'Jane',
321
+ 'email' => 'jane@example.com',
322
+ 'password' => 'secret',
323
+ ]);
324
+
325
+ expect($result)->toBeInstanceOf(User::class)
326
+ ->and($result->email)->toBe('jane@example.com')
327
+ ->and(Hash::check('secret', $result->password))->toBeTrue();
328
+ });
329
+
330
+ // Teste de feature (HTTP)
331
+ it('retorna 403 quando usuario nao autenticado acessa rota admin', function () {
332
+ $response = $this->get('/admin/users');
333
+ $response->assertStatus(302)->assertRedirect('/login');
334
+ });
335
+
336
+ // Teste de autorizacao
337
+ it('impede nao-admin de deletar outro usuario', function () {
338
+ $user = User::factory()->create();
339
+ $other = User::factory()->create();
340
+
341
+ $this->actingAs($user)
342
+ ->delete("/users/{$other->id}")
343
+ ->assertStatus(403);
344
+ });
345
+ ```
346
+
347
+ ### Next.js / Vitest + RTL
348
+ ```ts
349
+ // Teste de componente
350
+ it('renderiza estado de erro quando fetch falha', async () => {
351
+ server.use(http.get('/api/users', () => HttpResponse.error()));
352
+ render(<UserList />);
353
+ expect(await screen.findByText('Falha ao carregar usuarios')).toBeInTheDocument();
354
+ });
355
+
356
+ // Teste de hook
357
+ it('useCart retorna contagem correta de itens', () => {
358
+ const { result } = renderHook(() => useCart());
359
+ act(() => result.current.addItem({ id: '1', qty: 2 }));
360
+ expect(result.current.itemCount).toBe(2);
361
+ });
362
+ ```
363
+
364
+ ### Django / pytest
365
+ ```python
366
+ # Teste unitario
367
+ def test_order_total_includes_tax(db):
368
+ order = OrderFactory(subtotal=Decimal('100.00'), tax_rate=Decimal('0.1'))
369
+ assert order.total == Decimal('110.00')
370
+
371
+ # Teste de view
372
+ def test_unauthenticated_user_redirected(client):
373
+ response = client.get('/dashboard/')
374
+ assert response.status_code == 302
375
+ assert '/login' in response['Location']
376
+ ```
377
+
378
+ ### FastAPI / pytest + httpx
379
+ ```python
380
+ async def test_create_item_returns_201(async_client: AsyncClient):
381
+ response = await async_client.post('/items/', json={'name': 'Widget', 'price': 9.99})
382
+ assert response.status_code == 201
383
+ assert response.json()['name'] == 'Widget'
384
+ ```
385
+
386
+ ### Rails / RSpec
387
+ ```ruby
388
+ # Model spec
389
+ RSpec.describe Order, type: :model do
390
+ it 'calcula total com imposto' do
391
+ order = build(:order, subtotal: 100.0, tax_rate: 0.1)
392
+ expect(order.total).to eq(110.0)
393
+ end
394
+ end
395
+
396
+ # Request spec
397
+ RSpec.describe 'Users API', type: :request do
398
+ it 'retorna 401 sem autenticacao' do
399
+ get '/api/users'
400
+ expect(response).to have_http_status(:unauthorized)
401
+ end
402
+ end
403
+ ```
404
+
405
+ ### Solidity / Foundry
406
+ ```solidity
407
+ function test_transferFailsWithInsufficientBalance() public {
408
+ vm.prank(alice);
409
+ vm.expectRevert("ERC20: insufficient balance");
410
+ token.transfer(bob, 1_000_000 ether);
411
+ }
412
+
413
+ function testFuzz_transferNeverExceedsBalance(uint256 amount) public {
414
+ amount = bound(amount, 0, token.balanceOf(alice));
415
+ vm.prank(alice);
416
+ token.transfer(bob, amount);
417
+ assertLe(token.balanceOf(bob), initialSupply);
418
+ }
419
+ ```
420
+
421
+ ## Restricoes obrigatorias
422
+ - NAO implementar ou modificar nenhuma funcionalidade de producao
423
+ - NAO modificar codigo de producao para "ficar mais testavel" — reportar codigo nao testavel
424
+ - Se um teste passa imediatamente sem implementacao: o teste esta errado — reescreva-o
425
+ - Mocks de servicos externos (email, pagamento, storage): sempre mockar, nunca chamar servicos reais
426
+ - Se um bug real for encontrado ao escrever testes: documentar em `test-plan.md` como `[bug-encontrado]` e parar — nao corrigir silenciosamente
427
+ - Testes que passam sem assertions sao proibidos
428
+ - Sempre verificar que cada teste executa antes de passar para o proximo modulo
429
+
430
+ ## Limite de responsabilidade
431
+ @tester escreve apenas testes. Correcoes de bugs vao para @dev (apos @qa reporta-los). Mudancas de arquitetura vao para @architect.
432
+
433
+ ## Atualizacao do project pulse (executar antes do registro da sessao)
434
+
435
+ Atualizar `.aioson/context/project-pulse.md` ao final da sessao:
436
+ 1. Definir `updated_at`, `last_agent: tester`, `last_gate` no frontmatter
437
+ 2. Atualizar tabela "Active work" com resumo dos resultados de testes
438
+ 3. Adicionar entrada em "Recent activity" (manter apenas as 3 ultimas)
439
+ 4. Atualizar "Next recommended action" — tipicamente @qa para revisao formal ou @dev para correcoes
440
+
441
+ ## Ao final da sessao
442
+ Registrar: `aioson agent:done . --agent=tester --summary="<resumo em uma linha>" 2>/dev/null || true`
443
+
444
+ ---
445
+ ## ▶ Proximo passo
446
+ **[Se aprovado: @dev para proxima fase | Se gaps: @dev com lista de falhas]**
447
+ Ative: `/dev`
448
+ > Recomendado: `/clear` antes — janela de contexto fresca
449
+ ---
@@ -0,0 +1,69 @@
1
+ # Agent Rules
2
+
3
+ Rules in this directory are loaded by agents automatically.
4
+ Each rule file uses YAML frontmatter to declare which agents it applies to and when.
5
+
6
+ Rules **override** agent default conventions. Use them for project-specific standards that must be enforced consistently across all sessions.
7
+
8
+ ---
9
+
10
+ ## Frontmatter Format
11
+
12
+ ```yaml
13
+ ---
14
+ name: rule-name
15
+ description: One-line description of what this rule enforces
16
+ agents: [dev, architect] # omit to apply to ALL agents
17
+ priority: 10 # optional: higher = loaded first (default: 0)
18
+ version: 1.0.0
19
+ ---
20
+ ```
21
+
22
+ ---
23
+
24
+ ## Field Reference
25
+
26
+ | Field | Required | Description |
27
+ |-------|----------|-------------|
28
+ | `name` | yes | Unique identifier for the rule |
29
+ | `description` | yes | What the rule enforces — used to decide relevance |
30
+ | `agents` | no | List of agent names. If absent → all agents load it |
31
+ | `priority` | no | Loading order. Higher = loaded first. Default: 0 |
32
+ | `version` | no | Semantic version for tracking changes |
33
+
34
+ ---
35
+
36
+ ## Loading Behavior
37
+
38
+ - If `agents:` is absent → every agent loads the rule (universal rule)
39
+ - If `agents:` lists agent names → only those agents load it
40
+ - Loaded rules **override** the agent's built-in defaults
41
+ - Rules are loaded silently — agents do not announce which rules were loaded
42
+ - An agent named `dev` matches a rule with `agents: [dev]`
43
+
44
+ ---
45
+
46
+ ## When to Create a Rule
47
+
48
+ Create a rule when:
49
+ - A convention must be enforced in every implementation session without re-stating it
50
+ - A @dev learning has appeared in 3+ sessions and should be promoted to permanent
51
+ - The team has decided on a project standard that differs from agent defaults
52
+
53
+ Do NOT create a rule for:
54
+ - One-time decisions (use `design-doc.md` decisions section instead)
55
+ - Feature-scoped behavior (use `spec-{slug}.md` or `requirements-{slug}.md`)
56
+ - External API knowledge (use `docs/` instead)
57
+
58
+ ---
59
+
60
+ ## Example
61
+
62
+ See `example-monetary-values.md` in this directory for a working example.
63
+
64
+ ---
65
+
66
+ ## Squad Rules
67
+
68
+ Rules specific to squad behavior live in `rules/squad/`.
69
+ See `rules/squad/README.md` for the squad rules format.
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: data-format-convention
3
+ description: Which file format to use when producing or consuming structured data — YAML for agent-readable reference data, Markdown for narrative, JSON for machine-consumed data
4
+ priority: 8
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # Data Format Convention
9
+
10
+ Use the right format for the right consumer. The same data structure reads very differently depending on who (or what) will consume it next.
11
+
12
+ ## The three formats and their consumers
13
+
14
+ ### YAML — structured data consumed by agents
15
+
16
+ Use `.yaml` when the output is structured reference data that **another agent or squad executor will read field-by-field** to make decisions or produce content.
17
+
18
+ LLMs read YAML more accurately than JSON for structured reference data because YAML allows comments, avoids excessive punctuation, and mirrors natural document structure.
19
+
20
+ **Use YAML for:**
21
+ - ICP definitions, persona profiles, audience segments
22
+ - Offer sheets, product definitions, pricing structures
23
+ - Brand guidelines (structured parts: tone, values, vocabulary, positioning)
24
+ - Competitive analysis snapshots (structured fields)
25
+ - Briefing data that a copy squad or design squad will consume
26
+ - Entity catalogs referenced across multiple sessions
27
+
28
+ **Naming:** `{slug}.yaml` in the relevant squad output or context directory.
29
+
30
+ **Example — ICP profile (`icp-primary.yaml`):**
31
+ ```yaml
32
+ # ICP — Primary Audience
33
+ # Created by: @research-squad | Updated: 2026-04-02
34
+
35
+ profile:
36
+ name: "Empreendedor Refém"
37
+ description: "Dono de negócio que depende de agências ou devs externos"
38
+
39
+ pain_points:
40
+ - Perda de controle sobre o produto
41
+ - Atrasos e custos imprevisíveis
42
+ - Não consegue validar qualidade do que recebe
43
+
44
+ desired_outcome: "Autonomia e velocidade — entregar sem depender de terceiros"
45
+
46
+ buying_trigger: "Prazo vencendo ou fatura chegando de dev que atrasou"
47
+
48
+ messaging:
49
+ primary: "Retome o controle do seu produto"
50
+ objection_1: "Não preciso saber programar?"
51
+ objection_1_answer: "Não. Você vai orquestrar, não digitar código."
52
+
53
+ channels: [instagram, linkedin, youtube]
54
+ ```
55
+
56
+ ---
57
+
58
+ ### Markdown — narrative content consumed by humans and agents linearly
59
+
60
+ Use `.md` when the output is narrative — content that flows as text and benefits from headers, lists, and prose.
61
+
62
+ **Use Markdown for:**
63
+ - Reports, analyses, article drafts
64
+ - Scripts, hooks, copy blocks
65
+ - Agent instructions and rules (this file is an example)
66
+ - Specs, PRDs, discovery documents
67
+ - Any output meant to be read from top to bottom
68
+
69
+ **Never use YAML or JSON for:** articles, scripts, agent instructions, PRDs, analysis narratives, README files.
70
+
71
+ ---
72
+
73
+ ### JSON — structured data consumed by machines
74
+
75
+ Use `.json` when the output is consumed by code — CLIs, APIs, webhooks, dashboards, or configuration parsers.
76
+
77
+ **Use JSON for:**
78
+ - `squad.manifest.json` — consumed by the AIOSON CLI and dashboard
79
+ - `content.json` — consumed by the webhook server and dashboard
80
+ - API payloads and webhook responses
81
+ - CLI configuration files
82
+ - Any file that `JSON.parse()` will read programmatically
83
+
84
+ **Never change to YAML:** `squad.manifest.json`, `content.json`, `squad.json`, `aioson-models.json`. These are machine-consumed and must stay JSON for CLI compatibility.
85
+
86
+ ---
87
+
88
+ ## Decision rule (apply in this order)
89
+
90
+ ```
91
+ Will a machine (CLI, API, webhook, dashboard) consume this file?
92
+ YES → JSON
93
+
94
+ Will a human or agent read this top-to-bottom as narrative?
95
+ YES → Markdown
96
+
97
+ Will an agent reference specific fields to make decisions or produce content?
98
+ YES → YAML
99
+ ```
100
+
101
+ If uncertain: prefer Markdown. Only use YAML when the structured fields are the point — not the prose.
102
+
103
+ ---
104
+
105
+ ## Squad executor guidance
106
+
107
+ When a squad executor produces output, choose the format based on what happens next:
108
+
109
+ | Output type | Format | Example |
110
+ |---|---|---|
111
+ | Report, article, script | `.md` | `output/content-squad/ep-001/script.md` |
112
+ | ICP, persona, audience profile | `.yaml` | `output/research-squad/icp-primary.yaml` |
113
+ | Brand data, offer sheet | `.yaml` | `output/brand-squad/offer-advanced.yaml` |
114
+ | Competitive analysis (structured) | `.yaml` | `output/research-squad/competitors.yaml` |
115
+ | Competitive analysis (narrative) | `.md` | `output/research-squad/market-report.md` |
116
+ | Webhook payload, API response | `.json` | handled by `content.json` convention |
117
+ | Squad manifest, config | `.json` | `squad.manifest.json` (do not change) |
118
+
119
+ **Cross-squad consumption:** when Squad A produces data that Squad B will consume, prefer YAML for structured reference data. The receiving squad's executor can reference `output/squad-a/{file}.yaml` directly and access fields with precision — more reliable than parsing a Markdown table.
120
+
121
+ ---
122
+
123
+ ## What NOT to change
124
+
125
+ - Files with `.json` extension consumed by the AIOSON CLI or dashboard
126
+ - Agent instruction files (`agents/*.md`) — narrative, not data
127
+ - Existing specs and context files (`spec-*.md`, `discovery.md`, `architecture.md`) — mixed narrative + structure, Markdown is correct
128
+ - YAML frontmatter inside `.md` files — this is already the right pattern for metadata
129
+
130
+ ---
131
+
132
+ ## Why this matters
133
+
134
+ The same structured content stored as JSON or Markdown loses precision when an agent reads it. A JSON blob requires the agent to mentally parse brackets and quotes while tracking field relationships. A Markdown table requires the agent to infer column semantics from headers. A YAML document makes field names, nesting, and relationships immediately legible — the LLM spends its attention on the content, not the syntax.
135
+
136
+ For squads that pass structured data between executors across sessions, this compounds: each session starts fresh, and a YAML profile loads faster and more accurately into working context than an equivalent JSON or Markdown representation.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: monetary-values
3
+ description: All monetary values must be stored as integer cents, never as floats
4
+ agents: [dev, architect, qa]
5
+ priority: 5
6
+ version: 1.0.0
7
+ ---
8
+
9
+ # Monetary Values Convention
10
+
11
+ All monetary values in this project MUST be stored and calculated as integer cents.
12
+
13
+ ## Rule
14
+
15
+ - NEVER use float or decimal types for money fields
16
+ - Store as integer: `1000` = R$ 10,00 or USD $10.00
17
+ - Display formatting is a UI concern only — format at the presentation layer, never in persistence or business logic
18
+ - This applies to: database columns, API payloads, internal calculations, test fixtures
19
+
20
+ ## Rationale
21
+
22
+ Float arithmetic produces rounding errors in financial calculations.
23
+ Example: `0.1 + 0.2 === 0.30000000000000004` in most languages.
24
+ Using integer cents eliminates this class of bug entirely.
25
+
26
+ ## Applies to
27
+
28
+ - Database migrations: column type must be integer or bigint, not decimal/float
29
+ - API contracts: monetary fields must be documented as integer cents
30
+ - @qa: test fixtures must use integer cents; any float in a money field is a bug