brighter
/brighter
Use when implementing CQRS command dispatching, request pipelines, and asynchronous task queues with Paramore Brighter in .NET. USE FOR: command dispatching, CQRS command side, request handler pipelines, async task queues, policy-based retry and circuit breaker on handlers DO NOT USE FOR: simple in-process mediator without policies (use mediatr), full service bus with transport abstraction (use masstransit or nservicebus), event sourcing storage (use akka-net persistence)
- Author
- Tyler-R-Kendrick ↗
- Repository
- agent-skills ↗
- Licence
- MIT
- Last repository change
- 09.06.2026
Assessment and security
- Files in this package
- 19
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 3
No signals detected. Repository changed on 09.06.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when implementing CQRS command dispatching, request pipelines, and asynchronous task queues with Paramore Brighter in .NET. USE FOR: command dispatching, CQRS command side, request handler pipelines, async task queues, policy-based retry and circuit breaker on handlers DO NOT USE FOR: simple in-process mediator without policies (use mediatr), full service bus with transport abstraction (use masstransit or nservicebus), event sourcing storage (use akka-net persistence)
Original author description
Use when implementing CQRS command dispatching, request pipelines, and asynchronous task queues with Paramore Brighter in .NET. USE FOR: command dispatching, CQRS command side, request handler pipelines, async task queues, policy-based retry and circuit breaker on handlers DO NOT USE FOR: simple in-process mediator without policies (use mediatr), full service bus with transport abstraction (use masstransit or nservicebus), event sourcing storage (use akka-net persistence)
How it works
- Overview
- NuGet Packages
- Commands and Events
- Request Handlers
- Registration and Configuration
- Query Side with Darker
- Async Messaging with RabbitMQ
- Brighter vs MediatR vs MassTransit
- Best Practices
SKILL.md preview
---
name: brighter
description: |
Use when implementing CQRS command dispatching, request pipelines, and asynchronous task queues with Paramore Brighter in .NET.
USE FOR: command dispatching, CQRS command side, request handler pipelines, async task queues, policy-based retry and circuit breaker on handlers
DO NOT USE FOR: simple in-process mediator without policies (use mediatr), full service bus with transport abstraction (use masstransit or nservicebus), event sourcing storage (use akka-net persistence)
license: MIT
metadata:
displayName: "Brighter"
author: "Tyler-R-Kendrick"
version: "1.0.0"
compatibility: claude, copilot, cursor
references:
- title: "Brighter Official Website"
url: "https://www.goparamore.io/"
- title: "Brighter GitHub Repository"
url: "https://github.com/BrighterCommand/Brighter"
- title: "Paramore.Brighter NuGet Package"
url: "https://www.nuget.org/packages/Paramore.Brighter"
---
# Brighter (Paramore.Brighter)
## Overview
Paramore Brighter is a command dispatcher and processor library for .NET implementing the Command pattern with a pipeline of handlers. It supports synchronous dispatch, asynchronous task queues (via Paramore Darker for queries), attribute-based policies (retry, circuit breaker, timeout), and integration with external message brokers for decoupled messaging. Brighter separates command dispatch from handling and enables cross-cutting concerns through a decorator pipeline.
## NuGet Packages
- `Paramore.Brighter` -- core command processor and handler infrastructure
- `Paramore.Brighter.Extensions.DependencyInjection` -- Microsoft DI integration
- `Paramore.Brighter.Extensions.Hosting` -- hosted service for message pump
- `Paramore.Brighter.MessagingGateway.RMQ` -- RabbitMQ transport
- `Paramore.Brighter.MessagingGateway.AzureServiceBus` -- Azure Service Bus transport
- `Paramore.Darker` -- query processor (read side of CQRS)
- `Paramore.Darker.AspNetCore` -- ASP.NET Core integration for queries
## Commands and Events
```csharp
using Paramore.Brighter;
// Command: intent to perform an action (one handler)
public class CreateOrder : Command
{
public string CustomerId { get; init; }
public decimal Total { get; init; }
public CreateOrder(string customerId, decimal total)
: base(Guid.NewGuid())
{
CustomerId = customerId;
Total = total;
}
}
// Event: notification of something that happened (multiple handlers)
public class OrderCreated : Event
{
public Guid OrderId { get; init; }
public string CustomerId { get; init; }
public OrderCreated(Guid orderId, string customerId)
: base(Guid.NewGuid())
{
OrderId = orderId;
CustomerId = customerId;
}
}
```
## Request Handlers
```csharp
using Paramore.Brighter;
using Paramore.Brighter.Policies.Attributes;
public class CreateOrderHandler : RequestHandlerAsync<CreateOrder>
{
private readonly IOrderRepository _repository;
private readonly IAmACommandProcessor _processor;
public CreateOrderHandler(IOrderRepository repository, IAmACommandProcessor processor)
{
_repository = repository;
_processor = processor;
}
[RequestLogging(step: 1, timing: HandlerTiming.Before)]
[UsePolicy(CommandProcessor.RETRYPOLICYASYNC, step: 2)]
public override async Task<CreateOrder> HandleAsync(
CreateOrder command,
CancellationToken ct = default)
{
var order = new Order(command.CustomerId, command.Total);
await _repository.AddAsync(order, ct);
await _processor.PostAsync(
new OrderCreated(order.Id, order.CustomerId), cancellationToken: ct);
return await base.HandleAsync(command, ct);
}
}
// Event handler (subscriber)
public class OrderCreatedNotificationHandler : RequestHandlerAsync<OrderCreated>
{
private readonly INotificationService _notifications;
public OrderCreatedNotificationHandler(INotificationService notifications)
=> _notifications = notifications;
public override async Task<OrderCreated> HandleAsync(
OrderCreated @event,
CancellationToken ct = default)
{
await _notifications.SendAsync(
@event.CustomerId, $"Order {@event.OrderId} confirmed.", ct);
return await base.HandleAsync(@event, ct);
}
}
```
## Registration and Configuration
```csharp
using Paramore.Brighter.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddBrighter(options =>
{
options.PolicyRegistry = GetPolicies();
})
.AutoFromAssemblies();
builder.Services.AddScoped<IOrderRepository, OrderRepository>();
var app = builder.Build();
app.MapPost("/orders", async (CreateOrder cmd, IAmACommandProcessor processor) =>
{
await processor.SendAsync(cmd);
return Results.Accepted();
});
app.Run();
static PolicyRegistry GetPolicies()
{
var registry = new PolicyRegistry
{
{
CommandProcessor.RETRYPOLICYASYNC,
Policy.Handle<Exception>()
.WaitAndRetryAsync(3, retry => TimeSpan.FromMilliseconds(100 * Math.Pow(2, retry)))
},
{
CommandProcessor.CIRCUITBREAKERASYNC,
Policy.Handle<Exception>()
.CircuitBreakerAsync(5, TimeSpan.FromSeconds(30))
}
};
return registry;
}
```
## Query Side with Darker
```csharp
using Paramore.Darker;
// Query and result
public class GetOrderById : IQuery<OrderResult>
{
public Guid OrderId { get; init; }
}
public class OrderResult
{
public Guid Id { get; init; }
public string CustomerId { get; init; } = default!;
public decimal Total { get; init; }
public string Status { get; init; } = default!;
}
// Query handler
public class GetOrderByIdHandler : QueryHandlerAsync<GetOrderById, OrderResult>
{
private readonly IOrderRepository _repository;
public GetOrderByIdHandler(IOrderRepository repository)
=> _repository = repository;
public override async Task<OrderResult> ExecuteAsync(
GetOrderById query,
CancellationToken ct = default)
{
var order = await _repository.GetByIdAsync(query.OrderId, ct);
return new OrderResult
{
Id = order.Id,
CustomerId = order.CustomerId,
Total = order.Total,
Status = order.Status
};
}
}
// Registration
builder.Services.AddDarker()
.AddHandlersFromAssemblies(typeof(GetOrderByIdHandler).Assembly);
```
## Async Messaging with RabbitMQ
```csharp
using Paramore.Brighter.MessagingGateway.RMQ;
builder.Services.AddBrighter(options =>
{
options.PolicyRegistry = GetPolicies();
})
.UseExternalBus(new RmqProducerRegistryFactory(
new RmqMessagingGatewayConnection
{
AmpqUri = new AmqpUriSpecification(new Uri("amqp://guest:guest@localhost:5672")),
Exchange = new Exchange("orders.exchange")
},
new[]
{
new RmqPublication
{
Topic = new RoutingKey("order.created"),
RequestType = typeof(OrderCreated),
WaitForConfirmsTimeOutInMilliseconds = 1000
}
}).Create())
.AutoFromAssemblies();
```
## Brighter vs MediatR vs MassTransit
| Feature | Brighter | MediatR | MassTransit |
|---------|----------|---------|-------------|
| Command dispatch | Yes (Send) | Yes (Send) | Yes (via consumers) |
| Event publish | Yes (Post/Publish) | Yes (Publish) | Yes (Publish) |
| Policy pipeline | Attribute-based (retry, CB) | Pipeline behaviors | Middleware filters |
| External messaging | RabbitMQ, Azure SB, Kafka | None (in-process) | RabbitMQ, Azure SB, SQS |
| Query support | Via Darker | Yes (IRequest<T>) | No built-in query |
| Outbox pattern | Built-in | Not built-in | Built-in |
## Best Practices
- Use `Command` for operations handled by exactly one handler and `Event` for notifications that may have zero or more subscribers.
- Apply `[UsePolicy]` attributes to handlers for retry and circuit-breaker logic rather than wrapping handler code in try/catch with manual retry loops.
- Call `SendAsync` for commands (single handler expected) and `PublishAsync` for events (fan-out to multiple handlers).
- Register handlers using `AutoFromAssemblies()` for automatic discovery rather than manually wiring each handler to its command type.
- Keep handlers single-purpose; extract shared logic into services injected via the constructor instead of duplicating code across handlers.
- Use the Outbox pattern (`DepositPostAsync` + `ClearOutboxAsync`) when publishing events after a database write to ensure at-least-once delivery without dual-write issues.
- Pair Brighter (command side) with Darker (query side) in CQRS architectures to maintain a clean separation of reads and writes.
- Define policy registries centrally (retry, circuit breaker, timeout) and reference them by name in handler attributes for consistency across the application.
- Use `PostAsync` (internal dispatch) for in-process event fans and `PublishAsync` (external) when events must cross service boundaries via a message broker.
- Test handlers in isolation by mocking `IAmACommandProcessor` and repository dependencies, verifying that commands produce the expected downstream events.
Files in this package (19)
- AGENTS.md 8 KB
- README.md 1 KB
- SKILL.md 9 KB
- metadata.json 1 KB
- rules/_sections.md 2 KB
- rules/_template.md 1 KB
- rules/brighter-apply-usepolicy-attributes-to-handlers-for-retry-and.md 1 KB
- rules/brighter-call-sendasync-for-commands-single-handler-expected-and.md 1 KB
- rules/brighter-define-policy-registries-centrally-retry-circuit-breaker.md 1 KB
- rules/brighter-implement-retry-policies.md 1 KB
- rules/brighter-keep-handlers-single-purpose-extract-shared-logic-into.md 1 KB
- rules/brighter-pair-brighter-command-side-with-darker-query-side-in.md 1 KB
- rules/brighter-register-handlers-using-autofromassemblies-for.md 1 KB
- rules/brighter-test-handlers-in-isolation-by-mocking.md 1 KB
- rules/brighter-use-attributes-for-cross-cutting-concerns.md 1 KB
- rules/brighter-use-command-for-operations-handled-by-exactly-one-handler.md 1 KB
- rules/brighter-use-postasync-internal-dispatch-for-in-process-event.md 1 KB
- rules/brighter-use-task-queues-for-async-processing.md 1 KB
- rules/brighter-use-the-outbox-pattern-depositpostasync.md 1 KB
Versions
The database has no other skills named brighter.
Database snapshot: 13.11.2026 · package version 49eb62842d25 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100mediatr
Use when implementing in-process mediator, CQRS, and pipeline behavior patterns with MediatR in .NET applications. USE FOR: in-process command/query dispatch, CQRS with pipeline behaviors, notification fan-out, cross-cutting concern pipelines (validation, logging, caching),… - 100akka-net
Use when building concurrent, distributed, or fault-tolerant .NET applications with the actor model using Akka.NET. USE FOR: actor-based concurrency, distributed systems, supervision hierarchies, event sourcing with actors, cluster sharding, CQRS with persistent actors DO NOT… - 100cqrs-mediatr-setup
Set up CQRS with MediatR (or a thin custom dispatcher) in an ASP.NET Core project — commands, queries, handlers, and pipeline behaviors for validation, logging, and transactions. Use this skill whenever the user wants CQRS, MediatR, command/query handlers, a request pipeline,… - 95dotnet-patterns
Use this skill when implementing .NET patterns — MediatR pipelines, CQRS, Result pattern, EF Core patterns, pipeline behaviors, and event sourcing. This skill enforces: MediatR for CQRS, FluentValidation for validation, Result type for error handling, EF Core conventions.… - 100messenger-async
Use when implementing async processing, CQRS, or event-driven flows in Symfony with the Messenger component — message/handler pairs, transports, routing, retries, failure queues, and the outbox pattern. Use when the task mentions Messenger, message bus, async, queue,… - 100cqrs
CQRS - Command Query Responsibility Segregation. Use when implementing DDD patterns, separating read/write models, event sourcing, or building scalable architectures with heterogeneous performance requirements.