dotnet-patterns
Use this skill when implementing .NET patterns — MediatR pipelines, CQRS, Result pattern, EF Core patterns, pipeline behaviors, and event sourcing.
Skill by j4flmao
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/j4flmao-dotnet-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/dotnet-patterns
What's inside
- Skill name
dotnet-patterns- Description
- 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. Requires .NET SDK (dotnet new). Do NOT use for: Java, Node.js, Go, or non-.NET stacks.
- License
- MIT
- Instructions
- 494 lines in SKILL.md · view on GitHub
Agent Skills spec issues
- name: "dotnet-patterns" does not match folder "patterns"
- compatibility: must be text of at most 500 characters
Files (7)
- SKILL.md
- cqrs-mediatr.md · references/
- dotnet-cqrs.md · references/
- dotnet-event-sourcing.md · references/
- dotnet-pipeline-behaviors.md · references/
- dotnet-result-pattern.md · references/
- ef-core-patterns.md · references/
SKILL.md (first lines)
# .NET Patterns
## Purpose
Implement production-grade .NET patterns — MediatR pipeline behaviors, CQRS with separate models, Result pattern for explicit error handling, EF Core performance patterns, and event sourcing.
## Agent Protocol
### Trigger
User request includes: `dotnet MediatR pattern`, `dotnet CQRS`, `dotnet Result pattern`, `dotnet EF Core`, `dotnet pipeline behavior`, `dotnet FluentValidation`, `dotnet AutoMapper`.
### Input Context
- Architecture (Clean Architecture, Vertical Slices)
- ORM (EF Core, Dapper)
- Patterns needed (CQRS, Event Sourcing, Outbox, Saga)
- Testing approach (xUnit, NUnit)
### Output Artifact
Code examples for requested patterns — pipeline behavior, CQRS handler, Result type, EF optimization.
### Response Format
Code-first output. Pattern name, problem statement, implementation. No preamble, no postamble.
### Completion Criteria
- MediatR pipeline behaviors ordered
- CQRS with separate Command/Query handlers
- Result type with implicit conversions
- EF Core query optimization applied
- Unit of Work pattern with SaveChangesAsync
### Max Response Length
4096 tokens
## Architecture Decision Trees
### Pipeline Behavior Order
| Order | Behavior | Purpose |
|-------|----------|---------|
| 1 | LoggingBehavior | Log request start/end with timing |
| 2 | ValidationBehavior | Validate before processing |
| 3 | PerformanceBehavior | Warn if > threshold (500ms) |
| 4 | UnhandledExceptionBehavior | Catch and wrap unhandled |
| 5 | TransactionBehavior | Wrap in DB transaction |
Pipeline behaviors run in registration order (first added = outer wrapper, runs first).
### FluentValidation vs Data Annotations
| Criterion | FluentValidation | Data Annotations |
|-----------|-----------------|------------------|
| Separation | External to model | On model properties |
| Conditional rules | Yes (When/Unless) | Limited |
| Cross-property | Yes (Must) | No |
| DI support | Yes (inject services) | No |
| Testability | Easy (validator per model) | Requires model instantiation |
Decision: Complex validation rules → FluentValidation. Simple non-null/range checks → Data Annotations.
## Workflow
### Step 1: MediatR Pipeline Behaviors
```csharp
// Application/Common/Behaviors/PerformanceBehavior.cs
public class PerformanceBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
where TRequest : IRequest<TResponse>
{
private readonly ILogger<PerformanceBehavior<TRequest, TResponse>> _logger;
public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken ct)
{
const int threshold = 500;
var sw = Stopwatch.StartNew();
var response = await next();
sw.Stop();
if (sw.ElapsedMilliseconds > threshold)
{
_logger.LogWarning("Long running request: {Name} ({Elapsed}ms)",
typeof(TRequest).Name, sw.ElapsedMilliseconds);
}
return response;
}
}
// Application/Common/Behaviors/TransactionBehavior.cs
public class TransactionBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
where TRequest : IRequest<TResponse>
{
private readonly AppDbContext _context;
public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken ct)
{
if (request is IQuery<TResponse>) return await next();
await using var transaction = await _context.Database.BeginTransactionAsync(ct);
try
{
var response = await next();
await transaction.CommitAsync(ct);
return response;
}
catch
{
await transaction.RollbackAsync(ct);
throw;
}
}
}
```
### Step 2: Result Pattern
```csharp
// Application/Common/Models/Result.cs
public class Result<T>
{
private readonly T? _value;From j4flmao/agent-skills, MIT.
More from j4flmao/agent-skills
- 0.610score
elysia-patterns
j4flmao
Use this skill when implementing Elysia.js patterns — Eden Treaty client, WebSocket handlers, auth/guard macros, custom plugins, performance optimization, and…
SkillBFreshness: B★ 34Claude Code +9 - 0.607score
llm-finetuning
j4flmao
Best practices for dataset preparation and PEFT/LoRA fine-tuning.
SkillBFreshness: B★ 34Claude Code +9 - 0.607score
genai-vision
j4flmao
Integrating Stable Diffusion for vision generation and Whisper for audio/multimodal tasks.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
bun
j4flmao
Use this skill when building with Bun runtime — Bun APIs, testing, package management, shell scripting, hot reload, SQLite, file I/O.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
elixir
j4flmao
Use this skill when building with Elixir — Phoenix framework, OTP, BEAM, LiveView, Ecto, supervision trees.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
deno
j4flmao
Use this skill when building with Deno — TypeScript runtime, Deno Deploy, Fresh framework, Deno std library.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
micronaut
j4flmao
Use this skill when building Micronaut applications — compile-time DI, reactive HTTP server, AOT optimization, GraalVM native image.
SkillBFreshness: B★ 34Claude Code +9 - 0.601score
kotlin-architecture
j4flmao
Use this skill when designing Kotlin backend architecture — Ktor, Spring WebFlux, http4k.
SkillBFreshness: B★ 34Claude Code +9 - 0.601score
nestjs-patterns
j4flmao
Use this skill when implementing NestJS patterns — CQRS with @nestjs/cqrs, guards/interceptors/pipes/filters, event sourcing, custom decorators…
SkillBFreshness: B★ 34Claude Code +9 - 0.601score
kotlin-backend-patterns
j4flmao
Use this skill when implementing Kotlin backend patterns — repository pattern, service layer, DTO mapping, DI setup (Koin, Kodein), testing with MockK, and…
SkillBFreshness: B★ 34Claude Code +9 - 0.601score
nestjs-architecture
j4flmao
Use this skill when structuring NestJS applications — module-based architecture, dependency injection, provider scopes, dynamic modules, and monorepo structure.
SkillBFreshness: B★ 34Claude Code +9 - 0.601score
nodejs-architecture
j4flmao
Use this skill when designing Node.js backend architecture — Express, Fastify, Hono.
SkillBFreshness: B★ 34Claude Code +9
Signals
- Stars
- 34
- Forks
- 4
- Open issues
- 0
- Last commit (this folder)
- Aug 15, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/j4flmao/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from j4flmao
- 0.610score
elysia-patterns
j4flmao
Use this skill when implementing Elysia.js patterns — Eden Treaty client, WebSocket handlers, auth/guard macros, custom plugins, performance optimization, and…
SkillBFreshness: B★ 34Claude Code +9 - 0.607score
llm-finetuning
j4flmao
Best practices for dataset preparation and PEFT/LoRA fine-tuning.
SkillBFreshness: B★ 34Claude Code +9 - 0.607score
genai-vision
j4flmao
Integrating Stable Diffusion for vision generation and Whisper for audio/multimodal tasks.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
deno
j4flmao
Use this skill when building with Deno — TypeScript runtime, Deno Deploy, Fresh framework, Deno std library.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
bun
j4flmao
Use this skill when building with Bun runtime — Bun APIs, testing, package management, shell scripting, hot reload, SQLite, file I/O.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
elixir
j4flmao
Use this skill when building with Elixir — Phoenix framework, OTP, BEAM, LiveView, Ecto, supervision trees.
SkillBFreshness: B★ 34Claude Code +9
Cite this page
dotnet-patterns skill. Agent Mart. https://agentmart.dev/skills/j4flmao-dotnet-patterns (last updated 2026-10-24)