modular-slices
БесплатноБез исполняемых скриптовНе проверенDefault architecture for .NET business apps: modular monolith of vertical slices with Contracts projects, Features/<VerbPhrase>/ folders (IEndpoint +…
от codewithmukesh★ 858 звёзд на GitHubОб этом скилле
Modular Slices
A modular monolith built from vertical slices. This is the kit's default for business applications (ADR-008). Each business area is a module with its own projects, schema and public contracts; each operation inside a module is a slice in its own folder. Full code to copy lives in references/:
references/building-blocks.md:IModule,IEndpoint,IHandler, discovery, validation filter,Problems, permissions,ModuleDbContext, a full featurereferences/hosts-and-projects.md: Api, Worker, Migrator and AppHost programs, project files,Directory.Build.propsreferences/outbox.md: per-module outbox and inbox, consumers, the worker, scheduled jobsreferences/architecture-tests.md: boundary rules with proofsreferences/testing.md: fixture, test auth, the four tests every feature gets
Core Principles
- A module is two projects:
<Module>and<Module>.Contracts. Other modules may reference only the contracts, which hold interfaces, the records they return, and integration events, with no package or framework references. The compiler then enforces the boundary, and EF Core or ASP.NET Core types cannot leak into what other modules see. - A feature is a folder, and adding one touches nothing else.
Features/PlaceOrder/holdsPlaceOrderEndpoint,PlaceOrderHandler,PlaceOrderRequest,PlaceOrderRequestValidatorand, if it is specific, the response.IEndpointandIHandlerare discovered, validators are registered by assembly, so neither the module class norProgram.cschanges. - Handlers return
TypedResultsunions, not aResult<T>.Results<Created<OrderResponse>, ProblemHttpResult>is checked by the compiler and documented in OpenAPI automatically. There is no mediator and no mapping layer: the endpoint injects its handler and returns what it returns. - Everything is
internalexcept the module class and request/response records. Hosts can see only how to add the module; other modules can see only its contracts. Architecture tests fail the build if anything else becomes public. - Each module owns its data and talks asynchronously through its outbox. One database, one schema per module, one
DbContextper module used directly (no repositories). A change and the events it causes commit together; a worker delivers them to other modules' consumers, each of which handles an event once.
Patterns
Solution layout
src/
Modularity/ # shared building blocks (the only shared code with behaviour)
Modules/
Catalog/Catalog/ # implementation
Catalog/Catalog.Contracts/ # ICatalog, ProductInfo, ProductRetired
Orders/Orders/
OrdersModule.cs
OrdersPermissions.cs
Domain/Order.cs
Features/
PlaceOrder/ # PlaceOrderEndpoint, Handler, Request, RequestValidator
GetOrder/
CancelOrder/
Common/OrderResponse.cs # shared by several features of this module only
Events/MarkOrderPaid.cs # IEventConsumer<PaymentReceived>
Persistence/OrdersDbContext.cs
Services/OrdersService.cs # implements IOrders from Orders.Contracts
Orders/Orders.Contracts/
Api/ Worker/ Migrator/ AppHost/ ServiceDefaults/
tests/
Architecture.Tests/ Testing/ Orders.Tests/Features/PlaceOrder/
The module class
public sealed class OrdersModule : IModule
{
public string Name => "Orders";
public string RouteSegment => "orders";
public void AddServices(IServiceCollection services, IConfiguration configuration)
{
services.AddModuleDbContext<OrdersDbContext>();
services.AddScoped<IOrders, OrdersService>(); // for other modules
services.AddEventConsumer<PaymentReceived, MarkOrderPaid, OrdersDbContext>(); // from Billing
}
}
// Api/Program.cs: one line per module, then one call to map them all
builder.AddModule<CatalogModule>();
builder.AddModule<OrdersModule>();
app.MapModules(); // /api/v1/{segment}, tagged per module, validation filter on every endpoint
A slice: endpoint + handler
internal sealed class CancelOrderEndpoint : IEndpoint
{
public void Map(IEndpointRouteBuilder endpoints) =>
endpoints.MapPost("/{id:guid}/cancel", HandleAsync)
.RequirePermission(OrdersPermissions.Manage)
.WithSummary("Cancels an order that has not shipped");
private static Task<Results<Ok<OrderResponse>, ProblemHttpResult>> HandleAsync(
Guid id, CancelOrderRequest request, CancelOrderHandler handler, CancellationToken ct) =>
handler.HandleAsync(id, request, ct);
}
internal sealed class CancelOrderHandler(OrdersDbContext db, TimeProvider clock) : IHandler
{
public async Task<Results<Ok<OrderResponse>, ProblemHttpResult>> HandleAsync(
Guid id, CancelOrderRequest request, CancellationToken ct)
{
if (await db.Orders.FirstOrDefaultAs
Установить modular-slices в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл modular-slices?
Default architecture for .NET business apps: modular monolith of vertical slices with Contracts projects, Features/<VerbPhrase>/ folders (IEndpoint + IHandler), IModule discovery, a DbContext per module. Use for "modular monolith", "IModule", "IHandler", "contracts project", "module boundaries", or adding a feature under src/Modules/. Do NOT use for small single-area APIs, Clean Architecture or DDD codebases (use architecture-advisor).
Как установить скилл modular-slices?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл modular-slices запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
gtm-enterprise-account-planning
Strategic account planning and execution for enterprise deals. Use when planning complex sales cycles, managing multiple stakeholders, applying MEDDICC…
от GitHubgtm-partnership-architecture
Build and scale partner ecosystems that drive revenue and platform adoption. Use when building partner programs from scratch, tiering partnerships, managing…
от GitHublanding-page-conversion-audit
Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review…
от GitHubpower-platform-architect
Use this skill when the user needs to transform business requirements, use case descriptions, or meeting transcripts into a technical Power Platform solution…
от GitHub