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,250 @@
1
+ # Skill: Refactoring Specialist
2
+
3
+ > Version 1.0.0
4
+ > Priority: High
5
+ > Dependencies: Software Architect, Clean Code Validator, Complexity Analyzer, Testing
6
+ > Compatibility: ">=1.0.0"
7
+
8
+ ---
9
+
10
+ ## Identity
11
+
12
+ The Refactoring Specialist restructures existing code without changing its external behavior. It follows the boy scout rule (leave the code better than found), applies systematic refactoring techniques, and ensures tests pass before and after every change.
13
+
14
+ ---
15
+
16
+ ## Goals
17
+
18
+ - Improve code structure without changing behavior.
19
+ - Reduce complexity (cyclomatic and cognitive).
20
+ - Eliminate technical debt systematically.
21
+ - Apply refactoring patterns (Extract Method, Rename, Move, etc.).
22
+ - Ensure existing tests pass before and after.
23
+ - Never introduce bugs during refactoring.
24
+
25
+ ---
26
+
27
+ ## Triggers
28
+
29
+ | Condition | Action |
30
+ |-----------|--------|
31
+ | `task == "refactor"` | Full refactoring plan |
32
+ | Clean Code Validator finds violations | Apply refactoring techniques |
33
+ | Complexity Analyzer flags high complexity | Simplify complex code |
34
+ | User says "this code is messy" | Refactoring session |
35
+ | Before adding a feature to messy code | Clean first, then add |
36
+
37
+ ---
38
+
39
+ ## Workflow
40
+
41
+ ```
42
+ 1. Analyze current code
43
+ - Identify smells
44
+ - Measure complexity
45
+ - Review test coverage
46
+ ↓
47
+ 2. Ensure tests are in place
48
+ - No tests? Write characterization tests first
49
+ ↓
50
+ 3. Plan refactoring steps
51
+ - One change at a time
52
+ - Each step is reversible
53
+ ↓
54
+ 4. Execute step
55
+ - Apply refactoring technique
56
+ - Run tests (should still pass)
57
+ - Commit
58
+ ↓
59
+ 5. Repeat for next smell
60
+ ↓
61
+ 6. Verify final state
62
+ - Tests pass
63
+ - Complexity reduced
64
+ - No behavior change
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Code Smell Catalog
70
+
71
+ | Smell | Symptom | Refactoring Technique |
72
+ |-------|---------|----------------------|
73
+ | **Long Method** | > 20 lines, hard to understand | Extract Method |
74
+ | **Large Class** | > 200 lines, too many responsibilities | Extract Class |
75
+ | **Long Parameter List** | > 3 parameters | Introduce Parameter Object |
76
+ | **Duplicate Code** | Same logic in multiple places | Extract Method, Pull Up Method |
77
+ | **Switch Statement** | Type-based switching | Replace with Polymorphism |
78
+ | **Feature Envy** | Method uses more of another class | Move Method |
79
+ | **Data Class** | Class with only getters/setters | Encapsulate Field, Move Method |
80
+ | **Shotgun Surgery** | One change requires many edits | Move Method, Inline Class |
81
+ | **Divergent Change** | One class changed for many reasons | Extract Class |
82
+ | **Primitive Obsession** | Using primitives instead of objects | Replace Data Value with Object |
83
+ | **Message Chains** | a.b.c.d().e() | Hide Delegate |
84
+ | **Middle Man** | Class that delegates everything | Remove Middle Man |
85
+
86
+ ---
87
+
88
+ ## Refactoring Techniques
89
+
90
+ ### Extract Method
91
+
92
+ ```
93
+ Before:
94
+ function printInvoice() {
95
+ printBanner();
96
+ let total = calculateTotal();
97
+ print("Total: " + total);
98
+ print("Due: " + getDueDate());
99
+ print("Customer: " + getCustomer());
100
+ saveToHistory(total);
101
+ }
102
+
103
+ After:
104
+ function printInvoice() {
105
+ printBanner();
106
+ let total = calculateTotal();
107
+ printDetails(total);
108
+ saveToHistory(total);
109
+ }
110
+
111
+ function printDetails(total: number) {
112
+ print("Total: " + total);
113
+ print("Due: " + getDueDate());
114
+ print("Customer: " + getCustomer());
115
+ }
116
+ ```
117
+
118
+ ### Replace with Polymorphism
119
+
120
+ ```
121
+ Before:
122
+ function calculateDiscount(type: string, amount: number) {
123
+ if (type === "regular") return amount * 0.05;
124
+ if (type === "premium") return amount * 0.10;
125
+ if (type === "vip") return amount * 0.20;
126
+ return 0;
127
+ }
128
+
129
+ After:
130
+ interface DiscountStrategy {
131
+ calculate(amount: number): number;
132
+ }
133
+
134
+ class RegularDiscount implements DiscountStrategy {
135
+ calculate(amount: number) { return amount * 0.05; }
136
+ }
137
+
138
+ class PremiumDiscount implements DiscountStrategy {
139
+ calculate(amount: number) { return amount * 0.10; }
140
+ }
141
+ ```
142
+
143
+ ### Introduce Parameter Object
144
+
145
+ ```
146
+ Before:
147
+ function createUser(name: string, email: string, age: number, country: string) { ... }
148
+
149
+ After:
150
+ type UserData = { name: string; email: string; age: number; country: string; }
151
+ function createUser(data: UserData) { ... }
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Safety Checklist
157
+
158
+ Before every refactoring step:
159
+
160
+ - [ ] Tests exist for the code being changed
161
+ - [ ] All tests pass currently (green)
162
+ - [ ] I understand what the code does (behavior is known)
163
+ - [ ] The change is small (1 technique at a time)
164
+ - [ ] The change is reversible (can undo)
165
+ - [ ] Only structure changes — no behavior changes
166
+ - [ ] No feature additions during refactoring
167
+
168
+ ---
169
+
170
+ ## Refactoring Plan Template
171
+
172
+ ```yaml
173
+ refactoring_plan:
174
+ target: "app/Services/OrderService.php"
175
+ current_complexity: 28 (high)
176
+ target_complexity: 12 (low)
177
+
178
+ steps:
179
+ - step: 1
180
+ technique: "Extract Method"
181
+ target: "calculateTotals() (47 lines)"
182
+ into: ["applyDiscount()", "calculateTax()", "calculateShipping()"]
183
+ risk: "low"
184
+ test_coverage: "yes"
185
+
186
+ - step: 2
187
+ technique: "Extract Class"
188
+ target: "OrderService handles validation, pricing, and notification"
189
+ into: ["OrderValidator", "OrderPricing", "OrderNotification"]
190
+ risk: "medium"
191
+ test_coverage: "partial — add before refactoring"
192
+
193
+ - step: 3
194
+ technique: "Replace Conditional with Polymorphism"
195
+ target: "switch (order.type) in discount calculation"
196
+ into: "DiscountStrategy interface + implementations"
197
+ risk: "medium"
198
+ test_coverage: "yes"
199
+
200
+ estimated_time: "2 hours"
201
+ safety_nets:
202
+ - "Write failing test first (characterization test)"
203
+ - "Commit after each step"
204
+ - "All tests must pass before next step"
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Rules
210
+
211
+ ### Always
212
+
213
+ - ✅ Ensure tests exist before refactoring.
214
+ - ✅ Make one change at a time.
215
+ - ✅ Run tests after every change.
216
+ - ✅ Leave the code cleaner than you found it.
217
+ - ✅ Prefer small, safe refactorings over big rewrites.
218
+
219
+ ### Never
220
+
221
+ - ❌ Refactor without test coverage (write characterization tests first).
222
+ - ❌ Add new features during refactoring.
223
+ - ❌ Refactor and fix bugs in the same change.
224
+ - ❌ Make large, unreviewable refactoring PRs.
225
+ - ❌ Refactor code that is being deprecated or removed.
226
+
227
+ ---
228
+
229
+ ## Metrics
230
+
231
+ | Metric | Target | How to Measure |
232
+ |--------|--------|---------------|
233
+ | Complexity reduction | ≥ 40% | Before/after cyclomatic complexity |
234
+ | Test coverage after refactor | ≥ before | Coverage report |
235
+ | Bugs introduced | 0 | Post-refactor bug count |
236
+ | Code smells eliminated | ≥ 80% | Smells found vs resolved |
237
+
238
+ ---
239
+
240
+ ## Changelog
241
+
242
+ ### 1.0.0 (2026-07-17)
243
+
244
+ - Initial release
245
+ - 12 code smells with refactoring techniques
246
+ - 3 refactoring techniques with before/after (Extract Method, Polymorphism, Parameter Object)
247
+ - Safety checklist (7 items)
248
+ - Workflow with characterization tests
249
+ - Refactoring plan template in YAML
250
+ - "One change at a time" enforced
@@ -0,0 +1,70 @@
1
+ # Skill: Release Planner
2
+
3
+ > Version 1.0.0 | Priority: Medium
4
+ > Dependencies: Project Manager, Breaking Change Detector
5
+ > Compatibility: ">=1.0.0"
6
+
7
+ ---
8
+
9
+ ## Identity
10
+
11
+ Release Planner manages version bumps, changelog generation, release branches, and deployment coordination.
12
+
13
+ ---
14
+
15
+ ## Version Bump Rules
16
+
17
+ ```yaml
18
+ major: breaking changes (API contract, DB schema, public API)
19
+ format: "1.0.0 → 2.0.0"
20
+ branch: "release/2.0.0"
21
+ action: "Includes migration guide, sunset headers"
22
+
23
+ minor: new features, backward compatible
24
+ format: "1.0.0 → 1.1.0"
25
+ branch: "release/1.1.0"
26
+ action: "Add deprecation notices for old APIs"
27
+
28
+ patch: bug fixes, no new features
29
+ format: "1.0.0 → 1.0.1"
30
+ branch: "main (direct commit/tag)"
31
+ action: "Urgent: hotfix branch"
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Release Checklist
37
+
38
+ - [ ] All tests pass (CI green)
39
+ - [ ] Changelog.md updated
40
+ - [ ] Version bumped in config/app.php or package.json
41
+ - [ ] Migration scripts tested (up + down)
42
+ - [ ] Breaking changes documented in release notes
43
+ - [ ] Deployment playbook reviewed
44
+ - [ ] Rollback plan confirmed
45
+ - [ ] Stakeholders notified
46
+
47
+ ---
48
+
49
+ ## Changelog Entry
50
+
51
+ ```markdown
52
+ ## [1.2.0] — 2026-07-17
53
+
54
+ ### Added
55
+ - Payment integration with Stripe
56
+ - Email notifications for payment confirmation
57
+
58
+ ### Changed
59
+ - Upgrade Laravel from 10 to 11
60
+
61
+ ### Fixed
62
+ - N+1 query on posts listing (#142)
63
+ - Null email handling in login (#138)
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Changelog
69
+
70
+ ### 1.0.0 — Initial release. Version rules, checklist, changelog format.
@@ -0,0 +1,65 @@
1
+ # Skill: Requirement Analyzer
2
+
3
+ > Version 1.0.0 | Priority: High
4
+ > Dependencies: Software Architect
5
+ > Compatibility: ">=1.0.0"
6
+
7
+ ---
8
+
9
+ ## Identity
10
+
11
+ Requirement Analyzer extracts, clarifies, and structures requirements from natural language input. Identifies functional and non-functional requirements, constraints, assumptions, and open questions.
12
+
13
+ ---
14
+
15
+ ## Extraction Process
16
+
17
+ ```
18
+ 1. Parse input → extract explicit requirements
19
+ 2. Ask clarifying questions for ambiguities
20
+ 3. Categorize: functional vs non-functional
21
+ 4. Prioritize: must-have vs nice-to-have
22
+ 5. Identify constraints (time, budget, tech)
23
+ 6. Document open questions
24
+ 7. Output structured requirements document
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Requirement Format
30
+
31
+ ```yaml
32
+ requirements:
33
+ functional:
34
+ - id: F1
35
+ title: "User registration"
36
+ description: "Users can register with email and password"
37
+ priority: "must-have"
38
+ acceptance: "POST /api/v1/users returns 201 with valid data"
39
+
40
+ - id: F2
41
+ title: "Email verification"
42
+ description: "Users must verify email before accessing dashboard"
43
+ priority: "must-have"
44
+ acceptance: "Unverified users get 403 on dashboard"
45
+
46
+ non_functional:
47
+ - id: NF1
48
+ title: "Response time"
49
+ description: "API p95 response under 200ms"
50
+ priority: "must-have"
51
+
52
+ constraints:
53
+ - "Laravel 11 + PostgreSQL 16"
54
+ - "Delivery in 4 weeks"
55
+
56
+ open_questions:
57
+ - "Should we support social login (Google, GitHub)?"
58
+ - "Password policy: minimum length?"
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Changelog
64
+
65
+ ### 1.0.0 — Initial release. Extraction, categorization, format.
@@ -0,0 +1,73 @@
1
+ # Skill: Risk Analyzer
2
+
3
+ > Version 1.0.0 | Priority: High
4
+ > Dependencies: Requirement Analyzer, Software Architect
5
+ > Compatibility: ">=1.0.0"
6
+
7
+ ---
8
+
9
+ ## Identity
10
+
11
+ Risk Analyzer identifies, assesses, and mitigates project and technical risks before they materialize.
12
+
13
+ ---
14
+
15
+ ## Risk Assessment Matrix
16
+
17
+ ```yaml
18
+ probability:
19
+ rare: 1 (unlikely)
20
+ unlikely: 2
21
+ possible: 3
22
+ likely: 4
23
+ almost_certain: 5
24
+
25
+ impact:
26
+ negligible: 1
27
+ minor: 2
28
+ moderate: 3
29
+ major: 4
30
+ catastrophic: 5
31
+
32
+ risk_score: probability × impact
33
+
34
+ thresholds:
35
+ critical: 20-25 → requires immediate mitigation
36
+ high: 15-19 → requires mitigation plan
37
+ medium: 10-14 → monitor monthly
38
+ low: 1-9 → accept
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Risk Register
44
+
45
+ ```yaml
46
+ risks:
47
+ - id: R1
48
+ title: "Third-party payment API downtime"
49
+ probability: unlikely (2)
50
+ impact: major (4)
51
+ score: 8 (medium)
52
+ mitigation: "Queue failed payments with retry + fallback"
53
+
54
+ - id: R2
55
+ title: "Key developer leaves mid-project"
56
+ probability: possible (3)
57
+ impact: major (4)
58
+ score: 12 (medium)
59
+ mitigation: "Cross-training, documentation, no bus factor = 1"
60
+
61
+ - id: R3
62
+ title: "Database migration causes data loss"
63
+ probability: unlikely (2)
64
+ impact: catastrophic (5)
65
+ score: 10 (medium)
66
+ mitigation: "Staging restore test before production, backup verified"
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Changelog
72
+
73
+ ### 1.0.0 — Initial release. Matrix, thresholds, register.
@@ -0,0 +1,210 @@
1
+ # Skill: Root Cause Analyzer
2
+
3
+ > Version 1.0.0
4
+ > Priority: High
5
+ > Dependencies: Bug Hunter
6
+ > Compatibility: ">=1.0.0"
7
+
8
+ ---
9
+
10
+ ## Identity
11
+
12
+ The Root Cause Analyzer goes beyond the immediate bug to find the systemic reason it exists. It applies techniques like 5 Whys, Fishbone Diagram, and Premortem to identify process gaps, assumptions, and systemic weaknesses that allowed the bug to exist.
13
+
14
+ ---
15
+
16
+ ## Goals
17
+
18
+ - Identify the systemic root cause, not just the code-level cause.
19
+ - Distinguish between proximate cause and root cause.
20
+ - Recommend process changes to prevent recurrence.
21
+ - Identify patterns across multiple bugs.
22
+ - Feed findings into the Evolution Engine.
23
+
24
+ ---
25
+
26
+ ## Triggers
27
+
28
+ | Condition | Action |
29
+ |-----------|--------|
30
+ | After Bug Hunter completes | Full root cause analysis |
31
+ | Same bug appears twice | Systemic pattern analysis |
32
+ | Bug was introduced by a previous fix | Regression analysis |
33
+ | Critical or security bug | Root cause + process recommendation |
34
+
35
+ ---
36
+
37
+ ## Techniques
38
+
39
+ ### 5 Whys
40
+
41
+ ```
42
+ Bug: "Login returns 500 error on invalid email"
43
+
44
+ Why 1: "Str::contains() throws TypeError on null input in Laravel 11"
45
+ Why 2: "The email variable is null because validation happens after the check"
46
+ Why 3: "The developer assumed validation would run before the service layer"
47
+ Why 4: "No explicit contract between controller and service about input state"
48
+ Why 5: "No team convention on where null checks should live"
49
+
50
+ Root cause: Missing architectural convention for input validation boundaries.
51
+ Fix: Adopt convention: validate at controller boundary, assert at service boundary.
52
+ ```
53
+
54
+ ### Fishbone (Cause and Effect)
55
+
56
+ ```
57
+ Effect: Login 500 error on invalid email
58
+
59
+ Categories → Causes:
60
+ People | Assumed validation always runs first
61
+ Process | No code review checklist for type safety
62
+ Technology | Laravel 11 changed Str::contains() behavior
63
+ Environment | PHP 8.2 strict_types mode
64
+ Measurement | No test coverage for edge case inputs
65
+
66
+ Root cause: Multiple factors — no type safety checklist, missed behavior change,
67
+ no edge case tests. System-level vulnerability, not individual mistake.
68
+ ```
69
+
70
+ ### Premortem
71
+
72
+ ```
73
+ Scenario: "We deploy the fix. 3 months later, we discover..."
74
+
75
+ What could go wrong?
76
+ 1. The null check pattern isn't applied consistently
77
+ 2. Other Str:: methods also changed behavior
78
+ 3. Developers in other teams make the same assumption
79
+ 4. The fix works but the underlying pattern repeats elsewhere
80
+
81
+ Prevention:
82
+ 1. Run codemod to add null checks everywhere
83
+ 2. Audit all Str:: usages in the codebase
84
+ 3. Share findings in team tech talk
85
+ 4. Add to PR review checklist
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Root Cause Categories
91
+
92
+ | Category | Examples | Systemic Fix |
93
+ |----------|----------|-------------|
94
+ | **Knowledge Gap** | Didn't know the framework change | Update onboarding, share in team chat |
95
+ | **Process Gap** | No code review requirement for migrations | Update PR template |
96
+ | **Convention Gap** | No standard for null handling | Create ADR, add to style guide |
97
+ | **Testing Gap** | No edge case tests | Add test template, coverage requirements |
98
+ | **Communication Gap** | Team didn't know about the upgrade | Add upgrade notice channel, changelog bot |
99
+ | **Tooling Gap** | No static analysis for type safety | Add PHPStan at max level |
100
+ | **Assumption** | Assumed input is always valid | Document service contracts explicitly |
101
+
102
+ ---
103
+
104
+ ## Pattern Detection
105
+
106
+ The engine tracks root causes across multiple bugs to find patterns:
107
+
108
+ ```yaml
109
+ patterns:
110
+ - pattern_id: "p-001"
111
+ category: "testing_gap"
112
+ description: "Edge case inputs not tested"
113
+ count: 4
114
+ last_bug: "2026-07-17"
115
+ recommendation: "Add fuzz testing to CI pipeline"
116
+
117
+ - pattern_id: "p-002"
118
+ category: "knowledge_gap"
119
+ description: "Laravel upgrade behavior changes unknown"
120
+ count: 2
121
+ last_bug: "2026-07-15"
122
+ recommendation: "Add automated changelog analysis to upgrade process"
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Root Cause Report
128
+
129
+ ```yaml
130
+ root_cause_analysis:
131
+ bug_title: "Login returns 500 error on invalid email"
132
+
133
+ proximate_cause:
134
+ what: "Str::contains() throws TypeError on null"
135
+ where: "app/Services/LoginService.php:45"
136
+
137
+ root_cause:
138
+ what: "No convention on where input validation boundaries are enforced"
139
+ category: "convention_gap"
140
+
141
+ 5_whys:
142
+ - "Str::contains() throws TypeError on null in Laravel 11"
143
+ - "Email is null because validation ran inside controller but service received raw request"
144
+ - "Developer assumed controller validated before service call"
145
+ - "No explicit contract between controller and service about validated state"
146
+ - "No team convention on validation boundaries"
147
+
148
+ systemic_recommendations:
149
+ - priority: 1
150
+ action: "Create ADR: validation boundaries convention"
151
+ owner: "Tech Lead"
152
+ deadline: "2026-07-24"
153
+
154
+ - priority: 2
155
+ action: "Add null check rule to PHPStan config"
156
+ owner: "DevOps"
157
+ deadline: "2026-07-21"
158
+
159
+ - priority: 3
160
+ action: "Audit all Str:: usages for null safety"
161
+ owner: "Backend Team"
162
+ deadline: "2026-07-28"
163
+
164
+ evolution_feed:
165
+ skill: "security-engineer"
166
+ suggestion: "Add null safety check to code review checklist"
167
+ ```
168
+
169
+ ---
170
+
171
+ ## Rules
172
+
173
+ ### Always
174
+
175
+ - ✅ Ask "why" at least 5 times.
176
+ - ✅ Distinguish proximate cause from root cause.
177
+ - ✅ Categorize root cause (knowledge, process, convention, testing, etc.).
178
+ - ✅ Recommend systemic fixes, not just code fixes.
179
+ - ✅ Feed patterns into Evolution Engine.
180
+
181
+ ### Never
182
+
183
+ - ❌ Stop at the first "why".
184
+ - ❌ Blame individuals for systemic issues.
185
+ - ❌ Suggest only code fixes without process recommendations.
186
+ - ❌ Ignore patterns — if it happened twice, it'll happen again.
187
+
188
+ ---
189
+
190
+ ## Metrics
191
+
192
+ | Metric | Target | How to Measure |
193
+ |--------|--------|---------------|
194
+ | Root cause depth | ≥ 5 whys | Average depth per analysis |
195
+ | Systemic fix rate | ≥ 50% | Systemic fixes / total recommendations |
196
+ | Pattern detection rate | ≥ 80% | Patterns found / patterns present |
197
+ | Bug recurrence after analysis | ≤ 2% | Same bug reappearing after RCA |
198
+
199
+ ---
200
+
201
+ ## Changelog
202
+
203
+ ### 1.0.0 (2026-07-17)
204
+
205
+ - Initial release
206
+ - 3 root cause techniques: 5 Whys, Fishbone, Premortem
207
+ - 7 root cause categories with systemic fixes
208
+ - Pattern detection across multiple bugs
209
+ - Root cause report in YAML
210
+ - Systemic recommendation engine