skills/dotnet/patterns/transaction-policy/SKILL.md
Define explicit transaction policies for different operation types and consistency requirements in .NET applications. Use when: - Different operations require different transaction isolation levels - Implementing explicit transaction policies per operation type - Handling complex consistency requirements - Building systems with varying transaction needs - Enforcing transaction boundaries via decorators or middleware Triggers: "transaction policy", "isolation level", "transaction strategy", "consistency requirement", "transaction configuration"
npx skillsauth add yeeehaooo/WorkSpace transaction-policyInstall 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.
Define explicit transaction policies for different operation types and consistency requirements.
Applies to:
// Application Layer
public interface ITransactionPolicy
{
IsolationLevel IsolationLevel { get; }
TimeSpan? Timeout { get; }
bool ReadOnly { get; }
}
public class ReadCommittedPolicy : ITransactionPolicy
{
public IsolationLevel IsolationLevel => IsolationLevel.ReadCommitted;
public TimeSpan? Timeout => TimeSpan.FromSeconds(30);
public bool ReadOnly => false;
}
public class SerializablePolicy : ITransactionPolicy
{
public IsolationLevel IsolationLevel => IsolationLevel.Serializable;
public TimeSpan? Timeout => TimeSpan.FromSeconds(60);
public bool ReadOnly => false;
}
// Usage in Handler
public class TransferFundsHandler : ICommandHandler<TransferFundsCommand>
{
private readonly IUnitOfWork _uow;
private readonly ITransactionPolicy _policy;
public async Task<Result> Handle(TransferFundsCommand cmd, CancellationToken ct)
{
await _uow.BeginAsync(_policy, ct);
try
{
// Transfer logic...
await _uow.CommitAsync(ct);
return Result.Success();
}
catch
{
await _uow.RollbackAsync(ct);
throw;
}
}
}
development
Create reusable .NET atomic capability code snippets that can be directly copied and pasted. Use when: - Creating single-purpose code snippets - Building reusable code templates - Implementing atomic technical capabilities - Creating copy-pasteable code blocks - Building snippet library for common patterns Triggers: "create snippet", "code snippet", "reusable snippet", "atomic snippet", "copy-paste code"
development
Create Docker Compose configuration for containerized .NET application development and deployment. Use when: - Containerizing .NET applications - Setting up local development environment with dependencies - Creating multi-container setups (API + DB + Redis) - Defining service dependencies and networking - Building docker-compose.yml for development or production Triggers: "docker compose", "containerize", "multi-container", "docker-compose.yml", "docker setup"
tools
Create adapter structure for integrating third-party APIs in Clean Architecture applications. Use when: - Integrating external APIs or services - Creating HTTP client adapters for third-party services - Implementing API integration with error handling - Setting up adapter pattern for external dependencies - Building resilient external service integrations Triggers: "api adapter", "third-party api", "external service", "http client adapter", "api integration"
development
Enterprise backend structure built on Clean Architecture, DDD, CQRS, and Vertical Slice API Design with Dapper-first persistence. Use when: - Creating new enterprise backend projects - Implementing Clean Architecture with DDD and CQRS - Building vertical slice API endpoints - Using Dapper as primary persistence mechanism - Organizing modules by UseCase-driven and Model-driven separation Triggers: "dmis structure", "clean architecture", "enterprise backend", "DDD CQRS", "vertical slice", "dapper"