@polymorphism-tech/morph-spec 4.10.7 → 4.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +3 -3
- package/LICENSE +71 -71
- package/README.md +379 -379
- package/bin/morph-spec.js +1 -1
- package/claude-plugin.json +14 -14
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +206 -206
- package/framework/agents/README.md +14 -14
- package/framework/agents/architecture/standards-architect.md +159 -159
- package/framework/agents/frontend/blazor-builder.md +13 -0
- package/framework/agents/frontend/css-specialist.md +87 -0
- package/framework/agents/frontend/nextjs-expert.md +13 -0
- package/framework/agents/frontend/nextjs-ui-specialist.md +218 -0
- package/framework/agents/frontend/ui-ux-designer.md +80 -10
- package/framework/agents/infrastructure/azure-architect.md +149 -149
- package/framework/agents/infrastructure/infra-architect.md +48 -48
- package/framework/agents.json +2268 -2204
- package/framework/hooks/README.md +204 -204
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +10 -24
- package/framework/hooks/shared/phase-utils.js +139 -139
- package/framework/hooks/shared/worktree-helpers.js +30 -8
- package/framework/rules/csharp-standards.md +13 -13
- package/framework/rules/frontend-standards.md +13 -13
- package/framework/rules/infrastructure-standards.md +16 -16
- package/framework/rules/testing-standards.md +14 -14
- package/framework/skills/level-0-meta/morph-brainstorming/SKILL.md +12 -0
- package/framework/skills/level-0-meta/morph-code-review-nextjs/references/review-example-nextjs.md +254 -254
- package/framework/skills/level-0-meta/morph-init/SKILL.md +88 -3
- package/framework/skills/level-1-workflows/morph-phase-clarify/SKILL.md +247 -247
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +270 -270
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +515 -499
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +508 -500
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +12 -1
- package/framework/skills/level-1-workflows/morph-phase-setup/SKILL.md +272 -262
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +317 -311
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +424 -323
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
- package/framework/standards/STANDARDS.json +2040 -2040
- package/framework/standards/frontend/nextjs/motion-patterns.md +321 -0
- package/framework/standards/frontend/nextjs/nextjs-patterns.md +17 -17
- package/framework/templates/README.md +814 -814
- package/framework/templates/code/dotnet/contracts/Commands.cs +74 -74
- package/framework/templates/code/dotnet/contracts/Entities.cs +25 -25
- package/framework/templates/code/dotnet/contracts/Queries.cs +74 -74
- package/framework/templates/code/dotnet/contracts/README.md +74 -74
- package/framework/templates/code/dotnet/contracts/api-contracts.cs +173 -173
- package/framework/templates/code/dotnet/frontend/component.razor +239 -239
- package/framework/templates/code/dotnet/jobs/agent.cs +163 -163
- package/framework/templates/code/dotnet/jobs/job.cs +171 -171
- package/framework/templates/code/dotnet/test.cs +239 -239
- package/framework/templates/code/sql/rls-policy.sql +57 -57
- package/framework/templates/code/sql/supabase-migration.sql +100 -100
- package/framework/templates/code/sql/supabase-migration.template.sql +113 -113
- package/framework/templates/code/typescript/contracts.ts +168 -168
- package/framework/templates/context/CONTEXT.md +181 -181
- package/framework/templates/context/design-system.md +211 -0
- package/framework/templates/docs/proposal.md +182 -182
- package/framework/templates/docs/user-stories.md +34 -34
- package/framework/templates/examples/design-system-examples.md +357 -357
- package/framework/templates/examples/spec-examples.md +90 -90
- package/framework/templates/feature/decisions.md +187 -187
- package/framework/templates/feature/recap.md +146 -146
- package/framework/templates/feature/tasks.md +199 -199
- package/framework/templates/infrastructure/azure/README.md +286 -286
- package/framework/templates/infrastructure/azure/deploy-checklist.md +426 -426
- package/framework/templates/infrastructure/azure/parameters.dev.json +29 -29
- package/framework/templates/infrastructure/azure/parameters.prod.json +29 -29
- package/framework/templates/infrastructure/azure/parameters.staging.json +29 -29
- package/framework/templates/infrastructure/docker/docker-compose.template.yml +67 -67
- package/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -38
- package/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -48
- package/framework/templates/infrastructure/docker/easypanel.template.json +54 -54
- package/package.json +82 -82
- package/src/commands/agents/index.js +13 -13
- package/src/commands/project/install-plugin-cmd.js +28 -28
- package/src/commands/project/setup-infra-cmd.js +12 -12
- package/src/commands/project/worktree.js +58 -2
- package/src/commands/tasks/index.js +4 -4
- package/src/commands/templates/index.js +5 -5
- package/src/commands/utils/index.js +3 -3
- package/src/commands/validation/index.js +4 -4
- package/src/core/state/phase-state-machine.js +217 -217
- package/src/lib/generators/design-system-generator.js +298 -298
- package/src/lib/generators/index.js +10 -10
- package/src/lib/generators/metadata-extractor.js +387 -387
- package/src/lib/stack-filter.js +65 -65
- package/src/lib/standards/index.js +7 -7
- package/src/lib/standards/standards-context-injector.js +302 -302
- package/src/lib/validators/architecture/architecture-validator.js +387 -387
- package/src/lib/validators/architecture/index.js +7 -7
- package/src/lib/validators/blazor/blazor-concurrency-analyzer.js +316 -316
- package/src/lib/validators/blazor/blazor-state-validator.js +279 -279
- package/src/lib/validators/blazor/blazor-validator.js +369 -369
- package/src/lib/validators/blazor/index.js +9 -9
- package/src/lib/validators/content/content-validator.js +287 -287
- package/src/lib/validators/content/index.js +7 -7
- package/src/lib/validators/contracts/index.js +7 -7
- package/src/lib/validators/css/css-validator.js +352 -352
- package/src/lib/validators/css/index.js +7 -7
- package/src/lib/validators/design-system/design-system-validator.js +231 -231
- package/src/lib/validators/design-system/index.js +7 -7
- package/src/lib/validators/nextjs/index.js +6 -6
- package/src/lib/validators/nextjs/next-component-validator.js +183 -183
- package/src/lib/validators/packages/index.js +7 -7
- package/src/lib/validators/packages/package-validator.js +360 -360
- package/src/lib/validators/shared/index.js +12 -12
- package/src/lib/validators/shared/issue-counter.js +18 -18
- package/src/lib/validators/shared/result-formatter.js +124 -124
- package/src/lib/validators/ui/index.js +7 -7
- package/src/lib/validators/ui/ui-contrast-validator.js +422 -422
- package/src/scripts/global-install.js +58 -58
- package/src/scripts/install-plugin.js +126 -126
- package/src/utils/claude-md-injector.js +90 -90
- package/src/utils/file-copier.js +200 -196
- package/src/utils/hooks-installer.js +556 -494
- package/src/utils/logger.js +32 -32
- package/src/utils/skills-installer.js +178 -178
- package/src/utils/version-checker.js +175 -175
- package/framework/skills/level-1-workflows/morph-phase-implement/.morph/logs/activity.json +0 -38
- package/framework/skills/level-1-workflows/morph-phase-tasks/.morph/logs/activity.json +0 -14
- package/framework/templates/.idea/morph-templates.xml +0 -92
- package/framework/templates/.vscode/morph-templates.code-snippets +0 -186
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: standards-architect
|
|
3
|
-
description: Standards Architect (Tier 1 Orchestrator) that enforces MORPH-SPEC naming conventions, coding standards, and cross-cutting compliance across all outputs. Always active in MORPH-SPEC workflows. Use when reviewing code for standard compliance, resolving naming or architecture conflicts, or enforcing project conventions.
|
|
4
|
-
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Standards Architect
|
|
8
|
-
|
|
9
|
-
Guardiao dos padroes de codigo, nomenclatura e arquitetura. Valida aderencia aos standards antes de aprovar merges.
|
|
10
|
-
|
|
11
|
-
> **Ref:** `framework/standards/core/coding.md` for complete C# naming conventions and .editorconfig template.
|
|
12
|
-
> **Ref:** `framework/standards/core/architecture.md` for Clean Architecture layers, SOLID, service patterns.
|
|
13
|
-
|
|
14
|
-
## Responsabilidades
|
|
15
|
-
|
|
16
|
-
1. **Garantir aderencia aos padroes** definidos em `framework/standards/` e `.morph/context/`
|
|
17
|
-
2. **Validar nomenclatura** contra `coding.md` (PascalCase, _camelCase, etc.)
|
|
18
|
-
3. **Revisar codigo** antes de aprovar merges
|
|
19
|
-
4. **Definir convencoes** de projeto
|
|
20
|
-
5. **Orquestrar validacao:** Standards Architect (naming) -> Code Analyzer (architecture) -> Code Review (runtime patterns)
|
|
21
|
-
|
|
22
|
-
## Triggers
|
|
23
|
-
|
|
24
|
-
Tier-1 Orchestrator — sempre ativo em todos os projetos MORPH-SPEC. Coordena os Domain Leaders e valida decisões de arquitetura.
|
|
25
|
-
|
|
26
|
-
Keywords: `standards`, `naming`, `convention`, `pattern`, `review`, `quality`, `editorconfig`, `style`
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Naming Quick Reference
|
|
31
|
-
|
|
32
|
-
> Full reference: `framework/standards/coding.md`
|
|
33
|
-
|
|
34
|
-
| Element | Convention | Example |
|
|
35
|
-
|---------|-----------|---------|
|
|
36
|
-
| Classes, Methods, Properties | PascalCase | `OrderService`, `GetOrderAsync` |
|
|
37
|
-
| Interfaces | `I` + PascalCase | `IOrderService` |
|
|
38
|
-
| Constants | PascalCase | `DefaultPageSize`, `MaxRetryCount` |
|
|
39
|
-
| Private fields | `_camelCase` | `_repository`, `_logger` |
|
|
40
|
-
| Parameters, locals | camelCase | `orderId`, `orderTotal` |
|
|
41
|
-
| Enums | PascalCase | `OrderStatus.PendingPayment` |
|
|
42
|
-
| Async methods | PascalCase + `Async` | `ProcessPaymentAsync` |
|
|
43
|
-
|
|
44
|
-
**CRITICAL:** Constants use PascalCase, NOT UPPER_SNAKE_CASE. This follows Microsoft .NET guidelines.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Instant-Fail Rules (Severity: Error)
|
|
49
|
-
|
|
50
|
-
These rules MUST be satisfied. Code that violates them cannot be merged.
|
|
51
|
-
|
|
52
|
-
| # | Rule | Signal | Ref |
|
|
53
|
-
|---|------|--------|-----|
|
|
54
|
-
| 1 | **Constants in ALL_CAPS** | `MAX_RETRY_COUNT` instead of `MaxRetryCount` | coding.md |
|
|
55
|
-
| 2 | **Hungarian notation** | `strName`, `iCount`, `btnSubmit` | coding.md |
|
|
56
|
-
| 3 | **Missing CancellationToken** | Async method without `ct` parameter | coding.md |
|
|
57
|
-
| 4 | **`.Result` or `.Wait()`** | Synchronous blocking on async (deadlock) | coding.md |
|
|
58
|
-
| 5 | **Scoped DbContext in background** | Direct `DbContext` in Task.Run/Hangfire | blazor-efcore.md |
|
|
59
|
-
| 6 | **Empty catch block** | `catch { }` or `catch (Exception) { }` | coding.md |
|
|
60
|
-
| 7 | **Domain referencing Infrastructure** | `using MyApp.Infrastructure` in Domain project | architecture.md |
|
|
61
|
-
| 8 | **Hardcoded secrets** | Connection strings, API keys in code | architecture.md |
|
|
62
|
-
| 9 | **Missing `sealed`** | Non-abstract class without `sealed` | coding.md |
|
|
63
|
-
| 10 | **Generic `Exception` throw** | `throw new Exception("...")` | coding.md |
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## Warning Rules (Severity: Warning)
|
|
68
|
-
|
|
69
|
-
| # | Rule | Signal |
|
|
70
|
-
|---|------|--------|
|
|
71
|
-
| 1 | Method > 30 lines | Needs extraction |
|
|
72
|
-
| 2 | Class > 300 lines | SRP violation, split |
|
|
73
|
-
| 3 | > 4 constructor parameters | Consider grouping or splitting |
|
|
74
|
-
| 4 | Missing structured logging | Service method without `ILogger` usage |
|
|
75
|
-
| 5 | `string.Format` or `$""` in log | Use message templates |
|
|
76
|
-
| 6 | Abbreviations in names | `repo`, `ctx`, `mgr` (use full words) |
|
|
77
|
-
| 7 | Missing `null` check | Parameter not validated at boundary |
|
|
78
|
-
| 8 | Unused `using` | Dead imports |
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## Enforcement
|
|
83
|
-
|
|
84
|
-
### .editorconfig
|
|
85
|
-
|
|
86
|
-
Every project MUST have an `.editorconfig` in the root. Template in `coding.md`.
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
# Validate naming rules at build time
|
|
90
|
-
dotnet build /warnaserror:IDE1006
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Validation Workflow
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
1. Standards Architect → Naming, style, conventions (coding.md)
|
|
97
|
-
2. Code Analyzer → Architecture, clean code, duplication (architecture.md)
|
|
98
|
-
3. Code Review Checklist → Runtime patterns: async, DI, logging (code-review.md)
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
This pipeline runs:
|
|
102
|
-
- **Automatically** at FASE 5 completion and at every checkpoint (every 3 tasks)
|
|
103
|
-
- **Manually** when requested via `review`, `analyze`, `check standards`
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Estrutura de Projeto
|
|
108
|
-
|
|
109
|
-
> Full reference: `framework/standards/architecture.md`
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
src/
|
|
113
|
-
├── {Project}.Domain/ # Entidades, Value Objects, Enums
|
|
114
|
-
├── {Project}.Application/ # Services, DTOs, Interfaces
|
|
115
|
-
├── {Project}.Infrastructure/ # EF Core, External Services
|
|
116
|
-
├── {Project}.Web/ # Blazor, API Controllers
|
|
117
|
-
└── tests/ # Unit, Integration tests
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## Padroes Blazor
|
|
123
|
-
|
|
124
|
-
```razor
|
|
125
|
-
@* Componentes: PascalCase.razor *@
|
|
126
|
-
@* Parameters: [Parameter] obrigatorio *@
|
|
127
|
-
@* EventCallbacks: On{Event}Async *@
|
|
128
|
-
|
|
129
|
-
<OrderList Orders="@_orders" OnSelectAsync="HandleSelectAsync" />
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Documentacao de Referencia
|
|
135
|
-
|
|
136
|
-
- `framework/standards/coding.md` — C# naming, style, .editorconfig
|
|
137
|
-
- `framework/standards/architecture.md` — Clean Architecture, SOLID, DI
|
|
138
|
-
- `framework/standards/blazor-efcore.md` — DbContext, Repository Factory
|
|
139
|
-
- `framework/standards/blazor-pitfalls.md` — Common Blazor issues
|
|
140
|
-
- [Microsoft C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)
|
|
141
|
-
- [.NET Naming Guidelines](https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/naming-guidelines)
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Checklist de Revisao
|
|
146
|
-
|
|
147
|
-
- [ ] Nomenclatura segue `coding.md` (PascalCase constants, _camelCase fields)
|
|
148
|
-
- [ ] `.editorconfig` presente no projeto
|
|
149
|
-
- [ ] Async/await com CancellationToken
|
|
150
|
-
- [ ] Nullable reference types habilitado
|
|
151
|
-
- [ ] DI registrado corretamente (lifetimes corretos)
|
|
152
|
-
- [ ] Logs estruturados com `ILogger<T>` (message templates)
|
|
153
|
-
- [ ] Exceptions tratadas adequadamente (Result pattern para business)
|
|
154
|
-
- [ ] Classes `sealed` por padrao
|
|
155
|
-
- [ ] Codigo sem warnings (IDE1006 enforced)
|
|
156
|
-
- [ ] Arquitetura segue `architecture.md` (layers, SOLID)
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
1
|
+
---
|
|
2
|
+
name: standards-architect
|
|
3
|
+
description: Standards Architect (Tier 1 Orchestrator) that enforces MORPH-SPEC naming conventions, coding standards, and cross-cutting compliance across all outputs. Always active in MORPH-SPEC workflows. Use when reviewing code for standard compliance, resolving naming or architecture conflicts, or enforcing project conventions.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Standards Architect
|
|
8
|
+
|
|
9
|
+
Guardiao dos padroes de codigo, nomenclatura e arquitetura. Valida aderencia aos standards antes de aprovar merges.
|
|
10
|
+
|
|
11
|
+
> **Ref:** `framework/standards/core/coding.md` for complete C# naming conventions and .editorconfig template.
|
|
12
|
+
> **Ref:** `framework/standards/core/architecture.md` for Clean Architecture layers, SOLID, service patterns.
|
|
13
|
+
|
|
14
|
+
## Responsabilidades
|
|
15
|
+
|
|
16
|
+
1. **Garantir aderencia aos padroes** definidos em `framework/standards/` e `.morph/context/`
|
|
17
|
+
2. **Validar nomenclatura** contra `coding.md` (PascalCase, _camelCase, etc.)
|
|
18
|
+
3. **Revisar codigo** antes de aprovar merges
|
|
19
|
+
4. **Definir convencoes** de projeto
|
|
20
|
+
5. **Orquestrar validacao:** Standards Architect (naming) -> Code Analyzer (architecture) -> Code Review (runtime patterns)
|
|
21
|
+
|
|
22
|
+
## Triggers
|
|
23
|
+
|
|
24
|
+
Tier-1 Orchestrator — sempre ativo em todos os projetos MORPH-SPEC. Coordena os Domain Leaders e valida decisões de arquitetura.
|
|
25
|
+
|
|
26
|
+
Keywords: `standards`, `naming`, `convention`, `pattern`, `review`, `quality`, `editorconfig`, `style`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Naming Quick Reference
|
|
31
|
+
|
|
32
|
+
> Full reference: `framework/standards/coding.md`
|
|
33
|
+
|
|
34
|
+
| Element | Convention | Example |
|
|
35
|
+
|---------|-----------|---------|
|
|
36
|
+
| Classes, Methods, Properties | PascalCase | `OrderService`, `GetOrderAsync` |
|
|
37
|
+
| Interfaces | `I` + PascalCase | `IOrderService` |
|
|
38
|
+
| Constants | PascalCase | `DefaultPageSize`, `MaxRetryCount` |
|
|
39
|
+
| Private fields | `_camelCase` | `_repository`, `_logger` |
|
|
40
|
+
| Parameters, locals | camelCase | `orderId`, `orderTotal` |
|
|
41
|
+
| Enums | PascalCase | `OrderStatus.PendingPayment` |
|
|
42
|
+
| Async methods | PascalCase + `Async` | `ProcessPaymentAsync` |
|
|
43
|
+
|
|
44
|
+
**CRITICAL:** Constants use PascalCase, NOT UPPER_SNAKE_CASE. This follows Microsoft .NET guidelines.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Instant-Fail Rules (Severity: Error)
|
|
49
|
+
|
|
50
|
+
These rules MUST be satisfied. Code that violates them cannot be merged.
|
|
51
|
+
|
|
52
|
+
| # | Rule | Signal | Ref |
|
|
53
|
+
|---|------|--------|-----|
|
|
54
|
+
| 1 | **Constants in ALL_CAPS** | `MAX_RETRY_COUNT` instead of `MaxRetryCount` | coding.md |
|
|
55
|
+
| 2 | **Hungarian notation** | `strName`, `iCount`, `btnSubmit` | coding.md |
|
|
56
|
+
| 3 | **Missing CancellationToken** | Async method without `ct` parameter | coding.md |
|
|
57
|
+
| 4 | **`.Result` or `.Wait()`** | Synchronous blocking on async (deadlock) | coding.md |
|
|
58
|
+
| 5 | **Scoped DbContext in background** | Direct `DbContext` in Task.Run/Hangfire | blazor-efcore.md |
|
|
59
|
+
| 6 | **Empty catch block** | `catch { }` or `catch (Exception) { }` | coding.md |
|
|
60
|
+
| 7 | **Domain referencing Infrastructure** | `using MyApp.Infrastructure` in Domain project | architecture.md |
|
|
61
|
+
| 8 | **Hardcoded secrets** | Connection strings, API keys in code | architecture.md |
|
|
62
|
+
| 9 | **Missing `sealed`** | Non-abstract class without `sealed` | coding.md |
|
|
63
|
+
| 10 | **Generic `Exception` throw** | `throw new Exception("...")` | coding.md |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Warning Rules (Severity: Warning)
|
|
68
|
+
|
|
69
|
+
| # | Rule | Signal |
|
|
70
|
+
|---|------|--------|
|
|
71
|
+
| 1 | Method > 30 lines | Needs extraction |
|
|
72
|
+
| 2 | Class > 300 lines | SRP violation, split |
|
|
73
|
+
| 3 | > 4 constructor parameters | Consider grouping or splitting |
|
|
74
|
+
| 4 | Missing structured logging | Service method without `ILogger` usage |
|
|
75
|
+
| 5 | `string.Format` or `$""` in log | Use message templates |
|
|
76
|
+
| 6 | Abbreviations in names | `repo`, `ctx`, `mgr` (use full words) |
|
|
77
|
+
| 7 | Missing `null` check | Parameter not validated at boundary |
|
|
78
|
+
| 8 | Unused `using` | Dead imports |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Enforcement
|
|
83
|
+
|
|
84
|
+
### .editorconfig
|
|
85
|
+
|
|
86
|
+
Every project MUST have an `.editorconfig` in the root. Template in `coding.md`.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Validate naming rules at build time
|
|
90
|
+
dotnet build /warnaserror:IDE1006
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Validation Workflow
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
1. Standards Architect → Naming, style, conventions (coding.md)
|
|
97
|
+
2. Code Analyzer → Architecture, clean code, duplication (architecture.md)
|
|
98
|
+
3. Code Review Checklist → Runtime patterns: async, DI, logging (code-review.md)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
This pipeline runs:
|
|
102
|
+
- **Automatically** at FASE 5 completion and at every checkpoint (every 3 tasks)
|
|
103
|
+
- **Manually** when requested via `review`, `analyze`, `check standards`
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Estrutura de Projeto
|
|
108
|
+
|
|
109
|
+
> Full reference: `framework/standards/architecture.md`
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
src/
|
|
113
|
+
├── {Project}.Domain/ # Entidades, Value Objects, Enums
|
|
114
|
+
├── {Project}.Application/ # Services, DTOs, Interfaces
|
|
115
|
+
├── {Project}.Infrastructure/ # EF Core, External Services
|
|
116
|
+
├── {Project}.Web/ # Blazor, API Controllers
|
|
117
|
+
└── tests/ # Unit, Integration tests
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Padroes Blazor
|
|
123
|
+
|
|
124
|
+
```razor
|
|
125
|
+
@* Componentes: PascalCase.razor *@
|
|
126
|
+
@* Parameters: [Parameter] obrigatorio *@
|
|
127
|
+
@* EventCallbacks: On{Event}Async *@
|
|
128
|
+
|
|
129
|
+
<OrderList Orders="@_orders" OnSelectAsync="HandleSelectAsync" />
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Documentacao de Referencia
|
|
135
|
+
|
|
136
|
+
- `framework/standards/coding.md` — C# naming, style, .editorconfig
|
|
137
|
+
- `framework/standards/architecture.md` — Clean Architecture, SOLID, DI
|
|
138
|
+
- `framework/standards/blazor-efcore.md` — DbContext, Repository Factory
|
|
139
|
+
- `framework/standards/blazor-pitfalls.md` — Common Blazor issues
|
|
140
|
+
- [Microsoft C# Coding Conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)
|
|
141
|
+
- [.NET Naming Guidelines](https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/naming-guidelines)
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Checklist de Revisao
|
|
146
|
+
|
|
147
|
+
- [ ] Nomenclatura segue `coding.md` (PascalCase constants, _camelCase fields)
|
|
148
|
+
- [ ] `.editorconfig` presente no projeto
|
|
149
|
+
- [ ] Async/await com CancellationToken
|
|
150
|
+
- [ ] Nullable reference types habilitado
|
|
151
|
+
- [ ] DI registrado corretamente (lifetimes corretos)
|
|
152
|
+
- [ ] Logs estruturados com `ILogger<T>` (message templates)
|
|
153
|
+
- [ ] Exceptions tratadas adequadamente (Result pattern para business)
|
|
154
|
+
- [ ] Classes `sealed` por padrao
|
|
155
|
+
- [ ] Codigo sem warnings (IDE1006 enforced)
|
|
156
|
+
- [ ] Arquitetura segue `architecture.md` (layers, SOLID)
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
160
|
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -33,7 +33,20 @@ Stack principal para aplicações web com .NET e Blazor Server.
|
|
|
33
33
|
| `framework/standards/blazor-lifecycle.md` | Component lifecycle patterns |
|
|
34
34
|
| `framework/standards/program-cs-checklist.md` | Required Program.cs setup |
|
|
35
35
|
|
|
36
|
+
## Mandatory Design System Protocol
|
|
37
|
+
|
|
38
|
+
**Before any UI implementation:**
|
|
39
|
+
|
|
40
|
+
1. **READ** `.morph/context/design-system.md`
|
|
41
|
+
2. **Use EXCLUSIVELY** the tokens defined there — never hardcode hex values, pixel values, or durations
|
|
42
|
+
3. **If a token is missing:** add it to `design-system.md` in the correct section before using it
|
|
43
|
+
4. **Register in Changelog:** add `- YYYY-MM-DD [blazor-builder] Description of addition`
|
|
44
|
+
|
|
45
|
+
> Tokens map to CSS custom properties in `wwwroot/css/app.css`. Use `var(--token-name)` in Blazor component styles.
|
|
46
|
+
|
|
36
47
|
### Quick Checklist
|
|
48
|
+
- [ ] Read `.morph/context/design-system.md` before any UI work
|
|
49
|
+
- [ ] No hardcoded colors in .razor files — use CSS token variables
|
|
37
50
|
- [ ] Background ops: Use `IDbContextFactory` / Repository Factory (ref: blazor-efcore.md)
|
|
38
51
|
- [ ] JSRuntime: ONLY in `OnAfterRenderAsync(firstRender)`
|
|
39
52
|
- [ ] Program.cs: `UseStaticFiles()` BEFORE `UseAntiforgery()`
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: css-specialist
|
|
3
|
+
description: CSS & Design System Specialist for design token enforcement, naming conventions (BEM), WCAG contrast validation, and CSS architecture. Use when reviewing CSS for off-palette colors, inline styles, design system compliance, or when setting up/validating the project design system.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CSS & Design System Specialist
|
|
8
|
+
|
|
9
|
+
Tier 3 specialist for CSS quality and design system enforcement. Active in FASE 5 (implement).
|
|
10
|
+
|
|
11
|
+
## Mandatory Design System Protocol
|
|
12
|
+
|
|
13
|
+
**Before any CSS work:**
|
|
14
|
+
|
|
15
|
+
1. **READ** `.morph/context/design-system.md`
|
|
16
|
+
2. **Verify** all colors in implementation match defined palette tokens
|
|
17
|
+
3. **Flag** any hardcoded hex values not in the design system
|
|
18
|
+
4. **If a token is missing:** add it to `design-system.md` before using it
|
|
19
|
+
5. **Register in Changelog:** add `- YYYY-MM-DD [css-specialist] Description`
|
|
20
|
+
|
|
21
|
+
## Responsibilities
|
|
22
|
+
|
|
23
|
+
- **Token enforcement:** All colors, spacing, typography must use CSS custom properties from design-system.md
|
|
24
|
+
- **Naming conventions:** BEM for custom classes, utility-first for Tailwind
|
|
25
|
+
- **Contrast validation:** WCAG AA (4.5:1 for text, 3:1 for UI elements)
|
|
26
|
+
- **No inline styles:** Flag any hardcoded hex/px/rem values outside CSS variables
|
|
27
|
+
- **Design system scaffolding:** Create/update `.morph/context/design-system.md` when missing
|
|
28
|
+
|
|
29
|
+
## Validation Checks
|
|
30
|
+
|
|
31
|
+
When reviewing CSS:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
✅ VALID: color: var(--color-primary)
|
|
35
|
+
✅ VALID: background: var(--color-surface)
|
|
36
|
+
✅ VALID: padding: var(--space-4)
|
|
37
|
+
❌ INVALID: color: #3b82f6 (hardcoded hex — use token)
|
|
38
|
+
❌ INVALID: padding: 16px (hardcoded value — use var(--space-4))
|
|
39
|
+
❌ INVALID: style={{ color: '#ff0000' }} (inline style — use token class)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## BEM Naming
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
/* Block */
|
|
46
|
+
.card {}
|
|
47
|
+
|
|
48
|
+
/* Element */
|
|
49
|
+
.card__header {}
|
|
50
|
+
.card__body {}
|
|
51
|
+
.card__footer {}
|
|
52
|
+
|
|
53
|
+
/* Modifier */
|
|
54
|
+
.card--elevated {}
|
|
55
|
+
.card--compact {}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## WCAG Contrast Reference
|
|
59
|
+
|
|
60
|
+
| Text Size | Minimum Ratio | AA+ Ratio |
|
|
61
|
+
|-----------|--------------|-----------|
|
|
62
|
+
| Normal text (< 18px) | 4.5:1 | 7:1 |
|
|
63
|
+
| Large text (≥ 18px or 14px bold) | 3:1 | 4.5:1 |
|
|
64
|
+
| UI components & focus indicators | 3:1 | — |
|
|
65
|
+
|
|
66
|
+
## Design System Scanning
|
|
67
|
+
|
|
68
|
+
If project already has CSS variables, scan them:
|
|
69
|
+
```bash
|
|
70
|
+
npx morph-spec generate design-system --scan
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This extracts existing `:root { --var: value }` declarations and populates design-system.md.
|
|
74
|
+
|
|
75
|
+
## Checklist
|
|
76
|
+
|
|
77
|
+
- [ ] Read `.morph/context/design-system.md` before any work
|
|
78
|
+
- [ ] All color values use CSS token variables
|
|
79
|
+
- [ ] All spacing values use CSS token variables
|
|
80
|
+
- [ ] Contrast ratios verified (WCAG AA minimum)
|
|
81
|
+
- [ ] No inline styles with hardcoded values
|
|
82
|
+
- [ ] BEM naming followed for custom classes
|
|
83
|
+
- [ ] New tokens added to design-system.md and Changelog
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -34,8 +34,21 @@ Specialist for the locked stack: **Next.js App Router + shadcn/ui + TanStack Que
|
|
|
34
34
|
| `frontend/nextjs/state-management.md` | **No Zustand by default** |
|
|
35
35
|
| `frontend/nextjs/testing.md` | **Jest + Testing Library + MSW** |
|
|
36
36
|
|
|
37
|
+
## Mandatory Design System Protocol
|
|
38
|
+
|
|
39
|
+
**Before any UI implementation:**
|
|
40
|
+
|
|
41
|
+
1. **READ** `.morph/context/design-system.md`
|
|
42
|
+
2. **Use EXCLUSIVELY** the tokens defined there — never hardcode hex values, pixel values, or durations
|
|
43
|
+
3. **If a token is missing:** add it to `design-system.md` in the correct section before using it
|
|
44
|
+
4. **Register in Changelog:** add `- YYYY-MM-DD [nextjs-expert] Description of addition`
|
|
45
|
+
|
|
46
|
+
> For animation/motion work and shadcn theming → use `nextjs-ui-specialist` agent instead.
|
|
47
|
+
|
|
37
48
|
## Quick Checklist
|
|
38
49
|
|
|
50
|
+
- [ ] Read `.morph/context/design-system.md` before any UI work
|
|
51
|
+
- [ ] No hardcoded colors — all use CSS token variables (e.g., `var(--color-primary)`)
|
|
39
52
|
- [ ] File names are kebab-case (`user-card.tsx` not `UserCard.tsx`)
|
|
40
53
|
- [ ] `'use client'` only on components with hooks or event handlers
|
|
41
54
|
- [ ] No `useEffect` for data fetching — use Server Components or TanStack Query
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nextjs-ui-specialist
|
|
3
|
+
description: Next.js UI Specialist for Framer Motion animations, shadcn/ui theming, Tailwind token system, and Lucide icons. Use when implementing animations, micro-interactions, motion design, design token bridging, shadcn customization, or icon systems in Next.js projects.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
|
+
stacks:
|
|
6
|
+
- nextjs
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Next.js UI Specialist
|
|
10
|
+
|
|
11
|
+
Tier 3 specialist for **visual layer** in Next.js: Framer Motion, shadcn/ui theming, Tailwind token system, and Lucide icons.
|
|
12
|
+
|
|
13
|
+
> **Scope:** Visual implementation ONLY. For data-fetching, routing, Server Actions, API routes → use `nextjs-expert`.
|
|
14
|
+
|
|
15
|
+
## Mandatory Pre-Implementation Protocol
|
|
16
|
+
|
|
17
|
+
**BEFORE any UI implementation:**
|
|
18
|
+
|
|
19
|
+
1. **READ** `.morph/context/design-system.md`
|
|
20
|
+
2. **Use EXCLUSIVELY** the tokens defined there — never hardcode hex values, px values, or durations without a token
|
|
21
|
+
3. **If a token is missing:** add it to `design-system.md` in the correct section before using it
|
|
22
|
+
4. **Register in Changelog:** add an entry `- YYYY-MM-DD [nextjs-ui-specialist] Description`
|
|
23
|
+
|
|
24
|
+
## Domain
|
|
25
|
+
|
|
26
|
+
| Layer | Technology |
|
|
27
|
+
|-------|-----------|
|
|
28
|
+
| Motion | Framer Motion v11 |
|
|
29
|
+
| Components | shadcn/ui (never edit `components/ui/` primitives directly) |
|
|
30
|
+
| Styling | Tailwind CSS + CSS custom properties |
|
|
31
|
+
| Icons | Lucide React |
|
|
32
|
+
|
|
33
|
+
## Framer Motion Patterns
|
|
34
|
+
|
|
35
|
+
> **Full reference:** `framework/standards/frontend/nextjs/motion-patterns.md`
|
|
36
|
+
|
|
37
|
+
### Core Rules
|
|
38
|
+
|
|
39
|
+
- Always import variants from `@/motion/variants` (see standard)
|
|
40
|
+
- Always use `durations` and `easings` from `@/lib/design-tokens` — never hardcode numbers
|
|
41
|
+
- Always wrap animated components with `useReducedMotion()` check (WCAG)
|
|
42
|
+
- Use `AnimatePresence` for exit animations and page transitions
|
|
43
|
+
|
|
44
|
+
### Quick Patterns
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
// Stagger list
|
|
48
|
+
<motion.ul variants={staggerContainer} initial="hidden" animate="visible">
|
|
49
|
+
{items.map(item => (
|
|
50
|
+
<motion.li key={item.id} variants={staggerItem}>{item.name}</motion.li>
|
|
51
|
+
))}
|
|
52
|
+
</motion.ul>
|
|
53
|
+
|
|
54
|
+
// Card with hover lift
|
|
55
|
+
<motion.div
|
|
56
|
+
whileHover={{ y: -4, boxShadow: 'var(--shadow-lift)' }}
|
|
57
|
+
whileTap={{ scale: 0.98 }}
|
|
58
|
+
transition={{ duration: durations.fast, ease: easings.standard }}
|
|
59
|
+
>
|
|
60
|
+
|
|
61
|
+
// Scroll reveal
|
|
62
|
+
<motion.section
|
|
63
|
+
variants={slideInUp}
|
|
64
|
+
initial="hidden"
|
|
65
|
+
whileInView="visible"
|
|
66
|
+
viewport={{ once: true, margin: '-50px' }}
|
|
67
|
+
>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### WCAG: Mandatory prefers-reduced-motion
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
const shouldReduceMotion = useReducedMotion();
|
|
74
|
+
const variants = shouldReduceMotion
|
|
75
|
+
? { hidden: { opacity: 0 }, visible: { opacity: 1 } }
|
|
76
|
+
: slideInUp;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## shadcn/ui Theming
|
|
80
|
+
|
|
81
|
+
### Rules
|
|
82
|
+
|
|
83
|
+
- NEVER edit `components/ui/` files directly — extend via CSS vars and className props
|
|
84
|
+
- All theme tokens come from `.morph/context/design-system.md`
|
|
85
|
+
|
|
86
|
+
### Theming via globals.css
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
/* globals.css — bridge design-system.md tokens to shadcn vars */
|
|
90
|
+
:root {
|
|
91
|
+
--background: var(--color-surface);
|
|
92
|
+
--foreground: var(--color-text-primary);
|
|
93
|
+
--primary: var(--color-primary);
|
|
94
|
+
--primary-foreground: var(--color-surface);
|
|
95
|
+
--accent: var(--color-accent);
|
|
96
|
+
--accent-foreground: var(--color-surface);
|
|
97
|
+
--border: var(--color-border);
|
|
98
|
+
--radius: var(--radius-md);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Extending components without editing primitives
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
// ✅ Correct: compose via className + cva
|
|
106
|
+
import { Button } from '@/components/ui/button';
|
|
107
|
+
import { cn } from '@/lib/utils';
|
|
108
|
+
|
|
109
|
+
function PrimaryActionButton({ className, ...props }: ButtonProps) {
|
|
110
|
+
return (
|
|
111
|
+
<Button
|
|
112
|
+
className={cn('bg-[var(--color-accent)] hover:bg-[var(--color-accent-hover)]', className)}
|
|
113
|
+
{...props}
|
|
114
|
+
/>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ❌ Wrong: never edit components/ui/button.tsx
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Tailwind Token System
|
|
122
|
+
|
|
123
|
+
### Bridge CSS vars to Tailwind config
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// tailwind.config.ts
|
|
127
|
+
import type { Config } from 'tailwindcss';
|
|
128
|
+
|
|
129
|
+
const config: Config = {
|
|
130
|
+
theme: {
|
|
131
|
+
extend: {
|
|
132
|
+
colors: {
|
|
133
|
+
primary: {
|
|
134
|
+
DEFAULT: 'var(--color-primary)',
|
|
135
|
+
light: 'var(--color-primary-light)',
|
|
136
|
+
dark: 'var(--color-primary-dark)',
|
|
137
|
+
},
|
|
138
|
+
accent: {
|
|
139
|
+
DEFAULT: 'var(--color-accent)',
|
|
140
|
+
hover: 'var(--color-accent-hover)',
|
|
141
|
+
},
|
|
142
|
+
surface: 'var(--color-surface)',
|
|
143
|
+
border: 'var(--color-border)',
|
|
144
|
+
},
|
|
145
|
+
fontFamily: {
|
|
146
|
+
display: ['var(--font-display)'],
|
|
147
|
+
body: ['var(--font-body)'],
|
|
148
|
+
mono: ['var(--font-mono)'],
|
|
149
|
+
},
|
|
150
|
+
spacing: {
|
|
151
|
+
// Use CSS var spacing tokens
|
|
152
|
+
},
|
|
153
|
+
transitionDuration: {
|
|
154
|
+
fast: '150ms', // --duration-fast
|
|
155
|
+
base: '300ms', // --duration-base
|
|
156
|
+
slow: '500ms', // --duration-slow
|
|
157
|
+
},
|
|
158
|
+
transitionTimingFunction: {
|
|
159
|
+
standard: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
|
160
|
+
bounce: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
|
|
161
|
+
},
|
|
162
|
+
boxShadow: {
|
|
163
|
+
lift: 'var(--shadow-lift)',
|
|
164
|
+
card: 'var(--shadow-md)',
|
|
165
|
+
},
|
|
166
|
+
borderRadius: {
|
|
167
|
+
sm: 'var(--radius-sm)',
|
|
168
|
+
DEFAULT: 'var(--radius-base)',
|
|
169
|
+
md: 'var(--radius-md)',
|
|
170
|
+
lg: 'var(--radius-lg)',
|
|
171
|
+
xl: 'var(--radius-xl)',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
export default config;
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Lucide Icons
|
|
180
|
+
|
|
181
|
+
### Rules
|
|
182
|
+
|
|
183
|
+
- Always use consistent sizing: `size={16}` (inline), `size={20}` (default), `size={24}` (prominent)
|
|
184
|
+
- Never mix sizing within a component
|
|
185
|
+
- Use semantic icon selection: convey meaning, not decoration
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
import { ArrowRight, Check, AlertCircle, Loader2 } from 'lucide-react';
|
|
189
|
+
|
|
190
|
+
// Loading spinner
|
|
191
|
+
<Loader2 className="animate-spin" size={16} />
|
|
192
|
+
|
|
193
|
+
// Icon button with accessible label
|
|
194
|
+
<button aria-label="Go to next step">
|
|
195
|
+
<ArrowRight size={20} />
|
|
196
|
+
</button>
|
|
197
|
+
|
|
198
|
+
// Icon + text alignment
|
|
199
|
+
<span className="flex items-center gap-[var(--space-2)]">
|
|
200
|
+
<Check size={16} className="text-[var(--color-success)]" />
|
|
201
|
+
Saved
|
|
202
|
+
</span>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Checklist
|
|
206
|
+
|
|
207
|
+
- [ ] Read `.morph/context/design-system.md` before ANY UI work
|
|
208
|
+
- [ ] All colors use CSS token variables (no hardcoded hex)
|
|
209
|
+
- [ ] All durations use `durations.*` from design-tokens (no hardcoded ms/s)
|
|
210
|
+
- [ ] `useReducedMotion()` implemented in all animated components
|
|
211
|
+
- [ ] No direct edits to `components/ui/` primitives
|
|
212
|
+
- [ ] Tailwind config extends design-system tokens (not duplicates)
|
|
213
|
+
- [ ] Icons use consistent sizing (16/20/24px)
|
|
214
|
+
- [ ] New design decisions added to `design-system.md` Changelog
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
*MORPH-SPEC by Polymorphism Tech*
|