@polymorphism-tech/morph-spec 4.5.0 → 4.6.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 (71) hide show
  1. package/.morph/.morphversion +3 -3
  2. package/.morph/analytics/threads-log.jsonl +6 -44
  3. package/.morph/config/config.json +1 -1
  4. package/.morph/framework/standards/frontend/nextjs/nextjs-patterns.md +17 -0
  5. package/.morph/framework/templates/docs/user-stories.md +34 -0
  6. package/.morph/logs/tool-failures.log +7 -51
  7. package/.morph/memory/{pre-compact-2026-02-22T17-01-01-658Z.json → pre-compact-2026-02-23T15-43-03-521Z.json} +1 -1
  8. package/CLAUDE.md +77 -56
  9. package/framework/{skills/level-2-domains → agents}/ai-agents/ai-system-architect.md +1 -4
  10. package/framework/{skills/level-2-domains → agents}/architecture/po-pm-advisor.md +1 -2
  11. package/framework/{skills/level-2-domains → agents}/architecture/prompt-engineer.md +1 -2
  12. package/framework/{skills/level-2-domains → agents}/architecture/seo-growth-hacker.md +1 -2
  13. package/framework/{skills/level-2-domains → agents}/architecture/standards-architect.md +1 -4
  14. package/framework/agents/backend/api-designer.md +103 -0
  15. package/framework/{skills/level-2-domains → agents}/backend/dotnet-senior.md +1 -2
  16. package/framework/agents/backend/ef-modeler.md +119 -0
  17. package/framework/{skills/level-2-domains → agents}/backend/hangfire-orchestrator.md +1 -4
  18. package/framework/{skills/level-2-domains → agents}/backend/ms-agent-expert.md +1 -4
  19. package/framework/{skills/level-2-domains → agents}/frontend/blazor-builder.md +1 -4
  20. package/framework/{skills/level-2-domains → agents}/frontend/nextjs-expert.md +1 -4
  21. package/framework/{skills/level-2-domains → agents}/frontend/ui-ux-designer.md +1 -2
  22. package/framework/{skills/level-2-domains → agents}/infrastructure/azure-architect.md +1 -2
  23. package/framework/{skills/level-2-domains → agents}/infrastructure/azure-deploy-specialist.md +1 -2
  24. package/framework/{skills/level-2-domains → agents}/infrastructure/bicep-architect.md +1 -4
  25. package/framework/{skills/level-2-domains → agents}/infrastructure/container-specialist.md +1 -4
  26. package/framework/{skills/level-2-domains → agents}/infrastructure/devops-engineer.md +1 -4
  27. package/framework/{skills/level-2-domains → agents}/integrations/asaas-financial.md +1 -4
  28. package/framework/{skills/level-2-domains → agents}/integrations/azure-identity.md +1 -4
  29. package/framework/{skills/level-2-domains → agents}/integrations/clerk-auth.md +1 -4
  30. package/framework/{skills/level-2-domains → agents}/integrations/hangfire-integration.md +1 -2
  31. package/framework/{skills/level-2-domains → agents}/integrations/resend-email.md +1 -4
  32. package/framework/{skills/level-2-domains → agents}/quality/code-analyzer.md +1 -4
  33. package/framework/{skills/level-2-domains → agents}/quality/testing-specialist.md +1 -4
  34. package/framework/hooks/claude-code/statusline.py +384 -85
  35. package/framework/hooks/shared/phase-utils.js +129 -129
  36. package/framework/skills/README.md +66 -0
  37. package/framework/skills/level-0-meta/{brainstorming.md → brainstorming/SKILL.md} +3 -1
  38. package/framework/skills/level-0-meta/brainstorming/references/proposal-example.md +138 -0
  39. package/framework/skills/level-0-meta/{code-review.md → code-review/SKILL.md} +3 -2
  40. package/framework/skills/level-0-meta/code-review/references/review-example.md +164 -0
  41. package/framework/skills/level-0-meta/code-review/scripts/scan-csharp.mjs +121 -0
  42. package/framework/skills/level-0-meta/{morph-checklist.md → morph-checklist/SKILL.md} +2 -5
  43. package/framework/skills/{level-1-workflows/morph-replicate.md → level-0-meta/morph-replicate/SKILL.md} +6 -7
  44. package/framework/skills/level-0-meta/{simulation-checklist.md → simulation-checklist/SKILL.md} +3 -6
  45. package/framework/skills/level-0-meta/{tool-usage-guide.md → tool-usage-guide/SKILL.md} +1 -2
  46. package/framework/skills/level-0-meta/{verification-before-completion.md → verification-before-completion/SKILL.md} +3 -1
  47. package/framework/skills/level-0-meta/verification-before-completion/scripts/check-phase-outputs.mjs +110 -0
  48. package/framework/skills/level-1-workflows/{phase-clarify.md → phase-clarify/SKILL.md} +3 -3
  49. package/framework/skills/level-1-workflows/phase-clarify/references/clarifications-example.md +117 -0
  50. package/framework/skills/level-1-workflows/{phase-codebase-analysis.md → phase-codebase-analysis/SKILL.md} +2 -3
  51. package/framework/skills/level-1-workflows/{phase-design.md → phase-design/SKILL.md} +13 -185
  52. package/framework/skills/level-1-workflows/phase-design/references/spec-example.md +253 -0
  53. package/framework/skills/level-1-workflows/{phase-implement.md → phase-implement/SKILL.md} +3 -3
  54. package/framework/skills/level-1-workflows/phase-implement/references/recap-example.md +132 -0
  55. package/framework/skills/level-1-workflows/{phase-setup.md → phase-setup/SKILL.md} +2 -3
  56. package/framework/skills/level-1-workflows/{phase-tasks.md → phase-tasks/SKILL.md} +4 -3
  57. package/framework/skills/level-1-workflows/phase-tasks/references/tasks-example.md +231 -0
  58. package/framework/skills/level-1-workflows/phase-tasks/scripts/validate-tasks.mjs +112 -0
  59. package/framework/skills/level-1-workflows/{phase-uiux.md → phase-uiux/SKILL.md} +2 -3
  60. package/package.json +1 -1
  61. package/src/commands/project/init.js +4 -64
  62. package/src/commands/project/update.js +1 -62
  63. package/src/lib/detectors/claude-config-detector.js +1 -3
  64. package/src/utils/agents-installer.js +2 -2
  65. package/src/utils/skills-installer.js +59 -15
  66. package/.morph/context/README.md +0 -17
  67. package/framework/skills/level-2-domains/backend/api-designer.md +0 -66
  68. package/framework/skills/level-2-domains/backend/ef-modeler.md +0 -65
  69. package/framework/skills/level-3-technologies/README.md +0 -7
  70. package/framework/skills/level-4-patterns/README.md +0 -7
  71. /package/framework/{skills/level-2-domains → agents}/README.md +0 -0
package/CLAUDE.md CHANGED
@@ -1,56 +1,77 @@
1
- # MORPH-SPEC - Claude Code Instructions
2
-
3
- > by Polymorphism Tech
4
-
5
- Spec-driven development system for multi-stack projects (.NET/Blazor/Next.js/Azure).
6
-
7
- ---
8
-
9
- ## CRITICAL RULES
10
-
11
- ### NEVER:
12
- - Skip to code without a specification
13
- - Implement without design approval
14
- - Ignore standards in `.morph/framework/standards/`
15
- - Create infrastructure manually
16
- - Generate code without defined contracts
17
-
18
- ### ALWAYS:
19
- - Follow the 5 mandatory phases
20
- - Generate outputs in `.morph/features/{feature}/`
21
- - Document decisions in `decisions.md`
22
- - Checkpoint every 3 implemented tasks
23
- - Use Infrastructure as Code
24
-
25
- ---
26
-
27
- ## ENTRY POINTS
28
-
29
- | Command | Purpose |
30
- |---------|---------|
31
- | `/morph-proposal {feature}` | Full spec pipeline (phases 1–4, pauses for approval) |
32
- | `/morph-apply {feature}` | Implement feature (phase 5) |
33
- | `/morph-status` | Feature dashboard |
34
-
35
- > All agents, workflows, phases, and templates are described in the skills loaded at session start.
36
-
37
- ---
38
-
39
- ## PROJECT CONTEXT
40
-
41
- @.morph/context/README.md
42
-
43
- ---
44
-
45
- ## KEY PATHS
46
-
47
- | Path | Contents |
48
- |------|---------|
49
- | `.morph/config/config.json` | Project configuration |
50
- | `.morph/framework/agents.json` | 37 agent definitions |
51
- | `.morph/framework/standards/` | Coding and architecture standards |
52
- | `.morph/framework/skills/` | Phase workflows and domain specialists |
53
-
54
- ---
55
-
56
- *MORPH-SPEC v4.4.0 by Polymorphism Tech*
1
+ # MORPH-SPEC Runtime Instructions
2
+
3
+ > by Polymorphism Tech — Spec-driven development for .NET/Blazor/Next.js/Azure
4
+
5
+ ---
6
+
7
+ ## Project Context
8
+
9
+ @.morph/context/README.md
10
+
11
+ ---
12
+
13
+ ## Critical Rules
14
+
15
+ **NEVER:**
16
+ - Skip to code without a specification
17
+ - Implement without design approval
18
+ - Ignore standards in `.morph/framework/standards/`
19
+ - Create infrastructure manually
20
+ - Generate code without defined contracts
21
+
22
+ **ALWAYS:**
23
+ - Follow the mandatory phases
24
+ - Generate outputs in `.morph/features/{feature}/`
25
+ - Document decisions in `decisions.md`
26
+ - Checkpoint every 3 implemented tasks
27
+ - Use Infrastructure as Code
28
+
29
+ ---
30
+
31
+ ## Quick Reference
32
+
33
+ | Command | Purpose |
34
+ |---------|---------|
35
+ | `/morph-proposal {feature}` | Full spec pipeline (phases 1–4, pauses for approval) |
36
+ | `/morph-apply {feature}` | Implement feature (phase 5) |
37
+ | `/morph-status` | Feature status dashboard |
38
+ | `/morph-preflight` | Pre-implementation validation |
39
+
40
+ ---
41
+
42
+ ## State & Outputs
43
+
44
+ | Path | Notes |
45
+ |------|-------|
46
+ | `.morph/state.json` | **READ-ONLY** — use `morph-spec` CLI to update |
47
+ | `.morph/features/{feature}/{phase}/` | Feature outputs organized by phase |
48
+ | `.morph/framework/` | **READ-ONLY** — framework files managed by morph-spec |
49
+ | `.morph/config/config.json` | Project configuration (editable) |
50
+
51
+ ---
52
+
53
+ ## Phase Sequence
54
+
55
+ ```
56
+ proposal setup [uiux] → design → clarify → tasks → implement → [sync]
57
+ ```
58
+
59
+ Use `morph-spec state show {feature}` to see current phase and pending approval gates.
60
+
61
+ ---
62
+
63
+ ## Agents
64
+
65
+ Tier-1 and tier-2 MORPH agents are available as native subagents in `.claude/agents/`.
66
+ They can be invoked directly by Claude Code during multi-agent workflows.
67
+
68
+ ---
69
+
70
+ ## Context Window Tip
71
+
72
+ When using 3+ MCPs, add `"experimental": { "mcpCliMode": true }` to `.claude/settings.json`.
73
+ MCP tools load on-demand instead of all at startup — keeps context clean for actual work.
74
+
75
+ ---
76
+
77
+ *MORPH-SPEC v4.5.0 by Polymorphism Tech*
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: ai-system-architect
3
- description: >
4
- AI System Architect specialist for agent systems, LLM orchestration, and AI pipeline design. Activates for keywords: semantic kernel, microsoft agents, ai pipeline, llm, embeddings.
3
+ description: AI System Architect specialist for designing multi-agent systems, LLM orchestration, RAG pipelines, and Semantic Kernel patterns. Use when designing AI agent architectures, implementing LLM-powered features, building RAG pipelines, or integrating Microsoft Agent Framework.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
@@ -9,8 +8,6 @@ allowed-tools: Read, Write, Edit, Bash, Glob, Grep
9
8
 
10
9
  Expert in agentic system architecture, multi-agent orchestration, and RAG pipelines.
11
10
 
12
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** orchestration, multi-agent, rag, vector search, embedding, agentic, memory, reasoning
13
-
14
11
  > **Ref:** `framework/standards/ai-agents/workflows.md` — Workflow patterns with AgentWorkflowBuilder
15
12
  > **Ref:** `framework/standards/ai-agents/production.md` — Middleware, A2A, MCP, caching
16
13
  > **Ref:** `framework/standards/backend/database/vector-search-rag.md` — Vector Search + RAG with EF Core 10
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: po-pm-advisor
3
- description: >
4
- PO/PM Advisor specialist for product requirements, roadmaps, and user stories. Activates for keywords: product, roadmap, requirements, user stories, acceptance criteria.
3
+ description: PO/PM Advisor specialist for clarifying product requirements, defining acceptance criteria, writing user stories, and evaluating feature ROI. Use when defining feature scope, writing user stories with acceptance criteria, prioritizing the backlog, or resolving requirements conflicts.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: prompt-engineer
3
- description: >
4
- Prompt Engineer specialist for designing system prompts, few-shot examples, and LLM interaction patterns. Activates for keywords: prompts, system prompts, llm, few-shot, chain-of-thought.
3
+ description: Prompt Engineer specialist for designing system prompts, few-shot examples, chain-of-thought patterns, and LLM interaction optimization. Use when building AI features, writing or improving system prompts, designing LLM agent instructions, or optimizing prompt performance.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: seo-growth-hacker
3
- description: >
4
- SEO and Growth specialist for performance optimization, analytics, and search engine ranking. Activates for keywords: seo, performance, analytics, lighthouse, core web vitals.
3
+ description: SEO and Growth specialist for technical SEO, Core Web Vitals optimization, content strategy, and organic growth for SaaS and landing pages. Use when optimizing for search engine ranking, improving Lighthouse scores, implementing SEO for Next.js/Blazor pages, or planning content-driven growth.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: standards-architect
3
- description: >
4
- Standards Architect (Tier 1 Orchestrator). Always active. Enforces naming conventions, coding standards, cross-cutting concerns, and reviews all outputs for compliance.
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.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # Standards Architect
9
8
 
10
- > **Layer:** 0 | **Load:** always | **Scope:** All .NET projects (Core Agent)
11
-
12
9
  Guardiao dos padroes de codigo, nomenclatura e arquitetura. Valida aderencia aos standards antes de aprovar merges.
13
10
 
14
11
  > **Ref:** `framework/standards/core/coding.md` for complete C# naming conventions and .editorconfig template.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: api-designer
3
+ description: API Designer specialist for REST API design, OpenAPI/Swagger specs, endpoint architecture, and HTTP contract definitions. Use when designing API endpoints, creating OpenAPI specs, defining REST contracts, or implementing Minimal API controllers in .NET.
4
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep
5
+ ---
6
+
7
+ # API Designer
8
+
9
+ REST API design specialist for .NET Minimal API. Focuses on clean endpoint design, DTO contracts, and HTTP semantics.
10
+
11
+ ## Standards
12
+
13
+ - `framework/standards/backend/api/rest.md`
14
+ - `framework/standards/backend/api/validation.md`
15
+ - `framework/standards/backend/dotnet/async.md`
16
+ - `framework/standards/core/coding.md`
17
+
18
+ ---
19
+
20
+ ## Minimal API Pattern
21
+
22
+ ```csharp
23
+ // Endpoint group — one file per feature
24
+ public static class PhotoProcessingEndpoints
25
+ {
26
+ public static IEndpointRouteBuilder MapPhotoProcessing(this IEndpointRouteBuilder app)
27
+ {
28
+ var group = app.MapGroup("/api/photos").RequireAuthorization();
29
+
30
+ group.MapPost("/upload", UploadAsync)
31
+ .DisableAntiforgery();
32
+
33
+ group.MapGet("/status/{jobId:guid}", GetStatusAsync);
34
+ group.MapGet("/download/{jobId:guid}", DownloadAsync);
35
+
36
+ return app;
37
+ }
38
+
39
+ private static async Task<IResult> UploadAsync(
40
+ IFormFile file,
41
+ IPhotoProcessingService service,
42
+ ClaimsPrincipal user,
43
+ CancellationToken ct)
44
+ {
45
+ var result = await service.UploadAsync(new(file, user.GetUserId()), ct);
46
+ return result.IsSuccess
47
+ ? TypedResults.Ok(new { result.Value.JobId })
48
+ : TypedResults.ValidationProblem(result.Errors);
49
+ }
50
+ }
51
+ ```
52
+
53
+ ## HTTP Status Codes
54
+
55
+ | Scenario | Code | Method |
56
+ |----------|------|--------|
57
+ | Created resource | 201 | `TypedResults.Created(location, dto)` |
58
+ | Success, no body | 204 | `TypedResults.NoContent()` |
59
+ | Validation error | 400 | `TypedResults.ValidationProblem(errors)` |
60
+ | Unauthorized | 401 | `TypedResults.Unauthorized()` |
61
+ | Forbidden | 403 | `TypedResults.Forbid()` |
62
+ | Not found | 404 | `TypedResults.NotFound()` |
63
+ | Server error | 500 | let exception middleware handle |
64
+
65
+ ## DTO Rules
66
+
67
+ ```csharp
68
+ // Request DTOs: record + required init
69
+ public record UploadPhotoCommand(IFormFile Photo, Guid UserId);
70
+
71
+ // Response DTOs: include only what UI needs
72
+ public record JobStatusDto(Guid JobId, ProcessingStatus Status, string? DownloadUrl, DateTime CreatedAt);
73
+
74
+ // Never expose domain entities directly — always map to DTO
75
+ ```
76
+
77
+ ## Validation (FluentValidation)
78
+
79
+ ```csharp
80
+ public class UploadPhotoCommandValidator : AbstractValidator<UploadPhotoCommand>
81
+ {
82
+ public UploadPhotoCommandValidator()
83
+ {
84
+ RuleFor(x => x.Photo).NotNull();
85
+ RuleFor(x => x.Photo.Length).LessThanOrEqualTo(10 * 1024 * 1024)
86
+ .WithMessage("File must be under 10MB");
87
+ RuleFor(x => x.Photo.ContentType)
88
+ .Must(t => t is "image/jpeg" or "image/png")
89
+ .WithMessage("Only JPG and PNG are allowed");
90
+ }
91
+ }
92
+ ```
93
+
94
+ ## Collaborates With
95
+
96
+ - **dotnet-senior** — service layer consumed by endpoints
97
+ - **ef-modeler** — entity → DTO mapping
98
+ - **blazor-builder** — frontend consuming API
99
+ - **testing-specialist** — integration tests
100
+
101
+ ---
102
+
103
+ *MORPH-SPEC by Polymorphism Tech*
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: dotnet-senior
3
- description: >
4
- .NET Senior Engineer specialist for C#, Minimal API, and .NET ecosystem patterns. Activates for keywords: dotnet, csharp, minimal api, ef core, asp.net.
3
+ description: Senior .NET engineer and Backend Squad Leader for C#, Minimal API, async patterns, and Clean Architecture implementation. Use when implementing .NET/C# services, designing backend architecture, implementing async operations with CancellationToken, or coordinating backend domain specialists.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: ef-modeler
3
+ description: Entity Framework Modeler specialist for database schema design, EF Core migrations, DbContext configuration, and ORM patterns including IDbContextFactory. Use when designing database models, creating EF Core migrations, configuring DbContext, or implementing repository patterns with EF Core.
4
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep
5
+ ---
6
+
7
+ # EF Modeler
8
+
9
+ Entity Framework Core specialist for database modeling, entities, configurations, and migrations.
10
+
11
+ ## Standards
12
+
13
+ - `framework/standards/backend/database/ef-core.md`
14
+ - `framework/standards/backend/database/migrations.md`
15
+ - `framework/standards/backend/database/repository-patterns.md`
16
+ - `framework/standards/core/coding.md`
17
+
18
+ ---
19
+
20
+ ## Entity Pattern
21
+
22
+ ```csharp
23
+ // Private setters + factory method + domain state methods
24
+ public sealed class ProcessingJob
25
+ {
26
+ private ProcessingJob() { } // EF constructor
27
+
28
+ public Guid Id { get; private set; }
29
+ public string OriginalPhotoUrl { get; private set; } = default!;
30
+ public string? ProcessedPhotoUrl { get; private set; }
31
+ public ProcessingStatus Status { get; private set; }
32
+ public int RetryCount { get; private set; }
33
+ public DateTime CreatedAt { get; private set; }
34
+ public DateTime UpdatedAt { get; private set; }
35
+
36
+ // Factory method — enforces invariants at creation
37
+ public static ProcessingJob Create(string originalPhotoUrl)
38
+ {
39
+ ArgumentException.ThrowIfNullOrEmpty(originalPhotoUrl);
40
+ return new() { Id = Guid.NewGuid(), OriginalPhotoUrl = originalPhotoUrl,
41
+ Status = ProcessingStatus.Pending, CreatedAt = DateTime.UtcNow,
42
+ UpdatedAt = DateTime.UtcNow };
43
+ }
44
+
45
+ // Domain state methods — encapsulate transitions
46
+ public void MarkProcessing() => (Status, UpdatedAt) = (ProcessingStatus.Processing, DateTime.UtcNow);
47
+
48
+ public void MarkCompleted(string processedUrl)
49
+ {
50
+ ProcessedPhotoUrl = processedUrl;
51
+ Status = ProcessingStatus.Completed;
52
+ UpdatedAt = DateTime.UtcNow;
53
+ }
54
+
55
+ public void MarkFailed() { RetryCount++; Status = RetryCount >= 3 ? ProcessingStatus.Failed : ProcessingStatus.Pending;
56
+ UpdatedAt = DateTime.UtcNow; }
57
+ }
58
+ ```
59
+
60
+ ## Configuration Pattern
61
+
62
+ ```csharp
63
+ // One IEntityTypeConfiguration per entity — never configure in OnModelCreating
64
+ public sealed class ProcessingJobConfiguration : IEntityTypeConfiguration<ProcessingJob>
65
+ {
66
+ public void Configure(EntityTypeBuilder<ProcessingJob> builder)
67
+ {
68
+ builder.HasKey(j => j.Id);
69
+ builder.Property(j => j.OriginalPhotoUrl).HasMaxLength(500).IsRequired();
70
+ builder.Property(j => j.ProcessedPhotoUrl).HasMaxLength(500);
71
+ builder.Property(j => j.Status).HasConversion<int>();
72
+ builder.Property(j => j.CreatedAt).HasDefaultValueSql("GETUTCDATE()");
73
+ builder.HasIndex(j => j.Status); // index frequently filtered columns
74
+ }
75
+ }
76
+ ```
77
+
78
+ ## Migration Checklist
79
+
80
+ ```bash
81
+ # 1. Create migration
82
+ dotnet ef migrations add AddProcessingJob --project src/Infrastructure --startup-project src/Web
83
+
84
+ # 2. Review generated migration — check Up() and Down() for correctness
85
+ # 3. Apply
86
+ dotnet ef database update --project src/Infrastructure --startup-project src/Web
87
+ ```
88
+
89
+ - Never use `EnsureCreated()` in production — always explicit migrations
90
+ - Never edit a migration that's been applied to a shared environment — add a new one
91
+ - Soft-delete columns: add nullable `DeletedAt`, filter in repository (`HasQueryFilter`)
92
+
93
+ ## IDbContextFactory (Background Jobs)
94
+
95
+ ```csharp
96
+ // DbContext is HTTP-scoped — background jobs MUST use IDbContextFactory
97
+ public class PhotoProcessingJob(IDbContextFactory<AppDbContext> dbFactory)
98
+ {
99
+ public async Task ProcessAsync(Guid jobId, CancellationToken ct)
100
+ {
101
+ await using var db = await dbFactory.CreateDbContextAsync(ct);
102
+ var job = await db.ProcessingJobs.FindAsync([jobId], ct)
103
+ ?? throw new InvalidOperationException($"Job {jobId} not found");
104
+ job.MarkProcessing();
105
+ await db.SaveChangesAsync(ct);
106
+ // ... process ...
107
+ }
108
+ }
109
+ ```
110
+
111
+ ## Collaborates With
112
+
113
+ - **dotnet-senior** — service layer consuming repositories
114
+ - **api-designer** — DTO mapping from entities
115
+ - **azure-architect** — Azure SQL / Cosmos DB provisioning
116
+
117
+ ---
118
+
119
+ *MORPH-SPEC by Polymorphism Tech*
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: hangfire-orchestrator
3
- description: >
4
- Hangfire Orchestrator specialist for background jobs, recurring tasks, queue management, and job scheduling. Activates for keywords: background jobs, queue, scheduling, hangfire, recurring.
3
+ description: Hangfire Orchestrator specialist for background job design, recurring task scheduling, queue management, and idempotent job patterns in .NET. Use when implementing background jobs, scheduling recurring tasks, managing job queues, or integrating Hangfire with .NET services.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # Hangfire Orchestrator
9
8
 
10
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** scheduled, job, background, cron, recurring, batch, queue, hangfire
11
-
12
9
  Especialista em background jobs, tarefas agendadas e processamento assíncrono com Hangfire.
13
10
 
14
11
  ## .NET 10 Compatibility
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: ms-agent-expert
3
- description: >
4
- Microsoft Agent Framework Expert for Semantic Kernel, Microsoft AI extensions, and agent pipeline patterns. Activates for keywords: semantic kernel, microsoft agents, ai pipeline, sk, plugins.
3
+ description: Microsoft Agent Framework Expert for Semantic Kernel, AI extensions, function calling, MCP/A2A protocols, and agentic pipeline implementation. Use when building AI agents with Semantic Kernel, implementing tool/plugin calling, designing multi-agent workflows, or integrating LLMs with .NET services.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # Agent Framework Expert
9
8
 
10
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** agent, ai, llm, openai, chat, prompt, tool, function calling, rag, embedding, workflow, orchestration, mcp, a2a, middleware
11
-
12
9
  ## Identity
13
10
 
14
11
  Microsoft Agent Framework specialist for .NET 10. Implements AI agents, tools, workflows, and middleware.
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: blazor-builder
3
- description: >
4
- Blazor Builder specialist for .NET + Blazor stack, Razor components, MudBlazor, and Fluent UI. Activates for keywords: blazor, razor, mudblazor, fluent ui, wasm.
3
+ description: Blazor Builder specialist for .NET + Blazor Server stack, Razor components, Fluent UI Blazor, MudBlazor, and .NET 10 patterns. Use when implementing Blazor components and pages, configuring Program.cs, handling Blazor lifecycle patterns, or choosing between Fluent UI and MudBlazor libraries.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
@@ -18,8 +17,6 @@ Stack principal para aplicações web com .NET e Blazor Server.
18
17
  | **Background** | Hangfire |
19
18
  | **AI** | Microsoft Agent Framework |
20
19
 
21
- **Triggers:** `blazor`, `razor`, `server-side`, `.net`, `csharp`, `dotnet`
22
-
23
20
  ---
24
21
 
25
22
  ## Critical Standards (Read FIRST)
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: nextjs-expert
3
- description: >
4
- Next.js Expert specialist for React, App Router, Pages Router, and Next.js ecosystem patterns. Activates for keywords: nextjs, react, frontend, app router, pages, ssr, ssg.
3
+ description: Next.js Expert specialist for React, App Router, Pages Router, SSR/SSG patterns, and TypeScript-first frontend development. Use when implementing Next.js pages or components, configuring App Router, handling SSR/SSG, or building TypeScript React frontends.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # .NET + Next.js Stack
9
8
 
10
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** nextjs, next.js, react, api, frontend, spa, typescript
11
-
12
9
  | Aspect | Technology |
13
10
  |--------|------------|
14
11
  | **Backend** | .NET 10 Web API / C# 14 |
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: ui-ux-designer
3
- description: >
4
- UI/UX Designer specialist for wireframes, mockups, design systems, and user flows. Activates for keywords: design, ux, wireframe, mockup, figma, component library.
3
+ description: UI/UX Designer specialist for wireframes, design systems, component specs, user flows, and Fluent UI/MudBlazor component selection. Use when creating UI mockups, designing component specifications, building design systems, or deciding between UI component libraries for Blazor.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: azure-architect
3
- description: >
4
- Azure Architect specialist for Azure platform design, Container Apps, App Service, and cloud architecture. Activates for keywords: azure, container apps, bicep, app service, cloud.
3
+ description: Azure Architect specialist for designing Azure infrastructure, creating Bicep IaC templates, estimating resource costs, and enforcing zero-portal policy. Use when designing Azure architecture, provisioning cloud resources, creating Bicep templates, or planning multi-environment deployments.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: azure-deploy-specialist
3
- description: >
4
- Azure Deploy Specialist for CI/CD pipelines, GitHub Actions, Azure DevOps, and deployment automation. Activates for keywords: deploy, ci/cd, github actions, azure devops, pipeline.
3
+ description: Azure Deploy Specialist for end-to-end deployments to Azure Container Apps using systematic playbooks, validation checklists, and accumulated deployment knowledge. Use when deploying to Azure Container Apps, debugging deployment failures, configuring CI/CD pipelines, or performing pre-flight deployment validation.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: bicep-architect
3
- description: >
4
- Bicep Architect specialist for Azure Infrastructure as Code, ARM templates, and resource provisioning. Activates for keywords: bicep, iac, arm template, azure resources, infrastructure.
3
+ description: Bicep Architect specialist for Azure Infrastructure as Code, modular Bicep templates, ARM deployments, and resource configuration. Use when writing Bicep templates, structuring IaC modules, validating Azure deployments with what-if, or converting ARM JSON to Bicep.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # Bicep Architect
9
8
 
10
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** bicep, iac, infrastructure as code, provision, azure resource, deploy
11
-
12
9
  Especialista em Infrastructure as Code com Azure Bicep. **Zero Portal** — all infra via code.
13
10
 
14
11
  ## Structure
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: container-specialist
3
- description: >
4
- Container Specialist for Docker, Compose, Kubernetes, and containerized deployment patterns. Activates for keywords: docker, dockerfile, compose, kubernetes, container.
3
+ description: Container Specialist for Docker, Compose, Azure Container Registry, and containerized .NET application patterns. Use when creating Dockerfiles, configuring multi-stage builds, setting up container registries, or containerizing .NET applications for Azure Container Apps.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # Container Specialist
9
8
 
10
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** docker, container, containerize, container apps, acr, registry, image
11
-
12
9
  Especialista em containerização com Docker e deploy para Azure Container Apps.
13
10
 
14
11
  ## Dockerfile (.NET Multi-stage)
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: devops-engineer
3
- description: >
4
- DevOps Engineer (Tier 2 Domain Leader) for CI/CD strategy, deployment pipelines, monitoring, and infrastructure management. Always available for DevOps concerns.
3
+ description: DevOps Engineer (Tier 2 Domain Leader) for CI/CD pipeline strategy, GitHub Actions workflows, Azure DevOps, monitoring, and release automation. Use when designing deployment pipelines, configuring GitHub Actions, setting up Azure DevOps, or planning release strategies.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # DevOps Engineer
9
8
 
10
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** pipeline, ci/cd, deploy, release, azure devops, github actions, build, automation
11
-
12
9
  Especialista em CI/CD, pipelines e automação de deploy.
13
10
 
14
11
  ## Azure Pipelines
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: asaas-financial
3
- description: >
4
- Asaas Financial specialist for payment processing, billing, subscriptions, and the Asaas API integration. Activates for keywords: payment, billing, subscription, asaas, pix.
3
+ description: Asaas Financial specialist for Asaas API integration, payment processing, Pix/boleto billing, and subscription management in Brazilian projects. Use when integrating Asaas payments, implementing billing flows, handling payment webhooks, or building subscription management features.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # Asaas Financial
9
8
 
10
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** asaas, payment, pix, boleto, cobranca, subscription, billing, pagamento
11
-
12
9
  Integração com Asaas para pagamentos no Brasil. API REST, sem SDK .NET oficial. Suporta PIX, Boleto, Cartão.
13
10
 
14
11
  ## Setup
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: azure-identity
3
- description: >
4
- Azure Identity specialist for Microsoft Entra ID, OAuth 2.0, JWT, and enterprise authentication patterns. Activates for keywords: auth, authentication, entra id, jwt, oauth, azure ad.
3
+ description: Azure Identity specialist for Microsoft Entra ID, OAuth 2.0/OIDC, MSAL, JWT authentication, and enterprise SSO patterns. Use when implementing Microsoft authentication, configuring Entra ID app registrations, securing APIs with OAuth/JWT, or setting up enterprise SSO with Azure AD.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # Azure Identity (Microsoft Identity)
9
8
 
10
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** identity, entra, azure ad, microsoft auth, msal, oauth, oidc, microsoft identity
11
-
12
9
  Microsoft Identity Platform for .NET/Blazor. SDK: `Microsoft.Identity.Web`.
13
10
 
14
11
  ## Setup
@@ -1,14 +1,11 @@
1
1
  ---
2
2
  name: clerk-auth
3
- description: >
4
- Clerk Auth specialist for Clerk authentication, social login, user management, and Clerk SDK integration. Activates for keywords: clerk, auth0, authentication, social login, user management.
3
+ description: Clerk Auth specialist for Clerk SDK integration, social login, JWT session management, and user management in Next.js and .NET projects. Use when integrating Clerk authentication, implementing social login flows, managing user sessions with Clerk JWT, or protecting routes with Clerk middleware.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6
 
8
7
  # Clerk Auth
9
8
 
10
- > **Layer:** 2 | **Load:** on-keyword | **Keywords:** clerk, auth, login, signup, authentication, session, jwt, user
11
-
12
9
  Autenticação SaaS com Clerk para .NET/Blazor. SDK: `Clerk.Net.AspNetCore.Security`.
13
10
 
14
11
  ## Setup
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: hangfire-orchestrator-integration
3
- description: >
4
- Hangfire integration specialist for connecting background jobs with external services, webhooks, and event-driven workflows. Activates for keywords: hangfire, background jobs, webhooks, event-driven.
3
+ description: Hangfire integration specialist for connecting background jobs with external services, implementing webhook handlers, and building event-driven workflows in .NET. Use when integrating Hangfire with third-party APIs, processing webhooks asynchronously, or designing event-driven job pipelines.
5
4
  allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
5
  ---
7
6