pipeline-behaviors

Generate MediatR pipeline behaviors for .NET 8+ cross-cutting concerns.

Updated Jan 30, 2026
One-click install
npx skills add https://github.com/spallempati/AI-Studio --skill pipeline-behaviors-spallempati
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pipeline-behaviors
Source: https://github.com/spallempati/AI-Studio/tree/main/skills/dotnet-architecture/pipeline-behaviors
Command: npx skills add https://github.com/spallempati/AI-Studio --skill pipeline-behaviors-spallempati

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the implementation of common cross-cutting concerns in .NET applications by providing pre-built MediatR Pipeline Behaviors, reducing boilerplate code and ensuring consistent application of features like logging, validation, and error handling.

Core Features & Use Cases

  • Modular Concerns: Implement validation, logging, exception handling, transaction management, caching, and performance monitoring as distinct pipeline behaviors.
  • Decorator Pattern: Applies behaviors using the decorator pattern around your command and query handlers.
  • Use Case: Automatically log every incoming request, validate its parameters, handle any exceptions gracefully by returning a Result.Failure, and wrap database operations in a transaction, all without modifying individual handlers.

Quick Start

Register the LoggingBehavior, ValidationBehavior, and ExceptionHandlingBehavior in your application's dependency injection setup.

Frequently Asked Questions about pipeline-behaviors

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement cross-cutting concerns in MediatR without modifying my command and query handlers?

MediatR pipeline behaviors apply cross-cutting concerns like logging, validation, and exception handling using the decorator pattern. This wraps your handlers externally, keeping business logic clean and free of boilerplate code.

What is the best way to handle validation and logging in a .NET 8 clean architecture application?

The best way to handle validation and logging in a .NET 8 clean architecture application is using modular MediatR pipeline behaviors. They intercept requests to validate parameters via FluentValidation and log details before reaching the handler.

Can I wrap database operations in a transaction using MediatR pipeline behaviors?

Yes, you can wrap database operations in a transaction using a dedicated MediatR pipeline behavior. It manages the transaction scope around your handler execution, ensuring atomic data commits without cluttering individual handler logic.

How do I register pipeline behaviors for exception handling and performance monitoring in MediatR?

Register pipeline behaviors for exception handling and performance monitoring in your application's dependency injection setup. Add behaviors like ExceptionHandlingBehavior and LoggingBehavior to the DI container to intercept MediatR requests.

Does this pipeline behavior approach work with FluentValidation for request parameter validation?

Yes, this pipeline behavior approach integrates directly with FluentValidation. A specific ValidationBehavior intercepts incoming requests, executes FluentValidation rules, and short-circuits execution by returning a failure result if parameters are invalid.

What cross-cutting concerns can I manage with MediatR pipeline behaviors besides validation?

Besides validation, MediatR pipeline behaviors can manage logging, exception handling, transaction management, caching, and performance monitoring. Each concern operates as a distinct module following the chain of responsibility pattern.