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

问专家 - Playwriter模式

# 问专家技能 - 使用 Playwriter 控制已登录的浏览器

Archived SourceRecently Updated
General

ai-image-generator

AI 图片与视频异步生成技能,调用 AI Artist API 根据文本提示词生成图片或视频,自动轮询直到任务完成。 ⚠️ 使用前必须设置环境变量 AI_ARTIST_TOKEN 为你自己的 API Key! 获取 API Key:访问 https://staging.kocgo.vip/index 注册登录后创建。 支持图片模型:SEEDREAM5_0(默认高质量图片)、NANO_BANANA_2(轻量快速)。 支持视频模型:SEEDANCE_1_5_PRO(文生视频,支持音频)、SORA2(文生视频或首尾帧图生视频,支持 firstImageUrl/lastImageUrl)。 触发场景: - 用户要求生成图片,如"生成一匹狼"、"画一只猫"、"风景画"、"帮我画"等。 - 用户要求生成视频,如"生成视频"、"用 SORA2 生成"、"文生视频"、"图生视频"、"生成一段...的视频"等。 - 用户指定模型:SEEDREAM5_0、NANO_BANANA_2、SEEDANCE_1_5_PRO、SORA2。

Archived SourceRecently Updated
General

淘宝投放数据分析

# 投放数据分析技能

Archived SourceRecently Updated
General

productclank-campaigns

Community-powered growth for builders. Boost amplifies your social posts with authentic community engagement (replies, likes, reposts). Discover finds relevant conversations and generates AI-powered replies at scale. Use Boost when the user has a post URL. Use Discover when the user wants to find and engage in conversations about their product.

Archived SourceRecently Updated