CSharpEssentials

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

npx skills add senrecep/CSharpEssentials
dotnet add package CSharpEssentials
19 Packages
4 Target Frameworks
50+ AI Agent Skills
AOT Safe Enums

Built for production .NET

Every abstraction earns its place. No ceremony, no boilerplate — just composable, null-safe, type-driven primitives.

Railway-Oriented Error Handling

Chain operations with Result<T> and Error — no exceptions leaking 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() — readable, testable, reusable.

Null Safety by Design

Full nullable annotations with TreatWarningsAsErrors — null reference bugs caught 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 independently versioned and published. Or grab the meta-package for everything.

19 focused packages

Targeting .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 — no exceptions as control flow.

Error · ErrorCode
Maybe Core

Explicit optionals with Maybe<T> — make the absence of a value visible 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, allocation-free enum-to-string conversion.

[StringEnum] · AOT-safe
Rules Core

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

IRule<T> · RuleSet
Mediator Core

Lightweight CQRS mediator with pipeline behaviors, logging via ILoggableRequest.

IMessage · IMediator
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 cursor/offset pagination.

Interceptors · Pagination
AspNetCore Web

GlobalExceptionHandler, Result-aware action filters, and problem details mapping.

GlobalExceptionHandler · Filters
Http Web

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

HttpResult · TypedClient
Json Infra

Pre-configured System.Text.Json options with Result/Maybe converters included.

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 · SystemClock
Clone Core

Strongly-typed deep copy via ICloneable<T> — explicit, type-safe, no object returns.

ICloneable<T>
Validation Core

Model-first validation returning Result<T> natively. Zero reflection — no expression trees, no deferred builds.

Validator<T> · RuleChain
Meta Meta

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

Results · Errors · Maybe · Any · Rules · Mediator

AI skills for every agent

19 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 — without hallucination.