sdxc-http

Builds HTTP responses with status helpers, content negotiation, and caching for the Fetch API.

5|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-http-sergiodxa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sdxc-http
Source: https://github.com/sergiodxa/monorepo/tree/main/.agents/skills/sdxc-http
Command: npx skills add https://github.com/sergiodxa/monorepo --skill sdxc-http-sergiodxa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing HTTP handlers by hand means memorizing status codes, hand-writing Cache-Control directives, and reimplementing ETag and conditional-request logic for every endpoint. This Skill documents the @sdxc/http package, which provides status-named response builders, Accept-header content negotiation, and a complete HTTP caching layer so handlers return correct responses with minimal boilerplate. ## Core Features & Use Cases - Status-named response builders: Functions like ok, badRequest, and notFound write JSON or HTML bodies with the right status and content type, so each handler outcome reads as the status it answers with. - Content negotiation: accepts, AcceptList, and respond parse the Accept header and dispatch to the right format handler, answering 406 when nothing matches. - HTTP caching layer: policy/Policies build Cache-Control values from intent, while etag, conditional, precondition, and vary handle 304 revalidation, If-Match writes, and cache variance. - Use Case: A route serving JSON, HTML, and CSV from one URL uses respond for negotiation, vary to keep shared caches correct, and conditional so repeat GET requests answer 304 instead of resending the body. ## Quick Start Add @sdxc/http as a workspace dependency and use the sdxc-http skill to write a handler that returns status-named JSON responses with proper cache headers.

Frequently Asked Questions about sdxc-http

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

FAQPage Schema
How do I return typed HTTP responses in a Fetch API handler?▼

Import status-named builders from @sdxc/http/response/json or @sdxc/http/response/html, such as ok, badRequest, and notFound. Each function writes the body, status code, and content type in one call and returns a plain Response.

How do I serve JSON and HTML from one URL with content negotiation?▼

Use the respond function from @sdxc/http/negotiate with handlers keyed by content type; it parses the Accept header and dispatches to the best match. Pair it with vary(headers, ["Accept"]) so shared caches do not serve one client's variant to another.

Does @sdxc/http work outside Cloudflare Workers?▼

Yes, everything takes and returns plain Request and Response objects, so it runs on any fetch-compatible runtime. Only the cache and middleware subpaths additionally build on the typed headers and router of remix.

How do I answer 304 Not Modified with ETag in a handler?▼

Attach an etag to the response and pass it through conditional at the end of the handler. Only GET or HEAD requests answered with 200 are eligible; If-None-Match decides when present, otherwise If-Modified-Since is consulted.

When should I use weak ETags instead of strong ones?▼

Use { weak: true } for content that varies in insignificant ways between renders, since strong comparison would fail. Note that precondition compares If-Match strongly, so a weak tag fails there by design.

Why does my shared cache serve one user's page to another?▼

This happens when a personalized response is marked public or varies on Cookie. Use Policies.private() or Policies.revalidate() for authenticated HTML, and reserve public and Policies.immutable() for fingerprinted, shared URLs.