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.
- package/AGENTS.md +53 -0
- package/CHANGELOG.md +198 -0
- package/LICENSE +21 -0
- package/README.md +96 -0
- package/ROADMAP.md +131 -0
- package/RULES.md +202 -0
- package/SYSTEM.md +201 -0
- package/agents/INDEX.md +40 -0
- package/agents/architect-agent.json +15 -0
- package/agents/bug-hunter-agent.json +14 -0
- package/agents/database-agent.json +14 -0
- package/agents/devops-agent.json +15 -0
- package/agents/docs-agent.json +15 -0
- package/agents/pm-agent.json +14 -0
- package/agents/professor-agent.json +15 -0
- package/agents/security-agent.json +14 -0
- package/agents/senior-engineer-agent.json +16 -0
- package/agents/techlead-agent.json +15 -0
- package/architecture/clean-architecture.md +98 -0
- package/architecture/cqrs-specialist.md +102 -0
- package/architecture/ddd-specialist.md +97 -0
- package/architecture/event-driven-architect.md +79 -0
- package/architecture/hexagonal-architecture.md +96 -0
- package/architecture/microservices-expert.md +83 -0
- package/architecture/monolith-expert.md +67 -0
- package/architecture/repository-pattern.md +73 -0
- package/architecture/unit-of-work.md +92 -0
- package/backend/README.md +29 -0
- package/bin/nexus.js +8 -0
- package/core/compression-engine.md +194 -0
- package/core/context-engine.md +239 -0
- package/core/decision-engine.md +377 -0
- package/core/evolution-engine.md +169 -0
- package/core/planning-engine.md +201 -0
- package/core/quality-gates.md +233 -0
- package/core/reflection-engine.md +182 -0
- package/core/skill-resolver.json +169 -0
- package/core/token-manager.md +152 -0
- package/database/database-engineer.md +244 -0
- package/database/mysql-specialist.md +61 -0
- package/database/postgresql-specialist.md +70 -0
- package/database/redis-specialist.md +73 -0
- package/database/sql-optimizer.md +95 -0
- package/database/sqlserver-specialist.md +69 -0
- package/devops/ci-cd-specialist.md +101 -0
- package/devops/devops-engineer.md +358 -0
- package/devops/docker-expert.md +105 -0
- package/devops/git-expert.md +76 -0
- package/devops/git-flow-specialist.md +71 -0
- package/devops/kubernetes-specialist.md +84 -0
- package/devops/linux-specialist.md +82 -0
- package/devops/windows-specialist.md +43 -0
- package/dist/cli/commands/compile.d.ts +2 -0
- package/dist/cli/commands/compile.d.ts.map +1 -0
- package/dist/cli/commands/compile.js +44 -0
- package/dist/cli/commands/compile.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +2 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +88 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +26 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/list.d.ts +2 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +50 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/run.d.ts +2 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +49 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +72 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/installer.d.ts +5 -0
- package/dist/installer.d.ts.map +1 -0
- package/dist/installer.js +86 -0
- package/dist/installer.js.map +1 -0
- package/dist/postinstall.d.ts +2 -0
- package/dist/postinstall.d.ts.map +1 -0
- package/dist/postinstall.js +8 -0
- package/dist/postinstall.js.map +1 -0
- package/frontend/README.md +19 -0
- package/memory/context-recovery.md +49 -0
- package/memory/conversation-summarizer.md +65 -0
- package/memory/long-term-project-memory.md +58 -0
- package/memory/memory-manager.md +299 -0
- package/memory/session-compression.md +182 -0
- package/memory/smart-recall.md +37 -0
- package/optimization/compact-example.md +87 -0
- package/optimization/cost-optimizer.md +53 -0
- package/optimization/prompt-optimizer.md +194 -0
- package/optimization/token-audit.md +177 -0
- package/optimization/token-reducer.md +202 -0
- package/package.json +67 -0
- package/security/owasp-auditor.md +249 -0
- package/security/pentest-reviewer.md +109 -0
- package/security/security-engineer.md +238 -0
- package/skills/INDEX.md +434 -0
- package/skills/accessibility-reviewer.md +63 -0
- package/skills/agentic-coding.md +56 -0
- package/skills/ai-agent/SKILL.md +107 -0
- package/skills/ai-agent-dev/SKILL.md +117 -0
- package/skills/alternative-solution-generator.md +72 -0
- package/skills/architecture-patterns/SKILL.md +113 -0
- package/skills/breaking-change-detector.md +84 -0
- package/skills/bug-hunter.md +234 -0
- package/skills/bug-prevention.md +75 -0
- package/skills/chaos-engineering/SKILL.md +108 -0
- package/skills/clean-code-validator.md +218 -0
- package/skills/cloud-architect/SKILL.md +78 -0
- package/skills/cloud-infra/SKILL.md +99 -0
- package/skills/code-auditor.md +24 -0
- package/skills/complexity-analyzer.md +102 -0
- package/skills/confidence-estimator.md +53 -0
- package/skills/continuous-improvement.md +46 -0
- package/skills/continuous-learning-engine.md +51 -0
- package/skills/cto-advisor.md +66 -0
- package/skills/data-engineer/SKILL.md +76 -0
- package/skills/data-engineering/SKILL.md +82 -0
- package/skills/debug-specialist.md +215 -0
- package/skills/dependency-analyzer.md +78 -0
- package/skills/design-pattern-advisor.md +78 -0
- package/skills/documentation-writer.md +66 -0
- package/skills/dry-kiss-yagni-validator.md +114 -0
- package/skills/economia-tokens/SKILL.md +40 -0
- package/skills/er-diagram-builder.md +85 -0
- package/skills/feature-flags/SKILL.md +95 -0
- package/skills/frontend/SKILL.md +327 -0
- package/skills/frontend-dev/SKILL.md +178 -0
- package/skills/graphql/SKILL.md +104 -0
- package/skills/hallucination-detection.md +49 -0
- package/skills/handoff-sessao/SKILL.md +32 -0
- package/skills/i18n-l10n/SKILL.md +103 -0
- package/skills/iac-terraform/SKILL.md +98 -0
- package/skills/legacy-migration/SKILL.md +91 -0
- package/skills/logging-expert.md +78 -0
- package/skills/mcp-server-dev.md +33 -0
- package/skills/memoria-projeto/SKILL.md +49 -0
- package/skills/mobile-dev/SKILL.md +82 -0
- package/skills/mobile-engineer/SKILL.md +74 -0
- package/skills/monitoring-specialist.md +59 -0
- package/skills/observability-expert.md +60 -0
- package/skills/performance-optimizer.md +239 -0
- package/skills/principal-engineer.md +55 -0
- package/skills/privacy-engineer/SKILL.md +79 -0
- package/skills/professor-modo/SKILL.md +33 -0
- package/skills/project-manager.md +74 -0
- package/skills/prompt-engineering.md +27 -0
- package/skills/qa/SKILL.md +231 -0
- package/skills/qa-engineer/SKILL.md +222 -0
- package/skills/readme-generator.md +42 -0
- package/skills/refactoring-specialist.md +250 -0
- package/skills/release-planner.md +70 -0
- package/skills/requirement-analyzer.md +65 -0
- package/skills/risk-analyzer.md +73 -0
- package/skills/root-cause-analyzer.md +210 -0
- package/skills/scalability-expert.md +73 -0
- package/skills/security-privacy/SKILL.md +98 -0
- package/skills/self-correction.md +54 -0
- package/skills/self-critique.md +42 -0
- package/skills/senior-code-reviewer.md +193 -0
- package/skills/sequence-diagram-builder.md +56 -0
- package/skills/serverless-edge/SKILL.md +103 -0
- package/skills/software-architect.md +356 -0
- package/skills/solid-validator.md +332 -0
- package/skills/sre-reliability/SKILL.md +115 -0
- package/skills/staff-engineer.md +61 -0
- package/skills/task-planner.md +61 -0
- package/skills/tech-lead.md +59 -0
- package/skills/technical-debt-analyzer.md +81 -0
- package/skills/technical-writer.md +39 -0
- package/skills/tradeoff-analyzer.md +79 -0
- package/skills/uml-generator.md +72 -0
- package/skills/ux-reviewer.md +61 -0
- package/skills/wasm/SKILL.md +133 -0
- package/skills/web-perf-engineer/SKILL.md +75 -0
- package/skills/web-perf-seo/SKILL.md +111 -0
- package/skills/websocket-realtime/SKILL.md +107 -0
- package/teaching/adaptive-teaching.md +37 -0
- package/teaching/code-explainer.md +172 -0
- package/teaching/interactive-teaching.md +41 -0
- package/teaching/learning-tracker.md +63 -0
- package/teaching/mentor-mode.md +200 -0
- package/teaching/professor-mode.md +222 -0
- package/testing/e2e-test-engineer.md +68 -0
- package/testing/integration-test-engineer.md +74 -0
- package/testing/mocking-specialist.md +78 -0
- package/testing/unit-test-engineer.md +209 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Skill: Scalability Expert
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0 | Priority: High
|
|
4
|
+
> Dependencies: Performance Optimizer, DevOps Engineer, Software Architect
|
|
5
|
+
> Compatibility: ">=1.0.0"
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Identity
|
|
10
|
+
|
|
11
|
+
Scalability Expert ensures systems handle growth in users, data, and traffic without degradation. Designs horizontal scaling, caching layers, database sharding, CDN strategy, and async processing pipelines.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Scaling Dimensions
|
|
16
|
+
|
|
17
|
+
```yaml
|
|
18
|
+
horizontal: add more servers (web, API, workers)
|
|
19
|
+
vertical: bigger servers (limited ceiling)
|
|
20
|
+
|
|
21
|
+
cache:
|
|
22
|
+
- Browser: CDN for static assets
|
|
23
|
+
- Application: Redis for hot data
|
|
24
|
+
- Database: query cache, read replicas
|
|
25
|
+
|
|
26
|
+
database:
|
|
27
|
+
- Read replicas for read-heavy workloads
|
|
28
|
+
- Sharding for write-heavy workloads
|
|
29
|
+
- Connection pooling (PgBouncer, ProxySQL)
|
|
30
|
+
|
|
31
|
+
async:
|
|
32
|
+
- Queues for time-consuming tasks (email, export)
|
|
33
|
+
- Event-driven for decoupling services
|
|
34
|
+
- Stream processing for real-time data
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Horizontal Scaling Checklist
|
|
40
|
+
|
|
41
|
+
- [ ] Application is stateless (session in Redis, not local)
|
|
42
|
+
- [ ] Static assets served from CDN
|
|
43
|
+
- [ ] Database has read replicas
|
|
44
|
+
- [ ] Queues can scale independently
|
|
45
|
+
- [ ] No file storage on local disk (use S3/CDN)
|
|
46
|
+
- [ ] Health checks and auto-scaling configured
|
|
47
|
+
- [ ] Load balancer configured (round-robin or least connections)
|
|
48
|
+
- [ ] Cache invalidation works across nodes
|
|
49
|
+
- [ ] Graceful shutdown (drain connections before stopping)
|
|
50
|
+
- [ ] Metrics track requests per second per node
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Database Sharding
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
strategy: "modular sharding by user_id"
|
|
58
|
+
shards: 4
|
|
59
|
+
key: "user_id % 4"
|
|
60
|
+
|
|
61
|
+
challenges:
|
|
62
|
+
- Cross-shard queries (avoid or use fan-out)
|
|
63
|
+
- Rebalancing when adding shards
|
|
64
|
+
- Backup and restore per shard
|
|
65
|
+
|
|
66
|
+
alternative: "NoSQL (DynamoDB, CosmosDB) for automatic sharding"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Changelog
|
|
72
|
+
|
|
73
|
+
### 1.0.0 — Initial release. Scaling dimensions, checklist, sharding.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-privacy
|
|
3
|
+
description: |
|
|
4
|
+
Skill de Seguranca e Privacidade para o Portal. Aborda OWASP Top 10, LGPD/GDPR,
|
|
5
|
+
seguranca de APIs, authentication, authorization, cryptography e secure coding.
|
|
6
|
+
Use esta skill para implementar ou revisar aspectos de seguranca e protecao de dados.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Skill Security & Privacy — Portal
|
|
10
|
+
|
|
11
|
+
## OWASP Top 10
|
|
12
|
+
|
|
13
|
+
| # | Risco | Prevencao |
|
|
14
|
+
|---|-------|-----------|
|
|
15
|
+
| 1 | Broken Access Control | RLS no Supabase, middleware de role verification |
|
|
16
|
+
| 2 | Cryptographic Failures | TLS 1.3, hashing (bcrypt), encryption at rest |
|
|
17
|
+
| 3 | Injection | Zod validation, prepared statements (Supabase), sanitizacao |
|
|
18
|
+
| 4 | Insecure Design | Threat modeling, security review no design |
|
|
19
|
+
| 5 | Security Misconfiguration | Environment-specific configs, secrets management |
|
|
20
|
+
| 6 | Vulnerable Components | Dependabot, `npm audit`, renovate bot |
|
|
21
|
+
| 7 | Auth Failures | Supabase Auth + MFA, rate limiting |
|
|
22
|
+
| 8 | Data Integrity Failures | CSP headers, Subresource Integrity (SRI) |
|
|
23
|
+
| 9 | Logging Failures | Audit logging, never log PII |
|
|
24
|
+
| 10 | SSRF | URL validation, allowlist de dominios |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## LGPD (Lei Geral de Protecao de Dados)
|
|
29
|
+
|
|
30
|
+
### Direitos do Titular
|
|
31
|
+
- **Acesso**: API para usuario baixar seus dados
|
|
32
|
+
- **Correcao**: editar dados pessoais no perfil
|
|
33
|
+
- **Exclusao**: deletar conta + dados associados (anonimizar logs)
|
|
34
|
+
- **Portabilidade**: exportar dados em JSON
|
|
35
|
+
- **Revogacao de consentimento**: opt-out de comunicacoes
|
|
36
|
+
|
|
37
|
+
### Obrigacoes Tecnicas
|
|
38
|
+
- Mapeamento de dados pessoais (o que, onde, por que, por quanto tempo)
|
|
39
|
+
- Consentimento explicito para coleta de dados nao essenciais
|
|
40
|
+
- Aviso de privacidade claro (politica de privacidade)
|
|
41
|
+
- DPO (Encarregado) com canal de contato
|
|
42
|
+
- Notificacao de vazamento em 72h (ANPD)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Secure Coding
|
|
47
|
+
|
|
48
|
+
### Input Validation (Zod)
|
|
49
|
+
```tsx
|
|
50
|
+
import { z } from "zod";
|
|
51
|
+
|
|
52
|
+
const contactSchema = z.object({
|
|
53
|
+
name: z.string().min(2).max(100),
|
|
54
|
+
email: z.string().email(),
|
|
55
|
+
phone: z.string().regex(/^\(\d{2}\)\s\d{4,5}-\d{4}$/),
|
|
56
|
+
message: z.string().min(10).max(1000),
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### CSP Headers
|
|
61
|
+
```
|
|
62
|
+
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' https:; font-src 'self'; connect-src 'self' https://*.supabase.co;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### API Security
|
|
66
|
+
- Rate limiting (express-rate-limit ou Vercel WAF)
|
|
67
|
+
- CORS restrito (allowlist de dominios)
|
|
68
|
+
- Request size limiting (10kb body max)
|
|
69
|
+
- Idempotency keys em mutations
|
|
70
|
+
- Audit logging (quem, o que, quando)
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Authentication & Authorization
|
|
75
|
+
|
|
76
|
+
### Supabase Auth
|
|
77
|
+
```tsx
|
|
78
|
+
// Server-side middleware
|
|
79
|
+
export async function middleware(req: NextRequest) {
|
|
80
|
+
const session = await supabase.auth.getSession();
|
|
81
|
+
if (!session) return NextResponse.redirect("/admin/login");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// RLS policy
|
|
85
|
+
CREATE POLICY "Admins can read all posts" ON posts
|
|
86
|
+
FOR SELECT USING (auth.role() = 'admin');
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Cryptography
|
|
92
|
+
|
|
93
|
+
| Uso | Algoritmo |
|
|
94
|
+
|-----|-----------|
|
|
95
|
+
| Hashing de senha | bcrypt (cost 12) |
|
|
96
|
+
| JWT signing | RS256 (asymmetric) |
|
|
97
|
+
| TLS | TLS 1.3 (min 1.2) |
|
|
98
|
+
| Dados sensiveis em repouso | AES-256-GCM |
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Skill: Self Correction
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0 | Priority: High
|
|
4
|
+
> Dependencies: Reflection Engine, Evolution Engine
|
|
5
|
+
> Compatibility: ">=1.0.0"
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Identity
|
|
10
|
+
|
|
11
|
+
Self Correction detects when the agent has made an error in its own output, acknowledges it, explains the mistake, and provides the corrected version.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Detection
|
|
16
|
+
|
|
17
|
+
```yaml
|
|
18
|
+
detection_methods:
|
|
19
|
+
- User points out the error
|
|
20
|
+
- Contradiction detected in own output (I say X here but ~X there)
|
|
21
|
+
- Violation of a rule in RULES.md
|
|
22
|
+
- Security gate catches it (post-delivery scan)
|
|
23
|
+
- Code example contains syntax error
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Correction Protocol
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
1. Acknowledge — "I made an error in my previous response."
|
|
30
|
+
2. Explain — "I suggested using X, but Y is better because..."
|
|
31
|
+
3. Correct — Provide the corrected version.
|
|
32
|
+
4. Prevent — Update skill/rule to prevent recurrence.
|
|
33
|
+
5. Log — Record in reflection log.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Previous response:
|
|
42
|
+
❌ "Use localStorage for storing JWT tokens."
|
|
43
|
+
|
|
44
|
+
Self correction:
|
|
45
|
+
✅ Acknowledge: I made an error. localStorage is vulnerable to XSS.
|
|
46
|
+
✅ Correction: Use httpOnly cookies for JWT storage.
|
|
47
|
+
✅ Prevention: Updated Security Engineer skill rule: "never suggest localStorage for tokens."
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Changelog
|
|
53
|
+
|
|
54
|
+
### 1.0.0 — Initial release. Detection, protocol, example.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Skill: Self Critique
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0 | Priority: Medium
|
|
4
|
+
> Dependencies: Reflection Engine
|
|
5
|
+
> Compatibility: ">=1.0.0"
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Identity
|
|
10
|
+
|
|
11
|
+
Self Critique proactively reviews its own output for potential improvements before the user points them out. Aims to find at least one improvement per response.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Critique Questions
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
- Is this the clearest way to explain this?
|
|
19
|
+
- Could a beginner understand this?
|
|
20
|
+
- Did I include all relevant options?
|
|
21
|
+
- Did I explain my reasoning?
|
|
22
|
+
- Is there a simpler approach I missed?
|
|
23
|
+
- Did I consider security implications?
|
|
24
|
+
- Did I consider edge cases?
|
|
25
|
+
- Is this the most efficient solution?
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Critique Process
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
1. Generate initial response
|
|
32
|
+
2. Run self-critique (5 questions minimum)
|
|
33
|
+
3. If improvement found: revise before delivery
|
|
34
|
+
4. If no improvement: deliver as is
|
|
35
|
+
5. Log critique result (improvements found/none)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Changelog
|
|
41
|
+
|
|
42
|
+
### 1.0.0 — Initial release. Questions, process.
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Skill: Senior Code Reviewer
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0
|
|
4
|
+
> Priority: High
|
|
5
|
+
> Dependencies: SOLID Validator, Clean Code Validator, Security Engineer, Performance Optimizer
|
|
6
|
+
> Compatibility: ">=1.0.0"
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Identity
|
|
11
|
+
|
|
12
|
+
The Senior Code Reviewer analyzes code with the eye of an experienced engineer. It checks for correctness, security, performance, style, maintainability, and testability. Every review produces a structured report with severity levels, actionable fixes, and teaching moments.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Goals
|
|
17
|
+
|
|
18
|
+
- Catch bugs before they reach production.
|
|
19
|
+
- Ensure code follows project conventions and best practices.
|
|
20
|
+
- Identify security vulnerabilities in every review.
|
|
21
|
+
- Suggest performance improvements without premature optimization.
|
|
22
|
+
- Leave the code better than found (boy scout rule).
|
|
23
|
+
- Teach the author something new with every review.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Triggers
|
|
28
|
+
|
|
29
|
+
| Condition | Action |
|
|
30
|
+
|-----------|--------|
|
|
31
|
+
| `task == "review"` | Full code review with report |
|
|
32
|
+
| `task == "pr"` or `task == "merge"` | PR review mode |
|
|
33
|
+
| User says "review this code" | Full review |
|
|
34
|
+
| User shares code snippet | Quick scan + review |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Review Dimensions
|
|
39
|
+
|
|
40
|
+
| Dimension | Weight | Focus |
|
|
41
|
+
|-----------|--------|-------|
|
|
42
|
+
| Correctness | 30% | Logic, edge cases, off-by-one, null safety |
|
|
43
|
+
| Security | 25% | OWASP, secrets, input validation, auth |
|
|
44
|
+
| Maintainability | 15% | Naming, structure, comments, DRY |
|
|
45
|
+
| Performance | 10% | N+1 queries, loops, caching |
|
|
46
|
+
| Style | 10% | Conventions, formatting, consistency |
|
|
47
|
+
| Testability | 10% | Coupling, mocks, coverage |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Review Report Format
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
review:
|
|
55
|
+
file: "app/Http/Controllers/UserController.php"
|
|
56
|
+
overall_score: 7.5 / 10
|
|
57
|
+
verdict: "APPROVED WITH COMMENTS"
|
|
58
|
+
|
|
59
|
+
findings:
|
|
60
|
+
- severity: "critical"
|
|
61
|
+
line: 42
|
|
62
|
+
message: "SQL injection vulnerability — using raw concatenation"
|
|
63
|
+
rule: "A03: Injection"
|
|
64
|
+
fix: "Use parameterized query: DB::select(... ?, [$id])"
|
|
65
|
+
|
|
66
|
+
- severity: "major"
|
|
67
|
+
line: 15
|
|
68
|
+
message: "Controller has too many responsibilities"
|
|
69
|
+
rule: "SOLID — Single Responsibility"
|
|
70
|
+
fix: "Extract business logic to UserService"
|
|
71
|
+
|
|
72
|
+
- severity: "minor"
|
|
73
|
+
line: 88
|
|
74
|
+
message: "Method name getUserDetails is vague"
|
|
75
|
+
rule: "Clean Code — Meaningful Names"
|
|
76
|
+
fix: "Rename to findById or loadProfile"
|
|
77
|
+
|
|
78
|
+
- severity: "nitpick"
|
|
79
|
+
line: 120
|
|
80
|
+
message: "Trailing whitespace"
|
|
81
|
+
rule: "PSR-12"
|
|
82
|
+
fix: "Auto-fixable"
|
|
83
|
+
|
|
84
|
+
positives:
|
|
85
|
+
- "Good use of Form Request validation"
|
|
86
|
+
- "Pest tests are well-structured"
|
|
87
|
+
|
|
88
|
+
teaching:
|
|
89
|
+
- topic: "SQL Injection Prevention"
|
|
90
|
+
concept: "Always use parameterized queries"
|
|
91
|
+
example: "DB::select('SELECT * FROM users WHERE id = ?', [$id])"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Severity Levels
|
|
97
|
+
|
|
98
|
+
| Level | Color | Meaning | Action Required |
|
|
99
|
+
|-------|-------|---------|----------------|
|
|
100
|
+
| 🔴 Critical | Red | Bug, vulnerability, or data loss | Must fix before merge |
|
|
101
|
+
| 🟠 Major | Orange | Violates best practice, maintainability risk | Should fix |
|
|
102
|
+
| 🟡 Minor | Yellow | Style, naming, minor improvement | Consider fixing |
|
|
103
|
+
| ⚪ Nitpick | Gray | Trivial (whitespace, formatting) | Optional |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Review Algorithms
|
|
108
|
+
|
|
109
|
+
### Score Calculation
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
score = 0
|
|
113
|
+
score += correctness * 0.30
|
|
114
|
+
score += security * 0.25
|
|
115
|
+
score += maintainability * 0.15
|
|
116
|
+
score += performance * 0.10
|
|
117
|
+
score += style * 0.10
|
|
118
|
+
score += testability * 0.10
|
|
119
|
+
|
|
120
|
+
verdict:
|
|
121
|
+
if score >= 9.0: "APPROVED"
|
|
122
|
+
elif score >= 7.0: "APPROVED WITH COMMENTS"
|
|
123
|
+
elif score >= 5.0: "CHANGES REQUESTED"
|
|
124
|
+
else: "REJECTED"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Finding Priority
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
priority = severity_score * impact * likelihood
|
|
131
|
+
|
|
132
|
+
severity_score:
|
|
133
|
+
critical: 5
|
|
134
|
+
major: 3
|
|
135
|
+
minor: 1
|
|
136
|
+
nitpick: 0.5
|
|
137
|
+
|
|
138
|
+
impact:
|
|
139
|
+
affects production: 3
|
|
140
|
+
affects development: 2
|
|
141
|
+
cosmetic only: 1
|
|
142
|
+
|
|
143
|
+
likelihood:
|
|
144
|
+
certain: 3
|
|
145
|
+
likely: 2
|
|
146
|
+
possible: 1
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Rules
|
|
152
|
+
|
|
153
|
+
### Always
|
|
154
|
+
|
|
155
|
+
- ✅ Provide severity levels for every finding.
|
|
156
|
+
- ✅ Explain why a pattern is wrong, not just that it is wrong.
|
|
157
|
+
- ✅ Include positives — acknowledge what was done well.
|
|
158
|
+
- ✅ Offer specific, actionable fixes.
|
|
159
|
+
- ✅ Include at least one teaching moment per review.
|
|
160
|
+
|
|
161
|
+
### Never
|
|
162
|
+
|
|
163
|
+
- ❌ Be dismissive or rude ("this is terrible code").
|
|
164
|
+
- ❌ Suggest changes without explaining the reasoning.
|
|
165
|
+
- ❌ Skip security review — always run OWASP checks.
|
|
166
|
+
- ❌ Request changes for style preferences not in the project conventions.
|
|
167
|
+
- ❌ Leave a review without a clear verdict.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Metrics
|
|
172
|
+
|
|
173
|
+
| Metric | Target | How to Measure |
|
|
174
|
+
|--------|--------|---------------|
|
|
175
|
+
| Findings per review | ≥ 3 | Count findings |
|
|
176
|
+
| Critical findings found | 100% pre-merge | Bugs caught / total bugs |
|
|
177
|
+
| Actionable fix rate | ≥ 90% | Findings with specific fix / total |
|
|
178
|
+
| Teaching moments per review | ≥ 1 | Count teaching items |
|
|
179
|
+
| User satisfaction | ≥ 4.0 / 5 | Follow-up rating |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Changelog
|
|
184
|
+
|
|
185
|
+
### 1.0.0 (2026-07-17)
|
|
186
|
+
|
|
187
|
+
- Initial release
|
|
188
|
+
- 6-dimension review scoring with weights
|
|
189
|
+
- 4 severity levels (critical → nitpick)
|
|
190
|
+
- Structured YAML report format
|
|
191
|
+
- Priority calculation algorithm
|
|
192
|
+
- Positive feedback always included
|
|
193
|
+
- Teaching moment integration
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Skill: Sequence Diagram Builder
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0 | Priority: Low
|
|
4
|
+
> Dependencies: UML Generator
|
|
5
|
+
> Compatibility: ">=1.0.0"
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Identity
|
|
10
|
+
|
|
11
|
+
Sequence Diagram Builder generates sequence diagrams from API flow descriptions. Shows request/response flow between client, API, services, and database.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## PlantUML Sequence
|
|
16
|
+
|
|
17
|
+
```plantuml
|
|
18
|
+
@startuml
|
|
19
|
+
actor User
|
|
20
|
+
participant "Client" as C
|
|
21
|
+
participant "API" as A
|
|
22
|
+
participant "Service" as S
|
|
23
|
+
participant "Database" as DB
|
|
24
|
+
|
|
25
|
+
User -> C: Submit form
|
|
26
|
+
C -> A: POST /api/v1/users
|
|
27
|
+
A -> S: validate(request)
|
|
28
|
+
A -> S: create(data)
|
|
29
|
+
S -> DB: INSERT users
|
|
30
|
+
DB --> S: user
|
|
31
|
+
S --> A: User
|
|
32
|
+
A --> C: 201 JSON
|
|
33
|
+
C --> User: Success page
|
|
34
|
+
@enduml
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Mermaid Sequence
|
|
38
|
+
|
|
39
|
+
```mermaid
|
|
40
|
+
sequenceDiagram
|
|
41
|
+
User->>Client: Submit form
|
|
42
|
+
Client->>API: POST /api/v1/users
|
|
43
|
+
API->>Service: validate(request)
|
|
44
|
+
API->>Service: create(data)
|
|
45
|
+
Service->>Database: INSERT users
|
|
46
|
+
Database-->>Service: user
|
|
47
|
+
Service-->>API: User
|
|
48
|
+
API-->>Client: 201 JSON
|
|
49
|
+
Client-->>User: Success page
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Changelog
|
|
55
|
+
|
|
56
|
+
### 1.0.0 — Initial release. PlantUML, Mermaid sequence diagrams.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: serverless-edge
|
|
3
|
+
description: |
|
|
4
|
+
Skill de Serverless e Edge Computing para o Portal. Aborda AWS Lambda, Cloudflare
|
|
5
|
+
Workers, Vercel Edge Functions, serverless patterns, cold start optimization e edge caching.
|
|
6
|
+
Use esta skill para implementar funcionalidades serverless e edge computing.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Skill Serverless & Edge — Portal
|
|
10
|
+
|
|
11
|
+
## Plataformas
|
|
12
|
+
|
|
13
|
+
### Vercel Serverless Functions (Preferido)
|
|
14
|
+
```tsx
|
|
15
|
+
// app/api/hello/route.ts
|
|
16
|
+
export async function GET(req: NextRequest) {
|
|
17
|
+
return NextResponse.json({ message: "Hello from Edge!" });
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
- **Runtime**: Node.js 20, Edge Runtime
|
|
21
|
+
- **Max duration**: 10s (serverless), 30s (pro), 900s (Enterprise)
|
|
22
|
+
- **Memory**: 128MB a 1024MB
|
|
23
|
+
- **Cold start**: ~100ms (Node), ~50ms (Edge)
|
|
24
|
+
|
|
25
|
+
### AWS Lambda
|
|
26
|
+
- **Runtime**: Node.js 20, Python 3.12
|
|
27
|
+
- **Max duration**: 900s
|
|
28
|
+
- **Memory**: 128MB a 10240MB
|
|
29
|
+
- **Cold start**: ~200ms (Node), ~1s (Java/.NET)
|
|
30
|
+
- **Triggers**: API Gateway, SQS, S3, DynamoDB Streams, EventBridge
|
|
31
|
+
|
|
32
|
+
### Cloudflare Workers (Edge)
|
|
33
|
+
- **Runtime**: Service Worker API (V8 isolates)
|
|
34
|
+
- **Limites**: 30ms CPU por request, 128MB memory
|
|
35
|
+
- **Casos de uso**: redirects, rewrites, A/B testing, geolocation routing
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Serverless Patterns
|
|
40
|
+
|
|
41
|
+
### Lambda + API Gateway
|
|
42
|
+
```
|
|
43
|
+
Client → API Gateway → Lambda → DynamoDB/S3/External API
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Event-driven
|
|
47
|
+
```
|
|
48
|
+
S3 Event → Lambda → Process → DynamoDB or SQS → Next Step
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Fan-out
|
|
52
|
+
```
|
|
53
|
+
SQS → Lambda (process) → SNS → SQS A → Lambda A
|
|
54
|
+
→ SQS B → Lambda B
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Cold Start Optimization
|
|
60
|
+
|
|
61
|
+
| Estrategia | Impacto |
|
|
62
|
+
|------------|---------|
|
|
63
|
+
| Provisioned Concurrency (Lambda) | Elimina cold start |
|
|
64
|
+
| Keep warm (ping regular) | Reduz (nao elimina) |
|
|
65
|
+
| Lighter dependencies | Reduz tempo de carga |
|
|
66
|
+
| SnapStart (Lambda Java) | ~90% reducao |
|
|
67
|
+
| Edge Runtime (Vercel) | ~50ms cold start |
|
|
68
|
+
| Workers (Cloudflare) | Zero cold start |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Edge Computing
|
|
73
|
+
|
|
74
|
+
### Edge Functions (Vercel)
|
|
75
|
+
- **Geolocation**: rotear conteudo por pais/regiao
|
|
76
|
+
- **A/B testing**: servir diferentes variantes
|
|
77
|
+
- **Redirects**: redirecionar por dispositivo/idioma
|
|
78
|
+
- **Headers**: modificar security headers no edge
|
|
79
|
+
- **Authentication**: verificar JWT no edge (reduz latencia)
|
|
80
|
+
|
|
81
|
+
### Next.js Edge Middleware
|
|
82
|
+
```tsx
|
|
83
|
+
// middleware.ts
|
|
84
|
+
export function middleware(req: NextRequest) {
|
|
85
|
+
const country = req.geo?.country ?? "BR";
|
|
86
|
+
const url = req.nextUrl.clone();
|
|
87
|
+
if (country !== "BR" && url.pathname === "/") {
|
|
88
|
+
url.pathname = "/internacional";
|
|
89
|
+
return NextResponse.redirect(url);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Costs & Limits
|
|
97
|
+
|
|
98
|
+
| Recurso | Limite | Custo |
|
|
99
|
+
|---------|--------|-------|
|
|
100
|
+
| Vercel Serverless | 100k requests/mes (Hobby) | Gratuito |
|
|
101
|
+
| Vercel Edge | 100k requests/mes (Hobby) | Gratuito |
|
|
102
|
+
| AWS Lambda | 1M requests/mes | Sempre gratis |
|
|
103
|
+
| Cloudflare Workers | 100k requests/dia | Gratuito |
|