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,356 @@
|
|
|
1
|
+
# Skill: Software Architect
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0
|
|
4
|
+
> Priority: Critical
|
|
5
|
+
> Compatibility: ">=1.0.0"
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Identity
|
|
10
|
+
|
|
11
|
+
Responsável por projetar a arquitetura de software antes que qualquer código seja escrito. É a primeira skill ativada em projetos novos, features complexas ou refactors. Nenhuma linha de código é produzida sem passar por esta skill.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Goals
|
|
16
|
+
|
|
17
|
+
- Scalability — a arquitetura suporta crescimento sem reescrita.
|
|
18
|
+
- Maintainability — qualquer dev consegue navegar e modificar.
|
|
19
|
+
- Simplicity — a solução mais simples que atende os requisitos.
|
|
20
|
+
- Separation of Concerns — domínios isolados, responsabilidades claras.
|
|
21
|
+
- Risk Mitigation — riscos identificados e endereçados antes do código.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Triggers
|
|
26
|
+
|
|
27
|
+
| Condição | Ativa |
|
|
28
|
+
|----------|-------|
|
|
29
|
+
| `task == "new_project"` | ✅ Sempre |
|
|
30
|
+
| `task == "new_feature"` | ✅ Se complexidade > média |
|
|
31
|
+
| `task == "refactor"` | ✅ Sempre |
|
|
32
|
+
| `task == "architecture_review"` | ✅ Sempre |
|
|
33
|
+
| Usuário pergunta "qual arquitetura usar?" | ✅ |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Dependencies
|
|
38
|
+
|
|
39
|
+
core: [Decision Engine, Context Engine]
|
|
40
|
+
skills: [Planning Engine, Risk Analyzer]
|
|
41
|
+
memory: [Project Memory, Long Term Memory]
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Workflow
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
STEP 1 — Read Requirements
|
|
49
|
+
↓
|
|
50
|
+
STEP 2 — Identify Stakeholders (who uses this?)
|
|
51
|
+
↓
|
|
52
|
+
STEP 3 — Identify Risks
|
|
53
|
+
↓
|
|
54
|
+
STEP 4 — Choose Architecture Pattern
|
|
55
|
+
↓
|
|
56
|
+
STEP 5 — Design Components
|
|
57
|
+
↓
|
|
58
|
+
STEP 6 — Define Data Flow
|
|
59
|
+
↓
|
|
60
|
+
STEP 7 — Estimate Complexity
|
|
61
|
+
↓
|
|
62
|
+
STEP 8 — Generate Implementation Plan
|
|
63
|
+
↓
|
|
64
|
+
STEP 9 — Validate Against Checklist
|
|
65
|
+
↓
|
|
66
|
+
STEP 10 — Only Now → Hand off to Coding
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Decision Tree
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
if project is small (< 3 modules, 1 dev):
|
|
75
|
+
→ Monolith (simplicity)
|
|
76
|
+
|
|
77
|
+
elif project is medium (3-10 modules, 2-5 devs):
|
|
78
|
+
→ Modular Monolith or Layered
|
|
79
|
+
|
|
80
|
+
elif project is large (>10 modules, >5 devs):
|
|
81
|
+
if domain complexity is high:
|
|
82
|
+
→ Clean Architecture or Hexagonal
|
|
83
|
+
elif requires scalability:
|
|
84
|
+
→ Microservices + API Gateway
|
|
85
|
+
elif event-heavy:
|
|
86
|
+
→ Event-Driven + CQRS
|
|
87
|
+
|
|
88
|
+
elif project is a microservice:
|
|
89
|
+
→ Hexagonal or Onion
|
|
90
|
+
|
|
91
|
+
elif project is a library/package:
|
|
92
|
+
→ Simple layered
|
|
93
|
+
|
|
94
|
+
elif project requires real-time:
|
|
95
|
+
→ Event-Driven + WebSockets
|
|
96
|
+
|
|
97
|
+
else:
|
|
98
|
+
→ Layered (default safe choice)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Rules
|
|
104
|
+
|
|
105
|
+
### Always
|
|
106
|
+
|
|
107
|
+
- ✅ Analyze requirements before proposing architecture.
|
|
108
|
+
- ✅ Question ambiguities. Do not assume.
|
|
109
|
+
- ✅ Explain trade-offs of every decision.
|
|
110
|
+
- ✅ Document architectural decisions (ADRs).
|
|
111
|
+
- ✅ Consider future changes (extensibility).
|
|
112
|
+
- ✅ Validate against SOLID, DRY, KISS, YAGNI.
|
|
113
|
+
- ✅ Produce folder structure as part of the output.
|
|
114
|
+
|
|
115
|
+
### Never
|
|
116
|
+
|
|
117
|
+
- ❌ Start coding without architecture.
|
|
118
|
+
- ❌ Assume requirements are complete.
|
|
119
|
+
- ❌ Ignore scalability (even for small projects).
|
|
120
|
+
- ❌ Use microservices when monolith suffices.
|
|
121
|
+
- ❌ Add technology for novelty (e.g., Kafka for a CRUD app).
|
|
122
|
+
- ❌ Skip risk analysis.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Checklists
|
|
127
|
+
|
|
128
|
+
### Architecture Checklist
|
|
129
|
+
|
|
130
|
+
- [ ] Requirements fully understood
|
|
131
|
+
- [ ] Stakeholders identified
|
|
132
|
+
- [ ] Architecture pattern chosen
|
|
133
|
+
- [ ] Components defined
|
|
134
|
+
- [ ] Data flow mapped
|
|
135
|
+
- [ ] Folder structure generated
|
|
136
|
+
- [ ] Risks documented
|
|
137
|
+
- [ ] Trade-offs explained
|
|
138
|
+
- [ ] SOLID validated
|
|
139
|
+
- [ ] Scalability considered
|
|
140
|
+
- [ ] Security considered
|
|
141
|
+
- [ ] Testing strategy considered
|
|
142
|
+
- [ ] Deployment strategy considered
|
|
143
|
+
|
|
144
|
+
### ADR Checklist
|
|
145
|
+
|
|
146
|
+
- [ ] Title and status
|
|
147
|
+
- [ ] Context (why this decision?)
|
|
148
|
+
- [ ] Options considered (at least 2)
|
|
149
|
+
- [ ] Decision (which option and why)
|
|
150
|
+
- [ ] Consequences (positive and negative)
|
|
151
|
+
- [ ] Date and author
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Algorithms
|
|
156
|
+
|
|
157
|
+
### Complexity Estimator
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
if modules <= 3 AND integrations <= 2:
|
|
161
|
+
complexity = "low"
|
|
162
|
+
elif modules <= 8 AND integrations <= 5:
|
|
163
|
+
complexity = "medium"
|
|
164
|
+
else:
|
|
165
|
+
complexity = "high"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Risk Score
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
risk_score = (ambiguous_requirements * 3)
|
|
172
|
+
+ (new_team_members * 2)
|
|
173
|
+
+ (external_integrations * 2)
|
|
174
|
+
+ (unfamiliar_tech * 3)
|
|
175
|
+
|
|
176
|
+
if risk_score > 10:
|
|
177
|
+
→ require prototype first
|
|
178
|
+
elif risk_score > 5:
|
|
179
|
+
→ require design review
|
|
180
|
+
else:
|
|
181
|
+
→ proceed normally
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Examples
|
|
187
|
+
|
|
188
|
+
### Bad
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
User: Create a login.
|
|
192
|
+
AI: Here is the Laravel code...
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
❌ No architecture, no planning, no risk analysis.
|
|
196
|
+
|
|
197
|
+
### Good
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
User: Create a login.
|
|
201
|
+
AI:
|
|
202
|
+
## Requirements Analysis
|
|
203
|
+
- Auth method: JWT vs Session?
|
|
204
|
+
- DB: Which database?
|
|
205
|
+
- Rate limiting needed?
|
|
206
|
+
|
|
207
|
+
## Architecture
|
|
208
|
+
Pattern: Layered (Controller → Service → Repository)
|
|
209
|
+
Components: AuthController, AuthService, UserRepository
|
|
210
|
+
Data Flow: Request → Middleware → Controller → Service → Repository → DB
|
|
211
|
+
|
|
212
|
+
## Folder Structure
|
|
213
|
+
app/Http/Controllers/Auth/
|
|
214
|
+
app/Http/Requests/Auth/
|
|
215
|
+
app/Services/
|
|
216
|
+
app/Repositories/
|
|
217
|
+
database/migrations/
|
|
218
|
+
|
|
219
|
+
## Risks
|
|
220
|
+
- Token storage on client side (XSS vector)
|
|
221
|
+
- Brute force on login endpoint
|
|
222
|
+
|
|
223
|
+
## Mitigations
|
|
224
|
+
- Use httpOnly cookies for tokens
|
|
225
|
+
- Implement rate limiting
|
|
226
|
+
|
|
227
|
+
## Implementation Plan
|
|
228
|
+
1. Create migration
|
|
229
|
+
2. Create User model
|
|
230
|
+
3. Create AuthController
|
|
231
|
+
4. Create AuthService
|
|
232
|
+
5. Create UserRepository
|
|
233
|
+
6. Implement rate limiting
|
|
234
|
+
7. Write tests
|
|
235
|
+
8. Review
|
|
236
|
+
|
|
237
|
+
Now coding begins.
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
✅ Architecture first, code second.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Tests
|
|
245
|
+
|
|
246
|
+
### Given
|
|
247
|
+
User asks to create a new feature
|
|
248
|
+
|
|
249
|
+
### Expected
|
|
250
|
+
The skill should:
|
|
251
|
+
|
|
252
|
+
- [ ] Ask clarifying questions about requirements
|
|
253
|
+
- [ ] Propose at least 2 architecture options
|
|
254
|
+
- [ ] Explain trade-offs of each option
|
|
255
|
+
- [ ] Generate folder structure
|
|
256
|
+
- [ ] Identify risks
|
|
257
|
+
- [ ] Generate implementation plan
|
|
258
|
+
- [ ] Validate against SOLID
|
|
259
|
+
- [ ] Not write any code yet
|
|
260
|
+
|
|
261
|
+
### Test Cases
|
|
262
|
+
|
|
263
|
+
| Input | Expected Behavior |
|
|
264
|
+
|-------|------------------|
|
|
265
|
+
| "Create a blog" | Propose monolith vs modular. Explain trade-offs. |
|
|
266
|
+
| "Create a payment system" | Propose clean architecture. Identify PCI risks. |
|
|
267
|
+
| "Refactor legacy code" | Identify current issues. Propose migration plan. |
|
|
268
|
+
| "Add real-time chat" | Propose event-driven + WebSockets. Identify complexity. |
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Metrics
|
|
273
|
+
|
|
274
|
+
| Metric | Target | How to Measure |
|
|
275
|
+
|--------|--------|---------------|
|
|
276
|
+
| Architecture produced before code | 100% | Check if code appears before architecture |
|
|
277
|
+
| Risks identified per task | ≥ 2 | Count risks in output |
|
|
278
|
+
| Trade-offs explained per decision | ≥ 2 | Count trade-offs in output |
|
|
279
|
+
| User questions answered | 100% | Check if all user questions addressed |
|
|
280
|
+
| Architecture acceptance rate | ≥ 80% | Follow-up user satisfaction |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Evolution
|
|
285
|
+
|
|
286
|
+
### Known Improvements (logged from reflections)
|
|
287
|
+
|
|
288
|
+
- [ ] Add support for C4 model diagrams
|
|
289
|
+
- [ ] Add deployment architecture consideration
|
|
290
|
+
- [ ] Add cost estimation for cloud resources
|
|
291
|
+
- [ ] Generate PlantUML diagrams automatically
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Memory Hooks
|
|
296
|
+
|
|
297
|
+
```yaml
|
|
298
|
+
on_activate:
|
|
299
|
+
- load: project_architecture (if exists)
|
|
300
|
+
- load: user_preferences_pattern
|
|
301
|
+
|
|
302
|
+
on_complete:
|
|
303
|
+
- save: project_architecture
|
|
304
|
+
- save: decisions_log
|
|
305
|
+
- compress: if size > budget
|
|
306
|
+
|
|
307
|
+
on_failure:
|
|
308
|
+
- log: architecture_error
|
|
309
|
+
- notify: Reflection Engine
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Token Budget
|
|
315
|
+
|
|
316
|
+
| Phase | Tokens |
|
|
317
|
+
|-------|--------|
|
|
318
|
+
| Requirements analysis | 200 |
|
|
319
|
+
| Risk analysis | 150 |
|
|
320
|
+
| Architecture proposal | 400 |
|
|
321
|
+
| Folder structure | 100 |
|
|
322
|
+
| Implementation plan | 200 |
|
|
323
|
+
| Validation | 100 |
|
|
324
|
+
| **Total** | **1150** |
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Reflection
|
|
329
|
+
|
|
330
|
+
### Pre-delivery
|
|
331
|
+
|
|
332
|
+
- [ ] Did I understand the requirements fully?
|
|
333
|
+
- [ ] Did I consider at least 2 architecture options?
|
|
334
|
+
- [ ] Did I explain trade-offs?
|
|
335
|
+
- [ ] Did I identify risks?
|
|
336
|
+
- [ ] Did I validate against the checklist?
|
|
337
|
+
|
|
338
|
+
### Post-delivery
|
|
339
|
+
|
|
340
|
+
- [ ] Did the user need to ask for clarifications?
|
|
341
|
+
- [ ] Did I miss any requirement?
|
|
342
|
+
- [ ] What would I do differently next time?
|
|
343
|
+
- [ ] Should I update the skill based on this interaction?
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Changelog
|
|
348
|
+
|
|
349
|
+
### 1.0.0 (2026-07-17)
|
|
350
|
+
|
|
351
|
+
- Initial release
|
|
352
|
+
- Decision tree for architecture selection
|
|
353
|
+
- Complexity estimator algorithm
|
|
354
|
+
- Risk score algorithm
|
|
355
|
+
- Full workflow with 10 steps
|
|
356
|
+
- Integration with Planning Engine
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
# Skill: SOLID Validator
|
|
2
|
+
|
|
3
|
+
> Version 1.0.0
|
|
4
|
+
> Priority: High
|
|
5
|
+
> Dependencies: Clean Code Validator, Software Architect
|
|
6
|
+
> Compatibility: ">=1.0.0"
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Identity
|
|
11
|
+
|
|
12
|
+
The SOLID Validator checks every class and module against the five SOLID principles. It identifies violations, explains why they are problematic, and suggests specific refactoring techniques to resolve them.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Goals
|
|
17
|
+
|
|
18
|
+
- Validate every class against all 5 SOLID principles.
|
|
19
|
+
- Identify violations with specific evidence.
|
|
20
|
+
- Explain why the violation is harmful.
|
|
21
|
+
- Suggest specific refactoring to resolve it.
|
|
22
|
+
- Track SOLID adherence over time.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Triggers
|
|
27
|
+
|
|
28
|
+
| Condition | Action |
|
|
29
|
+
|-----------|--------|
|
|
30
|
+
| After any new class | SOLID validation |
|
|
31
|
+
| After code review | Deep SOLID pass |
|
|
32
|
+
| `task == "solid"` or `task == "validate"` | Full SOLID audit |
|
|
33
|
+
| Before refactoring | Baseline SOLID score |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## SRP — Single Responsibility Principle
|
|
38
|
+
|
|
39
|
+
> A class should have only one reason to change.
|
|
40
|
+
|
|
41
|
+
### Checks
|
|
42
|
+
|
|
43
|
+
- [ ] Class name describes a single responsibility
|
|
44
|
+
- [ ] Class has ≤ 3 public methods (if service/controller)
|
|
45
|
+
- [ ] All methods operate on the same level of abstraction
|
|
46
|
+
- [ ] No method mixes business logic with infrastructure concerns
|
|
47
|
+
|
|
48
|
+
### Violation Example
|
|
49
|
+
|
|
50
|
+
```php
|
|
51
|
+
// ❌ Violates SRP — Controller handles HTTP, business logic, and email
|
|
52
|
+
class UserController {
|
|
53
|
+
public function store(Request $request) {
|
|
54
|
+
$validated = $request->validate([...]);
|
|
55
|
+
$user = User::create($validated); // Business logic
|
|
56
|
+
Mail::to($user)->send(new WelcomeEmail($user)); // Email logic
|
|
57
|
+
Log::info('User created: ' . $user->id); // Logging logic
|
|
58
|
+
return response()->json($user, 201); // HTTP logic
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ✅ SRP Compliant
|
|
63
|
+
class UserController {
|
|
64
|
+
public function __construct(
|
|
65
|
+
private UserService $userService
|
|
66
|
+
) {}
|
|
67
|
+
|
|
68
|
+
public function store(StoreUserRequest $request): JsonResponse {
|
|
69
|
+
$user = $this->userService->create($request->validated());
|
|
70
|
+
return response()->json($user, 201);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// UserService handles business logic + coordination
|
|
75
|
+
class UserService {
|
|
76
|
+
public function create(array $data): User {
|
|
77
|
+
$user = User::create($data);
|
|
78
|
+
Event::dispatch(new UserRegistered($user));
|
|
79
|
+
return $user;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## OCP — Open/Closed Principle
|
|
87
|
+
|
|
88
|
+
> Software entities should be open for extension but closed for modification.
|
|
89
|
+
|
|
90
|
+
### Checks
|
|
91
|
+
|
|
92
|
+
- [ ] New behavior is added via extension, not modification
|
|
93
|
+
- [ ] Switch/if-else chains use polymorphism instead
|
|
94
|
+
- [ ] Abstract classes or interfaces define extension points
|
|
95
|
+
- [ ] Strategy pattern used for varying behavior
|
|
96
|
+
|
|
97
|
+
### Violation Example
|
|
98
|
+
|
|
99
|
+
```php
|
|
100
|
+
// ❌ Violates OCP — adding new notification type requires modifying this class
|
|
101
|
+
class NotificationService {
|
|
102
|
+
public function send(string $type, string $message): void {
|
|
103
|
+
if ($type === 'email') { ... }
|
|
104
|
+
elseif ($type === 'sms') { ... }
|
|
105
|
+
elseif ($type === 'slack') { ... }
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ✅ OCP Compliant
|
|
110
|
+
interface NotificationChannel {
|
|
111
|
+
public function send(string $message): void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
class EmailChannel implements NotificationChannel { ... }
|
|
115
|
+
class SmsChannel implements NotificationChannel { ... }
|
|
116
|
+
class SlackChannel implements NotificationChannel { ... }
|
|
117
|
+
|
|
118
|
+
class NotificationService {
|
|
119
|
+
public function __construct(
|
|
120
|
+
/** @var NotificationChannel[] */
|
|
121
|
+
private array $channels
|
|
122
|
+
) {}
|
|
123
|
+
|
|
124
|
+
public function send(string $message): void {
|
|
125
|
+
foreach ($this->channels as $channel) {
|
|
126
|
+
$channel->send($message);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## LSP — Liskov Substitution Principle
|
|
135
|
+
|
|
136
|
+
> Subtypes must be substitutable for their base types.
|
|
137
|
+
|
|
138
|
+
### Checks
|
|
139
|
+
|
|
140
|
+
- [ ] Subclass does not weaken preconditions
|
|
141
|
+
- [ ] Subclass does not strengthen postconditions
|
|
142
|
+
- [ ] Subclass does not throw new exception types
|
|
143
|
+
- [ ] Subclass preserves invariants of parent
|
|
144
|
+
- [ ] No "is-a" violations (Square extends Rectangle)
|
|
145
|
+
|
|
146
|
+
### Violation Example
|
|
147
|
+
|
|
148
|
+
```php
|
|
149
|
+
// ❌ Violates LSP — Square changes behavior of setWidth/setHeight
|
|
150
|
+
class Rectangle {
|
|
151
|
+
public function setWidth(int $w): void { $this->width = $w; }
|
|
152
|
+
public function setHeight(int $h): void { $this->height = $h; }
|
|
153
|
+
public function getArea(): int { return $this->width * $this->height; }
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
class Square extends Rectangle {
|
|
157
|
+
public function setWidth(int $w): void {
|
|
158
|
+
$this->width = $w;
|
|
159
|
+
$this->height = $w; // Violates LSP — changing height too
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// ✅ LSP Compliant — use a Shape interface instead
|
|
164
|
+
interface Shape {
|
|
165
|
+
public function getArea(): int;
|
|
166
|
+
}
|
|
167
|
+
class Rectangle implements Shape { ... }
|
|
168
|
+
class Square implements Shape { ... }
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## ISP — Interface Segregation Principle
|
|
174
|
+
|
|
175
|
+
> Clients should not be forced to depend on interfaces they do not use.
|
|
176
|
+
|
|
177
|
+
### Checks
|
|
178
|
+
|
|
179
|
+
- [ ] Interfaces are small and focused
|
|
180
|
+
- [ ] No "fat" interfaces with unrelated methods
|
|
181
|
+
- [ ] Classes don't implement methods they don't need
|
|
182
|
+
- [ ] Multiple specific interfaces over one general interface
|
|
183
|
+
|
|
184
|
+
### Violation Example
|
|
185
|
+
|
|
186
|
+
```php
|
|
187
|
+
// ❌ Violates ISP — UserService must implement sendEmail
|
|
188
|
+
interface UserOperations {
|
|
189
|
+
public function create(array $data): User;
|
|
190
|
+
public function update(int $id, array $data): User;
|
|
191
|
+
public function sendEmail(int $userId, string $template): void;
|
|
192
|
+
public function exportCsv(): string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ✅ ISP Compliant
|
|
196
|
+
interface UserRepository {
|
|
197
|
+
public function create(array $data): User;
|
|
198
|
+
public function update(int $id, array $data): User;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
interface EmailService {
|
|
202
|
+
public function send(int $userId, string $template): void;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
interface ExportService {
|
|
206
|
+
public function exportCsv(): string;
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## DIP — Dependency Inversion Principle
|
|
213
|
+
|
|
214
|
+
> Depend on abstractions, not concretions.
|
|
215
|
+
|
|
216
|
+
### Checks
|
|
217
|
+
|
|
218
|
+
- [ ] High-level modules don't depend on low-level modules
|
|
219
|
+
- [ ] Both depend on abstractions (interfaces/abstract classes)
|
|
220
|
+
- [ ] No `new` keyword in constructors (inject dependencies)
|
|
221
|
+
- [ ] No static method calls to concrete classes
|
|
222
|
+
- [ ] Dependency injection used throughout
|
|
223
|
+
|
|
224
|
+
### Violation Example
|
|
225
|
+
|
|
226
|
+
```php
|
|
227
|
+
// ❌ Violates DIP — depends on concrete MySQLRepository
|
|
228
|
+
class UserService {
|
|
229
|
+
private MySQLRepository $repo;
|
|
230
|
+
|
|
231
|
+
public function __construct() {
|
|
232
|
+
$this->repo = new MySQLRepository(); // Tight coupling
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// ✅ DIP Compliant
|
|
237
|
+
class UserService {
|
|
238
|
+
public function __construct(
|
|
239
|
+
private UserRepositoryInterface $repo // Depends on abstraction
|
|
240
|
+
) {}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Binding in service provider
|
|
244
|
+
$this->app->bind(UserRepositoryInterface::class, MySQLRepository::class);
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## SOLID Score
|
|
250
|
+
|
|
251
|
+
```yaml
|
|
252
|
+
solid_report:
|
|
253
|
+
class: "app/Services/OrderService.php"
|
|
254
|
+
overall_score: 3.8 / 5.0
|
|
255
|
+
|
|
256
|
+
principles:
|
|
257
|
+
srp:
|
|
258
|
+
score: 3 / 5
|
|
259
|
+
violations: ["Mixes validation, pricing, and notification"]
|
|
260
|
+
passed_checks: 2 / 4
|
|
261
|
+
|
|
262
|
+
ocp:
|
|
263
|
+
score: 5 / 5
|
|
264
|
+
violations: []
|
|
265
|
+
passed_checks: 4 / 4
|
|
266
|
+
|
|
267
|
+
lsp:
|
|
268
|
+
score: 5 / 5
|
|
269
|
+
violations: []
|
|
270
|
+
passed_checks: 4 / 4
|
|
271
|
+
|
|
272
|
+
isp:
|
|
273
|
+
score: 3 / 5
|
|
274
|
+
violations: ["UserService implements EmailNotifiableInterface"]
|
|
275
|
+
passed_checks: 3 / 4
|
|
276
|
+
|
|
277
|
+
dip:
|
|
278
|
+
score: 3 / 5
|
|
279
|
+
violations: ["New MySQLRepository() in constructor"]
|
|
280
|
+
passed_checks: 3 / 5
|
|
281
|
+
|
|
282
|
+
recommendations:
|
|
283
|
+
- principle: srp
|
|
284
|
+
action: "Extract OrderValidator, OrderPricing, OrderNotification classes"
|
|
285
|
+
effort: "medium"
|
|
286
|
+
- principle: dip
|
|
287
|
+
action: "Inject UserRepositoryInterface instead of instantiating MySQLRepository"
|
|
288
|
+
effort: "low"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Rules
|
|
294
|
+
|
|
295
|
+
### Always
|
|
296
|
+
|
|
297
|
+
- ✅ Check all 5 principles on every class.
|
|
298
|
+
- ✅ Explain why each violation is harmful.
|
|
299
|
+
- ✅ Suggest specific refactoring for each violation.
|
|
300
|
+
- ✅ Score each principle individually.
|
|
301
|
+
- ✅ Prioritize SRP and DIP (most commonly violated).
|
|
302
|
+
|
|
303
|
+
### Never
|
|
304
|
+
|
|
305
|
+
- ❌ Claim SOLID compliance without checking all 5.
|
|
306
|
+
- ❌ Suggest refactoring that introduces new violations.
|
|
307
|
+
- ❌ Ignore violations because "it works fine now".
|
|
308
|
+
- ❌ Apply SOLID dogmatically when it adds accidental complexity.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Metrics
|
|
313
|
+
|
|
314
|
+
| Metric | Target | How to Measure |
|
|
315
|
+
|--------|--------|---------------|
|
|
316
|
+
| Average SOLID score | ≥ 4.0 / 5 | Score per class, average |
|
|
317
|
+
| SRP compliance | ≥ 80% | Classes with single responsibility |
|
|
318
|
+
| DIP compliance | ≥ 90% | Classes using DI / total classes |
|
|
319
|
+
| Violations per class | ≤ 1 | Average violations per class |
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Changelog
|
|
324
|
+
|
|
325
|
+
### 1.0.0 (2026-07-17)
|
|
326
|
+
|
|
327
|
+
- Initial release
|
|
328
|
+
- All 5 SOLID principles with checklists
|
|
329
|
+
- Before/after examples for each principle
|
|
330
|
+
- SOLID score report in YAML
|
|
331
|
+
- Violation explanations with "why harmful"
|
|
332
|
+
- Refactoring recommendations per violation
|