원클릭으로
cqrs-mediatr-guidelines
Apply project CQRS conventions for commands, queries, handlers, validators, caching, and specification-driven reads.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Apply project CQRS conventions for commands, queries, handlers, validators, caching, and specification-driven reads.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Run the canonical build plus all nine per-project test commands from docs/TESTING.md. Never uses solution-level dotnet test.
Create or re-baseline lean, repository-grounded implementation plans and persistent dev docs when users ask for an implementation plan, technical plan, feature plan, refactor plan, or dev-docs workstream.
Senior CTO review workflow for repository-grounded implementation-plan workstreams used before coding.
Apply project EF Core conventions for repositories, DbContext setup, query filters, migrations, and seeded lookup data.
Create a self-contained HTML artifact focused on a high-quality SVG architecture or system diagram with minimal supporting prose.
Create a pragmatic self-contained HTML plan that organizes the user's plan content visually without expanding the scope unnecessarily.
| name | cqrs-mediatr-guidelines |
| description | Apply project CQRS conventions for commands, queries, handlers, validators, caching, and specification-driven reads. |
| type | pattern |
| enforcement | suggest |
| priority | high |
Use this skill when shaping Application-layer requests, handlers, validators, and response contracts. It keeps MediatR flows predictable and consistent with repository, caching, and DTO-mapping rules.
**/*Command.cs, **/*Query.cs, **/*Handler.cs, **/*Validator.cs, Explore.Application/**/*.cs.add-cqrs-handler, add-get-endpoint, add-write-endpoint, update-repository-query.BaseCommandResponse<Guid> for create or update work or bool for many deletes, while queries return DTOs or PaginatedResult<TDto>.IValidator<T> through DI.CancellationToken end to end and use HybridCache with GetOrCreateAsync for queries and RemoveAsync for command invalidation.IQuerySpecification<T> and immutable fluent composition via And(...) live in Application, while repositories apply the specification to IQueryable<T>.IValidator<T> through DI breaks the project validation standard and weakens handler-local control.ExploreDbContext directly in handlers bypasses repository abstractions and couples Application to EF Core.IQueryable from repositories leaks EF concerns into Application and lets handlers compose persistence logic ad hoc.public sealed record GetEventByIdQuery(Guid Id);
public sealed class GetEventByIdHandler(IEventRepository repository, HybridCache cache)
{
public async Task<EventDto?> Handle(GetEventByIdQuery request, CancellationToken cancellationToken)
{
var validator = new GetEventByIdQueryValidator();
await validator.ValidateAndThrowAsync(request, cancellationToken);
return await cache.GetOrCreateAsync(
$"events:{request.Id}",
async token =>
{
Event? entity = await repository.GetByIdAsync(request.Id, token);
return entity is null ? null : new EventDto(entity.Id, entity.Title);
},
cancellationToken: cancellationToken);
}
}
IQuerySpecification<Event> spec = EventQuerySpecification.Create()
.WithPublishedOnly()
.And(EventQuerySpecification.Create().WithTenant(tenantId))
.And(EventQuerySpecification.Create().WithSearch(searchTerm));
dotnet test --project Event.Architecture.Tests/Event.Architecture.Tests.csproj --configuration Release --verbosity quiet --filter FullyQualifiedName~Event.Architecture.Tests.CqrsPatternTestsdotnet test --project Event.Application.UnitTests/Event.Application.UnitTests.csproj --configuration Release --verbosity quietdotnet build --configuration Release --verbosity quiet