@polymorphism-tech/morph-spec 7.0.0 → 7.1.1

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 (89) hide show
  1. package/README.md +368 -368
  2. package/claude-plugin.json +14 -14
  3. package/docs/CHEATSHEET.md +199 -199
  4. package/docs/QUICKSTART.md +200 -200
  5. package/framework/CLAUDE.md +1 -1
  6. package/framework/MORPH.md +4 -1
  7. package/framework/agents.json +132 -127
  8. package/framework/rubrics/backend.json +41 -36
  9. package/framework/rules/ai-agents-standards.md +45 -15
  10. package/framework/rules/neon-standards.md +25 -26
  11. package/framework/skills/core/morph-brainstorming/SKILL.md +1 -1
  12. package/framework/skills/core/morph-plan/SKILL.md +3 -1
  13. package/framework/skills/core/morph-stack-scan/SKILL.md +3 -3
  14. package/framework/standards/STANDARDS.json +1729 -1133
  15. package/framework/standards/ai-agents/agent-session.md +160 -0
  16. package/framework/standards/ai-agents/batching.md +193 -0
  17. package/framework/standards/ai-agents/context-providers.md +188 -0
  18. package/framework/standards/ai-agents/mcp-server.md +250 -0
  19. package/framework/standards/ai-agents/mcp-tools.md +197 -0
  20. package/framework/standards/ai-agents/middleware-patterns.md +207 -0
  21. package/framework/standards/ai-agents/modalities-image-gen.md +173 -0
  22. package/framework/standards/ai-agents/modalities-speech-to-text.md +171 -0
  23. package/framework/standards/ai-agents/modalities-text-to-speech.md +181 -0
  24. package/framework/standards/ai-agents/modalities-vision.md +201 -0
  25. package/framework/standards/ai-agents/multi-agent-patterns.md +155 -0
  26. package/framework/standards/ai-agents/production.md +114 -258
  27. package/framework/standards/ai-agents/prompts-in-db.md +214 -0
  28. package/framework/standards/ai-agents/providers/model-registry.md +158 -0
  29. package/framework/standards/ai-agents/rag-custom-pgvector.md +243 -0
  30. package/framework/standards/ai-agents/service-tier-flex.md +135 -0
  31. package/framework/standards/ai-agents/setup.md +142 -316
  32. package/framework/standards/ai-agents/structured-output.md +249 -0
  33. package/framework/standards/ai-agents/sweet-spot.md +109 -0
  34. package/framework/standards/ai-agents/workflows.md +114 -284
  35. package/framework/standards/architecture/vertical-slice/vertical-slice.md +439 -429
  36. package/framework/standards/backend/api/validation.md +92 -88
  37. package/framework/standards/backend/database/postgresql/database.md +336 -332
  38. package/framework/standards/backend/database/vector-search-rag.md +599 -541
  39. package/framework/standards/backend/dotnet/fluent-validation-vsa.md +4 -0
  40. package/framework/standards/backend/dotnet/result-pattern.md +4 -0
  41. package/framework/standards/backend/dotnet/scalar-ui.md +176 -172
  42. package/framework/standards/backend/dotnet/scrutor.md +4 -0
  43. package/framework/standards/backend/dotnet/vsa-handler-patterns.md +310 -274
  44. package/framework/standards/backend/integrations/asaas/asaas-api.md +260 -216
  45. package/framework/standards/backend/integrations/hangfire/hangfire-jobs.md +354 -350
  46. package/framework/standards/backend/integrations/neon-auth/neon-auth.md +30 -19
  47. package/framework/standards/backend/integrations/resend/resend-email.md +400 -385
  48. package/framework/standards/data/nosql/cache/redis.md +106 -97
  49. package/framework/standards/data/nosql/cosmos-db.md +127 -118
  50. package/framework/standards/data/vector-search/rag-chunking.md +113 -104
  51. package/framework/standards/frontend/design-system/ai-image-generation.md +4 -0
  52. package/framework/standards/frontend/design-system/animations.md +164 -160
  53. package/framework/standards/frontend/design-system/naming.md +68 -64
  54. package/framework/standards/frontend/gsap/gsap-core.md +14 -8
  55. package/framework/standards/frontend/gsap/gsap-plugins.md +26 -21
  56. package/framework/standards/frontend/gsap/gsap-scrolltrigger.md +9 -7
  57. package/framework/standards/frontend/nextjs/app-router.md +127 -123
  58. package/framework/standards/frontend/nextjs/components.md +136 -132
  59. package/framework/standards/frontend/nextjs/data-fetching.md +130 -126
  60. package/framework/standards/frontend/nextjs/forms.md +134 -128
  61. package/framework/standards/frontend/nextjs/motion-patterns.md +328 -322
  62. package/framework/standards/frontend/nextjs/naming-conventions.md +71 -67
  63. package/framework/standards/frontend/nextjs/nextjs-patterns.md +229 -225
  64. package/framework/standards/frontend/nextjs/project-structure.md +106 -102
  65. package/framework/standards/frontend/nextjs/state-management.md +76 -72
  66. package/framework/standards/frontend/nextjs/testing.md +115 -111
  67. package/framework/standards/infrastructure/docker/easypanel-deploy.md +196 -192
  68. package/framework/standards/infrastructure/neon/neon-pgrag.md +6 -2
  69. package/framework/standards/infrastructure/neon/neon-pgvector.md +4 -0
  70. package/framework/standards/infrastructure/neon/neon-setup.md +5 -1
  71. package/framework/standards/integration/mcp/mcp-tools.md +471 -462
  72. package/framework/templates/CLAUDE.md.core.template +1 -1
  73. package/framework/templates/REGISTRY.json +1745 -1239
  74. package/framework/templates/code/dotnet/ai-agents/AgentBootstrap.cs.template +39 -0
  75. package/framework/templates/code/dotnet/ai-agents/EmbeddingService.cs.template +68 -0
  76. package/framework/templates/code/dotnet/ai-agents/ModelRegistry.cs.template +117 -0
  77. package/framework/templates/code/dotnet/ai-agents/PromptRepository.cs.template +95 -0
  78. package/framework/templates/code/dotnet/ai-agents/ResilientToolMiddleware.cs.template +61 -0
  79. package/framework/templates/code/dotnet/ai-agents/VectorSearchTool.cs.template +107 -0
  80. package/framework/templates/code/dotnet/ai-agents/model-registry.json.template +58 -0
  81. package/framework/templates/code/dotnet/backend/repository.cs +3 -10
  82. package/framework/templates/code/sql/ai-agents/agent-prompts-migration.sql.template +58 -0
  83. package/framework/templates/code/sql/ai-agents/pgvector-embeddings-migration.sql.template +91 -0
  84. package/package.json +89 -83
  85. package/src/core/templates/template-registry.js +289 -256
  86. package/src/lib/generators/context-generator.js +516 -518
  87. package/src/lib/generators/scaffold-generator.js +23 -26
  88. package/framework/standards/infrastructure/neon/neon-semantic-kernel.md +0 -310
  89. package/framework/templates/integrations/semantic-kernel-neon.cs +0 -125
@@ -5,6 +5,10 @@
5
5
  > **Keywords:** fluent-validation, validation, decorator, pipeline, vsa
6
6
  > **Load When:** dotnet VSA projects
7
7
 
8
+ **Verified against:** .NET 10 + FluentValidation 11 (`AbstractValidator`/`RuleFor` API). Last-verified: 2026-05-20.
9
+
10
+ ---
11
+
8
12
  ## Overview
9
13
 
10
14
  FluentValidation integrates into VSA via the decorator pattern. Validators are auto-discovered per assembly, and the `ValidationDecorator<TRequest, TResponse>` runs all matching validators before the handler executes. Failed validation short-circuits to `Result.Failure` without touching the handler.
@@ -5,6 +5,10 @@
5
5
  > **Keywords:** result, error-handling, railway, match, monadic
6
6
  > **Load When:** dotnet VSA projects
7
7
 
8
+ **Verified against:** .NET 10 (pure C# pattern — no external package). Last-verified: 2026-05-20.
9
+
10
+ ---
11
+
8
12
  ## Overview
9
13
 
10
14
  The Result pattern replaces exceptions for expected failures. Every handler returns `Result` or `Result<T>`, and endpoints use `Match()` to map success/failure to HTTP responses. No try-catch in business logic.
@@ -1,172 +1,176 @@
1
- # Scalar.AspNetCore — API Documentation UI
2
-
3
- > **Scope:** dotnet-vsa
4
- > **Layer:** 0 (always load)
5
- > **Keywords:** scalar, openapi, swagger, api-docs, documentation
6
- > **Load When:** dotnet VSA projects
7
-
8
- ## Overview
9
-
10
- Scalar replaces Swagger UI as the API documentation frontend. It provides a modern UI with built-in request testing, client code generation, and dark themes. Works with ASP.NET Core's native OpenAPI support (`Microsoft.AspNetCore.OpenApi`).
11
-
12
- ---
13
-
14
- ## Package Setup
15
-
16
- ```xml
17
- <!-- .csproj -->
18
- <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
19
- <PackageReference Include="Scalar.AspNetCore" Version="2.12.40" />
20
- ```
21
-
22
- No Swashbuckle needed. ASP.NET Core 9+ has built-in OpenAPI document generation.
23
-
24
- ---
25
-
26
- ## Program.cs Configuration
27
-
28
- ```csharp
29
- using Scalar.AspNetCore;
30
-
31
- var builder = WebApplication.CreateBuilder(args);
32
-
33
- // Enable OpenAPI document generation
34
- builder.Services.AddOpenApi();
35
-
36
- var app = builder.Build();
37
-
38
- // Map the OpenAPI JSON endpoint (dev only)
39
- if (app.Environment.IsDevelopment())
40
- {
41
- app.MapOpenApi();
42
- }
43
-
44
- // Map Scalar UI at /scalar/v1
45
- app.MapScalarApiReference(options =>
46
- {
47
- options.WithTheme(ScalarTheme.DeepSpace);
48
-
49
- // Enable Developer Tools (request + client code panel)
50
- options.WithDefaultHttpClient(
51
- ScalarTarget.CSharp,
52
- ScalarClient.HttpClient);
53
- });
54
- ```
55
-
56
- **Access URL:** `https://localhost:{port}/scalar/v1`
57
-
58
- ---
59
-
60
- ## Available Themes
61
-
62
- | Theme | Description |
63
- |-------|-------------|
64
- | `ScalarTheme.Default` | Light theme |
65
- | `ScalarTheme.DeepSpace` | Dark blue (recommended) |
66
- | `ScalarTheme.Purple` | Purple accent |
67
- | `ScalarTheme.Moon` | Dark grey |
68
- | `ScalarTheme.Saturn` | Warm dark |
69
- | `ScalarTheme.Mars` | Red accent |
70
-
71
- ---
72
-
73
- ## ApiTags Organization
74
-
75
- Group endpoints by feature using a constants class and `.WithTags()`:
76
-
77
- ```csharp
78
- // Constants/ApiTags.cs
79
- public static class ApiTags
80
- {
81
- public const string Books = "books";
82
- public const string Authors = "authors";
83
- public const string Orders = "orders";
84
- }
85
- ```
86
-
87
- Apply tags in endpoints:
88
-
89
- ```csharp
90
- internal sealed class CreateBookEndpoint : IApiEndpoint
91
- {
92
- public void MapEndpoint(IEndpointRouteBuilder app)
93
- {
94
- app.MapPost("books", async (
95
- IHandler<CreateBookRequest, Result<CreateBookResponse>> handler,
96
- CreateBookRequest command,
97
- CancellationToken cancellationToken) =>
98
- {
99
- var result = await handler.HandleAsync(command, cancellationToken);
100
- return result.Match(
101
- onSuccess: () => Results.Ok(result.Value),
102
- onFailure: error => Results.BadRequest(error));
103
- })
104
- .WithTags(ApiTags.Books)
105
- .Produces<CreateBookResponse>(StatusCodes.Status200OK)
106
- .Produces(StatusCodes.Status400BadRequest);
107
- }
108
- }
109
- ```
110
-
111
- ---
112
-
113
- ## Endpoint Metadata
114
-
115
- Use `.Produces<T>()` to document response types for OpenAPI:
116
-
117
- ```csharp
118
- app.MapGet("books/{id:guid}", async (...) => { ... })
119
- .WithTags(ApiTags.Books)
120
- .WithName("GetBookById")
121
- .WithSummary("Get a book by its unique identifier")
122
- .Produces<GetBookResponse>(StatusCodes.Status200OK)
123
- .Produces(StatusCodes.Status404NotFound);
124
-
125
- app.MapDelete("books/{id:guid}", async (...) => { ... })
126
- .WithTags(ApiTags.Books)
127
- .Produces(StatusCodes.Status204NoContent)
128
- .Produces(StatusCodes.Status404NotFound);
129
- ```
130
-
131
- ### Common Metadata Methods
132
-
133
- | Method | Purpose |
134
- |--------|---------|
135
- | `.WithTags("tag")` | Group in Scalar sidebar |
136
- | `.WithName("OperationId")` | Unique operation identifier |
137
- | `.WithSummary("...")` | Short description in endpoint list |
138
- | `.WithDescription("...")` | Long description in detail panel |
139
- | `.Produces<T>(statusCode)` | Document success response type |
140
- | `.Produces(statusCode)` | Document error response (no body) |
141
- | `.ProducesProblem(statusCode)` | Document ProblemDetails response |
142
- | `.RequireAuthorization()` | Marks as requiring auth in docs |
143
-
144
- ---
145
-
146
- ## Client Code Generation
147
-
148
- Scalar auto-generates client code for API calls. The `WithDefaultHttpClient` option selects the default language:
149
-
150
- | Target | Client | Description |
151
- |--------|--------|-------------|
152
- | `ScalarTarget.CSharp` | `ScalarClient.HttpClient` | .NET HttpClient |
153
- | `ScalarTarget.JavaScript` | `ScalarClient.Fetch` | Browser fetch() |
154
- | `ScalarTarget.Python` | `ScalarClient.Requests` | Python requests |
155
- | `ScalarTarget.Shell` | `ScalarClient.Curl` | cURL command |
156
-
157
- ---
158
-
159
- ## Anti-Patterns
160
-
161
- | Do NOT | Do Instead |
162
- |--------|------------|
163
- | Install Swashbuckle | Use `Microsoft.AspNetCore.OpenApi` + `Scalar.AspNetCore` |
164
- | Expose OpenAPI in production | Guard with `IsDevelopment()` check |
165
- | Skip `.WithTags()` on endpoints | Every endpoint needs a tag for organized docs |
166
- | Skip `.Produces<T>()` | Always document response types for accurate API docs |
167
- | Use magic strings for tags | Define tags in `Constants/ApiTags.cs` |
168
- | Map Scalar before `MapOpenApi()` | `MapOpenApi()` first, then `MapScalarApiReference()` |
169
-
170
- ---
171
-
172
- *MORPH-SPEC by Polymorphism Tech*
1
+ # Scalar.AspNetCore — API Documentation UI
2
+
3
+ > **Scope:** dotnet-vsa
4
+ > **Layer:** 0 (always load)
5
+ > **Keywords:** scalar, openapi, swagger, api-docs, documentation
6
+ > **Load When:** dotnet VSA projects
7
+
8
+ **Verified against:** .NET 10 + Scalar.AspNetCore 2.x + Microsoft.AspNetCore.OpenApi 10. Last-verified: 2026-05-20.
9
+
10
+ ---
11
+
12
+ ## Overview
13
+
14
+ Scalar replaces Swagger UI as the API documentation frontend. It provides a modern UI with built-in request testing, client code generation, and dark themes. Works with ASP.NET Core's native OpenAPI support (`Microsoft.AspNetCore.OpenApi`).
15
+
16
+ ---
17
+
18
+ ## Package Setup
19
+
20
+ ```xml
21
+ <!-- .csproj -->
22
+ <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
23
+ <PackageReference Include="Scalar.AspNetCore" Version="2.12.40" />
24
+ ```
25
+
26
+ No Swashbuckle needed. ASP.NET Core 9+ has built-in OpenAPI document generation (`Microsoft.AspNetCore.OpenApi`); this project targets .NET 10.
27
+
28
+ ---
29
+
30
+ ## Program.cs Configuration
31
+
32
+ ```csharp
33
+ using Scalar.AspNetCore;
34
+
35
+ var builder = WebApplication.CreateBuilder(args);
36
+
37
+ // Enable OpenAPI document generation
38
+ builder.Services.AddOpenApi();
39
+
40
+ var app = builder.Build();
41
+
42
+ // Map the OpenAPI JSON endpoint (dev only)
43
+ if (app.Environment.IsDevelopment())
44
+ {
45
+ app.MapOpenApi();
46
+ }
47
+
48
+ // Map Scalar UI at /scalar/v1
49
+ app.MapScalarApiReference(options =>
50
+ {
51
+ options.WithTheme(ScalarTheme.DeepSpace);
52
+
53
+ // Enable Developer Tools (request + client code panel)
54
+ options.WithDefaultHttpClient(
55
+ ScalarTarget.CSharp,
56
+ ScalarClient.HttpClient);
57
+ });
58
+ ```
59
+
60
+ **Access URL:** `https://localhost:{port}/scalar/v1`
61
+
62
+ ---
63
+
64
+ ## Available Themes
65
+
66
+ | Theme | Description |
67
+ |-------|-------------|
68
+ | `ScalarTheme.Default` | Light theme |
69
+ | `ScalarTheme.DeepSpace` | Dark blue (recommended) |
70
+ | `ScalarTheme.Purple` | Purple accent |
71
+ | `ScalarTheme.Moon` | Dark grey |
72
+ | `ScalarTheme.Saturn` | Warm dark |
73
+ | `ScalarTheme.Mars` | Red accent |
74
+
75
+ ---
76
+
77
+ ## ApiTags Organization
78
+
79
+ Group endpoints by feature using a constants class and `.WithTags()`:
80
+
81
+ ```csharp
82
+ // Constants/ApiTags.cs
83
+ public static class ApiTags
84
+ {
85
+ public const string Books = "books";
86
+ public const string Authors = "authors";
87
+ public const string Orders = "orders";
88
+ }
89
+ ```
90
+
91
+ Apply tags in endpoints:
92
+
93
+ ```csharp
94
+ internal sealed class CreateBookEndpoint : IApiEndpoint
95
+ {
96
+ public void MapEndpoint(IEndpointRouteBuilder app)
97
+ {
98
+ app.MapPost("books", async (
99
+ IHandler<CreateBookRequest, Result<CreateBookResponse>> handler,
100
+ CreateBookRequest command,
101
+ CancellationToken cancellationToken) =>
102
+ {
103
+ var result = await handler.HandleAsync(command, cancellationToken);
104
+ return result.Match(
105
+ onSuccess: () => Results.Ok(result.Value),
106
+ onFailure: error => Results.BadRequest(error));
107
+ })
108
+ .WithTags(ApiTags.Books)
109
+ .Produces<CreateBookResponse>(StatusCodes.Status200OK)
110
+ .Produces(StatusCodes.Status400BadRequest);
111
+ }
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Endpoint Metadata
118
+
119
+ Use `.Produces<T>()` to document response types for OpenAPI:
120
+
121
+ ```csharp
122
+ app.MapGet("books/{id:guid}", async (...) => { ... })
123
+ .WithTags(ApiTags.Books)
124
+ .WithName("GetBookById")
125
+ .WithSummary("Get a book by its unique identifier")
126
+ .Produces<GetBookResponse>(StatusCodes.Status200OK)
127
+ .Produces(StatusCodes.Status404NotFound);
128
+
129
+ app.MapDelete("books/{id:guid}", async (...) => { ... })
130
+ .WithTags(ApiTags.Books)
131
+ .Produces(StatusCodes.Status204NoContent)
132
+ .Produces(StatusCodes.Status404NotFound);
133
+ ```
134
+
135
+ ### Common Metadata Methods
136
+
137
+ | Method | Purpose |
138
+ |--------|---------|
139
+ | `.WithTags("tag")` | Group in Scalar sidebar |
140
+ | `.WithName("OperationId")` | Unique operation identifier |
141
+ | `.WithSummary("...")` | Short description in endpoint list |
142
+ | `.WithDescription("...")` | Long description in detail panel |
143
+ | `.Produces<T>(statusCode)` | Document success response type |
144
+ | `.Produces(statusCode)` | Document error response (no body) |
145
+ | `.ProducesProblem(statusCode)` | Document ProblemDetails response |
146
+ | `.RequireAuthorization()` | Marks as requiring auth in docs |
147
+
148
+ ---
149
+
150
+ ## Client Code Generation
151
+
152
+ Scalar auto-generates client code for API calls. The `WithDefaultHttpClient` option selects the default language:
153
+
154
+ | Target | Client | Description |
155
+ |--------|--------|-------------|
156
+ | `ScalarTarget.CSharp` | `ScalarClient.HttpClient` | .NET HttpClient |
157
+ | `ScalarTarget.JavaScript` | `ScalarClient.Fetch` | Browser fetch() |
158
+ | `ScalarTarget.Python` | `ScalarClient.Requests` | Python requests |
159
+ | `ScalarTarget.Shell` | `ScalarClient.Curl` | cURL command |
160
+
161
+ ---
162
+
163
+ ## Anti-Patterns
164
+
165
+ | Do NOT | Do Instead |
166
+ |--------|------------|
167
+ | Install Swashbuckle | Use `Microsoft.AspNetCore.OpenApi` + `Scalar.AspNetCore` |
168
+ | Expose OpenAPI in production | Guard with `IsDevelopment()` check |
169
+ | Skip `.WithTags()` on endpoints | Every endpoint needs a tag for organized docs |
170
+ | Skip `.Produces<T>()` | Always document response types for accurate API docs |
171
+ | Use magic strings for tags | Define tags in `Constants/ApiTags.cs` |
172
+ | Map Scalar before `MapOpenApi()` | `MapOpenApi()` first, then `MapScalarApiReference()` |
173
+
174
+ ---
175
+
176
+ *MORPH-SPEC by Polymorphism Tech*
@@ -5,6 +5,10 @@
5
5
  > **Keywords:** scrutor, di, decorators, auto-discovery, assembly-scanning
6
6
  > **Load When:** dotnet VSA projects
7
7
 
8
+ **Verified against:** .NET 10 + Scrutor 7 (`Scan`/`Decorate` API). Last-verified: 2026-05-20.
9
+
10
+ ---
11
+
8
12
  ## Overview
9
13
 
10
14
  Scrutor provides assembly-scanning and decoration extensions for `IServiceCollection`. In VSA, it replaces manual DI registration with convention-based auto-discovery for handlers, validators, and endpoints.