effect-http-client

Builds typed outgoing HTTP requests with Effect's HttpClient, schema decoding, retries, and transports.

3|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-http-client-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-http-client
Source: https://github.com/mpsuesser/opencode-effect-enforcer/tree/main/skills/effect-http-client
Command: npx skills add https://github.com/mpsuesser/opencode-effect-enforcer --skill effect-http-client-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect, @effect/platform-node.

What problem does it solve? Making outbound HTTP calls in TypeScript often means untyped responses, ad-hoc retry logic, scattered auth handling, and raw fetch calls leaking into business code. This Skill guides an agent to build outgoing HTTP integrations with Effect's HttpClient so requests, responses, errors, retries, and transports are all typed and composable. ## Core Features & Use Cases - Typed request/response pipeline: Build immutable HttpClientRequest values, execute them through a configured HttpClient service, and decode bodies with Schema via schemaBodyJson, schemaJson, and matchStatus. - Resilience combinators: Apply retryTransient for transient statuses, Effect.timeout for deadlines, withRateLimiter for client-side rate limiting, cookie jars, redirect following, and tracing spans. - Transport layers and error taxonomy: Choose FetchHttpClient or NodeHttpClient (undici/node:http) transports and handle failures through the single HttpClientError wrapper with its reason union. - Use Case: Wrap a third-party REST API in a named service that prepends the base URL, attaches a redacted bearer token, filters non-2xx statuses, retries transient failures three times, and decodes responses into Schema classes. ## Quick Start Ask the agent to write an Effect service that calls an external REST API using HttpClient with schema-decoded responses, typed errors, and retry on transient failures.

Frequently Asked Questions about effect-http-client

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

FAQPage Schema
How do I make an HTTP request with Effect HttpClient?

Provide a transport layer such as FetchHttpClient.layer, then call client.get(url) or the HttpClient.get accessor and flatMap the response through HttpClientResponse.filterStatusOk and schemaBodyJson. The result is an Effect with typed success and HttpClientError failure channels.

How do I decode an HTTP JSON response with a Schema in Effect?

Use HttpClientResponse.schemaBodyJson(MySchema) after filtering the status, which returns an Effect of the decoded type. Variants include schemaJson for status plus body, schemaNoBody for header-only responses, and schemaBodyUrlParams for urlencoded bodies.

Does Effect HttpClient support retries and rate limiting?

Yes. HttpClient.retryTransient retries transient statuses (408, 429, 5xx) and transport errors with a Schedule, while HttpClient.withRateLimiter delays requests past a limit and automatically retries 429s honoring retry-after headers. Timeouts use the standard Effect.timeout combinator.

Which transport should I use: FetchHttpClient or NodeHttpClient?

Use FetchHttpClient.layer anywhere globalThis.fetch exists, including browsers and edge runtimes. On Node.js, NodeHttpClient.layerUndici is the usual choice for performance, while layerNodeHttp uses node:http with configurable agents.

Why does a 404 response not fail by default in Effect HttpClient?

By default any status code is treated as a success value. Opt in to failure with HttpClient.filterStatusOk at the client level or HttpClientResponse.filterStatusOk per request, which converts non-2xx statuses into a StatusCodeError reason inside HttpClientError.

When should I avoid automatic retries on an HTTP client?

Avoid automatic retry on clients that execute non-idempotent POST or PATCH operations, since retrying can duplicate side effects. Restrict retryTransient and withRateLimiter with times greater than zero to clients limited to proven-idempotent operations or provider-supported idempotency keys.