skills/cap/SKILL.md
Comprehensive guidance for implementing distributed transactions and event bus patterns using DotNetCore.CAP library. Use when working with CAP for microservices event-driven architecture, message publishing/subscribing, outbox pattern implementation, and integration with message queues like RabbitMQ, Kafka, Azure Service Bus, and databases like SQL Server, PostgreSQL, MongoDB.
npx skillsauth add arisng/github-copilot-fc capInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides comprehensive guidance for using the DotNetCore.CAP library to implement distributed transactions and event bus patterns in .NET microservices.
Home page: https://cap.dotnetcore.xyz/
CAP is a .NET library that provides a lightweight solution for distributed transactions and event bus integration in microservices. It uses the Outbox Pattern to ensure message reliability and consistency.
An EventBus is a mechanism that allows different components to communicate with each other without knowing each other. A component can send an Event to the EventBus without knowing who will pick it up or how many others will. Components can also listen to Events on an EventBus without knowing who sent them. This way, components can communicate without depending on each other. Also, it's very easy to substitute a component – as long as the new component understands the events being sent and received, other components will never know about the substitution.
Install the main CAP package:
dotnet add package DotNetCore.CAP
Choose your transport (message queue):
# RabbitMQ
dotnet add package DotNetCore.CAP.RabbitMQ
# Kafka
dotnet add package DotNetCore.CAP.Kafka
# Azure Service Bus
dotnet add package DotNetCore.CAP.AzureServiceBus
Choose your storage provider:
# SQL Server
dotnet add package DotNetCore.CAP.SqlServer
# PostgreSQL
dotnet add package DotNetCore.CAP.PostgreSql
# MongoDB
dotnet add package DotNetCore.CAP.MongoDB
In Program.cs:
builder.Services.AddCap(x =>
{
// Configure storage
x.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"));
// Configure transport
x.UseRabbitMQ("localhost");
// Optional: Configure dashboard
x.UseDashboard();
});
public class OrderService
{
private readonly ICapPublisher _capPublisher;
public OrderService(ICapPublisher capPublisher)
{
_capPublisher = capPublisher;
}
public async Task CreateOrder(Order order)
{
// Publish event
await _capPublisher.PublishAsync("order.created", order);
}
}
public class OrderEventHandler : ICapSubscribe
{
[CapSubscribe("order.created")]
public async Task HandleOrderCreated(Order order)
{
// Process the order created event
await ProcessOrderAsync(order);
}
}
using (var transaction = dbContext.Database.BeginTransaction(_capPublisher, autoCommit: true))
{
// Business logic
await dbContext.Orders.AddAsync(order);
await dbContext.SaveChangesAsync();
// Publish event within transaction
await _capPublisher.PublishAsync("order.created", order);
}
[CapSubscribe("order.created", Group = "order-processing-group")]
public async Task ProcessOrder(Order order)
{
// Only one instance in the group will process this message
}
await _capPublisher.PublishDelayAsync(
TimeSpan.FromMinutes(5),
"order.reminder",
orderId
);
Use the CAP dashboard to monitor message status:
/cap by defaultSee references/ for detailed documentation on:
devops
Programmatically create tldraw whiteboards and visualize them with a self-hosted tldraw instance. Create boards with shapes, text, and connectors, then deploy to a self-hosted server for collaborative editing and gallery management.
tools
Execute Google Cloud Platform operations using the gcloud CLI (and gsutil/bq where applicable). Use when the user wants to: authenticate with GCP, manage GCP resources, deploy applications, configure projects or IAM, view logs, run SQL/BigQuery, or interact with any GCP service from the command line. Triggers on phrases like "gcloud", "Google Cloud CLI", "deploy to GCP", "create a VM", "Cloud Run", "GKE cluster", "Cloud Storage bucket", "set GCP project", "service account", "Cloud Functions", "App Engine deploy", or any request to manage Google Cloud resources via command line.
testing
Grilling session that challenges your plan against the existing domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when user wants to stress-test a plan against their project's language and documented decisions.
development
Session-scoped git commit orchestrator that commits only current-session changes and leaves unrelated dirty worktree edits untouched. Inherits git-atomic-commit for atomic grouping and commit message execution, and git-commit-scope-constitution for scope governance and validation. Use when asked to commit this session only or isolate commits from mixed worktree state.