upfetch

Load this skill for any up-fetch task: `up(fetch, getDefaultOptions?)`, `upfetch(url, options?)`. Covers dynamic defaults, auth, request shaping, validation, error handling, lifecycle timing, and runtime caveats.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "upfetch" with this command: npx skills add l-blondy/up-fetch/l-blondy-up-fetch-upfetch

upfetch

Use up-fetch when you need a reusable fetch client with request-scoped defaults, automatic request/response shaping, runtime validation, retries, and lifecycle hooks.

Mental model

  • up(fetchFn, getDefaultOptions?) creates the reusable client.
  • getDefaultOptions(input, options, ctx) runs on every request.
  • upfetch(input, options?, ctx?) performs one request.
  • Keep SKILL.md high-level; load the relevant file under references/ for details.

Minimum pattern

import { up } from 'up-fetch'
import { z } from 'zod'

export const upfetch = up(fetch, () => ({
   baseUrl: 'https://api.example.com',
   headers: {
      Authorization: readToken() ? `Bearer ${readToken()}` : undefined,
   },
   timeout: 5000,
}))

const user = await upfetch('/users/1', {
   schema: z.object({
      id: z.number(),
      name: z.string(),
   }),
})

Workflow

  1. Start with client setup and dynamic defaults.
  2. If the request needs auth, params, body shaping, or merge semantics, read auth and request shaping.
  3. If the response contract matters, read validation, parsing, and errors.
  4. If retries, timeouts, or hook timing matter, read retries, timeouts, and lifecycle.
  5. If streaming or runtime quirks matter, read streaming and runtime caveats.

High-value rules

  • Pass a function as the second argument to up(), not a plain object.
  • Read auth and other mutable defaults inside that function so values stay fresh.
  • Use params and body instead of hand-serializing query strings or JSON.
  • Use schema when you need runtime trust; TypeScript generics alone do not validate payloads.
  • If you want error-as-value behavior, set reject: () => false before relying on parseResponse.
  • Prefer globalThis.fetch over imported undici.fetch.

References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

fosun-skills-setup-guide

复星财富 OpenAPI 技能集(fosun-skills)的安装引导与安全提示说明。当用户首次安装 fosun-skills、或对 ClawHub 安装过程中的安全风险提示有疑问时使用。

Archived SourceRecently Updated
General

media-compress

Compress and convert images and videos using ffmpeg. Use when the user wants to reduce file size, change format, resize, or optimize media files. Handles common formats like JPG, PNG, WebP, MP4, MOV, WebM. Triggers on phrases like "compress image", "compress video", "reduce file size", "convert to webp/mp4", "resize image", "make image smaller", "batch compress", "optimize media".

Archived SourceRecently Updated
General

humanizer

Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.

Archived SourceRecently Updated
General

Drawing

Generate children's drawings and coloring pages with modular prompts, style packs, and print-ready constraints across image models.

Archived SourceRecently Updated