backend-slice

Adds CQRS vertical slices with handlers, validators, and endpoints to .NET API modules.

Updated May 7, 2026
One-click install
npx skills add https://github.com/Pieter-1337/Euricom-tsz --skill backend-slice-pieter-1337
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-slice
Source: https://github.com/Pieter-1337/Euricom-tsz/tree/main/.claude/skills/tsz-backend-slice
Command: npx skills add https://github.com/Pieter-1337/Euricom-tsz --skill backend-slice-pieter-1337

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding a new operation to a modular .NET backend requires coordinating many moving parts: command/query records, FluentValidation validators, handlers, DTOs, endpoint registration, and EF migrations. This Skill encodes the exact conventions of the Tsz.Api codebase so each new slice follows the established CQRS and vertical-slice architecture without guesswork. ## Core Features & Use Cases - Vertical Slice Generation: Creates one file per operation under Modules/<Feature>/Features/ containing the command/query record, validator, and handler implementing ICommandHandler or IQueryHandler. - Cross-Module Query Support: Places shared queries in Contracts/Queries with auto-discovered handlers in the CrossModule folder so other modules can dispatch them. - Endpoint Registration & Migrations: Registers minimal API endpoints using IDispatcher for commands and direct handler injection for queries, and generates EF Core migrations when the entity schema changes. - Use Case: You need a full CRUD bundle for a Users module. The Skill scaffolds Create, GetById, Update, and Delete slices with FluentValidation rules, endpoint mappings, and a migration, then verifies with bun run check. ## Quick Start Add a CreateUser command with validation, handler, and POST endpoint to the Users module in packages/api/Tsz.Api.

Frequently Asked Questions about backend-slice

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new API endpoint to a modular .NET backend?

Create a vertical slice file under Modules/<Feature>/Features/ containing the command or query record, its handler, and a validator for writes. Then register the endpoint in the module's Endpoints file, injecting IQueryHandler directly for reads or IDispatcher for commands.

How do I implement CQRS with FluentValidation in ASP.NET Core?

Define records implementing ICommand<TResponse> or IQuery<TResponse>, write handlers implementing ICommandHandler or IQueryHandler, and add AbstractValidator classes for writes. Validators auto-register via AddValidatorsFromAssembly and run automatically in the dispatcher pipeline.

How do I share queries between modules in a modular monolith?

Place the query record in the module's Contracts/Queries folder and its handler in the impl's CrossModule folder, where it is auto-discovered. Other modules then inject the module access interface and call ExecuteQueryAsync with the shared query.

When do I need an EF Core migration for a new endpoint?

A migration is only needed when the slice changes the entity schema, such as adding a field, index, or constraint. Pure read slices or commands over an unchanged schema do not require running dotnet ef migrations add.

Why use IDispatcher for commands but inject query handlers directly?

Commands flow through IDispatcher so the pipeline runs FluentValidation validators and maps errors to ValidationException automatically. Queries have no validation pipeline, so endpoints inject IQueryHandler directly and call HandleAsync.