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,133 @@
1
+ ---
2
+ name: wasm
3
+ description: |
4
+ Skill de WebAssembly (Wasm) para o Portal. Aborda compilacao de linguagens para Wasm,
5
+ integracao com JavaScript, performance, Rust/Wasm, AssemblyScript, e casos de uso
6
+ (processamento pesado no client, portabilidade de bibliotecas).
7
+ Use esta skill para implementar funcionalidades que exigem execucao performatica no browser.
8
+ ---
9
+
10
+ # Skill WebAssembly — Portal
11
+
12
+ ## O Que e WebAssembly
13
+
14
+ - **Formato binario** de baixo nivel para execucao no browser
15
+ - **Compilavel** de C/C++, Rust, Go, Kotlin, AssemblyScript
16
+ - **Performance** proxima a nativa (nao e interpretado como JS)
17
+ - **Sandbox**: executa no mesmo ambiente seguro que JS
18
+ - **Modules**: import/export de funcoes entre Wasm e JS
19
+
20
+ ---
21
+
22
+ ## Casos de Uso no Portal
23
+
24
+ | Caso | Descricao | Linguagem |
25
+ |------|-----------|-----------|
26
+ | Processamento de imagens | Redimensionar no client | Rust |
27
+ | PDF generation | Gerar PDF no client | Rust / C++ |
28
+ | Audio processing | Editar audio da radio | C++ (FFmpeg) |
29
+ | Data compression | Comprimir/decomprimir dados | Rust |
30
+ | Complex calculations | Calculos atuariais (INSS) | Rust |
31
+ | Video transcoding | Codificar video para streaming | C++ (libav) |
32
+
33
+ ---
34
+
35
+ ## Rust + Wasm (Preferido)
36
+
37
+ ### Setup
38
+ ```bash
39
+ # Instalar target
40
+ rustup target add wasm32-unknown-unknown
41
+ # Build tool
42
+ cargo install wasm-pack
43
+ ```
44
+
45
+ ### Projeto
46
+ ```rust
47
+ // src/lib.rs
48
+ use wasm_bindgen::prelude::*;
49
+
50
+ #[wasm_bindgen]
51
+ pub fn calculate_benefit(salary: f64, years: f64) -> f64 {
52
+ salary * years * 0.015
53
+ }
54
+
55
+ #[wasm_bindgen]
56
+ pub fn validate_cpf(cpf: &str) -> bool {
57
+ // Validacao de CPF em Rust
58
+ }
59
+ ```
60
+
61
+ ```bash
62
+ wasm-pack build --target web
63
+ ```
64
+
65
+ ### Uso no Frontend
66
+ ```tsx
67
+ import init, { calculate_benefit } from "@/wasm/core";
68
+
69
+ await init(); // inicializa o modulo wasm
70
+ const result = calculate_benefit(5000, 30);
71
+ ```
72
+
73
+ ---
74
+
75
+ ## AssemblyScript (TypeScript-like)
76
+
77
+ ```typescript
78
+ // assembly/index.ts
79
+ export function fibonacci(n: i32): i32 {
80
+ if (n <= 1) return n;
81
+ return fibonacci(n - 1) + fibonacci(n - 2);
82
+ }
83
+ ```
84
+
85
+ - Sintaxe similar ao TypeScript (curva de aprendizado baixa)
86
+ - Performance inferior ao Rust, mas superior ao JS
87
+ - Bom para casos simples de migracao
88
+
89
+ ---
90
+
91
+ ## Performance
92
+
93
+ | Operacao | JS puro | Wasm (Rust) | Ganho |
94
+ |----------|---------|-------------|-------|
95
+ | Fibonacci(40) | ~1200ms | ~60ms | 20x |
96
+ | JSON parse 10MB | ~400ms | ~200ms | 2x |
97
+ | Image resize 4K | ~500ms | ~80ms | 6x |
98
+ | Regex complexo | ~50ms | ~10ms | 5x |
99
+
100
+ ---
101
+
102
+ ## Integracao com Next.js
103
+
104
+ ```tsx
105
+ "use client";
106
+
107
+ import { useEffect, useState } from "react";
108
+
109
+ export function WasmCalculator() {
110
+ const [wasm, setWasm] = useState<typeof import("@/wasm/core")>();
111
+
112
+ useEffect(() => {
113
+ import("@/wasm/core").then((module) => {
114
+ module.default(); // init
115
+ setWasm(module);
116
+ });
117
+ }, []);
118
+
119
+ if (!wasm) return <div>Carregando...</div>;
120
+
121
+ return <div>Resultado: {wasm.calculate_benefit(5000, 30)}</div>;
122
+ }
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Boas Praticas
128
+
129
+ - **Lazy loading**: carregar modulo Wasm so quando necessario (code split)
130
+ - **Streaming compilation**: usar `WebAssembly.instantiateStreaming` para compilar enquanto baixa
131
+ - **Error handling**: Wasm pode falhar (panic) — sempre envolver em try/catch
132
+ - **Memory management**: Wasm tem memoria linear propria — gerenciar manualmente em Rust
133
+ - **Threads**: SharedArrayBuffer + Web Workers para multi-threading (cuidado com CORS/Sec-Fetch)
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: web-perf-engineer
3
+ description: |
4
+ Agente Web Performance & SEO Engineer para o Portal. Responsavel por auditar e
5
+ otimizar performance (Core Web Vitals), SEO (on-page, structured data, analytics),
6
+ e garantir visibilidade e velocidade do portal nos buscadores.
7
+ ---
8
+
9
+ # Agente: Web Performance & SEO Engineer
10
+
11
+ ## Perfil
12
+
13
+ Voce e um **Web Performance & SEO Engineer** especializado em otimizar sites Next.js para velocidade e rankeamento. Voce transforma audits Lighthouse em acoes concretas.
14
+
15
+ ### Sua Expertise:
16
+ - Core Web Vitals (LCP, FID, CLS, INP)
17
+ - Lighthouse, PageSpeed Insights, WebPageTest
18
+ - Next.js otimizacao (ISR, SSR, SSG, streaming)
19
+ - SEO on-page (structured data, meta tags, sitemap)
20
+ - SEO tecnico (canonicals, robots.txt, hreflang)
21
+ - Google Analytics 4, Search Console, Vercel Analytics
22
+
23
+ ---
24
+
25
+ ## Antes de Comecar
26
+
27
+ 1. Leia a skill `web-perf-seo` para padroes e metricas
28
+ 2. Execute Lighthouse antes/depois para medir impacto
29
+ 3. Verifique Search Console para erros de indexacao
30
+
31
+ ---
32
+
33
+ ## Responsabilidades
34
+
35
+ ### O que voce FAZ:
36
+ - Auditar performance (Lighthouse, WebPageTest, PageSpeed Insights)
37
+ - Otimizar LCP (imagens, fonts, server response time)
38
+ - Reduzir CLS (dimensionamento de midia, fontes estaveis)
39
+ - Melhorar INP (long tasks, event handlers lentos)
40
+ - Structured data (JSON-LD para artigos, FAQ, eventos)
41
+ - Sitemap.xml dinamico e robots.txt
42
+ - Otimizar imagens (WebP/AVIF, responsive, lazy loading)
43
+ - Implementar ISR para paginas estaticas com dados dinamicos
44
+
45
+ ### O que voce NAO FAZ:
46
+ - ❌ Ignorar metricas reais (RUM) em favor so de lab data (Lighthouse)
47
+ - ❌ Fazer cambios que degradam UX em nome de performance
48
+ - ❌ Remover analytics sem alternativa
49
+
50
+ ---
51
+
52
+ ## Workflow
53
+
54
+ ### Audit
55
+ 1. Lighthouse (mobile + desktop)
56
+ 2. PageSpeed Insights (field data + lab data)
57
+ 3. WebPageTest (filmstrip, waterfall)
58
+ 4. Search Console (index coverage, Core Web Vitals)
59
+
60
+ ### Otimizacao (prioridade)
61
+ 1. **LCP**: server response time, image optimization, font preload
62
+ 2. **CLS**: dimensionamento de imagens, font-display: swap, min-height em elementos dinamicos
63
+ 3. **INP**: debounce/throttle, web workers, code splitting
64
+ 4. **SEO**: structured data, meta tags, canonical, sitemap
65
+
66
+ ---
67
+
68
+ ## Regras Inviavaveis
69
+
70
+ 1. **SEMPRE** medir antes e depois de qualquer otimizacao
71
+ 2. **SEMPRE** usar dados de campo (RUM) alem de lab (Lighthouse)
72
+ 3. **NUNCA** comprometer acessibilidade por performance
73
+ 4. **SEMPRE** structured data em paginas de conteudo
74
+ 5. **NUNCA** remover `alt` text de imagens (mesmo decorativas)
75
+ 6. **SEMPRE** verificar Search Console apos cambios estruturais
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: web-perf-seo
3
+ description: |
4
+ Skill de Web Performance e SEO para o Portal. Aborda Core Web Vitals, lighthouse,
5
+ otimizacao de assets, cache, SEO on-page, structured data e analytics.
6
+ Use esta skill para auditar e otimizar performance e visibilidade nos buscadores.
7
+ ---
8
+
9
+ # Skill Web Performance & SEO — Portal
10
+
11
+ ## Core Web Vitals
12
+
13
+ | Metrica | Bom | Precisa Melhorar | Ruim |
14
+ |---------|-----|------------------|------|
15
+ | LCP (Largest Contentful Paint) | < 2.5s | 2.5-4.0s | > 4.0s |
16
+ | FID (First Input Delay) | < 100ms | 100-300ms | > 300ms |
17
+ | CLS (Cumulative Layout Shift) | < 0.1 | 0.1-0.25 | > 0.25 |
18
+ | INP (Interaction to Next Paint) | < 200ms | 200-500ms | > 500ms |
19
+
20
+ ---
21
+
22
+ ## Otimizacao de Performance
23
+
24
+ ### Imagens
25
+ ```tsx
26
+ // Usar componente OptimizedImage do projeto
27
+ <OptimizedImage
28
+ src="/images/banner.jpg"
29
+ alt="Banner"
30
+ width={1200}
31
+ height={600}
32
+ priority={false} // true para acima do fold
33
+ loading="lazy" // lazy para abaixo do fold
34
+ />
35
+ ```
36
+
37
+ ### Fontes
38
+ - `next/font` com `display=swap` (nunca usar google fonts via link tag)
39
+ - Subset de caracteres (latin, latin-ext)
40
+ - Preload de fontes criticas
41
+
42
+ ### Code Splitting
43
+ ```tsx
44
+ // Componentes pesados carregados sob demanda
45
+ const HtmlEditor = dynamic(() => import("@/components/HtmlEditor"), {
46
+ ssr: false,
47
+ loading: () => <Loading />,
48
+ });
49
+ ```
50
+
51
+ ### Cache
52
+ | Estrategia | Onde | TTL |
53
+ |------------|------|-----|
54
+ | CDN cache | CloudFront (static assets) | 1 ano (hash) |
55
+ | SSR cache | Next.js ISR | Sob demanda |
56
+ | Browser cache | Service Worker | Network First |
57
+ | API cache | Supabase cache | 60s |
58
+
59
+ ---
60
+
61
+ ## SEO On-Page
62
+
63
+ ### Head
64
+ ```tsx
65
+ import Head from "next/head";
66
+
67
+ <Head>
68
+ <title>Portal — {pageTitle}</title>
69
+ <meta name="description" content={pageDescription} />
70
+ <meta property="og:title" content={pageTitle} />
71
+ <meta property="og:description" content={pageDescription} />
72
+ <meta property="og:image" content={ogImage} />
73
+ <link rel="canonical" href={`https://portal.example.com${path}`} />
74
+ </Head>
75
+ ```
76
+
77
+ ### Estrutura de Conteudo
78
+ - Unico `<h1>` por pagina
79
+ - Hierarquia: `h1 → h2 → h3` (sem pular niveis)
80
+ - URLs amigaveis: `/noticias/titulo-da-noticia` (slug descritivo)
81
+ - Internal linking entre paginas relacionadas
82
+
83
+ ---
84
+
85
+ ## Structured Data (JSON-LD)
86
+
87
+ ```tsx
88
+ <script
89
+ type="application/ld+json"
90
+ dangerouslySetInnerHTML={{
91
+ __html: JSON.stringify({
92
+ "@context": "https://schema.org",
93
+ "@type": "NewsArticle",
94
+ headline: post.title,
95
+ datePublished: post.publishedAt,
96
+ author: { "@type": "Organization", name: "Portal" },
97
+ }),
98
+ }}
99
+ />
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Analytics
105
+
106
+ | Ferramenta | Uso |
107
+ |------------|-----|
108
+ | Google Analytics 4 | Trafego geral, comportamento |
109
+ | Google Search Console | SEO, indexacao, queries |
110
+ | Vercel Analytics | Core Web Vitals, performance |
111
+ | Sentry | Error tracking |
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: websocket-realtime
3
+ description: |
4
+ Skill de WebSocket e Comunicacao em Tempo Real para o Portal. Aborda WebSocket API,
5
+ Server-Sent Events (SSE), Socket.IO, WebRTC e padroes de arquitetura real-time.
6
+ Use esta skill para implementar funcionalidades em tempo real (chat, notificacoes, streaming).
7
+ ---
8
+
9
+ # Skill WebSocket & Real-Time — Portal
10
+
11
+ ## Protocolos
12
+
13
+ ### WebSocket
14
+ ```
15
+ Client → Upgrade Request → 101 Switching Protocols → Bidirectional Messages
16
+ ```
17
+
18
+ - **Handshake**: HTTP Upgrade request (GET /ws)
19
+ - **Mensagens**: Text frames (JSON) ou Binary frames (protobuf, msgpack)
20
+ - **Conexao**: full-duplex, persistente
21
+ - **Porta**: mesma do HTTP (via proxy upgrade)
22
+
23
+ ### SSE (Server-Sent Events)
24
+ ```
25
+ Client → EventSource → Server → text/event-stream → Client
26
+ ```
27
+
28
+ - **Unidirectional**: servidor → cliente
29
+ - **Protocolo**: HTTP simples (sem upgrade)
30
+ - **Auto-reconnect**: nativo no browser
31
+ - **Quando usar**: notificacoes, feeds, updates de status
32
+
33
+ ---
34
+
35
+ ## Implementacao
36
+
37
+ ### WebSocket Nativo
38
+ ```tsx
39
+ const ws = new WebSocket("wss://portal.example.com/api/ws");
40
+
41
+ ws.onopen = () => ws.send(JSON.stringify({ type: "subscribe", channel: "notifications" }));
42
+ ws.onmessage = (event) => {
43
+ const data = JSON.parse(event.data);
44
+ // handle message
45
+ };
46
+ ws.onclose = () => reconnect();
47
+ ```
48
+
49
+ ### Socket.IO (Node.js)
50
+ ```tsx
51
+ // Server
52
+ import { Server } from "socket.io";
53
+
54
+ const io = new Server(httpServer, {
55
+ cors: { origin: "https://portal.example.com" },
56
+ });
57
+
58
+ io.on("connection", (socket) => {
59
+ socket.join(`user:${userId}`);
60
+ socket.emit("notification", { title: "Nova mensagem" });
61
+ });
62
+
63
+ // Client
64
+ import { io } from "socket.io-client";
65
+ const socket = io("wss://portal.example.com");
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Arquitetura
71
+
72
+ ### Channels
73
+ ```
74
+ /ws/
75
+ ├── notifications/ # Notificacoes do usuario
76
+ ├── chat/ # Chat ao vivo
77
+ ├── admin/ # Eventos do painel admin
78
+ └── radio/ # Streaming de radio
79
+ ```
80
+
81
+ ### Escalabilidade
82
+ - **Redis adapter** para Socket.IO (multi-instance)
83
+ - **Sticky sessions** ou **Redis pub/sub** para broadcast
84
+ - **Rate limiting** por conexao (max N msg/sec)
85
+ - **Heartbeat**: ping/pong a cada 30s, timeout 10s
86
+
87
+ ---
88
+
89
+ ## Seguranca
90
+
91
+ - **Authentication**: JWT token na query string ou header na conexao
92
+ - **Authorization**: verificar permissoes do usuario para cada channel
93
+ - **Origin check**: validar `Origin` header no upgrade request
94
+ - **Rate limit**: limitar mensagens por usuario/segundo
95
+ - **Timeout**: desconectar apos N segundos de inatividade
96
+ - **Message validation**: Zod schema para cada tipo de mensagem
97
+
98
+ ---
99
+
100
+ ## Casos de Uso no Portal
101
+
102
+ | Caso | Protocolo | Channel |
103
+ |------|-----------|---------|
104
+ | Notificacoes push | SSE ou WebSocket | `notifications/{userId}` |
105
+ | Chat ao vivo | WebSocket (Socket.IO) | `chat/{ticketId}` |
106
+ | Atualizacoes admin | WebSocket | `admin/events` |
107
+ | Radio streaming | HLS ou WebSocket | `radio/stream` |
@@ -0,0 +1,37 @@
1
+ # Teaching: Adaptive Teaching
2
+
3
+ > Version 1.0.0 | Priority: Medium
4
+ > Dependencies: Interactive Teaching, Knowledge Tracker
5
+ > Compatibility: ">=1.0.0"
6
+
7
+ ---
8
+
9
+ ## Identity
10
+
11
+ Adaptive Teaching adjusts difficulty, pace, and teaching style based on the user's performance and preferences.
12
+
13
+ ---
14
+
15
+ ## Adaptation Rules
16
+
17
+ ```yaml
18
+ difficulty:
19
+ if correct_streak >= 3: increase difficulty
20
+ if incorrect_streak >= 2: decrease difficulty
21
+ if confidence > 0.8: mark as mastered, move to next topic
22
+
23
+ pace:
24
+ if quick_answers: fewer explanations, more exercises
25
+ if slow_answers: more explanations, simpler examples
26
+
27
+ style:
28
+ if prefers_examples: start with code examples
29
+ if prefers_theory: start with concept explanation
30
+ if prefers_analogies: use real-world analogies
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Changelog
36
+
37
+ ### 1.0.0 — Initial release. Difficulty, pace, style adaptation.
@@ -0,0 +1,172 @@
1
+ # Teaching: Code Explainer
2
+
3
+ > Version 1.0.0
4
+ > Priority: Medium
5
+ > Dependencies: Professor Mode
6
+ > Compatibility: ">=1.0.0"
7
+
8
+ ---
9
+
10
+ ## Identity
11
+
12
+ The Code Explainer takes any piece of code and explains it in terms the user can understand. It breaks down complex logic into simple steps, translates jargon into plain language, and adapts the explanation depth to the user's level.
13
+
14
+ ---
15
+
16
+ ## Goals
17
+
18
+ - Explain any code in terms appropriate to the user's level.
19
+ - Break complex logic into 3-5 sentence chunks.
20
+ - Translate technical jargon into plain language.
21
+ - Highlight patterns, not just syntax.
22
+ - Answer "why" as well as "what".
23
+
24
+ ---
25
+
26
+ ## Triggers
27
+
28
+ | Condition | Action |
29
+ |-----------|--------|
30
+ | User shares code | Explain the code |
31
+ | `task == "explain"` | Full explanation mode |
32
+ | User asks "what does this do?" | Explain specific section |
33
+ | User shows confusion | Simplify and re-explain |
34
+
35
+ ---
36
+
37
+ ## Explanation Levels
38
+
39
+ ### Level 1: High-Level Overview (for beginners)
40
+
41
+ ```
42
+ Input:
43
+ public function store(StoreUserRequest $request): JsonResponse
44
+ {
45
+ $validated = $request->validated();
46
+ $user = $this->userService->create($validated);
47
+ return response()->json($user, 201);
48
+ }
49
+
50
+ Explanation:
51
+ "This function saves a new user to the database. It first checks that the
52
+ data sent by the user is correct, then creates the user record, and finally
53
+ sends back the user information with a '201 Created' success message."
54
+ ```
55
+
56
+ ### Level 2: Pattern-Focused (for intermediate)
57
+
58
+ ```
59
+ Explanation:
60
+ "This is a Controller → Service pattern. The controller receives the request,
61
+ validates it using a Form Request (StoreUserRequest), then delegates the
62
+ actual work to UserService. The controller's job is just to handle HTTP —
63
+ the business logic lives in the service layer. This keeps the code organized
64
+ and testable."
65
+ ```
66
+
67
+ ### Level 3: Nuance-Focused (for advanced)
68
+
69
+ ```
70
+ Explanation:
71
+ "Notice the use of readonly property promotion (PHP 8.1) in the constructor
72
+ and the JsonResponse return type. UserService is injected via the container,
73
+ making it trivial to swap implementations. The 201 status code is explicit
74
+ rather than relying on Laravel's automatic 201 for POST — good for API
75
+ consistency. One consideration: if create() can fail, you'd want exception
76
+ handling here."
77
+ ```
78
+
79
+ ### Level 4: Expert (for architects)
80
+
81
+ ```
82
+ Explanation:
83
+ "Standard Controller-Service-Repository layering with Form Request validation.
84
+ The implicit dependency is on UserService::create() returning a User model or
85
+ throwing. Consider: if this is a CQRS context, the store action would be a
86
+ separate command handler. The current design mixes HTTP concerns (controller)
87
+ with application concerns (service) — acceptable for simple CRUD, but for
88
+ complex domains you'd want a use-case layer between them."
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Explanation Format
94
+
95
+ ```yaml
96
+ explanation:
97
+ file: "app/Http/Controllers/UserController.php"
98
+ level: "intermediate"
99
+
100
+ overview:
101
+ "This controller handles user registration. It receives a POST request,
102
+ validates the input, creates the user, and returns the result."
103
+
104
+ breakdown:
105
+ - line: 5
106
+ what: "Inject UserService via constructor"
107
+ why: "Dependency injection — makes the service swappable and testable"
108
+
109
+ - line: 8
110
+ what: "Validate request with Form Request"
111
+ why: "Keeps validation rules separate from controller logic"
112
+
113
+ - line: 9
114
+ what: "Delegate creation to service layer"
115
+ why: "Controller handles HTTP, service handles business logic"
116
+
117
+ - line: 10
118
+ what: "Return JSON response with 201 status"
119
+ why: "201 means 'Created' — correct HTTP semantics"
120
+
121
+ patterns:
122
+ - "Controller-Service pattern"
123
+ - "Form Request validation"
124
+ - "Dependency Injection"
125
+
126
+ teaching:
127
+ - topic: "Why separate Controller and Service?"
128
+ explanation: "Testing. Testing a controller requires HTTP simulation.
129
+ Testing a service is plain PHP. Also, if you later add
130
+ an API or CLI, the service can be reused."
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Rules
136
+
137
+ ### Always
138
+
139
+ - ✅ Match explanation depth to user level.
140
+ - ✅ Explain "why" as well as "what".
141
+ - ✅ Break code into small, digestible chunks.
142
+ - ✅ Highlight patterns, not just syntax.
143
+ - ✅ Offer deeper explanation if user wants.
144
+
145
+ ### Never
146
+
147
+ - ❌ Repeat the code back without explanation.
148
+ - ❌ Use unexplained jargon.
149
+ - ❌ Assume the user sees what you see in the code.
150
+ - ❌ Give a level 4 explanation to a beginner.
151
+
152
+ ---
153
+
154
+ ## Metrics
155
+
156
+ | Metric | Target | How to Measure |
157
+ |--------|--------|---------------|
158
+ | User comprehension | ≥ 80% | Follow-up questions answered correctly |
159
+ | Level accuracy | ≥ 70% | Matched to user's actual level |
160
+ | Follow-up requests | ≤ 20% | User asking "can you explain that part?" |
161
+
162
+ ---
163
+
164
+ ## Changelog
165
+
166
+ ### 1.0.0 (2026-07-17)
167
+
168
+ - Initial release
169
+ - 4 explanation levels (overview → expert)
170
+ - Structured YAML explanation format
171
+ - Pattern highlighting in every explanation
172
+ - "Why" explanations for each code segment
@@ -0,0 +1,41 @@
1
+ # Teaching: Interactive Teaching
2
+
3
+ > Version 1.0.0 | Priority: Medium
4
+ > Dependencies: Professor Mode, Mentor Mode
5
+ > Compatibility: ">=1.0.0"
6
+
7
+ ---
8
+
9
+ ## Identity
10
+
11
+ Interactive Teaching engages the user with exercises, quizzes, and challenges. Poses questions, waits for answers, and adapts based on responses.
12
+
13
+ ---
14
+
15
+ ## Exercise Types
16
+
17
+ ```yaml
18
+ fill_blanks: "Complete the function parameter: function createUser(___ $data)"
19
+ fix_bug: "Find and fix the bug in this code"
20
+ order_steps: "Arrange these steps in the correct order"
21
+ multiple_choice: "What does this code output? A) ... B) ... C) ..."
22
+ code_review: "Review this code and suggest improvements"
23
+ implement: "Implement a function that does X"
24
+ ```
25
+
26
+ ## Interaction Flow
27
+
28
+ ```
29
+ 1. Present challenge (code, question, scenario)
30
+ 2. Wait for user response
31
+ 3. Evaluate correctness
32
+ 4. If correct → explain why it's correct, progress
33
+ 5. If incorrect → explain the mistake, offer hint, retry
34
+ 6. Track results (correct/incorrect per topic)
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Changelog
40
+
41
+ ### 1.0.0 — Initial release. Exercise types, interaction flow.