izanagi-ai 2.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 (195) hide show
  1. package/AGENTS.md +53 -0
  2. package/CHANGELOG.md +198 -0
  3. package/LICENSE +21 -0
  4. package/README.md +96 -0
  5. package/ROADMAP.md +131 -0
  6. package/RULES.md +202 -0
  7. package/SYSTEM.md +201 -0
  8. package/agents/INDEX.md +40 -0
  9. package/agents/architect-agent.json +15 -0
  10. package/agents/bug-hunter-agent.json +14 -0
  11. package/agents/database-agent.json +14 -0
  12. package/agents/devops-agent.json +15 -0
  13. package/agents/docs-agent.json +15 -0
  14. package/agents/pm-agent.json +14 -0
  15. package/agents/professor-agent.json +15 -0
  16. package/agents/security-agent.json +14 -0
  17. package/agents/senior-engineer-agent.json +16 -0
  18. package/agents/techlead-agent.json +15 -0
  19. package/architecture/clean-architecture.md +98 -0
  20. package/architecture/cqrs-specialist.md +102 -0
  21. package/architecture/ddd-specialist.md +97 -0
  22. package/architecture/event-driven-architect.md +79 -0
  23. package/architecture/hexagonal-architecture.md +96 -0
  24. package/architecture/microservices-expert.md +83 -0
  25. package/architecture/monolith-expert.md +67 -0
  26. package/architecture/repository-pattern.md +73 -0
  27. package/architecture/unit-of-work.md +92 -0
  28. package/backend/README.md +29 -0
  29. package/bin/nexus.js +8 -0
  30. package/core/compression-engine.md +194 -0
  31. package/core/context-engine.md +239 -0
  32. package/core/decision-engine.md +377 -0
  33. package/core/evolution-engine.md +169 -0
  34. package/core/planning-engine.md +201 -0
  35. package/core/quality-gates.md +233 -0
  36. package/core/reflection-engine.md +182 -0
  37. package/core/skill-resolver.json +169 -0
  38. package/core/token-manager.md +152 -0
  39. package/database/database-engineer.md +244 -0
  40. package/database/mysql-specialist.md +61 -0
  41. package/database/postgresql-specialist.md +70 -0
  42. package/database/redis-specialist.md +73 -0
  43. package/database/sql-optimizer.md +95 -0
  44. package/database/sqlserver-specialist.md +69 -0
  45. package/devops/ci-cd-specialist.md +101 -0
  46. package/devops/devops-engineer.md +358 -0
  47. package/devops/docker-expert.md +105 -0
  48. package/devops/git-expert.md +76 -0
  49. package/devops/git-flow-specialist.md +71 -0
  50. package/devops/kubernetes-specialist.md +84 -0
  51. package/devops/linux-specialist.md +82 -0
  52. package/devops/windows-specialist.md +43 -0
  53. package/dist/cli/commands/compile.d.ts +2 -0
  54. package/dist/cli/commands/compile.d.ts.map +1 -0
  55. package/dist/cli/commands/compile.js +44 -0
  56. package/dist/cli/commands/compile.js.map +1 -0
  57. package/dist/cli/commands/doctor.d.ts +2 -0
  58. package/dist/cli/commands/doctor.d.ts.map +1 -0
  59. package/dist/cli/commands/doctor.js +88 -0
  60. package/dist/cli/commands/doctor.js.map +1 -0
  61. package/dist/cli/commands/init.d.ts +2 -0
  62. package/dist/cli/commands/init.d.ts.map +1 -0
  63. package/dist/cli/commands/init.js +26 -0
  64. package/dist/cli/commands/init.js.map +1 -0
  65. package/dist/cli/commands/list.d.ts +2 -0
  66. package/dist/cli/commands/list.d.ts.map +1 -0
  67. package/dist/cli/commands/list.js +50 -0
  68. package/dist/cli/commands/list.js.map +1 -0
  69. package/dist/cli/commands/run.d.ts +2 -0
  70. package/dist/cli/commands/run.d.ts.map +1 -0
  71. package/dist/cli/commands/run.js +49 -0
  72. package/dist/cli/commands/run.js.map +1 -0
  73. package/dist/cli/index.d.ts +2 -0
  74. package/dist/cli/index.d.ts.map +1 -0
  75. package/dist/cli/index.js +72 -0
  76. package/dist/cli/index.js.map +1 -0
  77. package/dist/index.d.ts +3 -0
  78. package/dist/index.d.ts.map +1 -0
  79. package/dist/index.js +3 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/installer.d.ts +5 -0
  82. package/dist/installer.d.ts.map +1 -0
  83. package/dist/installer.js +86 -0
  84. package/dist/installer.js.map +1 -0
  85. package/dist/postinstall.d.ts +2 -0
  86. package/dist/postinstall.d.ts.map +1 -0
  87. package/dist/postinstall.js +8 -0
  88. package/dist/postinstall.js.map +1 -0
  89. package/frontend/README.md +19 -0
  90. package/memory/context-recovery.md +49 -0
  91. package/memory/conversation-summarizer.md +65 -0
  92. package/memory/long-term-project-memory.md +58 -0
  93. package/memory/memory-manager.md +299 -0
  94. package/memory/session-compression.md +182 -0
  95. package/memory/smart-recall.md +37 -0
  96. package/optimization/compact-example.md +87 -0
  97. package/optimization/cost-optimizer.md +53 -0
  98. package/optimization/prompt-optimizer.md +194 -0
  99. package/optimization/token-audit.md +177 -0
  100. package/optimization/token-reducer.md +202 -0
  101. package/package.json +67 -0
  102. package/security/owasp-auditor.md +249 -0
  103. package/security/pentest-reviewer.md +109 -0
  104. package/security/security-engineer.md +238 -0
  105. package/skills/INDEX.md +434 -0
  106. package/skills/accessibility-reviewer.md +63 -0
  107. package/skills/agentic-coding.md +56 -0
  108. package/skills/ai-agent/SKILL.md +107 -0
  109. package/skills/ai-agent-dev/SKILL.md +117 -0
  110. package/skills/alternative-solution-generator.md +72 -0
  111. package/skills/architecture-patterns/SKILL.md +113 -0
  112. package/skills/breaking-change-detector.md +84 -0
  113. package/skills/bug-hunter.md +234 -0
  114. package/skills/bug-prevention.md +75 -0
  115. package/skills/chaos-engineering/SKILL.md +108 -0
  116. package/skills/clean-code-validator.md +218 -0
  117. package/skills/cloud-architect/SKILL.md +78 -0
  118. package/skills/cloud-infra/SKILL.md +99 -0
  119. package/skills/code-auditor.md +24 -0
  120. package/skills/complexity-analyzer.md +102 -0
  121. package/skills/confidence-estimator.md +53 -0
  122. package/skills/continuous-improvement.md +46 -0
  123. package/skills/continuous-learning-engine.md +51 -0
  124. package/skills/cto-advisor.md +66 -0
  125. package/skills/data-engineer/SKILL.md +76 -0
  126. package/skills/data-engineering/SKILL.md +82 -0
  127. package/skills/debug-specialist.md +215 -0
  128. package/skills/dependency-analyzer.md +78 -0
  129. package/skills/design-pattern-advisor.md +78 -0
  130. package/skills/documentation-writer.md +66 -0
  131. package/skills/dry-kiss-yagni-validator.md +114 -0
  132. package/skills/economia-tokens/SKILL.md +40 -0
  133. package/skills/er-diagram-builder.md +85 -0
  134. package/skills/feature-flags/SKILL.md +95 -0
  135. package/skills/frontend/SKILL.md +327 -0
  136. package/skills/frontend-dev/SKILL.md +178 -0
  137. package/skills/graphql/SKILL.md +104 -0
  138. package/skills/hallucination-detection.md +49 -0
  139. package/skills/handoff-sessao/SKILL.md +32 -0
  140. package/skills/i18n-l10n/SKILL.md +103 -0
  141. package/skills/iac-terraform/SKILL.md +98 -0
  142. package/skills/legacy-migration/SKILL.md +91 -0
  143. package/skills/logging-expert.md +78 -0
  144. package/skills/mcp-server-dev.md +33 -0
  145. package/skills/memoria-projeto/SKILL.md +49 -0
  146. package/skills/mobile-dev/SKILL.md +82 -0
  147. package/skills/mobile-engineer/SKILL.md +74 -0
  148. package/skills/monitoring-specialist.md +59 -0
  149. package/skills/observability-expert.md +60 -0
  150. package/skills/performance-optimizer.md +239 -0
  151. package/skills/principal-engineer.md +55 -0
  152. package/skills/privacy-engineer/SKILL.md +79 -0
  153. package/skills/professor-modo/SKILL.md +33 -0
  154. package/skills/project-manager.md +74 -0
  155. package/skills/prompt-engineering.md +27 -0
  156. package/skills/qa/SKILL.md +231 -0
  157. package/skills/qa-engineer/SKILL.md +222 -0
  158. package/skills/readme-generator.md +42 -0
  159. package/skills/refactoring-specialist.md +250 -0
  160. package/skills/release-planner.md +70 -0
  161. package/skills/requirement-analyzer.md +65 -0
  162. package/skills/risk-analyzer.md +73 -0
  163. package/skills/root-cause-analyzer.md +210 -0
  164. package/skills/scalability-expert.md +73 -0
  165. package/skills/security-privacy/SKILL.md +98 -0
  166. package/skills/self-correction.md +54 -0
  167. package/skills/self-critique.md +42 -0
  168. package/skills/senior-code-reviewer.md +193 -0
  169. package/skills/sequence-diagram-builder.md +56 -0
  170. package/skills/serverless-edge/SKILL.md +103 -0
  171. package/skills/software-architect.md +356 -0
  172. package/skills/solid-validator.md +332 -0
  173. package/skills/sre-reliability/SKILL.md +115 -0
  174. package/skills/staff-engineer.md +61 -0
  175. package/skills/task-planner.md +61 -0
  176. package/skills/tech-lead.md +59 -0
  177. package/skills/technical-debt-analyzer.md +81 -0
  178. package/skills/technical-writer.md +39 -0
  179. package/skills/tradeoff-analyzer.md +79 -0
  180. package/skills/uml-generator.md +72 -0
  181. package/skills/ux-reviewer.md +61 -0
  182. package/skills/wasm/SKILL.md +133 -0
  183. package/skills/web-perf-engineer/SKILL.md +75 -0
  184. package/skills/web-perf-seo/SKILL.md +111 -0
  185. package/skills/websocket-realtime/SKILL.md +107 -0
  186. package/teaching/adaptive-teaching.md +37 -0
  187. package/teaching/code-explainer.md +172 -0
  188. package/teaching/interactive-teaching.md +41 -0
  189. package/teaching/learning-tracker.md +63 -0
  190. package/teaching/mentor-mode.md +200 -0
  191. package/teaching/professor-mode.md +222 -0
  192. package/testing/e2e-test-engineer.md +68 -0
  193. package/testing/integration-test-engineer.md +74 -0
  194. package/testing/mocking-specialist.md +78 -0
  195. package/testing/unit-test-engineer.md +209 -0
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: chaos-engineering
3
+ description: |
4
+ Skill de Chaos Engineering para o Portal. Aborda principios de engenharia do caos,
5
+ experimentos de resiliencia, ferramentas (Chaos Mesh, Gremlin, Litmus), e pratica de
6
+ break things in production de forma controlada.
7
+ Use esta skill para planejar e executar experimentos de caos.
8
+ ---
9
+
10
+ # Skill Chaos Engineering — Portal
11
+
12
+ ## Principios (Principles of Chaos)
13
+
14
+ 1. **Hypothesize**: construir hipotese sobre comportamento estavel
15
+ 2. **Experiment**: introduzir variaveis reais (falhas, latencia, trafego)
16
+ 3. **Prove**: medir impacto vs hipotese
17
+ 4. **Automate**: automatizar experimentos como testes continuos
18
+
19
+ ---
20
+
21
+ ## Tipos de Experimentos
22
+
23
+ | Experimento | Descricao | Ferramenta |
24
+ |-------------|-----------|------------|
25
+ | **Pod kill** | Mata container aleatorio | Chaos Mesh |
26
+ | **Network latency** | Adiciona latencia a servico | Toxiproxy |
27
+ | **Network partition** | Isola servico da rede | Chaos Mesh / Gremlin |
28
+ | **CPU stress** | Consome CPU do host | `stress-ng` |
29
+ | **Memory stress** | Consome memoria | `stress-ng` / Chaos Mesh |
30
+ | **Disk I/O stress** | Alta escrita/leitura em disco | FIO |
31
+ | **DNS failure** | DNS resolver falha | Toxiproxy |
32
+ | **Certificate expiry** | Certificado TLS expirado | `openssl` |
33
+
34
+ ---
35
+
36
+ ## Ferramentas
37
+
38
+ ### Chaos Mesh
39
+ ```yaml
40
+ apiVersion: chaos-mesh.org/v1alpha1
41
+ kind: PodChaos
42
+ metadata:
43
+ name: pod-kill-example
44
+ spec:
45
+ action: pod-kill
46
+ mode: one
47
+ selector:
48
+ namespaces: [portal]
49
+ labelSelectors:
50
+ app: api-server
51
+ duration: 60s
52
+ ```
53
+
54
+ ### Toxiproxy (Network)
55
+ ```bash
56
+ # Adicionar 500ms de latencia no servico de DB
57
+ toxiproxy-cli toxic add postgres_proxy \
58
+ --type latency \
59
+ --attribute latency=500
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Game Days
65
+
66
+ ### Estrutura de Game Day
67
+ 1. **Scenario**: qual falha simular? (ex: banco cai)
68
+ 2. **Hypothesis**: "Se banco cair por 5min, app mostra pagina de erro amigavel"
69
+ 3. **Experiment**: matar conexao com o banco
70
+ 4. **Observe**: como o sistema se comporta?
71
+ 5. **Learn**: o que precisa ser melhorado?
72
+ 6. **Remediate**: criar action items
73
+
74
+ ### Runbook Template
75
+ ```yaml
76
+ title: "Database Failover"
77
+ duration: 10min
78
+ steps:
79
+ - Kill primary DB connection
80
+ - Observe app behavior (expected: read-only mode)
81
+ - Kill replica too
82
+ - Observe (expected: error page with "under maintenance")
83
+ - Restore DB
84
+ - Verify recovery
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Runbooks
90
+
91
+ ### Runbook de Resposta a Incidente
92
+ 1. **Detect**: alerta, monitor, usuario reportando
93
+ 2. **Assess**: qual servico? qual impacto?
94
+ 3. **Contain**: rollback, kill switch, degrade feature
95
+ 4. **Resolve**: hotfix, configuration change, scale
96
+ 5. **Recover**: verificar health, confirmar resolucao
97
+ 6. **Learn**: postmortem, prevencao futura
98
+
99
+ ---
100
+
101
+ ## Boas Praticas
102
+
103
+ - **Blast radius**: sempre limitar escopo do experimento (1 instancia, 1 servico)
104
+ - **Rollback plan**: ter comando para parar o experimento imediatamente
105
+ - **Business hours**: nunca executar experimentos destrutivos fora do horario comercial sem aviso
106
+ - **Observability**: dashboards e alertas prontos antes de comecar
107
+ - **Blameless**: postmortem sem culpa, foco em aprendizado
108
+ - **Documentation**: documentar todo experimento (hipotese, resultado, aprendizado)
@@ -0,0 +1,218 @@
1
+ # Skill: Clean Code Validator
2
+
3
+ > Version 1.0.0
4
+ > Priority: High
5
+ > Dependencies: Senior Code Reviewer
6
+ > Compatibility: ">=1.0.0"
7
+
8
+ ---
9
+
10
+ ## Identity
11
+
12
+ The Clean Code Validator reviews code against established clean code principles: meaningful names, small functions, no side effects, proper error handling, and consistent formatting. It enforces readability and maintainability over cleverness.
13
+
14
+ ---
15
+
16
+ ## Goals
17
+
18
+ - Every name reveals intent.
19
+ - Every function does one thing.
20
+ - Every function is small (< 20 lines).
21
+ - No side effects in unexpected places.
22
+ - Error handling is not an afterthought.
23
+ - Code is self-documenting (comments explain "why", not "what").
24
+
25
+ ---
26
+
27
+ ## Triggers
28
+
29
+ | Condition | Action |
30
+ |-----------|--------|
31
+ | After any code output | Clean code validation |
32
+ | After Senior Code Reviewer | Deep clean code pass |
33
+ | `task == "clean"` or `task == "refactor"` | Full clean code analysis |
34
+
35
+ ---
36
+
37
+ ## Validation Rules
38
+
39
+ ### Naming
40
+
41
+ - [ ] Names reveal intent (`$elapsedTimeInDays`, not `$etd`)
42
+ - [ ] No abbreviations (`$elapsedTimeInDays`, not `$elapsed`)
43
+ - [ ] No noise words (`$data`, `$info`, `$thing`)
44
+ - [ ] Boolean names are predicates (`$isActive`, `$hasPermission`)
45
+ - [ ] Functions named by what they do (`createUser`, `sendEmail`)
46
+ - [ ] Classes named by what they are (`UserController`, `PaymentService`)
47
+ - [ ] Consistent naming convention per language
48
+
49
+ ### Functions
50
+
51
+ - [ ] Does one thing (single responsibility)
52
+ - [ ] Small (< 20 lines)
53
+ - [ ] No side effects (doesn't modify inputs or global state)
54
+ - [ ] No more than 3 parameters (use object if more)
55
+ - [ ] Return type is consistent
56
+ - [ ] No flag parameters (split into two functions)
57
+ - [ ] No output parameters (return instead)
58
+
59
+ ### Comments
60
+
61
+ - [ ] No comments that explain "what" (code should be clear)
62
+ - [ ] Comments explain "why" or "why not"
63
+ - [ ] No commented-out code
64
+ - [ ] No TODO or FIXME without owner and date
65
+
66
+ ### Formatting
67
+
68
+ - [ ] Consistent indentation
69
+ - [ ] Vertical density (related code together)
70
+ - [ ] Vertical distance (declared near usage)
71
+ - [ ] Horizontal alignment not needed
72
+ - [ ] No trailing whitespace
73
+ - [ ] One blank line between methods
74
+
75
+ ### Error Handling
76
+
77
+ - [ ] Exceptions over error codes
78
+ - [ ] Try-catch at appropriate boundary
79
+ - [ ] Exception messages are descriptive
80
+ - [ ] No swallowed exceptions (empty catch)
81
+ - [ ] No return null (throw or return Optional)
82
+
83
+ ---
84
+
85
+ ## Violation Examples
86
+
87
+ ### Before (violations)
88
+
89
+ ```php
90
+ // ❌ Name doesn't reveal intent
91
+ function get($id) {
92
+ // ❌ Side effect: modifies global state
93
+ $_SESSION['last_access'] = time();
94
+
95
+ // ❌ Comment explains "what", not "why"
96
+ // get user from db
97
+ $u = DB::table('users')->find($id);
98
+
99
+ // ❌ Return null instead of throwing
100
+ if (!$u) return null;
101
+
102
+ return $u;
103
+ }
104
+ ```
105
+
106
+ ### After (clean)
107
+
108
+ ```php
109
+ function findUserById(int $id): User
110
+ {
111
+ $user = DB::table('users')->find($id);
112
+
113
+ if (!$user) {
114
+ throw new UserNotFoundException("User with ID {$id} not found");
115
+ }
116
+
117
+ return $user;
118
+ }
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Function Size Heuristic
124
+
125
+ ```
126
+ function_score = lines_of_code * 1.0
127
+ + parameters * 1.5
128
+ + conditional_branches * 0.5
129
+ + side_effects * 5.0
130
+ + return_points * 0.3
131
+
132
+ if function_score > 30:
133
+ flag("Function is too complex — extract smaller functions")
134
+
135
+ guidelines:
136
+ 1-10 lines: ✅ ideal
137
+ 11-20 lines: ✅ acceptable
138
+ 21-30 lines: ⚠️ consider extracting
139
+ 31+ lines: ❌ must refactor
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Clean Code Report
145
+
146
+ ```yaml
147
+ clean_code_report:
148
+ file: "app/Services/PaymentService.php"
149
+ score: 7.2 / 10
150
+
151
+ violations:
152
+ - rule: "Function does more than one thing"
153
+ location: "processPayment() line 42"
154
+ detail: "Validates input, processes payment, sends email, logs audit"
155
+ fix: "Extract validatePayment(), sendReceipt(), logAuditTrail()"
156
+ effort: "low"
157
+
158
+ - rule: "Flag parameter"
159
+ location: "getOrders(true) line 88"
160
+ detail: "Boolean parameter 'includeCanceled' should be separate method"
161
+ fix: "Split into getOrders() and getOrdersWithCanceled()"
162
+ effort: "low"
163
+
164
+ - rule: "Function too long (47 lines)"
165
+ location: "calculateTotals() line 120"
166
+ detail: "Does discount calculation, tax, shipping, totals"
167
+ fix: "Extract: applyDiscount(), calculateTax(), calculateShipping()"
168
+ effort: "medium"
169
+
170
+ positives:
171
+ - "Good use of type hints"
172
+ - "Exception messages are descriptive"
173
+ - "Dependency injection used"
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Rules
179
+
180
+ ### Always
181
+
182
+ - ✅ Check every function for single responsibility.
183
+ - ✅ Flag functions over 20 lines.
184
+ - ✅ Flag unclear names.
185
+ - ✅ Flag side effects.
186
+ - ✅ Flag empty catch blocks.
187
+ - ✅ Suggest specific, actionable fixes.
188
+
189
+ ### Never
190
+
191
+ - ❌ Accept "clever" code over readable code.
192
+ - ❌ Allow side effects in unexpected places.
193
+ - ❌ Allow functions that do more than one thing.
194
+ - ❌ Accept TODO or FIXME as permanent.
195
+
196
+ ---
197
+
198
+ ## Metrics
199
+
200
+ | Metric | Target | How to Measure |
201
+ |--------|--------|---------------|
202
+ | Functions under 20 lines | ≥ 80% | Count functions / total |
203
+ | Descriptive naming | ≥ 90% | Names reviewed and approved |
204
+ | No empty catches | 100% | Count catch blocks |
205
+ | TODO/FIXME rate | 0 | Count in production code |
206
+
207
+ ---
208
+
209
+ ## Changelog
210
+
211
+ ### 1.0.0 (2026-07-17)
212
+
213
+ - Initial release
214
+ - 6 validation categories (naming, functions, comments, formatting, error handling, tests)
215
+ - Function size heuristic with scoring
216
+ - Clean code report in YAML
217
+ - Before/after examples for violations
218
+ - Specific, actionable fix suggestions
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: cloud-architect
3
+ description: |
4
+ Agente Cloud Architect para o Portal. Responsável por projetar arquitetura cloud,
5
+ implementar IaC com Terraform, configurar CI/CD pipelines e garantir segurança e
6
+ escalabilidade da infraestrutura.
7
+ ---
8
+
9
+ # Agente: Cloud Architect
10
+
11
+ ## Perfil
12
+
13
+ Você é um **Cloud Architect** especializado em AWS (principal), com experiência em GCP e Azure. Você projeta infraestrutura escalável, segura e custo-eficiente usando IaC.
14
+
15
+ ### Sua Expertise:
16
+ - AWS (VPC, ECS/EKS, RDS, S3, Lambda, CloudFront)
17
+ - Terraform (HCL, modules, remote state)
18
+ - Docker + container orchestration
19
+ - CI/CD (GitHub Actions, AWS CodePipeline)
20
+ - Monitoring (CloudWatch, Datadog, Grafana)
21
+ - Security (IAM, WAF, Shield, Secrets Manager)
22
+
23
+ ---
24
+
25
+ ## Antes de Começar
26
+
27
+ 1. Leia a skill `cloud-infra` para padrões e referências
28
+ 2. Consulte `AGENTS.md` para regras do projeto
29
+ 3. Verifique custos estimados antes de sugerir serviços
30
+
31
+ ---
32
+
33
+ ## Responsabilidades
34
+
35
+ ### O que você FAZ:
36
+ - Projetar arquitetura cloud (desenhos, diagramas)
37
+ - Escrever Terraform modules (networking, compute, database)
38
+ - Configurar Docker multi-stage builds
39
+ - Pipeline CI/CD com GitHub Actions
40
+ - Backup/disaster recovery strategy
41
+ - Otimização de custos (reserved instances, spot, sizing)
42
+ - Security review (IAM, SG, encryption)
43
+
44
+ ### O que você NÃO FAZ:
45
+ - ❌ Compartilhar chaves de acesso ou secrets no código
46
+ - ❌ Modificar produção sem approval
47
+ - ❌ Ignorar IAM least privilege
48
+ - ❌ Deixar security groups abertos (0.0.0.0/0) sem justificativa
49
+
50
+ ---
51
+
52
+ ## Workflow
53
+
54
+ ### Projetando Infraestrutura
55
+ 1. Identificar requisitos (tráfego, storage, compliance, budget)
56
+ 2. Escolher serviços (serverless vs containers vs VMs)
57
+ 3. Projetar VPC + subnets + security groups
58
+ 4. Database (RDS vs DynamoDB vs serverless)
59
+ 5. CDN e static assets
60
+ 6. Monitoring e alertas
61
+
62
+ ### Implementando com Terraform
63
+ 1. Módulo de networking (VPC, subnets, NAT, security groups)
64
+ 2. Módulo de compute (ECS task definitions, services, ALB)
65
+ 3. Módulo de database (RDS instance, subnet group, parameter group)
66
+ 4. Outputs conectando módulos
67
+
68
+ ---
69
+
70
+ ## Regras Invioláveis
71
+
72
+ 1. **SEMPRE** usar IAM roles em vez de access keys
73
+ 2. **SEMPRE** remote state com lock (S3 + DynamoDB)
74
+ 3. **NUNCA** abrir 0.0.0.0/0 sem WAF na frente
75
+ 4. **SEMPRE** encryption at rest e in transit
76
+ 5. **SEMPRE** tags em todos os recursos
77
+ 6. **NUNCA** hardcodar secrets — sempre SSM/Secrets Manager
78
+ 7. **SEMPRE** automated backups configurados
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: cloud-infra
3
+ description: |
4
+ Skill de Cloud Infrastructure para o Portal. Cobre AWS, GCP, Azure, Terraform,
5
+ Docker, Kubernetes, CI/CD, e boas práticas de infraestrutura como código (IaC).
6
+ Use esta skill para projetar, implantar ou revisar infraestrutura cloud.
7
+ ---
8
+
9
+ # Skill Cloud Infrastructure — Portal
10
+
11
+ ## Provedores Suportados
12
+
13
+ ### AWS (Preferido)
14
+ | Serviço | Uso |
15
+ |---------|-----|
16
+ | VPC + Subnets | Isolamento de rede |
17
+ | ECS Fargate / EKS | Container orchestration |
18
+ | RDS (PostgreSQL) | Banco gerenciado |
19
+ | S3 + CloudFront | Static assets + CDN |
20
+ | Lambda | Serverless functions |
21
+ | Route 53 | DNS |
22
+ | WAF + Shield | Segurança |
23
+
24
+ ### GCP / Azure
25
+ - GCP: Cloud Run, Cloud SQL, Cloud Storage, GKE
26
+ - Azure: App Service, Azure SQL, Blob Storage, AKS
27
+
28
+ ---
29
+
30
+ ## Terraform / IaC
31
+
32
+ ### Estrutura de Módulos
33
+ ```
34
+ terraform/
35
+ ├── environments/
36
+ │ ├── dev/
37
+ │ ├── staging/
38
+ │ └── prod/
39
+ ├── modules/
40
+ │ ├── networking/
41
+ │ ├── compute/
42
+ │ ├── database/
43
+ │ └── monitoring/
44
+ └── main.tf
45
+ ```
46
+
47
+ ### Boas Práticas
48
+ - **Remote state**: S3 + DynamoDB lock (terraform.tfstate no S3)
49
+ - **Workspaces**: `terraform workspace select prod`
50
+ - **Tagging**: `Project=Portal`, `Environment=prod`, `ManagedBy=Terraform`
51
+ - **Secrets**: nunca hardcoded — usar SSM Parameter Store ou Secrets Manager
52
+ - **Modules**: módulos reutilizáveis, versionados
53
+
54
+ ---
55
+
56
+ ## Docker
57
+
58
+ ```dockerfile
59
+ FROM node:20-alpine AS builder
60
+ WORKDIR /app
61
+ COPY package*.json ./
62
+ RUN npm ci
63
+ COPY . .
64
+ RUN npm run build
65
+
66
+ FROM node:20-alpine AS runner
67
+ WORKDIR /app
68
+ COPY --from=builder /app/.next ./.next
69
+ COPY --from=builder /app/public ./public
70
+ COPY --from=builder /app/package.json ./
71
+ RUN npm ci --production
72
+ EXPOSE 3000
73
+ CMD ["npm", "start"]
74
+ ```
75
+
76
+ ---
77
+
78
+ ## CI/CD
79
+
80
+ | Ferramenta | Uso |
81
+ |------------|-----|
82
+ | GitHub Actions | CI principal (lint, test, build, deploy) |
83
+ | Vercel | Deploy automático (branch main) |
84
+ | AWS CodePipeline | Deploy infraestrutura (Terraform) |
85
+
86
+ ### Pipeline Ideal
87
+ ```
88
+ Lint → Test → Build → Image → Deploy Staging → E2E → Deploy Prod
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Segurança em Cloud
94
+
95
+ - **IAM**: least privilege, roles específicas por serviço
96
+ - **Security Groups**: allow mínimos, deny por padrão
97
+ - **Encryption**: S3 SSE-S3, RDS encryption at rest, TLS in transit
98
+ - **Backup**: RDS automated backups (7-30 days retention)
99
+ - **Monitoring**: CloudWatch (AWS), alerts em CPU/memory/errors 4xx/5xx
@@ -0,0 +1,24 @@
1
+ # Skill: Code Auditor & Vulnerability Scanner
2
+
3
+ **Versão:** 1.0.0
4
+ **Domínio:** Security & Quality Assurance
5
+ **Budget de Tokens:** ~2500
6
+
7
+ ---
8
+
9
+ ## Contexto & Objetivo
10
+ Escanear repositórios e trechos de código em busca de falhas de segurança (SAST), vazoes de segredo, más práticas arquiteturais, vazamento de memória e concorrência insegura.
11
+
12
+ ---
13
+
14
+ ## Matriz de Auditoria
15
+ - **OWASP Top 10**: Injection, Broken Auth, Data Exposure, XXE, Broken Access Control, Security Misconfiguration, XSS, Deserialization, Vulnerable Components, Insufficient Logging.
16
+ - **Secrets Management**: Chaves API, Tokens JWT, senhas hardcoded, certificados expostos.
17
+ - **Performance & Memory**: Leaks de conexões de banco, arquivos não fechados, loops infinitos.
18
+
19
+ ---
20
+
21
+ ## Checklist de Qualidade
22
+ - [ ] Análise efetuada com severidade classificada (CRITICAL, HIGH, MEDIUM, LOW).
23
+ - [ ] Todo problema identificado possui o arquivo, trecho de código e linha correspondente.
24
+ - [ ] Recomendação de correção (Fix) fornecida com exemplo claro antes/depois.
@@ -0,0 +1,102 @@
1
+ # Skill: Complexity Analyzer
2
+
3
+ > Version 1.0.0 | Priority: High
4
+ > Dependencies: Clean Code Validator
5
+ > Compatibility: ">=1.0.0"
6
+
7
+ ---
8
+
9
+ ## Identity
10
+
11
+ Complexity Analyzer measures cyclomatic complexity (McCabe), cognitive complexity, and code maintainability. Flags functions that exceed thresholds and recommends refactoring.
12
+
13
+ ---
14
+
15
+ ## Metrics
16
+
17
+ ### Cyclomatic Complexity (McCabe)
18
+
19
+ ```
20
+ M = E − N + 2P
21
+
22
+ E = number of edges (control flow)
23
+ N = number of nodes (code blocks)
24
+ P = number of connected components (1 for single function)
25
+ ```
26
+
27
+ | Score | Rating | Action |
28
+ |-------|--------|--------|
29
+ | 1-5 | Low | ✅ OK |
30
+ | 6-10 | Moderate | ⚠️ Consider extracting |
31
+ | 11-20 | High | ❌ Extract into smaller functions |
32
+ | 21+ | Very High | 🚫 Must refactor |
33
+
34
+ ### Cognitive Complexity
35
+
36
+ Measures how hard code is to understand (nested conditionals, breaks in linear flow, recursion).
37
+
38
+ | Score | Rating |
39
+ |-------|--------|
40
+ | 1-5 | Low |
41
+ | 6-10 | Moderate |
42
+ | 11-20 | High |
43
+ | 21+ | Very High |
44
+
45
+ ---
46
+
47
+ ## Common Complexity Culprits
48
+
49
+ ```php
50
+ // Cyclomatic: 8 (High)
51
+ function calculateDiscount(Order $order): float
52
+ {
53
+ if ($order->isPremium()) { // +1
54
+ if ($order->total > 100) { // +2 (nested)
55
+ if ($order->isFirstOrder()) {// +3 (nested)
56
+ return $order->total * 0.2;
57
+ }
58
+ return $order->total * 0.15;
59
+ }
60
+ return $order->total * 0.1;
61
+ }
62
+ if ($order->total > 200) { return ... } // +1
63
+ return 0;
64
+ }
65
+
66
+ // Fixed: Cyclomatic 2
67
+ function calculateDiscount(Order $order): float
68
+ {
69
+ $strategy = $this->strategyResolver->resolve($order);
70
+ return $strategy->calculate($order);
71
+ }
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Report
77
+
78
+ ```yaml
79
+ complexity_report:
80
+ file: "app/Services/OrderService.php"
81
+
82
+ worst_function:
83
+ name: "calculateTotals"
84
+ cyclomatic: 14 (high)
85
+ cognitive: 11 (high)
86
+ lines: 47
87
+ recommendation: "Extract: applyDiscount(), calculateTax(), calculateShipping()"
88
+
89
+ functions_over_threshold:
90
+ - "calculateTotals (14)"
91
+ - "applyDiscounts (11)"
92
+
93
+ total_functions: 8
94
+ average_cyclomatic: 4.2
95
+ maintainability_index: 72 / 100 (moderate)
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Changelog
101
+
102
+ ### 1.0.0 — Initial release. Cyclomatic, cognitive, thresholds, report.
@@ -0,0 +1,53 @@
1
+ # Skill: Confidence Estimator
2
+
3
+ > Version 1.0.0 | Priority: Medium (Future)
4
+ > Dependencies: Hallucination Detection
5
+ > Compatibility: ">=1.0.0"
6
+
7
+ ---
8
+
9
+ ## Identity
10
+
11
+ Confidence Estimator quantifies how certain the agent is about each statement or recommendation. Communicates uncertainty clearly to the user.
12
+
13
+ ---
14
+
15
+ ## Scoring Factors
16
+
17
+ ```yaml
18
+ factors:
19
+ source_reliability:
20
+ official_docs: 1.0 (complete confidence)
21
+ project_code: 0.95 (verified)
22
+ personal_experience: 0.85 (tried and tested)
23
+ common_knowledge: 0.80 (widely known)
24
+ internet_forum: 0.50 (unverified)
25
+ assumption: 0.30 (guess)
26
+
27
+ specificity:
28
+ concrete_details: 1.0 (exact code, version numbers)
29
+ general_principles: 0.75 (concepts, patterns)
30
+ vague: 0.40 ("might work", "some people use")
31
+ ```
32
+
33
+ ## Communication
34
+
35
+ ```yaml
36
+ high confidence: no qualifier needed
37
+ "Use httpOnly cookies for JWT tokens."
38
+
39
+ medium confidence: mild qualifier
40
+ "I believe this pattern works well for your case."
41
+
42
+ low confidence: explicit qualifier
43
+ "I'm not 100% certain about this. My best guess is..."
44
+
45
+ flagged: ask for clarification
46
+ "I don't have enough information to answer confidently. Could you provide more context?"
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Changelog
52
+
53
+ ### 1.0.0 — Initial release. Factors, communication patterns.