# Willyu1007 AI First Template Data Fetching

> Data Fetching

- Skill: `tomevault-io/willyu1007-ai-first-template-data-fetching` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/willyu1007-ai-first-template-data-fetching`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/willyu1007-ai-first-template-data-fetching/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/willyu1007-ai-first-template-data-fetching

---


# Data Fetching

This skill describes patterns for client-side data fetching and caching.

---

## 1. Core rules

1. Prefer a single data access layer (API client + feature APIs).
2. Use stable query keys for caching.
3. Invalidate caches intentionally on mutations.
4. Keep loading/error UX consistent (Suspense or explicit states).

---

## 2. Query key pattern

Example shape:
- `["users", "list", filters]`
- `["users", "detail", userId]`

Avoid:
- keys that depend on unstable object identity
- mixing unrelated resources in a single key

---

## 3. Mutation pattern

After a successful mutation:
- invalidate affected list queries
- update detail caches when possible

---

## 4. Error handling

- Show user-friendly errors.
- Capture exceptions to monitoring with route/feature context (when available).

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/willyu1007) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-14 -->

