CSharpEssentials

Modular .NET library ecosystem bridging OOP and Functional Programming: Result monads, discriminated unions, a rules engine, and more.

npx skills add senrecep/CSharpEssentials
dotnet add package CSharpEssentials
25 Packages
6 Target Frameworks
50+ Compatible AI Agents
AOT Safe Enums

Built for production .NET

Every abstraction earns its place. The primitives are composable, null-safe and type-driven, with little ceremony or boilerplate.

Railway-Oriented Error Handling

Chain operations with Result<T> and Error, so exceptions do not leak across boundaries.

Discriminated Unions

First-class Any<T1,T2,...> types bring exhaustive pattern matching to C# without the ceremony.

Composable Rules Engine

Build validation and business logic with .And() .Or() .Next(). The rules stay readable, testable and reusable.

Null Safety by Design

Full nullable annotations with TreatWarningsAsErrors, so null reference bugs surface at compile time.

DDD Foundations

EntityBase<TId>, domain events, EF Core interceptors, and pagination out of the box.

Modular by Default

Take only what you need. Each package is published on its own and all of them share one version number. Or grab the meta-package for the core functional modules.

25 focused packages

Targeting .NET 11, .NET 10, .NET 9, .NET 8, netstandard2.1, and netstandard2.0. Central package management keeps versions consistent.

Results Core

Railway-oriented error handling with Result<T>. Chain operations without throwing exceptions.

Result<T> · IResult
Errors Core

Structured Error values with codes and metadata, instead of exceptions as control flow.

Error · ErrorType
Maybe Core

Explicit optionals with Maybe<T>. The absence of a value shows up in your type signatures.

Maybe<T> · None
Any Core

Discriminated unions Any<T1,T2> for exhaustive pattern matching without class hierarchies.

Any<T1,T2> · Match()
Core Core

String, GUID, and collection utilities that should be in the BCL but aren't.

Extensions · Helpers
Enums Core

[StringEnum] source generator for AOT-safe wire names and metadata that JSON, binding, OpenAPI and EF Core share.

[StringEnum] · AOT-safe
Rules Core

Composable rule engine with .And() .Or() .Next() for readable, testable validation trees.

IRule<T> · RuleEngine
Mediator Core

CQRS pipeline behaviors for the Mediator source generator: validation, logging, exception handling, caching, locking and transactions.

ValidationBehavior · LoggingBehavior
Entity Domain

EntityBase<TId> with domain event support, the foundation for DDD aggregates.

EntityBase<TId> · IDomainEvent
EntityFrameworkCore Data

EF Core interceptors for domain events, soft delete, auditing and slow queries, plus keyset and offset pagination.

Interceptors · KeysetPaginateAsync
AspNetCore Web

GlobalExceptionHandler, ResultEndpointFilter, problem details mapping, enum binding and API versioning.

GlobalExceptionHandler · ResultEndpointFilter
AspNetCore.OpenApi Web

Enum convention schemas for Microsoft.AspNetCore.OpenApi on .NET 10. Use it or the Swashbuckle package, never both.

AddEnumConventions · net10.0
AspNetCore.Swashbuckle Web

Swagger versioning, schema ids, security schemes and enum convention schemas for Swashbuckle 10.

AddSwagger · UseVersionableSwagger
Http Web

HttpClient extensions that return Result<T> instead of throwing on non-2xx responses.

HttpRequestBuilder · HttpStatusCodeMapper
Json Infra

Pre-configured System.Text.Json options with enum conventions, polymorphic and multi-format date converters.

JsonOptions · Converters
RequestResponseLogging Infra

ASP.NET Core middleware for structured request/response body logging with configurable filtering.

Middleware · ILogger
GcpSecretManager Infra

GCP Secret Manager integration that surfaces secrets as standard IConfiguration entries.

IConfiguration · GCP
Time Infra

Testable IDateTimeProvider. Swap real time for fixed time in unit tests without static hacks.

IDateTimeProvider · FakeDateTimeProvider
Clone Core

Strongly-typed deep copy via ICloneable<T>. Copies are explicit and type-safe, and nothing returns object.

ICloneable<T>
Validation Core

Model-first validation returning Result<T> natively. It uses no reflection, expression trees or deferred builds.

Validator<T> · RuleChain
Resilience Infra

Modular resilience policies (Retry, Timeout, CircuitBreaker, Fallback) that compose through a fluent API.

ResiliencePolicy · Polly
These Core

Partial success: Left (errors), Right (value) or Both (errors and a value).

These<TError,TValue> · Match
Endpoints Web

Source-generated Minimal API endpoint discovery and grouping. No reflection, Native AOT safe.

IEndpoint · IEndpointGroup · Analyzers
DependencyInjection Infra

Attribute-based, source-generated service registration and decoration, keyed services included.

[RegisterScoped] · [Decorates] · Analyzers
Meta Meta

The meta-package. It includes all core functional modules in a single dependency for quick project setup.

Results · Errors · Maybe · Any · These · Rules · Core · Json · Http · …

AI skills for every agent

23 per-package skills for Claude Code, Cursor, Codex, and 50+ compatible AI agents. Install once and every agent in your workflow gets structured, accurate knowledge of each package's API.

Claude Code Cursor Codex GitHub Copilot Windsurf 50+ agents
Install via package name
npx skills add senrecep/CSharpEssentials
Install via GitHub Pages URL
npx skills add https://senrecep.github.io/CSharpEssentials

After install, your AI assistant knows the full API surface of each package: types, methods, patterns and idiomatic usage, so it does not have to guess.