This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- NO DUPLICATION - EVER!!!! REMOVING DUPLICATION is the absolute HIGHEST PRIORITY!!!
- YOU ARE NOT ALLOWED TO SKIP TESTS
- No throwing exceptions, except for in tests
- FP style code. Pure functions with immutable types.
- Keep functions under 20 LOC
- Keep files under 300 LOC
- NEVER copy files. Only MOVE files
- Don't use Git unless I explicitly ask you to
- Promote code analysis warnings to errors
- EXHAUSTION001 is a critical error and must be turned on everywhere
- Nullable reference types are enabled and MUST be obeyed
- Do not back files up
- Aggressively pursue these aims, even when it means taking more time on a task
dotnet builddotnet testdotnet build --configuration Releasedotnet test --filter FullyQualifiedName~TestClassName.TestMethodNameRestClient.Net is a functional HTTP client library using Result types for error handling. Key components:
-
HttpClientFactoryExtensions.cs - Primary API. Extension methods on
IHttpClientFactorythat return delegates (e.g.,GetAsync<TSuccess, TError, TParam>). Methods useCreateClient()with no parameters to leverage default HTTP client configuration. -
HttpClientExtensions.cs - Direct extensions on
HttpClientfor when you already have an instance. -
Delegates.cs - Core types:
BuildRequest<TParam>- Transforms parameters intoHttpRequestParts(URL + body + headers)Deserialize<T>- Deserializes HTTP responsesGetAsync/PostAsync/PutAsync/DeleteAsync/PatchAsync- Delegates returned byCreate*methods
-
Result Pattern - From the Results F# project. Returns
Result<TSuccess, HttpError<TError>>with exhaustive pattern matching. -
ProgressReportingHttpContent - Custom
HttpContentsupporting upload/download progress callbacks.
- Compare the current branch to main branch. Base title and comments solely on diff. IGNORE commit messages
- Use the template at .github/pull_request_template.md
- Keep the documentation tight.
RestClient.Net.OpenApiGenerator - Generates C# extension methods from OpenAPI 3.x specs:
- ExtensionMethodGenerator.cs - Creates extension methods using the
Create*delegate pattern - ModelGenerator.cs - Generates DTOs from schema components
- Produces type aliases for convenient Result pattern matching (e.g.,
OkUser,ErrorUser) - All generated code uses
factory.CreateClient()with no client name
- Functional composition -
Create*methods return delegates that can be composed/reused - HttpRequestParts bundling - Single struct containing URL, body, and headers instead of separate parameters
- IHttpClientFactory integration - Proper lifecycle management without socket exhaustion
- Zero exceptions - All errors return as Result types