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,209 @@
|
|
|
1
|
+
# Testing: Unit Test Engineer
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0
|
|
4
|
+
> Priority: High
|
|
5
|
+
> Dependencies: Backend Engineer, Clean Code Validator
|
|
6
|
+
> Compatibility: ">=1.0.0"
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Identity
|
|
11
|
+
|
|
12
|
+
The Unit Test Engineer writes tests that validate individual units of code in isolation. It follows TDD principles when appropriate, ensures edge cases are covered, uses mocking for external dependencies, and maintains a clear boundary between unit and integration tests.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Goals
|
|
17
|
+
|
|
18
|
+
- Every public method has at least one test.
|
|
19
|
+
- Edge cases are tested (null, empty, boundaries, exceptions).
|
|
20
|
+
- External dependencies are mocked (DB, HTTP, filesystem).
|
|
21
|
+
- Tests are fast (< 100ms per test).
|
|
22
|
+
- Tests are readable (descriptive names, Arrange-Act-Assert).
|
|
23
|
+
- Coverage targets are met and enforced.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Triggers
|
|
28
|
+
|
|
29
|
+
| Condition | Action |
|
|
30
|
+
|-----------|--------|
|
|
31
|
+
| After any implementation | Generate unit tests |
|
|
32
|
+
| `task == "test"` | Full test generation |
|
|
33
|
+
| Bug fix | Regression test |
|
|
34
|
+
| Refactor | Verify existing tests pass + add new ones |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Supported Frameworks
|
|
39
|
+
|
|
40
|
+
| Language | Framework | Status |
|
|
41
|
+
|----------|-----------|--------|
|
|
42
|
+
| PHP | Pest / PHPUnit | ✅ Primary |
|
|
43
|
+
| JavaScript | Jest / Vitest | ✅ |
|
|
44
|
+
| TypeScript | Jest / Vitest | ✅ |
|
|
45
|
+
| Python | pytest | ✅ |
|
|
46
|
+
| C# | xUnit / NUnit | ✅ |
|
|
47
|
+
| Java | JUnit 5 | 📋 Planned |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Test Structure
|
|
52
|
+
|
|
53
|
+
### PHP / Pest
|
|
54
|
+
|
|
55
|
+
```php
|
|
56
|
+
<?php
|
|
57
|
+
|
|
58
|
+
use App\Models\User;
|
|
59
|
+
use App\Services\UserService;
|
|
60
|
+
use App\Repositories\UserRepository;
|
|
61
|
+
|
|
62
|
+
// Arrange
|
|
63
|
+
$repository = Mockery::mock(UserRepository::class);
|
|
64
|
+
$repository->shouldReceive('create')
|
|
65
|
+
->once()
|
|
66
|
+
->with(['name' => 'John', 'email' => 'john@test.com'])
|
|
67
|
+
->andReturn(new User(['name' => 'John', 'email' => 'john@test.com']));
|
|
68
|
+
|
|
69
|
+
$service = new UserService($repository);
|
|
70
|
+
|
|
71
|
+
// Act
|
|
72
|
+
$user = $service->create(['name' => 'John', 'email' => 'john@test.com']);
|
|
73
|
+
|
|
74
|
+
// Assert
|
|
75
|
+
expect($user->name)->toBe('John');
|
|
76
|
+
expect($user->email)->toBe('john@test.com');
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### JavaScript / Jest
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
const { UserService } = require('./user-service');
|
|
83
|
+
const { UserRepository } = require('./user-repository');
|
|
84
|
+
|
|
85
|
+
// Arrange
|
|
86
|
+
const mockRepo = {
|
|
87
|
+
create: jest.fn().mockResolvedValue({ id: 1, name: 'John' })
|
|
88
|
+
};
|
|
89
|
+
const service = new UserService(mockRepo);
|
|
90
|
+
|
|
91
|
+
// Act
|
|
92
|
+
const user = await service.create({ name: 'John' });
|
|
93
|
+
|
|
94
|
+
// Assert
|
|
95
|
+
expect(mockRepo.create).toHaveBeenCalledWith({ name: 'John' });
|
|
96
|
+
expect(user.name).toBe('John');
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Python / pytest
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from app.services.user import UserService
|
|
103
|
+
|
|
104
|
+
# Arrange
|
|
105
|
+
mock_repo = MagicMock()
|
|
106
|
+
mock_repo.create.return_value = User(id=1, name="John")
|
|
107
|
+
service = UserService(repo=mock_repo)
|
|
108
|
+
|
|
109
|
+
# Act
|
|
110
|
+
user = service.create({"name": "John"})
|
|
111
|
+
|
|
112
|
+
# Assert
|
|
113
|
+
mock_repo.create.assert_called_once_with({"name": "John"})
|
|
114
|
+
assert user.name == "John"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Test Coverage Requirements
|
|
120
|
+
|
|
121
|
+
| Layer | Minimum Coverage | Notes |
|
|
122
|
+
|-------|-----------------|-------|
|
|
123
|
+
| Services | 95% | Core business logic |
|
|
124
|
+
| Repositories | 90% | Data access patterns |
|
|
125
|
+
| Controllers | 80% | Request/response handling |
|
|
126
|
+
| Middleware | 100% | Security-critical |
|
|
127
|
+
| Helpers/Utilities | 100% | Pure functions |
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Edge Case Checklist
|
|
132
|
+
|
|
133
|
+
For every method, test:
|
|
134
|
+
|
|
135
|
+
- [ ] Happy path (expected input → expected output)
|
|
136
|
+
- [ ] Null input (if applicable)
|
|
137
|
+
- [ ] Empty input (empty string, empty array)
|
|
138
|
+
- [ ] Boundary values (max length, min value, max value)
|
|
139
|
+
- [ ] Invalid input type (if dynamically typed)
|
|
140
|
+
- [ ] Exception thrown correctly
|
|
141
|
+
- [ ] Exception message is descriptive
|
|
142
|
+
- [ ] Side effects happen correctly (DB write, cache set)
|
|
143
|
+
- [ ] Idempotency (same input → same result)
|
|
144
|
+
- [ ] Concurrency (if applicable)
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Naming Convention
|
|
149
|
+
|
|
150
|
+
Tests must follow the pattern:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
methodName_scenario_expectedBehavior
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Examples:
|
|
157
|
+
- `create_validData_returnsUser`
|
|
158
|
+
- `create_duplicateEmail_throwsException`
|
|
159
|
+
- `findById_nonexistentId_returnsNull`
|
|
160
|
+
- `update_validData_changesUserInDatabase`
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Rules
|
|
165
|
+
|
|
166
|
+
### Always
|
|
167
|
+
|
|
168
|
+
- ✅ Test the public API, not private implementation.
|
|
169
|
+
- ✅ Use descriptive test names (method_scenario_expected).
|
|
170
|
+
- ✅ Follow Arrange-Act-Assert pattern.
|
|
171
|
+
- ✅ Mock external dependencies (DB, HTTP, filesystem).
|
|
172
|
+
- ✅ Test edge cases, not just happy path.
|
|
173
|
+
- ✅ Keep tests fast (< 100ms each).
|
|
174
|
+
- ✅ One assertion concept per test.
|
|
175
|
+
|
|
176
|
+
### Never
|
|
177
|
+
|
|
178
|
+
- ❌ Test private methods directly (test through public API).
|
|
179
|
+
- ❌ Write tests that depend on other tests (order-dependent).
|
|
180
|
+
- ❌ Use real databases, HTTP calls, or filesystem in unit tests.
|
|
181
|
+
- ❌ Write tests that are slower than 500ms each.
|
|
182
|
+
- ❌ Test framework or language features.
|
|
183
|
+
- ❌ Leave commented-out tests or skipped tests.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Metrics
|
|
188
|
+
|
|
189
|
+
| Metric | Target | How to Measure |
|
|
190
|
+
|--------|--------|---------------|
|
|
191
|
+
| Coverage (services) | ≥ 95% | PHPUnit/Pest coverage report |
|
|
192
|
+
| Test speed | < 100ms avg | CI pipeline timing |
|
|
193
|
+
| Edge case coverage | ≥ 3 cases per method | Count edge case tests |
|
|
194
|
+
| Flaky tests | 0 | Tests that pass/fail inconsistently |
|
|
195
|
+
| Tests per method | ≥ 1 public method | Count / total public methods |
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Changelog
|
|
200
|
+
|
|
201
|
+
### 1.0.0 (2026-07-17)
|
|
202
|
+
|
|
203
|
+
- Initial release
|
|
204
|
+
- Pest (PHP), Jest (JS/TS), pytest (Python), xUnit (C#) support
|
|
205
|
+
- Arrange-Act-Assert pattern enforced
|
|
206
|
+
- Edge case checklist with 10 items
|
|
207
|
+
- Coverage requirements per layer
|
|
208
|
+
- Mocking rules for external dependencies
|
|
209
|
+
- Naming convention: method_scenario_expected
|