/arbiter-skills:arbiter-commandqueryfrom 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.
Ships in arbiter-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole 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.
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>();
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub loresoft/arbiter --plugin arbiter-skills14 skills in this plugin
/arbiter-commandquery-efUse when wiring Arbiter.CommandQuery with Entity Framework Core — registering AddEntityQueries / AddEntityCommands / AddQueryPipeline for an entity, defining DbContext-backed handlers, or implementing audited / soft-delete / tenant entities for EF Core./arbiter-commandquery-mongoUse when wiring Arbiter.CommandQuery with MongoDB — AddMongoRepository plus AddEntityQueries / AddEntityCommands for an IMongoEntityRepository<TEntity>. Trigger on IMongoRepository, IMongoEntityRepository, MongoDB document handlers./arbiter-communicationUse when sending templated email or SMS via Arbiter.Communication — AddEmailServices / AddSmsServices, IEmailDeliveryService / ISmsDeliveryService, template resolvers, or wiring a delivery provider like Azure Communication Services, Microsoft Graph, SendGrid, Twilio, or SMTP./arbiter-dispatcherUse when wiring the Blazor IDispatcher abstraction from Arbiter.Dispatcher — MessagePackDispatcher / JsonDispatcher for WebAssembly, ServerDispatcher for Server Interactive, AddDispatcherService + MapDispatcherService on the host, or component state helpers ModelStateManager / ModelStateLoader / ModelStateEditor. Trigger on Blazor Auto render mode setup./arbiter-endpointsUse when exposing Arbiter commands and queries as REST via Minimal APIs — AddEndpointRoutes, MapEndpointRoutes, EntityCommandEndpointBase, EntityQueryEndpointBase, IEndpointRoute. Trigger on Minimal API endpoint registration for CRUD entities./arbiter-mappingUse when defining or registering Arbiter.Mapping source-generated mappers — [GenerateMapper] attribute, partial class deriving from MapperProfile<TSource, TDestination>, ConfigureMapping with MappingBuilder, IMapper / IMapper<TSrc,TDst>, ProjectTo for IQueryable, ServiceProviderMapper registration.Other plugins' skills for the same job