fec-data-fetching

fec-data-fetching is a skill for Claude Code from bovinphang/frontend-craft. It costs 76 tokens per session (721 once invoked), scanned A, original, MIT.

A frontend guide for handling data that comes from a server, including typed requests, caching, refreshing, pagination, and updates. Server state means data owned by an API rather than by a page’s local controls.

In plain words
What is it for?
Use it to design query keys, request hooks, cache invalidation, optimistic updates with rollback, prefetching, server rendering hydration, and API integrations.
Why use it?
It keeps loading, error, empty, cache, and update logic out of scattered page components and helps prevent stale or duplicated requests.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the frontend-craft plugin — 56 skills, 11 commands, 14 agents, 5 hooks, 6 MCP servers shipped together

Good fit Use it to design query keys, request hooks, cache invalidation, optimistic updates with rollback, prefetching, server rendering hydration, and API integrations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bovinphang/frontend-craft/fec-data-fetching
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add bovinphang/frontend-craft --skill fec-data-fetching
Clone the repo
git clone --depth 1 https://github.com/bovinphang/frontend-craft

Made for: Claude Code.

Or install frontend-craft, the plugin that ships this one along with the rest of its 56 skills, 11 commands, 14 agents, 5 hooks, 6 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fec-data-fetching

README.md
[![agentmods](https://agentmods.dev/badge/skills/bovinphang/frontend-craft/fec-data-fetching/github.svg)](https://agentmods.dev/skills/bovinphang/frontend-craft/fec-data-fetching)
Your own site
<a href="https://agentmods.dev/skills/bovinphang/frontend-craft/fec-data-fetching"><img src="https://agentmods.dev/badge/skills/bovinphang/frontend-craft/fec-data-fetching/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fec-data-fetching

Your own site · 80×15
<a href="https://agentmods.dev/skills/bovinphang/frontend-craft/fec-data-fetching"><img src="https://agentmods.dev/badge/skills/bovinphang/frontend-craft/fec-data-fetching.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 76 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 721 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00076 $0.00721
Opus 5 $0.00038 $0.00360
Sonnet 5 $0.00015 $0.00144
Haiku 4.5 $0.00008 $0.00072

Measured 10d ago against content hash 3c1832fa8133, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

fec-data-fetching scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

localized/zh-CN/skills/fec-data-fetching/SKILL.md · 63 lines

What it actually says

Server State 数据获取

用途

为前端 server state 建立清晰的数据获取、缓存、失效和提交边界,避免请求状态散落在页面组件中。

流程

  1. 判断状态来源:来自服务端且需要缓存、去重、刷新、分页或 mutation 时使用请求缓存方案;纯本地 UI 状态用组件 state 或 store。
  2. 先沿用项目已有数据获取库;新增依赖时 React/Vue/Solid/Svelte 可考虑 TanStack Query,也可沿用 SWR、Nuxt/Nitro 数据获取或项目封装。
  3. 设计稳定 cache key/query key:结构包含实体、动作和所有影响结果的参数。
  4. API 函数保持纯请求函数,数据 hook/composable 负责缓存、select、loading/error/empty 状态。
  5. mutation 成功后 invalidation;需要即时反馈时使用 optimistic update 并在失败时回滚。

React 快速开始

import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";

export function UserList({ keyword }: { keyword: string }) {
  const query = useQuery({
    queryKey: ["users", "list", { keyword }],
    queryFn: () => getUserList({ keyword, page: 1, pageSize: 20 }),
    select: (response) => response.list,
  });

  if (query.isLoading) return <Skeleton />;
  if (query.isError) return <ErrorFallback onRetry={() => query.refetch()} />;
  if (!query.data?.length) return <EmptyState />;

  return query.data.map((user) => <UserRow key={user.id} user={user} />);
}

export function useCreateUser() {
  const queryClient = useQueryClient();
  return useMutation({
    mutationFn: createUser,
    onSuccess: () => queryClient.invalidateQueries({ queryKey: ["users"] }),
  });
}

详细参考

涉及是否需要查询库、QueryClient 默认配置、Vue adapter、乐观更新、无限滚动查询、预取、SSR 水合和 API 层整合时,加载 references/query-patterns.md

约束

  • 相同数据必须复用相同 cache key/query key;参数缺失会造成缓存串读。
  • staleTime 过长会显示旧数据,过短会造成频繁请求。
  • 请求缓存库不管理本地 UI 状态;不要把 modal、输入框值放进 query cache。
  • 乐观更新必须保存快照并在失败时回滚。
  • SSR/SSG 场景必须使用框架支持的预取、水合或服务端数据边界。

预期输出

数据获取层具备 loading/error/empty/data 状态,重复请求自动去重,mutation 后缓存正确失效或回滚,API 层与 UI 层边界清晰。

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 63 lines · 76 tokens per session scan A 3c1832fa8133

Subscribe to this mod's changes

fec-data-fetching is a skill published in the GitHub repository bovinphang/frontend-craft (21 stars, last pushed 8d ago), licensed MIT. It adds 76 tokens to every session and 721 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

brand-design

Brand-aware design system generator that acts as Head of Brand. Translates abstract brand language into a mathematically-validated, implementation-ready design system, writes creative-brief.md as the source of truth for all UI/UX in a project, and optionally compiles it to framework tokens (Tailwind v4 @theme, v3…

rfxlamia/pocketto · 146 tokens

liveview-patterns

Build LiveView: async data (assignasync), PubSub (check connected?), phx-change events, form components/modals/uploads, streams for lists, livepatch. Use when handling interactions, debugging events, or tracking Presence.

oliver-kriska/claude-elixir-phoenix · 51 tokens

cesiumjs-core-utilities

CesiumJS core utilities and networking - Resource, Color, Event, Request, RequestScheduler, error handling, helper functions, feature detection. Use when fetching remote data, managing HTTP requests, working with colors, handling events, debugging errors, or using utility functions like defined, clone, or…

CesiumGS/cesiumjs-skills · 69 tokens

litestar-vite

Auto-activate for litestarvite, VitePlugin, ViteConfig, PathConfig, RuntimeConfig, TypeGenConfig, InertiaConfig, vite.config.ts, HMR, typegen, assets, or modes. Not for plain Vite.

litestar-org/litestar-skills · 57 tokens

litestar-inertia

Auto-activate for litestarvite.inertia, InertiaConfig, component=, @inertia, @inertiajs/, createInertiaApp, useForm, usePage, Link, router, or pages/. Not for HTMX.

litestar-org/litestar-skills · 56 tokens

litestar-htmx

Auto-activate for litestarhtmx, HTMXPlugin, HTMXConfig, HTMXRequest, HTMXTemplate, HXLocation, ReplaceUrl, TriggerEvent, HX- headers, or Litestar partial HTML. Not for generic browser-side HTMX or Litestar Vite JSON templating — those are client concerns.

litestar-org/litestar-skills · 71 tokens