@polymorphism-tech/morph-spec 2.3.0 → 3.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 (166) hide show
  1. package/CLAUDE.md +446 -1730
  2. package/README.md +515 -516
  3. package/bin/morph-spec.js +366 -294
  4. package/bin/task-manager.js +429 -368
  5. package/bin/validate.js +369 -268
  6. package/content/.claude/commands/morph-apply.md +221 -158
  7. package/content/.claude/commands/morph-deploy.md +529 -0
  8. package/content/.claude/commands/morph-preflight.md +227 -0
  9. package/content/.claude/commands/morph-proposal.md +122 -101
  10. package/content/.claude/commands/morph-status.md +86 -86
  11. package/content/.claude/commands/morph-troubleshoot.md +122 -0
  12. package/content/.claude/skills/infra/azure-deploy-specialist.md +699 -0
  13. package/content/.claude/skills/level-0-meta/README.md +7 -0
  14. package/content/.claude/skills/level-0-meta/code-review.md +226 -0
  15. package/content/.claude/skills/level-0-meta/morph-checklist.md +117 -0
  16. package/content/.claude/skills/level-0-meta/simulation-checklist.md +77 -0
  17. package/content/.claude/skills/level-1-workflows/README.md +7 -0
  18. package/content/.claude/skills/level-1-workflows/morph-replicate.md +213 -0
  19. package/content/.claude/{commands/morph-clarify.md → skills/level-1-workflows/phase-clarify.md} +131 -184
  20. package/content/.claude/{commands/morph-design.md → skills/level-1-workflows/phase-design.md} +213 -275
  21. package/content/.claude/skills/level-1-workflows/phase-setup.md +106 -0
  22. package/content/.claude/skills/level-1-workflows/phase-tasks.md +164 -0
  23. package/content/.claude/{commands/morph-uiux.md → skills/level-1-workflows/phase-uiux.md} +169 -211
  24. package/content/.claude/skills/level-2-domains/README.md +14 -0
  25. package/content/.claude/skills/level-2-domains/ai-agents/ai-system-architect.md +192 -0
  26. package/content/.claude/skills/{specialists → level-2-domains/architecture}/po-pm-advisor.md +197 -197
  27. package/content/.claude/skills/level-2-domains/architecture/standards-architect.md +156 -0
  28. package/content/.claude/skills/level-2-domains/backend/dotnet-senior.md +287 -0
  29. package/content/.claude/skills/level-2-domains/backend/ef-modeler.md +113 -0
  30. package/content/.claude/skills/level-2-domains/backend/hangfire-orchestrator.md +126 -0
  31. package/content/.claude/skills/level-2-domains/backend/ms-agent-expert.md +109 -0
  32. package/content/.claude/skills/level-2-domains/frontend/blazor-builder.md +210 -0
  33. package/content/.claude/skills/level-2-domains/frontend/nextjs-expert.md +154 -0
  34. package/content/.claude/skills/level-2-domains/frontend/ui-ux-designer.md +191 -0
  35. package/content/.claude/skills/{specialists → level-2-domains/infrastructure}/azure-architect.md +142 -142
  36. package/content/.claude/skills/level-2-domains/infrastructure/bicep-architect.md +126 -0
  37. package/content/.claude/skills/level-2-domains/infrastructure/container-specialist.md +131 -0
  38. package/content/.claude/skills/level-2-domains/infrastructure/devops-engineer.md +119 -0
  39. package/content/.claude/skills/level-2-domains/integrations/asaas-financial.md +130 -0
  40. package/content/.claude/skills/level-2-domains/integrations/azure-identity.md +142 -0
  41. package/content/.claude/skills/level-2-domains/integrations/clerk-auth.md +108 -0
  42. package/content/.claude/skills/level-2-domains/integrations/resend-email.md +119 -0
  43. package/content/.claude/skills/level-2-domains/quality/code-analyzer.md +235 -0
  44. package/content/.claude/skills/level-2-domains/quality/testing-specialist.md +126 -0
  45. package/content/.claude/skills/level-3-technologies/README.md +7 -0
  46. package/content/.claude/skills/level-4-patterns/README.md +7 -0
  47. package/content/.claude/skills/specialists/prompt-engineer.md +189 -0
  48. package/content/.claude/skills/specialists/seo-growth-hacker.md +320 -0
  49. package/content/.morph/config/agents.json +762 -242
  50. package/content/.morph/config/config.template.json +122 -108
  51. package/content/.morph/docs/workflows/design-impl.md +37 -0
  52. package/content/.morph/docs/workflows/enforcement-pipeline.md +668 -0
  53. package/content/.morph/docs/workflows/fast-track.md +29 -0
  54. package/content/.morph/docs/workflows/full-morph.md +76 -0
  55. package/content/.morph/docs/workflows/standard.md +44 -0
  56. package/content/.morph/docs/workflows/ui-refresh.md +39 -0
  57. package/content/.morph/examples/scheduled-reports/decisions.md +158 -0
  58. package/content/.morph/examples/scheduled-reports/proposal.md +95 -0
  59. package/content/.morph/examples/scheduled-reports/spec.md +267 -0
  60. package/content/.morph/hooks/README.md +348 -239
  61. package/content/.morph/hooks/pre-commit-agents.sh +24 -24
  62. package/content/.morph/hooks/task-completed.js +73 -0
  63. package/content/.morph/hooks/teammate-idle.js +68 -0
  64. package/content/.morph/schemas/tasks.schema.json +220 -0
  65. package/content/.morph/standards/agent-framework-blazor-ui.md +359 -0
  66. package/content/.morph/standards/agent-framework-production.md +410 -0
  67. package/content/.morph/standards/agent-framework-setup.md +413 -453
  68. package/content/.morph/standards/agent-framework-workflows.md +349 -0
  69. package/content/.morph/standards/agent-teams-workflow.md +474 -0
  70. package/content/.morph/standards/architecture.md +325 -325
  71. package/content/.morph/standards/azure.md +605 -379
  72. package/content/.morph/standards/dotnet10-migration.md +520 -494
  73. package/content/.morph/templates/CONTEXT-FEATURE.md +276 -0
  74. package/content/.morph/templates/CONTEXT.md +170 -0
  75. package/content/.morph/templates/agent.cs +163 -172
  76. package/content/.morph/templates/clarify-questions.md +159 -0
  77. package/content/.morph/templates/contracts/Commands.cs +74 -0
  78. package/content/.morph/templates/contracts/Entities.cs +25 -0
  79. package/content/.morph/templates/contracts/Queries.cs +74 -0
  80. package/content/.morph/templates/contracts/README.md +74 -0
  81. package/content/.morph/templates/decisions.md +123 -106
  82. package/content/.morph/templates/infra/azure-pipelines-deploy.yml +480 -0
  83. package/content/.morph/templates/infra/deploy-checklist.md +426 -0
  84. package/content/.morph/templates/proposal.md +141 -155
  85. package/content/.morph/templates/recap.md +94 -105
  86. package/content/.morph/templates/simulation.md +353 -0
  87. package/content/.morph/templates/spec.md +149 -148
  88. package/content/.morph/templates/state.template.json +222 -222
  89. package/content/.morph/templates/tasks.md +257 -235
  90. package/content/.morph/templates/ui-components.md +362 -276
  91. package/content/CLAUDE.md +150 -442
  92. package/detectors/structure-detector.js +245 -250
  93. package/docs/README.md +144 -149
  94. package/docs/getting-started.md +301 -302
  95. package/docs/installation.md +361 -361
  96. package/docs/validation-checklist.md +265 -266
  97. package/package.json +80 -80
  98. package/src/commands/advance-phase.js +266 -0
  99. package/src/commands/analyze-blazor-concurrency.js +193 -0
  100. package/src/commands/deploy.js +780 -0
  101. package/src/commands/detect-agents.js +167 -0
  102. package/src/commands/doctor.js +356 -280
  103. package/src/commands/generate-context.js +40 -0
  104. package/src/commands/init.js +258 -245
  105. package/src/commands/lint-fluent.js +352 -0
  106. package/src/commands/rollback-phase.js +185 -0
  107. package/src/commands/session-summary.js +291 -0
  108. package/src/commands/task.js +78 -75
  109. package/src/commands/troubleshoot.js +222 -0
  110. package/src/commands/update.js +192 -159
  111. package/src/commands/validate-blazor-state.js +210 -0
  112. package/src/commands/validate-blazor.js +156 -0
  113. package/src/commands/validate-css.js +84 -0
  114. package/src/commands/validate-phase.js +221 -0
  115. package/src/lib/blazor-concurrency-analyzer.js +288 -0
  116. package/src/lib/blazor-state-validator.js +291 -0
  117. package/src/lib/blazor-validator.js +374 -0
  118. package/src/lib/complexity-analyzer.js +441 -292
  119. package/src/lib/context-generator.js +513 -0
  120. package/src/lib/continuous-validator.js +421 -440
  121. package/src/lib/css-validator.js +352 -0
  122. package/src/lib/decision-constraint-loader.js +109 -0
  123. package/src/lib/design-system-detector.js +187 -0
  124. package/src/lib/design-system-scaffolder.js +299 -0
  125. package/src/lib/hook-executor.js +256 -0
  126. package/src/lib/recap-generator.js +205 -0
  127. package/src/lib/spec-validator.js +258 -0
  128. package/src/lib/standards-context-injector.js +287 -0
  129. package/src/lib/state-manager.js +397 -340
  130. package/src/lib/team-orchestrator.js +322 -0
  131. package/src/lib/troubleshoot-grep.js +194 -0
  132. package/src/lib/troubleshoot-index.js +144 -0
  133. package/src/lib/validation-runner.js +283 -0
  134. package/src/lib/validators/contract-compliance-validator.js +273 -0
  135. package/src/lib/validators/design-system-validator.js +231 -0
  136. package/src/utils/file-copier.js +187 -139
  137. package/content/.claude/commands/morph-costs.md +0 -206
  138. package/content/.claude/commands/morph-setup.md +0 -100
  139. package/content/.claude/commands/morph-tasks.md +0 -319
  140. package/content/.claude/skills/infra/bicep-architect.md +0 -419
  141. package/content/.claude/skills/infra/container-specialist.md +0 -437
  142. package/content/.claude/skills/infra/devops-engineer.md +0 -405
  143. package/content/.claude/skills/integrations/asaas-financial.md +0 -333
  144. package/content/.claude/skills/integrations/azure-identity.md +0 -309
  145. package/content/.claude/skills/integrations/clerk-auth.md +0 -290
  146. package/content/.claude/skills/specialists/ai-system-architect.md +0 -604
  147. package/content/.claude/skills/specialists/cost-guardian.md +0 -110
  148. package/content/.claude/skills/specialists/ef-modeler.md +0 -211
  149. package/content/.claude/skills/specialists/hangfire-orchestrator.md +0 -255
  150. package/content/.claude/skills/specialists/ms-agent-expert.md +0 -263
  151. package/content/.claude/skills/specialists/standards-architect.md +0 -78
  152. package/content/.claude/skills/specialists/ui-ux-designer.md +0 -1100
  153. package/content/.claude/skills/stacks/dotnet-blazor.md +0 -606
  154. package/content/.claude/skills/stacks/dotnet-nextjs.md +0 -402
  155. package/content/.claude/skills/stacks/shopify.md +0 -445
  156. package/content/.morph/config/azure-pricing.json +0 -70
  157. package/content/.morph/config/azure-pricing.schema.json +0 -50
  158. package/content/.morph/hooks/pre-commit-costs.sh +0 -91
  159. package/docs/api/cost-calculator.js.html +0 -513
  160. package/docs/api/design-system-generator.js.html +0 -382
  161. package/docs/api/global.html +0 -5263
  162. package/docs/api/index.html +0 -96
  163. package/docs/api/state-manager.js.html +0 -423
  164. package/src/commands/cost.js +0 -181
  165. package/src/commands/update-pricing.js +0 -206
  166. package/src/lib/cost-calculator.js +0 -429
@@ -0,0 +1,235 @@
1
+ # Code Analyzer
2
+
3
+ > **Layer:** 2 | **Load:** on-keyword | **Keywords:** analyze, review, refactor, clean, smell, duplicate, architecture, quality, debt, unused, dead code, code review, code quality
4
+
5
+ Deep code analysis specialist. Automates architecture review, clean code checks, and duplication detection.
6
+
7
+ > **Ref:** `framework/standards/coding.md` for naming conventions.
8
+ > **Ref:** `framework/standards/architecture.md` for architectural patterns.
9
+ > **Ref:** `.claude/skills/checklists/code-review.md` for runtime pattern checks.
10
+
11
+ ---
12
+
13
+ ## When to Run
14
+
15
+ | Trigger | Automatic? | Scope |
16
+ |---------|-----------|-------|
17
+ | FASE 5 completion (`/morph-apply` done) | Yes | Full feature code |
18
+ | Checkpoint (every 3 tasks) | Yes | Code since last checkpoint |
19
+ | Manual: `analyze`, `review code`, `code quality` | No | Specified scope |
20
+ | Pre-merge review | Recommended | All changed files |
21
+
22
+ ---
23
+
24
+ ## 3 Analysis Modes
25
+
26
+ Run all 3 modes by default. Use `--mode architecture`, `--mode clean`, or `--mode duplication` for targeted analysis.
27
+
28
+ ---
29
+
30
+ ### Mode 1: Architecture Analysis
31
+
32
+ Analyze the codebase for structural and architectural issues.
33
+
34
+ #### Checklist
35
+
36
+ **Layer Integrity:**
37
+ - [ ] `[CRITICAL]` Domain project has zero references to Infrastructure or Web
38
+ - [ ] `[CRITICAL]` Application does NOT reference Web project
39
+ - [ ] `[HIGH]` No circular dependencies between projects
40
+ - [ ] `[HIGH]` Infrastructure details don't leak into Application (no EF types in DTOs)
41
+
42
+ **Responsibility Separation:**
43
+ - [ ] `[HIGH]` Each class has a single, clear responsibility (< 300 lines)
44
+ - [ ] `[HIGH]` Controllers/pages are thin (< 50 lines logic, delegate to services)
45
+ - [ ] `[MEDIUM]` Interfaces are focused (< 7 methods per interface)
46
+ - [ ] `[MEDIUM]` No "God classes" (classes with 10+ dependencies)
47
+
48
+ **Abstractions:**
49
+ - [ ] `[MEDIUM]` External services accessed through interfaces (testable)
50
+ - [ ] `[LOW]` No over-abstraction (interfaces with exactly 1 implementation that's never mocked)
51
+ - [ ] `[MEDIUM]` Missing abstractions: direct HTTP calls, file I/O, or DB access without interface
52
+
53
+ **File Organization:**
54
+ - [ ] `[MEDIUM]` One class per file (file name matches class name)
55
+ - [ ] `[MEDIUM]` Files in correct project/folder per architecture.md
56
+ - [ ] `[LOW]` Consistent folder structure across all layers
57
+
58
+ **Configuration:**
59
+ - [ ] `[HIGH]` No hardcoded connection strings, URLs, or secrets
60
+ - [ ] `[MEDIUM]` Configuration via Options pattern (`IOptions<T>`)
61
+ - [ ] `[LOW]` No duplicate configuration across projects
62
+
63
+ **Unused Code:**
64
+ - [ ] `[MEDIUM]` No unused classes or interfaces (search for zero references)
65
+ - [ ] `[MEDIUM]` No dead code paths (unreachable branches)
66
+ - [ ] `[LOW]` No commented-out code blocks (> 3 lines)
67
+ - [ ] `[LOW]` No empty or near-empty files (< 10 lines of actual code)
68
+
69
+ ---
70
+
71
+ ### Mode 2: Clean Code Analysis
72
+
73
+ Analyze for code smells, style violations, and improvement opportunities.
74
+
75
+ #### Checklist
76
+
77
+ **Naming (ref: coding.md):**
78
+ - [ ] `[HIGH]` All naming follows coding.md conventions (PascalCase constants, _camelCase fields, etc.)
79
+ - [ ] `[HIGH]` No Hungarian notation (`strName`, `iCount`, `btnSubmit`)
80
+ - [ ] `[HIGH]` No ALL_CAPS constants (`MAX_RETRY` -> `MaxRetry`)
81
+ - [ ] `[MEDIUM]` Descriptive names (no `data`, `info`, `item`, `result` without context)
82
+ - [ ] `[MEDIUM]` No abbreviations in public APIs (`repo` -> `repository`)
83
+
84
+ **Method Quality:**
85
+ - [ ] `[HIGH]` No methods > 30 lines (extract sub-methods)
86
+ - [ ] `[HIGH]` No methods with > 4 parameters (use request object)
87
+ - [ ] `[MEDIUM]` No nested conditionals > 3 levels (extract or use early return)
88
+ - [ ] `[MEDIUM]` No complex conditionals (> 3 conditions in one `if` — extract to named bool or method)
89
+
90
+ **Class Quality:**
91
+ - [ ] `[HIGH]` No classes > 300 lines (SRP violation — split)
92
+ - [ ] `[HIGH]` No classes with > 7 constructor dependencies (God class — split)
93
+ - [ ] `[MEDIUM]` Classes are `sealed` unless designed for inheritance
94
+
95
+ **Magic Values:**
96
+ - [ ] `[HIGH]` No magic strings in comparisons (`if (status == "active")` -> use enum or constant)
97
+ - [ ] `[HIGH]` No magic numbers (`if (items.Count > 50)` -> extract `const int MaxItemsPerPage = 50`)
98
+ - [ ] `[MEDIUM]` No hardcoded URLs, file paths, or configuration values
99
+
100
+ **Dead Code:**
101
+ - [ ] `[MEDIUM]` No unused private methods (zero callers)
102
+ - [ ] `[MEDIUM]` No unused parameters in methods
103
+ - [ ] `[LOW]` No TODO/FIXME/HACK comments older than 2 sprints
104
+ - [ ] `[LOW]` No `#if DEBUG` blocks with substantial logic
105
+
106
+ **Error Handling:**
107
+ - [ ] `[CRITICAL]` No empty catch blocks
108
+ - [ ] `[HIGH]` No generic `catch (Exception)` without re-throw
109
+ - [ ] `[HIGH]` Result pattern used for business errors (not exceptions)
110
+ - [ ] `[MEDIUM]` Consistent error handling pattern across all services
111
+
112
+ **Logging:**
113
+ - [ ] `[HIGH]` No `$""` string interpolation in log methods (use message templates)
114
+ - [ ] `[HIGH]` Critical operations have entry/exit/error logging
115
+ - [ ] `[MEDIUM]` Log messages include correlation IDs (OrderId, UserId)
116
+ - [ ] `[MEDIUM]` Consistent log levels across similar operations
117
+
118
+ ---
119
+
120
+ ### Mode 3: Duplication Detection
121
+
122
+ Find redundant, duplicate, and unnecessary code.
123
+
124
+ #### Targets
125
+
126
+ **Exact/Near-Exact Duplicates:**
127
+ - [ ] `[HIGH]` Methods with identical or near-identical logic in different classes
128
+ - Same method body, different class -> extract to shared service or extension
129
+ - Same logic with different types -> extract to generic method
130
+ - [ ] `[HIGH]` Repeated code blocks (> 5 lines identical in 2+ locations)
131
+
132
+ **Thin Wrappers:**
133
+ - [ ] `[MEDIUM]` Methods that only delegate to another method with same parameters
134
+ ```csharp
135
+ // SMELL: Thin wrapper with no added value
136
+ public Task<Order> GetOrderAsync(int id, CancellationToken ct)
137
+ => _innerService.GetOrderAsync(id, ct);
138
+ ```
139
+ - [ ] `[MEDIUM]` Service methods that only call a repository method (no logic added)
140
+
141
+ **Interface Redundancy:**
142
+ - [ ] `[MEDIUM]` Same method signature appearing in multiple interfaces (extract base interface)
143
+ - [ ] `[LOW]` Interface that exactly mirrors another interface (merge or inherit)
144
+
145
+ **Passthrough Delegates:**
146
+ - [ ] `[MEDIUM]` Controller/page methods that only call one service method and return result
147
+ - If no validation, auth, or mapping: consider simplifying the layer
148
+
149
+ **DTO/Model Duplication:**
150
+ - [ ] `[HIGH]` Duplicate model definitions (same properties in different classes)
151
+ - [ ] `[MEDIUM]` Request/Response DTOs that are identical (merge or use shared base)
152
+ - [ ] `[MEDIUM]` Enums defined in multiple projects (centralize in Domain)
153
+
154
+ ---
155
+
156
+ ## Output Format
157
+
158
+ For each finding, report:
159
+
160
+ ```
161
+ ### [{SEVERITY}] {Category}: {Short Description}
162
+
163
+ **File:** `path/to/file.cs:42`
164
+ **Rule:** {rule reference from checklist above}
165
+
166
+ **Current code:**
167
+ ```csharp
168
+ // problematic code snippet
169
+ ```
170
+
171
+ **Suggested fix:**
172
+ ```csharp
173
+ // corrected code snippet
174
+ ```
175
+
176
+ **Why:** {brief explanation of the problem and impact}
177
+ ```
178
+
179
+ ---
180
+
181
+ ## Summary Template
182
+
183
+ After analysis, generate a summary:
184
+
185
+ ```markdown
186
+ ## Code Analysis Summary
187
+
188
+ **Scope:** {files/feature analyzed}
189
+ **Date:** {date}
190
+ **Modes:** Architecture | Clean Code | Duplication
191
+
192
+ ### Findings by Severity
193
+
194
+ | Severity | Count |
195
+ |----------|-------|
196
+ | CRITICAL | {n} |
197
+ | HIGH | {n} |
198
+ | MEDIUM | {n} |
199
+ | LOW | {n} |
200
+
201
+ ### Top 5 Priorities
202
+
203
+ 1. {Most critical finding with file:line}
204
+ 2. {Second most critical}
205
+ 3. ...
206
+
207
+ ### Estimated Effort
208
+
209
+ | Category | Findings | Effort |
210
+ |----------|----------|--------|
211
+ | Quick fixes (naming, style) | {n} | ~{h}h |
212
+ | Refactoring (extraction, splitting) | {n} | ~{h}h |
213
+ | Architecture (layer changes) | {n} | ~{h}h |
214
+
215
+ ### Recommendations
216
+
217
+ - {Key recommendation 1}
218
+ - {Key recommendation 2}
219
+ - {Key recommendation 3}
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Integration with Other Specialists
225
+
226
+ | Specialist | Handoff |
227
+ |------------|---------|
228
+ | **Standards Architect** | Code Analyzer validates naming rules defined by Standards Architect |
229
+ | **.NET Senior Engineer** | Code Analyzer reviews code produced by dotnet-senior |
230
+ | **Code Review Checklist** | Code Analyzer runs architecture/clean code checks; code-review.md covers runtime patterns |
231
+ | **Testing Specialist** | Findings may generate new test requirements |
232
+
233
+ ---
234
+
235
+ *MORPH-SPEC by Polymorphism Tech*
@@ -0,0 +1,126 @@
1
+ # Testing Specialist
2
+
3
+ > **Layer:** 2 | **Load:** on-keyword | **Keywords:** test, testing, mock, fake, simulation, unit test, integration test
4
+
5
+ Especialista em testes, mocking e simulação para projetos .NET.
6
+
7
+ ## Strategy
8
+
9
+ | Level | What | Tools |
10
+ |-------|------|-------|
11
+ | **Unit** | Business logic, domain, handlers | xUnit + Moq + FluentAssertions |
12
+ | **Integration** | API flows, DB operations | WebApplicationFactory + TestContainers |
13
+ | **Component** | Blazor rendering, events | bUnit |
14
+ | **E2E** | Critical user journeys | Playwright (if needed) |
15
+
16
+ **Focus:** Critical/complex code. Don't aim for 100%, aim for value. Cover edge cases and error paths.
17
+
18
+ ---
19
+
20
+ ## Core Patterns
21
+
22
+ ### AAA (Arrange-Act-Assert)
23
+
24
+ ```csharp
25
+ [Fact]
26
+ public async Task CreateOrder_Should_ReturnSuccess_When_ValidInput()
27
+ {
28
+ // Arrange
29
+ var command = new CreateOrderCommand { CustomerId = 1, Items = [...] };
30
+ var handler = new CreateOrderHandler(_mockRepo.Object);
31
+ // Act
32
+ var result = await handler.Handle(command, CancellationToken.None);
33
+ // Assert
34
+ result.IsSuccess.Should().BeTrue();
35
+ }
36
+ ```
37
+
38
+ ### Naming Convention
39
+ ```
40
+ [Method]_Should_[ExpectedResult]_When_[Condition]
41
+ ```
42
+
43
+ ### Test Data Builders
44
+ Use builder pattern for complex test entities: `new OrderBuilder().WithCustomer(123).WithStatus(Completed).Build()`
45
+
46
+ ### Mocking (Moq)
47
+ ```csharp
48
+ var mockRepo = new Mock<IOrderRepository>();
49
+ mockRepo.Setup(r => r.GetByIdAsync(It.IsAny<int>())).ReturnsAsync(new Order { Id = 1 });
50
+ mockRepo.Verify(r => r.SaveAsync(It.IsAny<Order>()), Times.Once);
51
+ ```
52
+
53
+ ### Integration Tests (WebApplicationFactory)
54
+ Replace real DB with in-memory in `ConfigureServices`, use `CreateClient()` for HTTP calls.
55
+
56
+ ### bUnit (Blazor)
57
+ `RenderComponent<Counter>()` → `Find("button").Click()` → assert `TextContent`.
58
+
59
+ ---
60
+
61
+ ## Libraries
62
+
63
+ | Library | Purpose | NuGet |
64
+ |---------|---------|-------|
65
+ | xUnit | Test framework | `xunit` |
66
+ | Moq | Mocking | `Moq` |
67
+ | FluentAssertions | Readable assertions | `FluentAssertions` |
68
+ | Bogus | Fake data | `Bogus` |
69
+ | TestContainers | DB containers | `Testcontainers` |
70
+ | Respawn | DB reset | `Respawn` |
71
+ | WireMock | HTTP mocking | `WireMock.Net` |
72
+ | bUnit | Blazor testing | `bunit` |
73
+
74
+ ## Folder Structure
75
+
76
+ ```
77
+ tests/
78
+ ├── Unit/{Domain,Application,Builders}/
79
+ ├── Integration/{Api,Fixtures}/
80
+ └── E2E/
81
+ ```
82
+
83
+ ## Anti-Patterns
84
+ 1. **Fragile tests** — test behavior, not implementation
85
+ 2. **Slow tests** — use mocks, not real DB for unit tests
86
+ 3. **Coupled tests** — each test independent
87
+ 4. **Vague assertions** — use specific FluentAssertions
88
+ 5. **Giant setup** — extract to builders/fixtures
89
+
90
+ ---
91
+
92
+ ## Simulation of External Services
93
+
94
+ > **Ref:** `.claude/skills/checklists/simulation-checklist.md` for complete checklist
95
+
96
+ ### Key Rules
97
+
98
+ | Mock Type | Characteristic | DI Lifetime |
99
+ |-----------|---------------|-------------|
100
+ | **Stateful** (Dictionary, List) | Keeps data between calls | `Singleton` |
101
+ | **Stateless** | No state | `Scoped` |
102
+
103
+ ```csharp
104
+ // ❌ Stateful with Scoped = loses state between requests
105
+ services.AddScoped<IReplicateClient, FakeReplicateClient>();
106
+ // ✅ Stateful with Singleton
107
+ services.AddSingleton<IReplicateClient, FakeReplicateClient>();
108
+ ```
109
+
110
+ **Before implementing mocks:** Map ALL dependencies (interfaces, transitive deps, lifetimes).
111
+
112
+ ---
113
+
114
+ ## Checklists
115
+
116
+ ### Per Test Type
117
+ | Target | Test |
118
+ |--------|------|
119
+ | Entity/Domain | Creation validation, state transitions (valid + invalid), invariants |
120
+ | Handler/Service | Happy path, invalid input, not found (404), auth error, timeout |
121
+ | API | Status codes, response body, request validation, auth |
122
+ | Blazor Component | Initial render, user events, states (loading/error/empty), form validation |
123
+
124
+ ---
125
+
126
+ *MORPH-SPEC by Polymorphism Tech*
@@ -0,0 +1,7 @@
1
+ # Level 3: Technologies
2
+
3
+ Technology-specific implementation patterns.
4
+
5
+ **Purpose:** Skills for specific technologies (EF Core, Blazor, Hangfire, SignalR, etc.).
6
+
7
+ **To be populated in Phase 8/9.**
@@ -0,0 +1,7 @@
1
+ # Level 4: Patterns
2
+
3
+ Architectural and design patterns.
4
+
5
+ **Purpose:** Skills for specific patterns (CQRS, Event Sourcing, DDD, Repository, etc.).
6
+
7
+ **To be populated later.**
@@ -0,0 +1,189 @@
1
+ # Prompt Engineer
2
+
3
+ Especialista em engenharia de prompts para LLMs e sistemas de IA. Use PROATIVAMENTE ao construir features de IA, melhorar performance de agentes ou criar system prompts.
4
+
5
+ ## Responsabilidades
6
+
7
+ 1. Criar prompts otimizados para LLMs
8
+ 2. Aplicar técnicas avançadas de prompting
9
+ 3. Definir formatos de output estruturados
10
+ 4. Otimizar prompts existentes
11
+ 5. Adaptar prompts para diferentes modelos
12
+
13
+ ## Triggers
14
+
15
+ Keywords: `prompt`, `prompting`, `system prompt`, `few-shot`, `chain-of-thought`, `llm prompt`, `agent prompt`, `engenharia de prompt`
16
+
17
+ ## Áreas de Expertise
18
+
19
+ ### Otimização de Prompts
20
+
21
+ - Seleção few-shot vs zero-shot
22
+ - Raciocínio chain-of-thought
23
+ - Role-playing e definição de perspectiva
24
+ - Especificação de formato de output
25
+ - Definição de constraints e limites
26
+
27
+ ### Arsenal de Técnicas
28
+
29
+ - Constitutional AI principles
30
+ - Recursive prompting
31
+ - Tree of thoughts
32
+ - Self-consistency checking
33
+ - Prompt chaining e pipelines
34
+
35
+ ### Otimização por Modelo
36
+
37
+ - **Claude**: Ênfase em helpful, harmless, honest
38
+ - **GPT**: Estrutura clara e exemplos
39
+ - **Open models**: Necessidades específicas de formatação
40
+ - **Modelos especializados**: Adaptação de domínio
41
+
42
+ ## Processo de Otimização
43
+
44
+ 1. Analisar caso de uso pretendido
45
+ 2. Identificar requisitos e constraints chave
46
+ 3. Selecionar técnicas de prompting apropriadas
47
+ 4. Criar prompt inicial com estrutura clara
48
+ 5. Testar e iterar baseado em outputs
49
+ 6. Documentar padrões efetivos
50
+
51
+ ## Formato de Output Obrigatório
52
+
53
+ **IMPORTANTE:** SEMPRE que criar qualquer prompt, DEVE exibir o texto completo. NUNCA apenas descreva um prompt.
54
+
55
+ ### O Prompt
56
+ ```
57
+ [Exibir texto completo do prompt aqui]
58
+ ```
59
+
60
+ ### Notas de Implementação
61
+ - Técnicas chave usadas
62
+ - Por que essas escolhas foram feitas
63
+ - Outcomes esperados
64
+
65
+ ## Deliverables
66
+
67
+ - **O texto do prompt** (exibido completo, formatado)
68
+ - Explicação das escolhas de design
69
+ - Guidelines de uso
70
+ - Exemplos de outputs esperados
71
+ - Benchmarks de performance
72
+ - Estratégias de tratamento de erro
73
+
74
+ ## Padrões Comuns
75
+
76
+ ### Estrutura System/User/Assistant
77
+ ```
78
+ <system>
79
+ [Contexto e personalidade]
80
+ </system>
81
+
82
+ <user>
83
+ [Input do usuário]
84
+ </user>
85
+ ```
86
+
87
+ ### Tags XML para Seções Claras
88
+ ```xml
89
+ <context>
90
+ [Background information]
91
+ </context>
92
+
93
+ <instructions>
94
+ [What to do]
95
+ </instructions>
96
+
97
+ <output_format>
98
+ [Expected format]
99
+ </output_format>
100
+ ```
101
+
102
+ ### Outros Padrões
103
+ - Formatos de output explícitos
104
+ - Raciocínio passo-a-passo
105
+ - Critérios de auto-avaliação
106
+
107
+ ## Exemplo de Output
108
+
109
+ Quando solicitado a criar prompt para code review:
110
+
111
+ ### O Prompt
112
+ ```
113
+ You are an expert code reviewer with 10+ years of experience. Review the provided code focusing on:
114
+ 1. Security vulnerabilities
115
+ 2. Performance optimizations
116
+ 3. Code maintainability
117
+ 4. Best practices
118
+
119
+ For each issue found, provide:
120
+ - Severity level (Critical/High/Medium/Low)
121
+ - Specific line numbers
122
+ - Explanation of the issue
123
+ - Suggested fix with code example
124
+
125
+ Format your response as a structured report with clear sections.
126
+ ```
127
+
128
+ ### Notas de Implementação
129
+ - Usa role-playing para estabelecer expertise
130
+ - Fornece critérios de avaliação claros
131
+ - Especifica formato de output para consistência
132
+ - Inclui requisitos de feedback acionável
133
+
134
+ ## Técnicas Avançadas
135
+
136
+ ### Few-Shot Prompting
137
+ ```
138
+ Here are examples of good responses:
139
+
140
+ Example 1:
141
+ Input: [example input]
142
+ Output: [example output]
143
+
144
+ Example 2:
145
+ Input: [example input]
146
+ Output: [example output]
147
+
148
+ Now process this:
149
+ Input: [actual input]
150
+ ```
151
+
152
+ ### Chain-of-Thought
153
+ ```
154
+ Think through this step by step:
155
+ 1. First, identify...
156
+ 2. Then, analyze...
157
+ 3. Finally, conclude...
158
+
159
+ Show your reasoning before giving the final answer.
160
+ ```
161
+
162
+ ### Self-Consistency
163
+ ```
164
+ Generate 3 different approaches to solve this problem.
165
+ Compare the approaches and select the most robust one.
166
+ Explain why this approach is best.
167
+ ```
168
+
169
+ ## Checklist Antes de Completar
170
+
171
+ - [ ] Exibiu texto completo do prompt (não apenas descreveu)
172
+ - [ ] Marcou claramente com headers ou code blocks
173
+ - [ ] Forneceu instruções de uso
174
+ - [ ] Explicou escolhas de design
175
+ - [ ] Incluiu exemplos de outputs esperados
176
+
177
+ ## Documentação de Referência
178
+
179
+ - [Anthropic Prompt Engineering Guide](https://docs.anthropic.com/claude/docs/prompt-engineering)
180
+ - [OpenAI Prompt Engineering](https://platform.openai.com/docs/guides/prompt-engineering)
181
+ - [Prompt Engineering Patterns](https://www.promptingguide.ai/)
182
+
183
+ ## Anti-Patterns a Evitar
184
+
185
+ 1. **Prompts vagos**: "Faça algo bom" → Especifique critérios claros
186
+ 2. **Sem formato de output**: Sempre definir estrutura esperada
187
+ 3. **Instruções contraditórias**: Revisar consistência antes de usar
188
+ 4. **Overloading**: Muitas instruções = confusão. Priorize as essenciais
189
+ 5. **Falta de exemplos**: Few-shot geralmente supera zero-shot