From arbiter-skills
Provides pre-built generic CQRS commands and queries for entity CRUD with filter/sort/paging and pipeline behaviors (validation, cache, audit, tenant, soft-delete) for .NET applications.
How this skill is triggered — by the user, by Claude, or both
Slash command
/arbiter-skills:arbiter-commandqueryThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
CQRS layer on top of `Arbiter.Mediation`: pre-built generic commands/queries for entity CRUD, plus filter/sort/page modeling and opt-in behaviors.
CQRS layer on top of Arbiter.Mediation: pre-built generic commands/queries for entity CRUD, plus filter/sort/page modeling and opt-in behaviors.
dotnet add package Arbiter.CommandQuery
A data provider package supplies the handlers — pick one:
Arbiter.CommandQuery.EntityFramework → see arbiter-commandquery-efArbiter.CommandQuery.MongoDB → see arbiter-commandquery-mongousing Arbiter.CommandQuery;
services.AddCommandQuery(); // core CQRS pipeline + mediator
services.AddCommandValidation(); // optional: FluentValidation pipeline behavior
services.AddEntityHybridCache(); // optional: HybridCache-backed query caching
services.AddMessagePackOptions(); // optional: configure MessagePack for dispatcher
| Type | Purpose |
|---|---|
EntityIdentifierQuery<TKey, TReadModel> | Get one by id |
EntityIdentifiersQuery<TKey, TReadModel> | Get many by ids |
EntityPagedQuery<TReadModel> | Filter + sort + (optional) page |
EntityCreateCommand<TCreateModel, TReadModel> | Insert |
EntityUpdateCommand<TKey, TUpdateModel, TReadModel> | Update; pass upsert: true for upsert |
EntityPatchCommand<TKey, TReadModel> | JSON Patch partial update |
EntityDeleteCommand<TKey, TReadModel> | Delete |
All commands/queries take a ClaimsPrincipal as the first ctor arg.
using Arbiter.CommandQuery.Queries;
var entityQuery = new EntityQuery
{
Filter = new EntityFilter
{
Logic = FilterLogic.And,
Filters = new List<EntityFilter>
{
new() { Name = "Category", Operator = FilterOperators.Equal, Value = "Electronics" },
new() { Name = "Price", Operator = FilterOperators.GreaterThan, Value = 100m },
}
},
Sort = new List<EntitySort>
{
new() { Name = "Name", Direction = SortDirections.Ascending }
},
Page = 1,
PageSize = 20, // omit Page/PageSize to return all matches
};
var query = new EntityPagedQuery<ProductReadModel>(principal, entityQuery);
var result = await mediator.Send(query, cancellationToken); // EntityPagedResult<ProductReadModel>
// Get by id
var product = await mediator.Send(
new EntityIdentifierQuery<int, ProductReadModel>(principal, id), ct);
// Create
var created = await mediator.Send(
new EntityCreateCommand<ProductCreateModel, ProductReadModel>(principal, createModel), ct);
// Update (upsert with last bool)
var updated = await mediator.Send(
new EntityUpdateCommand<int, ProductUpdateModel, ProductReadModel>(principal, id, model, upsert: true), ct);
// Delete
var deleted = await mediator.Send(
new EntityDeleteCommand<int, ProductReadModel>(principal, id), ct);
FilterOperators: Equal, NotEqual, LessThan, LessThanOrEqual, GreaterThan, GreaterThanOrEqual, Contains, StartsWith, EndsWith, In, NotIn, IsNull, IsNotNull.
FilterLogic: And, Or.
SortDirections: Ascending, Descending.
| Behavior | Triggered by |
|---|---|
| Validation | services.AddCommandValidation() + a FluentValidation.IValidator<TRequest> |
| Hybrid cache | services.AddEntityHybridCache() + [Cacheable] on the query/read-model |
| Audit fields | Entity implements ITrackCreated / ITrackUpdated |
| Soft delete | Entity implements ITrackDeleted — paged queries auto-filter |
| Tenant isolation | Entity implements IHaveTenant<TKey> |
Add per-entity behavior registrations only if you need extra pipeline stages beyond what AddEntityQueries / AddEntityCommands already wires:
services.AddEntityQueryBehaviors<int, ProductReadModel>();
services.AddEntityCreateBehaviors<int, ProductReadModel, ProductCreateModel>();
services.AddEntityUpdateBehaviors<int, ProductReadModel, ProductUpdateModel>();
services.AddEntityPatchBehaviors<int, Product, ProductReadModel>();
services.AddEntityDeleteBehaviors<int, Product, ProductReadModel>();
npx claudepluginhub loresoft/arbiter --plugin arbiter-skillsWires Arbiter.CommandQuery with Entity Framework Core, registering add-entity-queries/commands, defining DbContext-backed handlers, and implementing audited/soft-delete/tenant entities.
Generates CQRS query handlers, validators, and response DTOs using Dapper and MediatR. Useful for implementing read-optimized .NET applications with explicit separation of commands and queries.
Quick reference for .NET 8+ ASP.NET Core Web APIs: controller-based and minimal APIs, Marten Postgres setup, Wolverine message bus. For backend .NET pattern lookups.