Code scaffolding patterns for .NET 10 features, entities, and tests. Generates complete feature slices, entities with EF Core configuration, and integration tests following the project's chosen architecture. Load when: "scaffold", "create feature", "add feature", "new endpoint", "generate", "add entity", "new entity", "scaffold test", "add module".
설치
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
Code scaffolding patterns for .NET 10 features, entities, and tests. Generates complete feature slices, entities with EF Core configuration, and integration tests following the project's chosen architecture. Load when: "scaffold", "create feature", "add feature", "new endpoint", "generate", "add entity", "new entity", "scaffold test", "add module".
Scaffolding
Core Principles
Architecture-aware generation — Never scaffold without knowing the project's architecture (VSA, CA, DDD, Modular Monolith). If unknown, ask first or run the architecture-advisor questionnaire.
Complete vertical slices — Never generate half a feature. A scaffold includes endpoint, handler, validation, DTOs, EF configuration, and tests as a single unit.
Tests included by default — Every scaffolded feature includes at least one integration test using WebApplicationFactory + Testcontainers. Skip only if explicitly told to.
Modern C# 14 patterns — Primary constructors, collection expressions, file-scoped types, records for DTOs, sealed on all handler classes.
Convention-matching — Before generating, check existing code for naming patterns (*Handler, *Service, *Endpoint), folder structure, and access modifiers. Match what exists.
Scaffold Checklist (MANDATORY)
Every scaffolded feature MUST include ALL of the following. Do not skip any item:
Result pattern — Handlers return Result<T>, not raw responses. Endpoints map Result to HTTP (success → TypedResults, failure → ToProblemDetails())
CancellationToken on every async method and passed to every async call
FluentValidation validator class with meaningful rules (ranges, required fields, max lengths)
ValidationFilter wiring — .AddEndpointFilter<ValidationFilter<T>>() on mutating endpoints
Domain logic lives in the aggregate; handler orchestrates persistence:
// Domain/Orders/Order.cs — Aggregate root with invariant enforcementpublicsealedclassOrder : AggregateRoot
{
privatereadonly List<OrderItem> _items = [];
public IReadOnlyList<OrderItem> Items => _items.AsReadOnly();
publicdecimal Total { get; privateset; }
public OrderStatus Status { get; privateset; }
publicstatic Order Place(string customerId, List<(Guid ProductId, int Qty, decimal Price)> items, DateTimeOffset now)
{
if (items.Count == 0) thrownew DomainException("Order must have at least one item.");
var order = new Order { Id = Guid.NewGuid(), Status = OrderStatus.Placed };
foreach (var (productId, qty, price) in items)
order._items.Add(OrderItem.Create(productId, qty, price));
order.Total = order._items.Sum(i => i.LineTotal);
order.AddDomainEvent(new OrderPlacedEvent(order.Id, customerId, order.Total, now));
return order;
}
}
Feature Scaffold — Modular Monolith
Feature within a module boundary with its own DbContext. Handler passes CancellationToken, publishes integration events:
// BAD — Generating code without knowing if project uses VSA, CA, or DDDpublicclassCreateOrderHandler { /* random structure */ }
// GOOD — Ask first: "I see feature folders, so I'll scaffold using VSA patterns."publicstaticclassCreateOrder { /* VSA single-file feature */ }
Feature Without Tests
Always scaffold feature + test as a single unit. CreateOrder.cs + CreateOrderTests.cs are never generated separately.
Entity Without EF Configuration
// BAD — data annotations scattered in entitypublicclassProduct { [Key] public Guid Id { get; set; } [MaxLength(200)] publicstring Name { get; set; } = ""; }
// GOOD — clean entity + separate IEntityTypeConfiguration<T>publicsealedclassProduct { /* No attributes */ }
internalsealedclassProductConfiguration : IEntityTypeConfiguration<Product> { /* All EF config */ }
Anemic DTOs That Mirror Entities 1:1
// BAD — DTO mirrors entity with no purposepublicrecordProductDto(Guid Id, string Name, string Sku, decimal Price, bool IsActive, DateTime CreatedAt, DateTime? UpdatedAt);
// GOOD — response shaped for the consumerpublicrecordProductSummary(Guid Id, string Name, decimal Price);