@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,226 @@
1
+ # Code Review Checklist
2
+
3
+ > Comprehensive checklist for .NET code review: naming, architecture, clean code, duplication, and runtime patterns.
4
+ > **Ref:** `framework/standards/coding.md` for naming conventions and style.
5
+ > **Ref:** `framework/standards/architecture.md` for layer rules and SOLID.
6
+ > **Ref:** `framework/standards/blazor-efcore.md` for DbContext patterns and background ops.
7
+
8
+ ---
9
+
10
+ ## Naming & Style (ref: coding.md)
11
+
12
+ - [ ] `[CRITICAL]` Constants use PascalCase (`MaxRetryCount`, NOT `MAX_RETRY_COUNT`)
13
+ - [ ] `[CRITICAL]` No Hungarian notation (`strName`, `iCount`, `btnSubmit`)
14
+ - [ ] `[HIGH]` Private fields use `_camelCase` prefix
15
+ - [ ] `[HIGH]` Async methods have `Async` suffix
16
+ - [ ] `[HIGH]` Interfaces prefixed with `I`
17
+ - [ ] `[MEDIUM]` No abbreviations in public APIs (`repository` not `repo`)
18
+ - [ ] `[MEDIUM]` All classes `sealed` unless designed for inheritance
19
+ - [ ] `[MEDIUM]` File-scoped namespaces used
20
+
21
+ ---
22
+
23
+ ## Architecture Review (ref: architecture.md)
24
+
25
+ ### Layer Integrity
26
+ - [ ] `[CRITICAL]` Domain has zero references to Infrastructure or Web
27
+ - [ ] `[CRITICAL]` No circular dependencies between projects
28
+ - [ ] `[HIGH]` Application does NOT reference Web project
29
+ - [ ] `[HIGH]` Infrastructure details don't leak into Application DTOs
30
+
31
+ ### Responsibility & Organization
32
+ - [ ] `[HIGH]` No class > 300 lines (SRP violation)
33
+ - [ ] `[HIGH]` Controllers/pages are thin (< 50 lines logic)
34
+ - [ ] `[MEDIUM]` One class per file, file name = class name
35
+ - [ ] `[MEDIUM]` Files in correct project/folder per architecture.md
36
+ - [ ] `[LOW]` No "God classes" (10+ constructor dependencies)
37
+
38
+ ### Dependencies
39
+ - [ ] `[HIGH]` External services accessed through interfaces
40
+ - [ ] `[HIGH]` No hardcoded connection strings, URLs, or secrets
41
+ - [ ] `[MEDIUM]` Configuration via Options pattern (`IOptions<T>`)
42
+ - [ ] `[LOW]` No over-abstraction (interface with 1 impl never mocked)
43
+
44
+ ---
45
+
46
+ ## Clean Code Review
47
+
48
+ ### Method Quality
49
+ - [ ] `[HIGH]` No methods > 30 lines (extract sub-methods)
50
+ - [ ] `[HIGH]` No methods with > 4 parameters (use request object)
51
+ - [ ] `[MEDIUM]` No nested conditionals > 3 levels (use early return)
52
+ - [ ] `[MEDIUM]` No complex conditionals (> 3 conditions — extract to named method)
53
+
54
+ ### Magic Values
55
+ - [ ] `[HIGH]` No magic strings in comparisons (use enum or constant)
56
+ - [ ] `[HIGH]` No magic numbers (extract to PascalCase constant)
57
+ - [ ] `[MEDIUM]` No hardcoded URLs, file paths, or config values
58
+
59
+ ### Dead Code
60
+ - [ ] `[MEDIUM]` No unused private methods
61
+ - [ ] `[MEDIUM]` No unused parameters
62
+ - [ ] `[LOW]` No commented-out code blocks (> 3 lines)
63
+ - [ ] `[LOW]` No empty or near-empty files
64
+
65
+ ---
66
+
67
+ ## Duplication Review
68
+
69
+ - [ ] `[HIGH]` No exact/near-exact duplicate methods across classes
70
+ - [ ] `[HIGH]` No duplicate model definitions (same properties in different classes)
71
+ - [ ] `[MEDIUM]` No thin wrappers that only delegate without adding value
72
+ - [ ] `[MEDIUM]` No mirrored interface methods (extract base interface)
73
+ - [ ] `[MEDIUM]` No duplicate enums across projects (centralize in Domain)
74
+ - [ ] `[LOW]` No passthrough service methods (controller -> service with zero logic)
75
+
76
+ ---
77
+
78
+ ## Async & Cancellation
79
+
80
+ - [ ] `[CRITICAL]` CancellationToken propagated through entire call chain
81
+ - [ ] `[CRITICAL]` No `.Result` or `.Wait()` (deadlock risk in Blazor Server)
82
+ - [ ] `[HIGH]` No `async void` (except event handlers)
83
+ - [ ] `[HIGH]` Timeout configured for external operations
84
+ - [ ] `[MEDIUM]` `ConfigureAwait(false)` only in library code
85
+
86
+ ---
87
+
88
+ ## Logging
89
+
90
+ - [ ] `[HIGH]` Logs at critical points (entry, exit, errors)
91
+ - [ ] `[HIGH]` No `$""` string interpolation in log methods (use message templates)
92
+ - [ ] `[HIGH]` No sensitive data logged (passwords, tokens, PII)
93
+ - [ ] `[MEDIUM]` Logs include correlation IDs (OrderId, UserId)
94
+ - [ ] `[MEDIUM]` Appropriate log level (Information, Warning, Error)
95
+
96
+ ---
97
+
98
+ ## Error Handling
99
+
100
+ - [ ] `[CRITICAL]` No empty catch blocks
101
+ - [ ] `[HIGH]` Specific exceptions (not generic `catch (Exception)` without re-throw)
102
+ - [ ] `[HIGH]` Inner exception preserved on re-throw
103
+ - [ ] `[HIGH]` Result pattern for expected business errors, exceptions for infrastructure
104
+ - [ ] `[MEDIUM]` Consistent error handling pattern across all services
105
+
106
+ ---
107
+
108
+ ## DI
109
+
110
+ - [ ] `[HIGH]` Constructor injection with interfaces (not concrete types)
111
+ - [ ] `[HIGH]` Correct lifetime (Scoped for DbContext, Singleton for factories)
112
+ - [ ] `[MEDIUM]` No service locator pattern (`IServiceProvider.GetService<T>()` in business code)
113
+
114
+ ---
115
+
116
+ ## Services
117
+
118
+ ### State Validation
119
+ - [ ] `[HIGH]` Validates INVALID states (not valid ones) for future extensibility
120
+ - [ ] `[HIGH]` Error states handled explicitly
121
+
122
+ ```csharp
123
+ // Correct: validate INVALID states
124
+ if (order.Status >= OrderStatus.Completed || order.Status == OrderStatus.Failed)
125
+ throw new InvalidOperationException("Cannot process completed or failed order");
126
+ ```
127
+
128
+ ### Transactions
129
+ - [ ] `[HIGH]` Multiple operations wrapped in transaction
130
+ - [ ] `[HIGH]` Rollback on error
131
+
132
+ ```csharp
133
+ await using var transaction = await _context.Database.BeginTransactionAsync(ct);
134
+ try
135
+ {
136
+ await _repository.AddAsync(order, ct);
137
+ await _paymentService.ChargeAsync(order.Id, ct);
138
+ await transaction.CommitAsync(ct);
139
+ }
140
+ catch { await transaction.RollbackAsync(ct); throw; }
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Background Operations
146
+
147
+ ### DbContext Safety
148
+ - [ ] `[CRITICAL]` Uses `IDbContextFactory` (not scoped DbContext)
149
+ - [ ] `[CRITICAL]` Repository created via Factory with `await using`
150
+ - [ ] `[HIGH]` No `Task.Delay` as race condition workaround
151
+
152
+ ```csharp
153
+ // Correct pattern
154
+ _ = Task.Run(async () =>
155
+ {
156
+ try
157
+ {
158
+ await using var repo = _repoFactory.CreateScoped();
159
+ var order = await repo.GetByIdAsync(orderId);
160
+ // ...
161
+ }
162
+ catch (Exception ex) { _logger.LogError(ex, "Failed {OrderId}", orderId); }
163
+ });
164
+ ```
165
+
166
+ ### Hangfire Jobs
167
+ - [ ] `[HIGH]` `[AutomaticRetry]` configured
168
+ - [ ] `[HIGH]` Job is idempotent (safe to run multiple times)
169
+ - [ ] `[MEDIUM]` CancellationToken used
170
+ - [ ] `[MEDIUM]` No HTTP request state dependency
171
+
172
+ ### Resilience
173
+ - [ ] `[MEDIUM]` Retry policy for transient operations
174
+ - [ ] `[MEDIUM]` State persisted before long operation
175
+ - [ ] `[MEDIUM]` Idempotency guaranteed for retries
176
+
177
+ ---
178
+
179
+ ## DTOs / Contracts
180
+
181
+ ### Naming
182
+ - [ ] `[HIGH]` Descriptive property names (not "Data", "Value", "Info")
183
+ - [ ] `[HIGH]` Correct suffix: `Request` (input), `Response` (output), `Dto` (generic), `Command`/`Query` (CQRS)
184
+
185
+ ### Types
186
+ - [ ] `[MEDIUM]` `Stream` for large files, `byte[]` for small in-memory data
187
+ - [ ] `[MEDIUM]` `DateTimeOffset` for timestamps, `DateTime` for local dates
188
+ - [ ] `[MEDIUM]` Nullable `?` only where truly optional
189
+
190
+ ### Structure
191
+ - [ ] `[MEDIUM]` Records for immutable DTOs, classes with `init` for mutable entities
192
+ - [ ] `[MEDIUM]` Response DTOs have all properties needed by UI
193
+ - [ ] `[MEDIUM]` Enums have explicit values with logical ordering (errors at 100+)
194
+
195
+ ```csharp
196
+ public enum OrderStatus
197
+ {
198
+ Created = 0, PendingPayment = 1, Processing = 2, Completed = 3, // Normal flow
199
+ Failed = 100, Cancelled = 101, Refunded = 102 // Error states
200
+ }
201
+ ```
202
+
203
+ ### Service Interfaces
204
+ - [ ] `[HIGH]` Async methods with `Async` suffix
205
+ - [ ] `[HIGH]` CancellationToken as last parameter
206
+ - [ ] `[MEDIUM]` `Task<Result<T>>` for expected business errors
207
+
208
+ ---
209
+
210
+ ## Quick Pre-Merge Checklist
211
+
212
+ ```
213
+ [ ] Naming follows coding.md (PascalCase constants, _camelCase fields, sealed classes)
214
+ [ ] CancellationToken propagated on all async methods
215
+ [ ] Structured logging at critical points (message templates, not $"")
216
+ [ ] No empty catch blocks, Result pattern for business errors
217
+ [ ] Background ops use IDbContextFactory + await using
218
+ [ ] No duplicate code, no magic values, no methods > 30 lines
219
+ [ ] Architecture layers respected (Domain has zero external refs)
220
+ [ ] DTOs have descriptive names + correct types
221
+ ```
222
+
223
+ ---
224
+
225
+ *Consolidated from: code-review-services.md + code-review-background.md + code-review-contracts.md + architecture/clean-code/duplication analysis.*
226
+ *MORPH-SPEC by Polymorphism Tech*
@@ -0,0 +1,117 @@
1
+ # Skill: /morph-checklist
2
+
3
+ > **Layer:** 2 | **Load:** on-keyword | **Keywords:** checklist, deploy, security, seo, performance, accessibility, lgpd, legal
4
+
5
+ Types: `deploy`, `security`, `seo`, `performance`, `accessibility`, `legal-brazil`, `simulation` (see [simulation-checklist.md](simulation-checklist.md))
6
+
7
+ ---
8
+
9
+ ## Deploy
10
+
11
+ ### Pre-Deploy
12
+ - [ ] `dotnet build --configuration Release` passes
13
+ - [ ] `dotnet test` passes
14
+ - [ ] Migrations applied (`dotnet ef database update`)
15
+ - [ ] Env vars configured (connection strings, API keys, feature flags)
16
+
17
+ ### Infrastructure
18
+ - [ ] Bicep/IaC updated (`az deployment group what-if`)
19
+ - [ ] SSL/HTTPS configured
20
+ - [ ] DNS pointing correctly
21
+ - [ ] Health checks configured
22
+
23
+ ### Security & Monitoring
24
+ - [ ] Secrets in Key Vault (not in code)
25
+ - [ ] Managed Identity configured
26
+ - [ ] CORS configured
27
+ - [ ] Rate limiting enabled
28
+ - [ ] Application Insights + alerts configured
29
+
30
+ ### Post-Deploy
31
+ - [ ] Smoke tests executed
32
+ - [ ] Rollback plan documented
33
+
34
+ ---
35
+
36
+ ## Security
37
+
38
+ ### Auth & Authorization
39
+ - [ ] Passwords hashed (bcrypt/Argon2), MFA available
40
+ - [ ] JWT with short expiration + refresh tokens
41
+ - [ ] RBAC + resource-based authorization
42
+ - [ ] Ownership verification (user sees only their data)
43
+
44
+ ### Input & Headers
45
+ - [ ] Server-side validation (never trust client)
46
+ - [ ] HTML sanitized (XSS), parametrized queries (SQLi)
47
+ - [ ] File upload validation (type, size, content)
48
+ - [ ] Security headers: `X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY`, `CSP: default-src 'self'`
49
+
50
+ ### Data
51
+ - [ ] PII encrypted at rest, masked in logs
52
+ - [ ] Card data never stored (use tokenization)
53
+ - [ ] `dotnet list package --vulnerable` clean
54
+
55
+ ---
56
+
57
+ ## SEO
58
+
59
+ - [ ] `<title>` + `<meta description>` (150-160 chars)
60
+ - [ ] `<link rel="canonical">` + `robots.txt` + `sitemap.xml`
61
+ - [ ] Open Graph tags (og:title, og:description, og:image)
62
+ - [ ] URLs friendly, heading hierarchy (H1>H2>H3)
63
+ - [ ] Images optimized (WebP, lazy loading, alt text)
64
+ - [ ] Core Web Vitals: LCP < 2.5s, FID < 100ms, CLS < 0.1
65
+
66
+ ---
67
+
68
+ ## Performance
69
+
70
+ ### Backend
71
+ - [ ] `.AsNoTracking()` for reads, no N+1, projections (`.Select()`)
72
+ - [ ] Indexes on search columns
73
+ - [ ] Response/distributed caching with invalidation
74
+ - [ ] All I/O operations are async (no `.Result` / `.Wait()`)
75
+
76
+ ### Frontend (Blazor)
77
+ - [ ] Lazy loading, virtualization for large lists
78
+ - [ ] Debounce search inputs
79
+ - [ ] `@key` in loops, `ShouldRender()` for perf
80
+
81
+ ### Infrastructure
82
+ - [ ] CDN for static assets, gzip/brotli compression
83
+ - [ ] Connection pooling, scale-to-zero
84
+
85
+ ---
86
+
87
+ ## Accessibility (WCAG 2.1)
88
+
89
+ - [ ] Alt text on images, captions on videos
90
+ - [ ] Contrast >= 4.5:1 (AA), color not sole indicator
91
+ - [ ] Keyboard navigation works, focus visible
92
+ - [ ] Skip links, `<html lang="pt-BR">`
93
+ - [ ] Labels on all inputs, clear error messages
94
+ - [ ] Valid HTML, ARIA used correctly
95
+
96
+ ---
97
+
98
+ ## Legal Brazil (LGPD)
99
+
100
+ ### Documentation
101
+ - [ ] Privacy policy (data collected, purpose, legal basis, DPO contact)
102
+ - [ ] Terms of use (service description, responsibilities, forum)
103
+
104
+ ### Consent & Rights
105
+ - [ ] Cookie banner with granular options
106
+ - [ ] Explicit consent for marketing, revocation option
107
+ - [ ] Data access, correction, deletion, portability
108
+
109
+ ### Technical
110
+ - [ ] Data minimization, defined retention periods
111
+ - [ ] Anonymization/pseudonymization where possible
112
+ - [ ] Access logs for personal data
113
+ - [ ] Incident response plan (ANPD notification in 72h)
114
+
115
+ ---
116
+
117
+ *MORPH-SPEC Checklist Skill*
@@ -0,0 +1,77 @@
1
+ # Skill: /morph-checklist simulation
2
+
3
+ > **Layer:** 2 | **Load:** on-keyword | **Keywords:** simulation, mock, fake, external service, sandbox
4
+
5
+ Checklist for simulating external services (AI, payment, email APIs).
6
+
7
+ ## Pre-Implementation
8
+
9
+ ### 1. Map All Dependencies
10
+
11
+ - [ ] List ALL interfaces in the flow (`grep -r "I{ServiceName}" src/ --include="*.cs" -l`)
12
+ - [ ] Identify **transitive dependencies** (e.g., `ArtGenerationService` → `IReplicateClient` + `IImageDownloader`)
13
+ - [ ] Document dependency trace: services to mock, transitive deps, required lifetimes
14
+
15
+ ### 2. Verify Lifetimes
16
+
17
+ | State | Lifetime | Example |
18
+ |-------|----------|---------|
19
+ | Stateful (Dictionary, List) | **Singleton** | `FakeReplicateClient` with prediction store |
20
+ | Stateless | **Scoped** | `FakeEmailClient` that only logs |
21
+
22
+ ```csharp
23
+ // ❌ Stateful + Scoped = loses state between requests
24
+ services.AddScoped<IReplicateClient, FakeReplicateClient>();
25
+ // ✅ Stateful + Singleton
26
+ services.AddSingleton<IReplicateClient, FakeReplicateClient>();
27
+ ```
28
+
29
+ ### 3. Read Complete Interfaces
30
+
31
+ - [ ] Check full signatures — don't miss optional parameters (`attachments`, `CancellationToken`)
32
+ - [ ] For AI mocks: verify current prompts, model in use, response format
33
+ - [ ] For email mocks: check for attachments/inline images, log simulated sends
34
+ - [ ] For payment mocks: implement state transitions (PENDING → CONFIRMED → REFUNDED), simulate webhooks
35
+
36
+ ## Configuration Template
37
+
38
+ ```json
39
+ // appsettings.Development.json
40
+ { "Simulation": { "Enabled": true, "ImageDelayMs": 500, "PlaceholderImageUrl": "https://picsum.photos/1024/1024" } }
41
+ ```
42
+
43
+ ```csharp
44
+ if (configuration.GetValue<bool>("Simulation:Enabled"))
45
+ services.AddSimulationClients(configuration); // Stateful→Singleton, Stateless→Scoped
46
+ else
47
+ services.AddProductionClients(configuration);
48
+ ```
49
+
50
+ ## Post-Implementation
51
+
52
+ - [ ] Validate DI: `dotnet build && dotnet run` + health check
53
+ - [ ] Test full flow end-to-end (not just unit tests)
54
+ - [ ] Verify simulation logs — confirm mocks are being called
55
+
56
+ ## Common Errors
57
+
58
+ | Error | Cause | Fix |
59
+ |-------|-------|-----|
60
+ | Mock loses state between requests | Scoped lifetime for stateful service | Change to Singleton |
61
+ | `Unable to resolve service` at runtime | Transitive dependency not registered | Map ALL dependencies |
62
+ | Incorrect method signature | Didn't read full interface | Check optional params |
63
+ | Mock returns wrong data | Prompts/model changed | Read current prompts |
64
+ | Works in test, fails at runtime | Test doesn't cover full DI | Test with `dotnet run` |
65
+
66
+ ## Checklist
67
+
68
+ - [ ] All interfaces mapped (including transitive)
69
+ - [ ] Lifetimes correct (stateful=Singleton, stateless=Scoped)
70
+ - [ ] Complete interface signatures implemented
71
+ - [ ] Simulation toggle via config
72
+ - [ ] End-to-end flow tested in simulation mode
73
+ - [ ] No real API calls in simulation mode
74
+
75
+ ---
76
+
77
+ *MORPH-SPEC Simulation Checklist*
@@ -0,0 +1,7 @@
1
+ # Level 1: Workflows
2
+
3
+ Phase orchestration and workflow management.
4
+
5
+ **Purpose:** Skills that implement MORPH workflow phases (FASE 0-6).
6
+
7
+ **Examples:** phase-setup, phase-design, phase-uiux
@@ -0,0 +1,213 @@
1
+ # Skill: /morph-replicate
2
+
3
+ > Workflow simplificado para replicar prototipos HTML em Blazor.
4
+ > Use quando tiver um prototipo HTML pronto e precisar converter para codigo Blazor funcional.
5
+
6
+ ## Comando
7
+
8
+ ```bash
9
+ /morph-replicate {feature-name} {prototype-path}
10
+ ```
11
+
12
+ **Exemplo:**
13
+ ```bash
14
+ /morph-replicate ui-redesign prototipo/
15
+ ```
16
+
17
+ ---
18
+
19
+ ## Workflow Simplificado
20
+
21
+ ### FASE 1: ANALISE DO PROTOTIPO
22
+
23
+ 1. **Ler todos os arquivos HTML em `{prototype-path}/`**
24
+ ```bash
25
+ # Encontrar todos os arquivos HTML
26
+ glob: {prototype-path}/**/*.html
27
+ glob: {prototype-path}/**/code.html # Pattern comum de prototipos
28
+ ```
29
+
30
+ 2. **Extrair padroes de cada arquivo:**
31
+ - Layout (grid, flexbox, estrutura)
32
+ - Componentes (cards, buttons, forms, modals)
33
+ - Cores (extrair de inline styles e CSS)
34
+ - Fontes (font-family, sizes)
35
+ - Espacamentos (padding, margin, gap)
36
+ - Classes CSS usadas
37
+
38
+ 3. **Gerar mapeamento HTML → Blazor:**
39
+
40
+ | HTML Pattern | Blazor Equivalente |
41
+ |--------------|-------------------|
42
+ | `<button class="btn-primary">` | `<FluentButton Appearance="Appearance.Accent">` |
43
+ | `<div class="card">` | `<FluentCard>` ou HTML customizado |
44
+ | `<input type="text">` | `<FluentTextField>` |
45
+ | `<div class="modal">` | Modal customizado (se design especifico) |
46
+
47
+ 4. **Gerar lista de classes CSS a criar:**
48
+ ```markdown
49
+ ## Classes CSS Necessarias
50
+
51
+ - [ ] .page-layout
52
+ - [ ] .home-hero
53
+ - [ ] .card-premium
54
+ - [ ] .checkout-form
55
+ - [ ] .modal-overlay
56
+ - [ ] .animate-slideInUp
57
+ ```
58
+
59
+ **PAUSA:** Aprovar mapeamento e lista de CSS
60
+
61
+ ---
62
+
63
+ ### FASE 2: TASKS (Lista de Telas)
64
+
65
+ Gerar lista de telas para implementar na ordem correta:
66
+
67
+ ```markdown
68
+ ## Tasks de Implementacao
69
+
70
+ ### T001: Setup Design System
71
+ - Criar/atualizar wwwroot/css/design-system.css
72
+ - Adicionar todas as classes CSS listadas
73
+ - Validar com `morph-spec validate-css`
74
+
75
+ ### T002: {Nome da Tela 1}
76
+ - Ler: {prototype-path}/{tela1}.html
77
+ - Criar/Atualizar: Pages/{Tela1}.razor
78
+ - Componentes: FluentCard, FluentButton, etc.
79
+ - CSS: .home-hero, .card-premium
80
+
81
+ ### T003: {Nome da Tela 2}
82
+ - Ler: {prototype-path}/{tela2}.html
83
+ - Criar/Atualizar: Pages/{Tela2}.razor
84
+ - ...
85
+
86
+ ### TXXX: Validacao Final
87
+ - Build completo
88
+ - `morph-spec validate-css`
89
+ - Testar responsividade
90
+ ```
91
+
92
+ **PAUSA:** Aprovar lista de tasks
93
+
94
+ ---
95
+
96
+ ### FASE 3: IMPLEMENT (Por Tela)
97
+
98
+ Para cada tela, seguir este fluxo:
99
+
100
+ 1. **Ler HTML do prototipo**
101
+ ```
102
+ Read: {prototype-path}/{tela}.html
103
+ ```
104
+
105
+ 2. **Ler arquivo .razor atual** (se existir)
106
+ ```
107
+ Read: Pages/{Tela}.razor
108
+ ```
109
+
110
+ 3. **Reescrever .razor usando Fluent UI/MudBlazor**
111
+ - Manter estrutura de layout do prototipo
112
+ - Substituir elementos HTML por componentes Blazor
113
+ - Aplicar classes CSS do design-system
114
+
115
+ 4. **Adicionar CSS ao design-system.css**
116
+ - Se classe nova foi usada no .razor
117
+ - Seguir padrao de nomenclatura (prefixo por pagina)
118
+
119
+ 5. **Build para validar**
120
+ ```bash
121
+ dotnet build
122
+ ```
123
+
124
+ 6. **Validar CSS**
125
+ ```bash
126
+ morph-spec validate-css src/MyApp.Web
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Outputs
132
+
133
+ Este workflow gera apenas:
134
+
135
+ | Arquivo | Descricao |
136
+ |---------|-----------|
137
+ | `.razor` files | Paginas convertidas |
138
+ | `design-system.css` | CSS atualizado |
139
+ | `recap.md` | Resumo da implementacao (ao final) |
140
+
141
+ **NAO gera:** proposal.md, spec.md, contracts.cs, tasks.json
142
+
143
+ ---
144
+
145
+ ## Exemplo de Execucao
146
+
147
+ ```markdown
148
+ /morph-replicate checkout-redesign prototipo/checkout/
149
+
150
+ 📁 Analisando prototipo em prototipo/checkout/...
151
+
152
+ **Arquivos encontrados:**
153
+ - step1-cart.html
154
+ - step2-payment.html
155
+ - step3-confirmation.html
156
+
157
+ **Padroes extraidos:**
158
+
159
+ Cores:
160
+ - Primary: #FF6B35
161
+ - Secondary: #2D3047
162
+ - Background: #FAFAFA
163
+
164
+ Classes CSS a criar:
165
+ - [ ] .checkout-layout
166
+ - [ ] .checkout-steps
167
+ - [ ] .checkout-form
168
+ - [ ] .checkout-summary
169
+ - [ ] .payment-options
170
+ - [ ] .confirmation-message
171
+
172
+ Mapeamento HTML → Blazor:
173
+ - form.checkout-form → EditForm + FluentTextField
174
+ - div.payment-card → FluentCard
175
+ - button.btn-pay → FluentButton Accent
176
+
177
+ ---
178
+
179
+ ⛔ **PAUSA OBRIGATORIA**
180
+
181
+ **Proximos passos:**
182
+ 1. ✅ Aprovar e gerar tasks de implementacao
183
+ 2. 🔄 Ajustar mapeamento
184
+ 3. 📋 Ver mais detalhes dos componentes
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Quando Usar
190
+
191
+ - ✅ Prototipo HTML pronto (Figma export, hand-coded, etc.)
192
+ - ✅ Design ja aprovado pelo cliente
193
+ - ✅ Apenas conversao visual (sem logica de negocio nova)
194
+ - ✅ Codigo Blazor existente para atualizar
195
+
196
+ ## Quando NAO Usar
197
+
198
+ - ❌ Feature nova com logica complexa (use FULL MORPH)
199
+ - ❌ Infraestrutura Azure necessaria (use FULL MORPH)
200
+ - ❌ Sem prototipo definido (use STANDARD ou FULL MORPH)
201
+
202
+ ---
203
+
204
+ ## Referencias
205
+
206
+ - [HTML to Blazor Guide](../../../../framework/standards/html-to-blazor.md)
207
+ - [CSS Naming Convention](../../../../framework/standards/css-naming.md)
208
+ - [CSS Animations](../../../../framework/standards/css-animations.md)
209
+ - [Fluent UI Blazor](../../../../framework/standards/fluent-ui-blazor.md)
210
+
211
+ ---
212
+
213
+ *MORPH-SPEC v2.2.0 by Polymorphism Tech*