Add retry, circuit breaker, timeout, hedging, and rate-limiting to HttpClient-based .NET code using Microsoft.Extensions.Http.Resilience (built on Polly v8). Covers AddStandardResilienceHandler, AddResilienceHandler, AddStandardHedgingHandler, ResiliencePipelineBuilder for static clients, Refit integration, and the ResilienceHandler wrapper. Trigger whenever the user writes, reviews, or asks about HTTP resilience, retries, circuit breakers, timeouts, transient fault handling, AddStandardResilienceHandler, AddResilienceHandler, AddStandardHedgingHandler, Polly, IHttpClientFactory resilience, or HttpClient reliability in .NET — even if they don't mention Microsoft.Extensions.Http.Resilience by name. Always prefer this skill over guessing; the handler-stacking rules, retry safety for non-idempotent methods, TimeoutRejectedException vs TimeoutException distinction, and static-client wiring all have non-obvious failure modes. Also trigger when the deprecated Microsoft.Extensions.Http.Polly package is used — it sho
설치
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
Add retry, circuit breaker, timeout, hedging, and rate-limiting to HttpClient-based .NET code using Microsoft.Extensions.Http.Resilience (built on Polly v8). Covers AddStandardResilienceHandler, AddResilienceHandler, AddStandardHedgingHandler, ResiliencePipelineBuilder for static clients, Refit integration, and the ResilienceHandler wrapper. Trigger whenever the user writes, reviews, or asks about HTTP resilience, retries, circuit breakers, timeouts, transient fault handling, AddStandardResilienceHandler, AddResilienceHandler, AddStandardHedgingHandler, Polly, IHttpClientFactory resilience, or HttpClient reliability in .NET — even if they don't mention Microsoft.Extensions.Http.Resilience by name. Always prefer this skill over guessing; the handler-stacking rules, retry safety for non-idempotent methods, TimeoutRejectedException vs TimeoutException distinction, and static-client wiring all have non-obvious failure modes. Also trigger when the deprecated Microsoft.Extensions.Http.Polly package is used — it should be replaced with this package.
Microsoft.Extensions.Http.Resilience Skill
Microsoft.Extensions.Http.Resilience is the official .NET integration layer between IHttpClientFactory and Polly v8 resilience pipelines. It replaces the deprecated Microsoft.Extensions.Http.Polly package and provides first-class DI support for retry, circuit breaker, timeout, rate limiting, and hedging.
When you construct HttpClient directly (e.g., Refit with scoped DI, or a singleton not owned by DI), build the pipeline and wrap the handler chain manually. See static-clients.md.
Critical rules
Never stack resilience handlers. Only add one resilience handler per client. If you need multiple strategies combine them inside a single AddResilienceHandler call.
Retry is unsafe for non-idempotent methods. Always call options.Retry.DisableForUnsafeHttpMethods() (or DisableFor(HttpMethod.Post, ...)) when POST/PUT/DELETE mutate state.
Timeout exception type. Polly throws TimeoutRejectedException, not TimeoutException. When writing ShouldHandle predicates in a retry that sits outside a timeout, handle TimeoutRejectedException.
Circuit breaker per authority. When using a circuit breaker on named clients shared across multiple host names, call .SelectPipelineByAuthority() so each host gets its own breaker state.
Microsoft.Extensions.Http.Polly is deprecated. Replace any AddPolicyHandler / AddTransientHttpErrorPolicy calls with the APIs in this skill.