zap-fetch-typed-http
Implement type-safe HTTP requests with @zap-studio/fetch using $fetch, api.get/post/put/patch/delete, createFetch defaults, searchParams merging, and throwOnFetchError/throwOnValidationError return modes.
Best use case
zap-fetch-typed-http is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Implement type-safe HTTP requests with @zap-studio/fetch using $fetch, api.get/post/put/patch/delete, createFetch defaults, searchParams merging, and throwOnFetchError/throwOnValidationError return modes.
Teams using zap-fetch-typed-http should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/zap-fetch-typed-http/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How zap-fetch-typed-http Compares
| Feature / Agent | zap-fetch-typed-http | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Implement type-safe HTTP requests with @zap-studio/fetch using $fetch, api.get/post/put/patch/delete, createFetch defaults, searchParams merging, and throwOnFetchError/throwOnValidationError return modes.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# @zap-studio/fetch — Typed HTTP Client
## Setup
```ts
import { createFetch } from "@zap-studio/fetch";
import { z } from "zod";
const UserSchema = z.object({
id: z.number(),
name: z.string(),
email: z.string().email(),
});
const { api } = createFetch({
baseURL: "https://api.example.com",
headers: { Authorization: "Bearer token" },
searchParams: { locale: "en" },
});
const user = await api.get("/users/1", UserSchema);
```
## Core Patterns
### Return raw `Response` when no schema is provided
```ts
import { $fetch } from "@zap-studio/fetch";
const response = await $fetch("https://api.example.com/health");
const data = await response.json();
```
### Request validated payload via schema
```ts
import { api } from "@zap-studio/fetch";
import { z } from "zod";
const PostSchema = z.object({ id: z.number(), title: z.string() });
const post = await api.get("https://api.example.com/posts/1", PostSchema);
```
### Handle non-throw validation mode explicitly
```ts
import { $fetch } from "@zap-studio/fetch";
import { z } from "zod";
const UserSchema = z.object({ id: z.number() });
const result = await $fetch("/users/1", UserSchema, {
throwOnValidationError: false,
});
if (result.issues) {
throw new Error("Invalid response payload");
}
console.log(result.value.id);
```
## Common Mistakes
### HIGH Assuming `api.get` returns raw `Response`
Wrong:
```ts
const res = await api.get("/users/1", { headers: { Authorization: token } });
const body = await res.json();
```
Correct:
```ts
const user = await api.get("/users/1", UserSchema, {
headers: { Authorization: token },
});
console.log(user.id);
```
`api.*` overloads are schema-based helpers; they return validated payloads, not a `Response`.
Source: zap-studio/monorepo:packages/fetch/src/index.ts
### HIGH Ignoring validation result branch
Wrong:
```ts
const user = await $fetch("/users/1", UserSchema, {
throwOnValidationError: false,
});
console.log(user.id);
```
Correct:
```ts
const result = await $fetch("/users/1", UserSchema, {
throwOnValidationError: false,
});
if (result.issues) throw new Error("Invalid payload");
console.log(result.value.id);
```
With `throwOnValidationError: false`, return type is `{ value?, issues? }` and must be narrowed.
Source: zap-studio/monorepo:packages/fetch/src/index.ts
### MEDIUM Relying on implicit body semantics for non-JSON inputs
Wrong:
```ts
await api.post("/users", UserSchema, {
body: new URLSearchParams({ name: "Ada" }),
});
```
Correct:
```ts
await api.post("/users", UserSchema, {
body: { name: "Ada" },
headers: { "Content-Type": "application/json" },
});
```
Only plain object bodies are auto-JSON-stringified; other `BodyInit` forms keep their native encoding behavior.
Source: zap-studio/monorepo:packages/fetch/src/utils.ts
See also: zap-validation-standard-schema/SKILL.md — response validation result handling.Related Skills
zap-webhooks-routing-and-verification
Build webhook ingestion with @zap-studio/webhooks using createWebhookRouter, register path keys, prefix normalization, schema validation, lifecycle hooks, createHmacVerifier, and BaseAdapter request/response mapping.
zap-validation-standard-schema
Validate unknown data with @zap-studio/validation using isStandardSchema, standardValidate/standardValidateSync, createStandardValidator, createSyncStandardValidator, and throwOnError result/exception modes.
zap-permit-policy-authoring
Author typed authorization policies with @zap-studio/permit using createPolicy, allow/deny/when, condition combinators, has/hasRole, and mergePolicies vs mergePoliciesAny decision strategies.
native-data-fetching
Use when implementing or debugging ANY network request, API call, or data fetching. Covers fetch API, React Query, SWR, error handling, caching, offline support, and Expo Router data loaders (useLoaderData).
web-content-fetcher
Extracts clean Markdown content from any given URL, intelligently prioritizing a robust Scrapling script with stealth fallback, or using Jina Reader as an alternative.
data-fetching
Data fetching architecture guide using Service layer + Zustand Store + SWR. Use when implementing data fetching, creating services, working with store hooks, or migrating from useEffect. Triggers on data loading, API calls, service creation, or store data fetching tasks.
http_mcp_headers
HTTP MCP Header Secret Support - Implementation Summary
performing-http-parameter-pollution-attack
Execute HTTP Parameter Pollution attacks to bypass input validation, WAF rules, and security controls by injecting duplicate parameters that are processed differently by front-end and back-end systems.
exploiting-http-request-smuggling
Detecting and exploiting HTTP request smuggling vulnerabilities caused by Content-Length and Transfer-Encoding parsing discrepancies between front-end and back-end servers.
analyzing-windows-prefetch-with-python
Parse Windows Prefetch files using the windowsprefetch Python library to reconstruct application execution history, detect renamed or masquerading binaries, and identify suspicious program execution patterns.
analyzing-prefetch-files-for-execution-history
Parse Windows Prefetch files to determine program execution history including run counts, timestamps, and referenced files for forensic investigation.
Effect TS and HTTP-aware errors
**When to use:** Composing `Effect` programs, domain errors, `HttpError`, repository error types, or error propagation at HTTP boundaries.