jarvis-ai-framework 2.0.0 → 2.1.1

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 (192) hide show
  1. package/AGENTS.md +12 -9
  2. package/agents/AGENTS.md +9 -1
  3. package/agents/README.md +2 -2
  4. package/agents/engineering/data/eng.data-engineer.agent.md +2 -2
  5. package/agents/engineering/eng.agent.md +4 -6
  6. package/agents/engineering/eng.bug-hunter.md +10 -5
  7. package/agents/engineering/eng.cybersecurity.agent.md +2 -4
  8. package/agents/engineering/eng.dev-code-reviewer.md +4 -0
  9. package/agents/engineering/eng.docs-writer.md +3 -3
  10. package/agents/engineering/eng.frontend.agent.md +17 -8
  11. package/agents/engineering/eng.rpa.agent.md +3 -5
  12. package/agents/engineering/eng.ux-designer.agent.md +4 -0
  13. package/agents/engineering/qa/eng.qa.cypress-specialist.md +8 -5
  14. package/agents/engineering/qa/eng.qa.quality-champion-task-agent.md +4 -0
  15. package/agents/engineering/qa/eng.qa.quality-strategist.md +18 -8
  16. package/agents/engineering/qa/eng.qa.test-architect.md +17 -6
  17. package/agents/engineering/qa/eng.qa.test-planner.md +17 -8
  18. package/agents/engineering/qa/eng.qa.testing-engineer.md +26 -9
  19. package/agents/product/prod.discovery-interviewer.md +22 -3
  20. package/agents/product/prod.pm-checker.md +4 -0
  21. package/bin/commands/map.js +43 -0
  22. package/bin/commands/tokens.js +93 -0
  23. package/bin/jarvis.js +10 -0
  24. package/bin/lib/config/constants.js +11 -0
  25. package/bin/lib/core/profile-filter.js +113 -0
  26. package/bin/lib/core/scanner.js +2 -2
  27. package/bin/lib/core/token-report.js +90 -0
  28. package/bin/lib/flow-map/index.js +65 -0
  29. package/bin/lib/flow-map/parse.js +217 -0
  30. package/bin/lib/flow-map/render.js +86 -0
  31. package/bin/lib/flow-map/tree.js +199 -0
  32. package/members.md +1 -1
  33. package/package.json +4 -2
  34. package/rules/AGENTS.md +18 -7
  35. package/rules/engineering/eng-rules.md +2 -12
  36. package/rules/engineering/eng-security-rules.md +1 -2
  37. package/rules/engineering/eng.integrations-rules.md +0 -4
  38. package/rules/engineering/eng.skills-rules.md +0 -4
  39. package/rules/engineering/eng.specializations-rules.md +0 -4
  40. package/rules/product/README.md +1 -0
  41. package/rules/product/prod-rules.md +1 -4
  42. package/rules/product/prod.spec-rules.md +0 -4
  43. package/rules/rtk-rules.md +0 -1
  44. package/{rules → rules-on-demand}/engineering/eng.breakdown-subtasks-rules.md +0 -4
  45. package/{rules → rules-on-demand}/engineering/eng.plan-rules.md +0 -4
  46. package/{rules → rules-on-demand}/engineering/eng.pr-rules.md +0 -4
  47. package/{rules → rules-on-demand}/engineering/eng.pre-pr-rules.md +0 -4
  48. package/{rules → rules-on-demand}/engineering/eng.start-rules.md +0 -4
  49. package/{rules → rules-on-demand}/engineering/eng.tech-spec-rules.md +1 -2
  50. package/{rules → rules-on-demand}/engineering/eng.work-rules.md +0 -4
  51. package/skills/AGENTS.md +22 -21
  52. package/skills/SKILLS-ROADMAP.md +0 -4
  53. package/skills/eng-ai-engineer/SKILL.md +6 -0
  54. package/skills/eng-backend/SKILL.md +6 -0
  55. package/skills/eng-backend-arch-c4/SKILL.md +10 -4
  56. package/skills/eng-backend-microservices-trace/SKILL.md +6 -0
  57. package/skills/eng-backend-nestjs/SKILL.md +16 -461
  58. package/skills/eng-backend-nestjs/references/1-arquitetura-modulos.md +54 -0
  59. package/skills/eng-backend-nestjs/references/2-guards-autenticacao.md +118 -0
  60. package/skills/eng-backend-nestjs/references/3-interceptors-pipes-filters.md +113 -0
  61. package/skills/eng-backend-nestjs/references/4-config-logging.md +61 -0
  62. package/skills/eng-backend-nestjs/references/5-testes.md +83 -0
  63. package/skills/eng-backend-nestjs/references/6-problemas-comuns.md +53 -0
  64. package/skills/eng-backend-rabbitmq/SKILL.md +15 -298
  65. package/skills/eng-backend-rabbitmq/references/1-referencia-endpoints.md +28 -0
  66. package/skills/eng-backend-rabbitmq/references/2-codigo-consumer-producer.md +90 -0
  67. package/skills/eng-backend-rabbitmq/references/3-arquiteturas-comuns.md +101 -0
  68. package/skills/eng-backend-rabbitmq/references/4-troubleshooting.md +93 -0
  69. package/skills/eng-data-bi/SKILL.md +6 -0
  70. package/skills/eng-data-debug/SKILL.md +6 -0
  71. package/skills/eng-data-engineer/SKILL.md +16 -7
  72. package/skills/eng-data-onboard/SKILL.md +6 -0
  73. package/skills/eng-data-orchestrator/SKILL.md +6 -0
  74. package/skills/eng-devops-performance-engineer/SKILL.md +6 -0
  75. package/skills/eng-frontend/SKILL.md +6 -0
  76. package/skills/eng-frontend-design-system/SKILL.md +13 -479
  77. package/skills/eng-frontend-design-system/references/1-estrutura-pacote.md +57 -0
  78. package/skills/eng-frontend-design-system/references/2-tokens.md +116 -0
  79. package/skills/eng-frontend-design-system/references/3-componentes.md +165 -0
  80. package/skills/eng-frontend-design-system/references/4-storybook.md +85 -0
  81. package/skills/eng-frontend-design-system/references/5-auditoria-versionamento.md +76 -0
  82. package/skills/eng-frontend-microfrontend/SKILL.md +17 -457
  83. package/skills/eng-frontend-microfrontend/references/1-criando-remote.md +109 -0
  84. package/skills/eng-frontend-microfrontend/references/2-configurando-shell.md +70 -0
  85. package/skills/eng-frontend-microfrontend/references/3-contratos-interface.md +73 -0
  86. package/skills/eng-frontend-microfrontend/references/4-shared-dependencies.md +48 -0
  87. package/skills/eng-frontend-microfrontend/references/5-event-bus.md +59 -0
  88. package/skills/eng-frontend-microfrontend/references/6-monorepo-deploy.md +77 -0
  89. package/skills/eng-frontend-microfrontend/references/7-troubleshooting.md +45 -0
  90. package/skills/eng-global-browser-extension-builder/SKILL.md +6 -0
  91. package/skills/eng-global-docs-write/SKILL.md +10 -5
  92. package/skills/eng-global-jira-comment/SKILL.md +6 -0
  93. package/skills/eng-global-pr/SKILL.md +7 -1
  94. package/skills/eng-global-task-comment/SKILL.md +6 -0
  95. package/skills/eng-qa-a11y-audit/SKILL.md +10 -4
  96. package/skills/eng-qa-bug-report/SKILL.md +18 -230
  97. package/skills/eng-qa-bug-report/references/1-integracao-task-managers.md +148 -0
  98. package/skills/eng-qa-bug-report/references/2-exemplos-de-uso.md +46 -0
  99. package/skills/eng-qa-bug-report/references/3-bug-to-test.md +45 -0
  100. package/skills/eng-qa-cypress-e2e/SKILL.md +6 -0
  101. package/skills/eng-qa-dev-guide/SKILL.md +9 -1
  102. package/skills/eng-qa-e2e/SKILL.md +9 -3
  103. package/skills/eng-qa-e2e-spec-writer/SKILL.md +15 -9
  104. package/skills/eng-qa-exploratory/SKILL.md +16 -9
  105. package/skills/eng-qa-gate/SKILL.md +11 -5
  106. package/skills/eng-qa-gate/assets/checklist-validacao.md +1 -1
  107. package/skills/eng-qa-graphql-contract/SKILL.md +9 -3
  108. package/skills/eng-qa-quality-report/SKILL.md +9 -3
  109. package/skills/eng-qa-test-plan/SKILL.md +6 -0
  110. package/skills/eng-qa-testsprite/SKILL.md +10 -4
  111. package/skills/eng-qa-unit-test/SKILL.md +7 -1
  112. package/skills/eng-scraper/SKILL.md +12 -436
  113. package/skills/eng-scraper/references/1-puppeteer.md +140 -0
  114. package/skills/eng-scraper/references/2-playwright-cheerio-pdf.md +82 -0
  115. package/skills/eng-scraper/references/3-anti-bot.md +94 -0
  116. package/skills/eng-scraper/references/4-resiliencia-etl-monitoramento.md +137 -0
  117. package/skills/eng-scraper-robot-builder/SKILL.md +6 -0
  118. package/skills/eng-security-cybersecurity/SKILL.md +13 -409
  119. package/skills/eng-security-cybersecurity/references/1-owasp-top-10.md +331 -0
  120. package/skills/eng-security-cybersecurity/references/2-secrets-management.md +31 -0
  121. package/skills/eng-security-cybersecurity/references/3-input-validation.md +43 -0
  122. package/skills/eng-security-cybersecurity/references/4-compliance.md +20 -0
  123. package/skills/eng-security-patch/SKILL.md +6 -0
  124. package/skills/eng-security-threat-model/SKILL.md +6 -0
  125. package/skills/eng-security-triage/SKILL.md +6 -0
  126. package/skills/jarvis-context-detect/SKILL.md +6 -0
  127. package/skills/jarvis-create-specialization/SKILL.md +6 -0
  128. package/skills/jarvis-docs-central/SKILL.md +6 -0
  129. package/skills/jarvis-docs-index/SKILL.md +10 -2
  130. package/skills/jarvis-evolution-architect/SKILL.md +439 -0
  131. package/skills/jarvis-evolution-architect/references/exemplos.md +297 -0
  132. package/skills/jarvis-evolution-architect/references/guia-de-uso.md +355 -0
  133. package/skills/jarvis-evolution-architect/references/lentes-e-conceitos.md +292 -0
  134. package/skills/jarvis-evolution-architect/references/visao-geral.md +272 -0
  135. package/skills/jarvis-init/SKILL.md +14 -7
  136. package/skills/jarvis-list-specializations/SKILL.md +6 -0
  137. package/skills/jarvis-report-issue/SKILL.md +6 -0
  138. package/skills/product-roadmap-report/SKILL.md +8 -0
  139. package/skills/product-specs/SKILL.md +9 -0
  140. package/skills/product-specs-update/SKILL.md +6 -0
  141. package/taxonomy.md +12 -12
  142. package/templates/AGENTS.md +2 -0
  143. package/templates/engineering/tech-spec-delivery-template.md +179 -0
  144. package/workflows/AGENTS.md +12 -2
  145. package/workflows/README.md +18 -16
  146. package/workflows/all-tools.md +7 -1
  147. package/workflows/engineering/data/data.contract.md +8 -0
  148. package/workflows/engineering/data/data.new-pipeline.md +10 -0
  149. package/workflows/engineering/eng.breakdown-subtasks.md +9 -0
  150. package/workflows/engineering/eng.bug-audit.md +9 -2
  151. package/workflows/engineering/eng.build-tech-spec.md +17 -146
  152. package/workflows/engineering/eng.create-ard-from-code.md +8 -0
  153. package/workflows/engineering/eng.create-ard.md +8 -0
  154. package/workflows/engineering/eng.create-rfc.md +7 -0
  155. package/workflows/engineering/eng.debug.md +3 -3
  156. package/workflows/engineering/eng.docs.md +9 -0
  157. package/workflows/engineering/eng.light-arch.md +7 -0
  158. package/workflows/engineering/eng.plan.md +15 -2
  159. package/workflows/engineering/eng.pr.md +19 -7
  160. package/workflows/engineering/eng.pre-pr.md +27 -1
  161. package/workflows/engineering/eng.review.md +13 -0
  162. package/workflows/engineering/eng.rpa.robot.md +16 -0
  163. package/workflows/engineering/eng.security-audit.md +7 -0
  164. package/workflows/engineering/eng.security-incident.md +6 -0
  165. package/workflows/engineering/eng.security-pipeline.md +9 -0
  166. package/workflows/engineering/eng.security-review.md +6 -0
  167. package/workflows/engineering/eng.start.md +22 -6
  168. package/workflows/engineering/eng.work.md +18 -2
  169. package/workflows/engineering/frontend/eng.frontend-component.md +7 -0
  170. package/workflows/engineering/frontend/eng.frontend-perf-audit.md +8 -0
  171. package/workflows/engineering/frontend/eng.frontend-review.md +8 -0
  172. package/workflows/engineering/qa/eng.qa-dev-quality-guide.md +6 -0
  173. package/workflows/engineering/qa/eng.qa-e2e-test-generation.md +6 -0
  174. package/workflows/engineering/qa/eng.qa-exploratory-session.md +8 -0
  175. package/workflows/engineering/qa/eng.qa-quality-gate-validation.md +7 -0
  176. package/workflows/engineering/qa/eng.qa-quality-report.md +7 -0
  177. package/workflows/engineering/qa/eng.qa-refinement-entry.md +7 -0
  178. package/workflows/engineering/qa/eng.qa-release-signoff.md +6 -0
  179. package/workflows/engineering/qa/eng.qa-sprint-planning.md +6 -0
  180. package/workflows/product/prod.roadmap.preview.md +9 -0
  181. package/workflows/product/prod.spec.ard.md +97 -0
  182. package/workflows/product/prod.spec.breakdown.md +10 -0
  183. package/workflows/product/prod.spec.clarify.md +8 -2
  184. package/workflows/product/prod.spec.discovery.md +10 -0
  185. package/workflows/product/prod.spec.epic.md +8 -0
  186. package/workflows/product/prod.spec.frd.md +7 -0
  187. package/workflows/product/prod.spec.issue.md +6 -0
  188. package/workflows/product/prod.spec.md +15 -1
  189. package/workflows/product/prod.spec.prd.md +7 -0
  190. package/workflows/taxonomy.md +58 -6
  191. package/workflows/warm-up.md +24 -9
  192. package/rules/engineering/eng.downstream-flow-rules.md +0 -297
@@ -281,33 +281,25 @@ curl -s -X DELETE -u "$AUTH" \
281
281
  "$MB_URL/queues/%2F/{nome-fila}/contents"
282
282
  ```
283
283
 
284
- ---
284
+ ### Skills invocados durante a execução do skill
285
285
 
286
- ## Referência de Endpoints
287
-
288
- | Operação | Método | Endpoint |
289
- |----------|--------|----------|
290
- | Status geral | GET | `/api/overview` |
291
- | Listar filas | GET | `/api/queues` |
292
- | Detalhes de fila | GET | `/api/queues/{vhost}/{name}` |
293
- | Criar fila | PUT | `/api/queues/{vhost}/{name}` |
294
- | Deletar fila | DELETE | `/api/queues/{vhost}/{name}` |
295
- | Purgar fila | DELETE | `/api/queues/{vhost}/{name}/contents` |
296
- | Consumir mensagens | POST | `/api/queues/{vhost}/{name}/get` |
297
- | Listar exchanges | GET | `/api/exchanges/{vhost}` |
298
- | Criar exchange | PUT | `/api/exchanges/{vhost}/{name}` |
299
- | Deletar exchange | DELETE | `/api/exchanges/{vhost}/{name}` |
300
- | Publicar mensagem | POST | `/api/exchanges/{vhost}/{name}/publish` |
301
- | Listar bindings | GET | `/api/bindings/{vhost}` |
302
- | Criar binding (fila) | POST | `/api/bindings/{vhost}/e/{exchange}/q/{queue}` |
303
- | Deletar binding | DELETE | `/api/bindings/{vhost}/e/{exchange}/q/{queue}/{props}` |
304
- | Listar connections | GET | `/api/connections` |
305
- | Fechar connection | DELETE | `/api/connections/{name}` |
306
- | Listar channels | GET | `/api/channels` |
307
- | Listar vhosts | GET | `/api/vhosts` |
286
+ | Passo | Skill | Condição |
287
+ |-------|-------|----------|
288
+ | — | Nenhuma — skill autocontida | — |
308
289
 
309
290
  ---
310
291
 
292
+ ## Referências (leia só o tema que a tarefa pedir)
293
+
294
+ Leia **só** o arquivo do tema que a tarefa pedir; o restante fica fora do contexto.
295
+
296
+ | Tema | Quando ler | Arquivo |
297
+ |------|-----------|---------|
298
+ | Referência de Endpoints | Precisar do endpoint exato, método ou payload da Management API | `references/1-referencia-endpoints.md` |
299
+ | Código de Consumer/Producer | A tarefa pedir código de consumer ou producer (Node.js com amqplib ou Python com pika) | `references/2-codigo-consumer-producer.md` |
300
+ | Arquiteturas Comuns (DLX, retry, fanout, topic) | A tarefa pedir Dead Letter Exchange, retry com delay, fanout ou topic routing | `references/3-arquiteturas-comuns.md` |
301
+ | Troubleshooting do RabbitMQ | Houver fila acumulando, mensagens indo para dead letter, loop de consumer, erro 406 ou mensagens que não chegam | `references/4-troubleshooting.md` |
302
+
311
303
  ## Regras
312
304
 
313
305
  ### Nunca
@@ -326,281 +318,6 @@ curl -s -X DELETE -u "$AUTH" \
326
318
 
327
319
  ---
328
320
 
329
- ## Criar Código de Consumer/Producer
330
-
331
- Quando o usuário pedir para criar código, gerar implementação completa e funcional. Verificar a linguagem/framework do projeto antes de escolher a biblioteca.
332
-
333
- ### Node.js com amqplib
334
-
335
- ```javascript
336
- // consumer.js
337
- const amqp = require('amqplib');
338
-
339
- async function startConsumer() {
340
- const conn = await amqp.connect(process.env.RABBITMQ_URL);
341
- const channel = await conn.createChannel();
342
-
343
- const queue = 'nome-da-fila';
344
- await channel.assertQueue(queue, { durable: true });
345
- channel.prefetch(1); // processa 1 mensagem por vez
346
-
347
- console.log(`Aguardando mensagens em ${queue}`);
348
-
349
- channel.consume(queue, async (msg) => {
350
- if (!msg) return;
351
- try {
352
- const payload = JSON.parse(msg.content.toString());
353
- console.log('Mensagem recebida:', payload);
354
-
355
- // processar aqui...
356
-
357
- channel.ack(msg); // confirmar processamento
358
- } catch (err) {
359
- console.error('Erro ao processar:', err);
360
- channel.nack(msg, false, false); // rejeitar sem requeue → vai para DLX
361
- }
362
- });
363
- }
364
-
365
- startConsumer().catch(console.error);
366
- ```
367
-
368
- ```javascript
369
- // producer.js
370
- const amqp = require('amqplib');
371
-
372
- async function publish(exchange, routingKey, payload) {
373
- const conn = await amqp.connect(process.env.RABBITMQ_URL);
374
- const channel = await conn.createChannel();
375
-
376
- channel.publish(
377
- exchange,
378
- routingKey,
379
- Buffer.from(JSON.stringify(payload)),
380
- { persistent: true, contentType: 'application/json' }
381
- );
382
-
383
- await channel.close();
384
- await conn.close();
385
- }
386
- ```
387
-
388
- ### Python com pika
389
-
390
- ```python
391
- # consumer.py
392
- import pika, json, os
393
-
394
- def on_message(channel, method, properties, body):
395
- try:
396
- payload = json.loads(body)
397
- print(f"Mensagem recebida: {payload}")
398
- # processar aqui...
399
- channel.basic_ack(delivery_tag=method.delivery_tag)
400
- except Exception as e:
401
- print(f"Erro: {e}")
402
- channel.basic_nack(delivery_tag=method.delivery_tag, requeue=False)
403
-
404
- params = pika.URLParameters(os.environ['RABBITMQ_URL'])
405
- conn = pika.BlockingConnection(params)
406
- ch = conn.channel()
407
- ch.basic_qos(prefetch_count=1)
408
- ch.basic_consume('nome-da-fila', on_message)
409
- ch.start_consuming()
410
- ```
411
-
412
- > Sempre ler o projeto para detectar a linguagem e adaptar o código antes de gerar.
413
-
414
- ---
415
-
416
- ## Arquiteturas Comuns
417
-
418
- ### Dead Letter Exchange (DLX) — Fila com rejeição controlada
419
-
420
- ```
421
- Fila principal → (nack/expired) → DLX Exchange → Fila de Dead Letters
422
- ```
423
-
424
- ```bash
425
- # 1. Criar DLX exchange
426
- curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
427
- -d '{"type":"direct","durable":true}' \
428
- "$MB_URL/exchanges/%2F/dlx.minha-fila"
429
-
430
- # 2. Criar fila de dead letters
431
- curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
432
- -d '{"durable":true}' \
433
- "$MB_URL/queues/%2F/minha-fila.dead"
434
-
435
- # 3. Criar binding DLX → fila dead
436
- curl -s -X POST -u "$AUTH" -H "Content-Type: application/json" \
437
- -d '{"routing_key":"minha-fila"}' \
438
- "$MB_URL/bindings/%2F/e/dlx.minha-fila/q/minha-fila.dead"
439
-
440
- # 4. Criar fila principal apontando para DLX
441
- curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
442
- -d '{
443
- "durable": true,
444
- "arguments": {
445
- "x-dead-letter-exchange": "dlx.minha-fila",
446
- "x-dead-letter-routing-key": "minha-fila",
447
- "x-message-ttl": 86400000
448
- }
449
- }' \
450
- "$MB_URL/queues/%2F/minha-fila"
451
- ```
452
-
453
- ### Retry com Delay (usando TTL + DLX como fila de espera)
454
-
455
- ```
456
- Fila principal → (nack) → DLX Exchange → Fila retry (TTL 30s) → republica → Fila principal
457
- ```
458
-
459
- ```bash
460
- # Fila de retry com TTL de 30 segundos e DLX apontando de volta para a fila principal
461
- curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
462
- -d '{
463
- "durable": true,
464
- "arguments": {
465
- "x-message-ttl": 30000,
466
- "x-dead-letter-exchange": "",
467
- "x-dead-letter-routing-key": "minha-fila"
468
- }
469
- }' \
470
- "$MB_URL/queues/%2F/minha-fila.retry"
471
- ```
472
-
473
- ### Fanout — Broadcast para múltiplas filas
474
-
475
- ```
476
- Exchange fanout → Fila A
477
- → Fila B
478
- → Fila C
479
- ```
480
-
481
- ```bash
482
- # Exchange fanout (routing_key é ignorada)
483
- curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
484
- -d '{"type":"fanout","durable":true}' \
485
- "$MB_URL/exchanges/%2F/events.broadcast"
486
-
487
- # Cada fila se liga sem routing_key
488
- curl -s -X POST -u "$AUTH" -H "Content-Type: application/json" \
489
- -d '{"routing_key":""}' \
490
- "$MB_URL/bindings/%2F/e/events.broadcast/q/servico-a"
491
- ```
492
-
493
- ### Topic Routing — Roteamento por padrão
494
-
495
- ```
496
- Exchange topic → "pedido.criado" → fila pedidos
497
- → "pedido.*" → fila auditoria
498
- → "*.erro" → fila alertas
499
- ```
500
-
501
- ```bash
502
- curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
503
- -d '{"type":"topic","durable":true}' \
504
- "$MB_URL/exchanges/%2F/events.topic"
505
-
506
- # Binding com wildcard
507
- curl -s -X POST -u "$AUTH" -H "Content-Type: application/json" \
508
- -d '{"routing_key":"pedido.*"}' \
509
- "$MB_URL/bindings/%2F/e/events.topic/q/fila-auditoria"
510
- ```
511
-
512
- ---
513
-
514
- ## Troubleshooting
515
-
516
- ### Diagnóstico inicial — sempre começar aqui
517
-
518
- ```bash
519
- AUTH=$(grep "MESSAGE_BROKER_API_AUTH" $IDE/ENV.md | cut -d'=' -f2)
520
- MB_URL=$(grep "MESSAGE_BROKER_URL_API" $IDE/ENV.md | cut -d'=' -f2)
521
-
522
- # Visão geral do cluster
523
- curl -s -u "$AUTH" "$MB_URL/overview" | python3 -m json.tool
524
-
525
- # Filas com problemas (messages_ready > 0 e consumers = 0)
526
- curl -s -u "$AUTH" "$MB_URL/queues" | python3 -c "
527
- import json,sys
528
- qs = json.load(sys.stdin)
529
- for q in qs:
530
- ready = q.get('messages_ready', 0)
531
- consumers = q.get('consumers', 0)
532
- if ready > 0 and consumers == 0:
533
- print(f\"ALERTA: {q['name']} | mensagens={ready} | consumers=0\")
534
- "
535
- ```
536
-
537
- ### Problema: Fila acumulando mensagens (consumer parado)
538
-
539
- 1. Verificar se há consumers ativos na fila:
540
- ```bash
541
- curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -m json.tool | grep -E "consumers|messages"
542
- ```
543
- 2. Verificar connections abertas:
544
- ```bash
545
- curl -s -u "$AUTH" "$MB_URL/connections" | python3 -m json.tool
546
- ```
547
- 3. Checar se o consumer está com unacked alto (travado no processamento):
548
- ```bash
549
- curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -c "
550
- import json,sys; q=json.load(sys.stdin)
551
- print('messages_ready:', q.get('messages_ready'))
552
- print('messages_unacknowledged:', q.get('messages_unacknowledged'))
553
- print('consumers:', q.get('consumers'))
554
- "
555
- ```
556
-
557
- ### Problema: Mensagens indo para Dead Letter inesperadamente
558
-
559
- Causas comuns:
560
- - `x-message-ttl` expirando antes do consumer processar → aumentar TTL ou aumentar prefetch
561
- - Consumer fazendo `nack` com `requeue=false` por erro no código → checar logs do consumer
562
- - Fila com `x-max-length` atingido → verificar se fila está lotada
563
-
564
- ```bash
565
- # Ver argumentos da fila (TTL, DLX, max-length)
566
- curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -c "
567
- import json,sys; q=json.load(sys.stdin)
568
- print(json.dumps(q.get('arguments', {}), indent=2))
569
- "
570
- ```
571
-
572
- ### Problema: Consumer recebe mensagem mas não processa (loop infinito)
573
-
574
- Sintoma: `messages_unacknowledged` cresce, `messages_ready` não zera.
575
-
576
- Solução: Verificar prefetch — consumer pode estar segurando todas as mensagens:
577
- ```bash
578
- # Ver detalhes dos channels (prefetch_count)
579
- curl -s -u "$AUTH" "$MB_URL/channels" | python3 -m json.tool
580
- ```
581
-
582
- ### Problema: 406 PRECONDITION_FAILED ao criar fila/exchange
583
-
584
- A fila/exchange já existe com parâmetros diferentes. Verificar parâmetros atuais:
585
- ```bash
586
- curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -m json.tool
587
- ```
588
- Se precisar mudar: deletar e recriar (confirmar com o usuário antes).
589
-
590
- ### Problema: Mensagens publicadas mas não chegam na fila
591
-
592
- Verificar se o binding existe com a routing_key correta:
593
- ```bash
594
- curl -s -u "$AUTH" "$MB_URL/bindings/%2F" | python3 -c "
595
- import json,sys
596
- for b in json.load(sys.stdin):
597
- if b.get('source') == 'nome-exchange':
598
- print(b)
599
- "
600
- ```
601
-
602
- ---
603
-
604
321
  ## Tratamento de Erros
605
322
 
606
323
  ### 401 Unauthorized
@@ -0,0 +1,28 @@
1
+ # Referência de Endpoints
2
+
3
+ > Parte do skill `eng-backend-rabbitmq`. Leia este arquivo quando precisar do endpoint exato, método ou payload da Management API.
4
+
5
+ ## Referência de Endpoints
6
+
7
+ | Operação | Método | Endpoint |
8
+ |----------|--------|----------|
9
+ | Status geral | GET | `/api/overview` |
10
+ | Listar filas | GET | `/api/queues` |
11
+ | Detalhes de fila | GET | `/api/queues/{vhost}/{name}` |
12
+ | Criar fila | PUT | `/api/queues/{vhost}/{name}` |
13
+ | Deletar fila | DELETE | `/api/queues/{vhost}/{name}` |
14
+ | Purgar fila | DELETE | `/api/queues/{vhost}/{name}/contents` |
15
+ | Consumir mensagens | POST | `/api/queues/{vhost}/{name}/get` |
16
+ | Listar exchanges | GET | `/api/exchanges/{vhost}` |
17
+ | Criar exchange | PUT | `/api/exchanges/{vhost}/{name}` |
18
+ | Deletar exchange | DELETE | `/api/exchanges/{vhost}/{name}` |
19
+ | Publicar mensagem | POST | `/api/exchanges/{vhost}/{name}/publish` |
20
+ | Listar bindings | GET | `/api/bindings/{vhost}` |
21
+ | Criar binding (fila) | POST | `/api/bindings/{vhost}/e/{exchange}/q/{queue}` |
22
+ | Deletar binding | DELETE | `/api/bindings/{vhost}/e/{exchange}/q/{queue}/{props}` |
23
+ | Listar connections | GET | `/api/connections` |
24
+ | Fechar connection | DELETE | `/api/connections/{name}` |
25
+ | Listar channels | GET | `/api/channels` |
26
+ | Listar vhosts | GET | `/api/vhosts` |
27
+
28
+ ---
@@ -0,0 +1,90 @@
1
+ # Código de Consumer/Producer
2
+
3
+ > Parte do skill `eng-backend-rabbitmq`. Leia este arquivo quando a tarefa pedir código de consumer ou producer (Node.js com amqplib ou Python com pika).
4
+
5
+ ## Criar Código de Consumer/Producer
6
+
7
+ Quando o usuário pedir para criar código, gerar implementação completa e funcional. Verificar a linguagem/framework do projeto antes de escolher a biblioteca.
8
+
9
+ ### Node.js com amqplib
10
+
11
+ ```javascript
12
+ // consumer.js
13
+ const amqp = require('amqplib');
14
+
15
+ async function startConsumer() {
16
+ const conn = await amqp.connect(process.env.RABBITMQ_URL);
17
+ const channel = await conn.createChannel();
18
+
19
+ const queue = 'nome-da-fila';
20
+ await channel.assertQueue(queue, { durable: true });
21
+ channel.prefetch(1); // processa 1 mensagem por vez
22
+
23
+ console.log(`Aguardando mensagens em ${queue}`);
24
+
25
+ channel.consume(queue, async (msg) => {
26
+ if (!msg) return;
27
+ try {
28
+ const payload = JSON.parse(msg.content.toString());
29
+ console.log('Mensagem recebida:', payload);
30
+
31
+ // processar aqui...
32
+
33
+ channel.ack(msg); // confirmar processamento
34
+ } catch (err) {
35
+ console.error('Erro ao processar:', err);
36
+ channel.nack(msg, false, false); // rejeitar sem requeue → vai para DLX
37
+ }
38
+ });
39
+ }
40
+
41
+ startConsumer().catch(console.error);
42
+ ```
43
+
44
+ ```javascript
45
+ // producer.js
46
+ const amqp = require('amqplib');
47
+
48
+ async function publish(exchange, routingKey, payload) {
49
+ const conn = await amqp.connect(process.env.RABBITMQ_URL);
50
+ const channel = await conn.createChannel();
51
+
52
+ channel.publish(
53
+ exchange,
54
+ routingKey,
55
+ Buffer.from(JSON.stringify(payload)),
56
+ { persistent: true, contentType: 'application/json' }
57
+ );
58
+
59
+ await channel.close();
60
+ await conn.close();
61
+ }
62
+ ```
63
+
64
+ ### Python com pika
65
+
66
+ ```python
67
+ # consumer.py
68
+ import pika, json, os
69
+
70
+ def on_message(channel, method, properties, body):
71
+ try:
72
+ payload = json.loads(body)
73
+ print(f"Mensagem recebida: {payload}")
74
+ # processar aqui...
75
+ channel.basic_ack(delivery_tag=method.delivery_tag)
76
+ except Exception as e:
77
+ print(f"Erro: {e}")
78
+ channel.basic_nack(delivery_tag=method.delivery_tag, requeue=False)
79
+
80
+ params = pika.URLParameters(os.environ['RABBITMQ_URL'])
81
+ conn = pika.BlockingConnection(params)
82
+ ch = conn.channel()
83
+ ch.basic_qos(prefetch_count=1)
84
+ ch.basic_consume('nome-da-fila', on_message)
85
+ ch.start_consuming()
86
+ ```
87
+
88
+ > Sempre ler o projeto para detectar a linguagem e adaptar o código antes de gerar.
89
+
90
+ ---
@@ -0,0 +1,101 @@
1
+ # Arquiteturas Comuns (DLX, retry, fanout, topic)
2
+
3
+ > Parte do skill `eng-backend-rabbitmq`. Leia este arquivo quando a tarefa pedir Dead Letter Exchange, retry com delay, fanout ou topic routing.
4
+
5
+ ## Arquiteturas Comuns
6
+
7
+ ### Dead Letter Exchange (DLX) — Fila com rejeição controlada
8
+
9
+ ```
10
+ Fila principal → (nack/expired) → DLX Exchange → Fila de Dead Letters
11
+ ```
12
+
13
+ ```bash
14
+ # 1. Criar DLX exchange
15
+ curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
16
+ -d '{"type":"direct","durable":true}' \
17
+ "$MB_URL/exchanges/%2F/dlx.minha-fila"
18
+
19
+ # 2. Criar fila de dead letters
20
+ curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
21
+ -d '{"durable":true}' \
22
+ "$MB_URL/queues/%2F/minha-fila.dead"
23
+
24
+ # 3. Criar binding DLX → fila dead
25
+ curl -s -X POST -u "$AUTH" -H "Content-Type: application/json" \
26
+ -d '{"routing_key":"minha-fila"}' \
27
+ "$MB_URL/bindings/%2F/e/dlx.minha-fila/q/minha-fila.dead"
28
+
29
+ # 4. Criar fila principal apontando para DLX
30
+ curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
31
+ -d '{
32
+ "durable": true,
33
+ "arguments": {
34
+ "x-dead-letter-exchange": "dlx.minha-fila",
35
+ "x-dead-letter-routing-key": "minha-fila",
36
+ "x-message-ttl": 86400000
37
+ }
38
+ }' \
39
+ "$MB_URL/queues/%2F/minha-fila"
40
+ ```
41
+
42
+ ### Retry com Delay (usando TTL + DLX como fila de espera)
43
+
44
+ ```
45
+ Fila principal → (nack) → DLX Exchange → Fila retry (TTL 30s) → republica → Fila principal
46
+ ```
47
+
48
+ ```bash
49
+ # Fila de retry com TTL de 30 segundos e DLX apontando de volta para a fila principal
50
+ curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
51
+ -d '{
52
+ "durable": true,
53
+ "arguments": {
54
+ "x-message-ttl": 30000,
55
+ "x-dead-letter-exchange": "",
56
+ "x-dead-letter-routing-key": "minha-fila"
57
+ }
58
+ }' \
59
+ "$MB_URL/queues/%2F/minha-fila.retry"
60
+ ```
61
+
62
+ ### Fanout — Broadcast para múltiplas filas
63
+
64
+ ```
65
+ Exchange fanout → Fila A
66
+ → Fila B
67
+ → Fila C
68
+ ```
69
+
70
+ ```bash
71
+ # Exchange fanout (routing_key é ignorada)
72
+ curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
73
+ -d '{"type":"fanout","durable":true}' \
74
+ "$MB_URL/exchanges/%2F/events.broadcast"
75
+
76
+ # Cada fila se liga sem routing_key
77
+ curl -s -X POST -u "$AUTH" -H "Content-Type: application/json" \
78
+ -d '{"routing_key":""}' \
79
+ "$MB_URL/bindings/%2F/e/events.broadcast/q/servico-a"
80
+ ```
81
+
82
+ ### Topic Routing — Roteamento por padrão
83
+
84
+ ```
85
+ Exchange topic → "pedido.criado" → fila pedidos
86
+ → "pedido.*" → fila auditoria
87
+ → "*.erro" → fila alertas
88
+ ```
89
+
90
+ ```bash
91
+ curl -s -X PUT -u "$AUTH" -H "Content-Type: application/json" \
92
+ -d '{"type":"topic","durable":true}' \
93
+ "$MB_URL/exchanges/%2F/events.topic"
94
+
95
+ # Binding com wildcard
96
+ curl -s -X POST -u "$AUTH" -H "Content-Type: application/json" \
97
+ -d '{"routing_key":"pedido.*"}' \
98
+ "$MB_URL/bindings/%2F/e/events.topic/q/fila-auditoria"
99
+ ```
100
+
101
+ ---
@@ -0,0 +1,93 @@
1
+ # Troubleshooting do RabbitMQ
2
+
3
+ > Parte do skill `eng-backend-rabbitmq`. Leia este arquivo quando houver fila acumulando, mensagens indo para dead letter, loop de consumer, erro 406 ou mensagens que não chegam.
4
+
5
+ ## Troubleshooting
6
+
7
+ ### Diagnóstico inicial — sempre começar aqui
8
+
9
+ ```bash
10
+ AUTH=$(grep "MESSAGE_BROKER_API_AUTH" $IDE/ENV.md | cut -d'=' -f2)
11
+ MB_URL=$(grep "MESSAGE_BROKER_URL_API" $IDE/ENV.md | cut -d'=' -f2)
12
+
13
+ # Visão geral do cluster
14
+ curl -s -u "$AUTH" "$MB_URL/overview" | python3 -m json.tool
15
+
16
+ # Filas com problemas (messages_ready > 0 e consumers = 0)
17
+ curl -s -u "$AUTH" "$MB_URL/queues" | python3 -c "
18
+ import json,sys
19
+ qs = json.load(sys.stdin)
20
+ for q in qs:
21
+ ready = q.get('messages_ready', 0)
22
+ consumers = q.get('consumers', 0)
23
+ if ready > 0 and consumers == 0:
24
+ print(f\"ALERTA: {q['name']} | mensagens={ready} | consumers=0\")
25
+ "
26
+ ```
27
+
28
+ ### Problema: Fila acumulando mensagens (consumer parado)
29
+
30
+ 1. Verificar se há consumers ativos na fila:
31
+ ```bash
32
+ curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -m json.tool | grep -E "consumers|messages"
33
+ ```
34
+ 2. Verificar connections abertas:
35
+ ```bash
36
+ curl -s -u "$AUTH" "$MB_URL/connections" | python3 -m json.tool
37
+ ```
38
+ 3. Checar se o consumer está com unacked alto (travado no processamento):
39
+ ```bash
40
+ curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -c "
41
+ import json,sys; q=json.load(sys.stdin)
42
+ print('messages_ready:', q.get('messages_ready'))
43
+ print('messages_unacknowledged:', q.get('messages_unacknowledged'))
44
+ print('consumers:', q.get('consumers'))
45
+ "
46
+ ```
47
+
48
+ ### Problema: Mensagens indo para Dead Letter inesperadamente
49
+
50
+ Causas comuns:
51
+ - `x-message-ttl` expirando antes do consumer processar → aumentar TTL ou aumentar prefetch
52
+ - Consumer fazendo `nack` com `requeue=false` por erro no código → checar logs do consumer
53
+ - Fila com `x-max-length` atingido → verificar se fila está lotada
54
+
55
+ ```bash
56
+ # Ver argumentos da fila (TTL, DLX, max-length)
57
+ curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -c "
58
+ import json,sys; q=json.load(sys.stdin)
59
+ print(json.dumps(q.get('arguments', {}), indent=2))
60
+ "
61
+ ```
62
+
63
+ ### Problema: Consumer recebe mensagem mas não processa (loop infinito)
64
+
65
+ Sintoma: `messages_unacknowledged` cresce, `messages_ready` não zera.
66
+
67
+ Solução: Verificar prefetch — consumer pode estar segurando todas as mensagens:
68
+ ```bash
69
+ # Ver detalhes dos channels (prefetch_count)
70
+ curl -s -u "$AUTH" "$MB_URL/channels" | python3 -m json.tool
71
+ ```
72
+
73
+ ### Problema: 406 PRECONDITION_FAILED ao criar fila/exchange
74
+
75
+ A fila/exchange já existe com parâmetros diferentes. Verificar parâmetros atuais:
76
+ ```bash
77
+ curl -s -u "$AUTH" "$MB_URL/queues/%2F/nome-da-fila" | python3 -m json.tool
78
+ ```
79
+ Se precisar mudar: deletar e recriar (confirmar com o usuário antes).
80
+
81
+ ### Problema: Mensagens publicadas mas não chegam na fila
82
+
83
+ Verificar se o binding existe com a routing_key correta:
84
+ ```bash
85
+ curl -s -u "$AUTH" "$MB_URL/bindings/%2F" | python3 -c "
86
+ import json,sys
87
+ for b in json.load(sys.stdin):
88
+ if b.get('source') == 'nome-exchange':
89
+ print(b)
90
+ "
91
+ ```
92
+
93
+ ---
@@ -150,6 +150,12 @@ Se existir `$IDE/rules/engineering/data/data-rules.md`, ler e aplicar as conven
150
150
  3. **Registrar o compartilhamento**
151
151
  - Anotar no contrato de dados quem está consumindo
152
152
 
153
+ ### Skills invocados durante a execução do skill
154
+
155
+ | Passo | Skill | Condição |
156
+ |-------|-------|----------|
157
+ | — | Nenhuma — skill autocontida | — |
158
+
153
159
  ---
154
160
 
155
161
  ## Boas Práticas de Performance
@@ -288,6 +288,12 @@ Após a correção:
288
288
  | Métrica errada | Gold | Join ou regra de negócio |
289
289
  | Dashboard não atualiza | Gold / Cache | Data da última ingestão em gold |
290
290
 
291
+ ### Skills invocados durante a execução do skill
292
+
293
+ | Passo | Skill | Condição |
294
+ |-------|-------|----------|
295
+ | — | Nenhuma — skill autocontida | — |
296
+
291
297
  ---
292
298
 
293
299
  ## Regras Críticas