httpclient-factory

Configure .NET HTTP clients with IHttpClientFactory and standard resilience handlers.

1|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/Maj3D10/Training-Platform --skill httpclient-factory-maj3d10
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: httpclient-factory
Source: https://github.com/Maj3D10/Training-Platform/tree/main/.agent/skills/httpclient-factory
Command: npx skills add https://github.com/Maj3D10/Training-Platform --skill httpclient-factory-maj3d10

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents production outages and flaky integrations caused by incorrect HttpClient usage, missing resilience policies, and unsafe configuration patterns.

Core Features & Use Cases

  • Centralized HTTP client setup with IHttpClientFactory: Avoids per-request HttpClient creation and ensures proper handler lifetime management.
  • Resilience-by-default for external calls: Adds retry, timeouts, circuit breaker, and rate limiting via AddStandardResilienceHandler.
  • Production-ready client pipelines: Uses DelegatingHandlers for auth tokens and correlation IDs, plus optional SocketsHttpHandler tuning for pooling.

Real-world example: Your service calls a third-party payments API and sometimes experiences transient failures; you use the factory, add resilience defaults, inject tokens via a DelegatingHandler, and keep DNS and connection lifetimes healthy under load.

Quick Start

Load the httpclient-factory skill and ask it to generate a .NET 10 IHttpClientFactory setup that uses keyed clients with standard resilience, plus an auth DelegatingHandler and a correlation ID handler for outgoing requests.

Frequently Asked Questions about httpclient-factory

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

FAQPage Schema
Why does creating a new HttpClient per request cause socket exhaustion in .NET?▼

Creating a new HttpClient per request causes socket exhaustion because underlying sockets are not immediately released. Using IHttpClientFactory manages handler lifetimes and pools connections to prevent this .NET production issue.

How do I configure retry and circuit breaker policies for external API calls in .NET?▼

You configure retry and circuit breaker policies for external API calls in .NET by applying AddStandardResilienceHandler to your IHttpClientFactory setup, ensuring transient failures are handled automatically.

What is the best way to inject auth tokens and correlation IDs into outgoing HTTP requests?▼

The best way to inject auth tokens and correlation IDs is by using a DelegatingHandler pipeline within your IHttpClientFactory configuration, cleanly intercepting and modifying outgoing HTTP requests.

Can I use keyed HTTP clients with standard resilience in .NET 10?▼

Yes, you can use keyed HTTP clients with standard resilience in .NET 10. The IHttpClientFactory pattern supports keyed and named clients alongside AddStandardResilienceHandler for safe, testable integrations.

When do I need SocketsHttpHandler tuning to keep DNS and connection lifetimes healthy under load?▼

You need SocketsHttpHandler tuning under heavy load to actively manage DNS and connection lifetimes, complementing IHttpClientFactory to avoid socket exhaustion and maintain reliable external API integrations.