Skip to content
Agentmart
Submit a tool

api-fetching

Implements data fetching following a three-layer pattern (api → repository → hook) with TanStack Query.

Skill by ZevaGuillo

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/zevaguillo-api-fetching

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Implements data fetching following a three-layer pattern (api → repository → hook) with TanStack Query. Use this skill when writing any data fetching code, creating API calls, defining query hooks, or implementing mutations with optimistic updates.

Use cases: backend, data, writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Node.js package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/api-fetching

What's inside

Skill name
api-fetching
Description
Implements data fetching following a three-layer pattern (api → repository → hook) with TanStack Query. Use this skill when writing any data fetching code, creating API calls, defining query hooks, or implementing mutations with optimistic updates.
License
MIT
Instructions
77 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (12)

  • SKILL.md
  • errors.ts · rules/
  • invalidation.ts · rules/
  • nextjs.ts · rules/
  • optimistic.ts · rules/
  • query-keys.ts · rules/
  • shared-types.ts · rules/
  • three-layer.ts · rules/
  • entity.repository.ts · templates/
  • query-client.template.ts · templates/
  • query-keys.template.ts · templates/
  • useEntity.template.ts · templates/

SKILL.md (first lines)

# api-fetching — Execution Protocol

## Phase 1: Intent Detection

### IF user says:
- "fetch data" / "API call" / "get data"
- "useQuery" / "useMutation"
- "TanStack Query" / "React Query"
- "optimistic update" / "cache invalidation"
- "server component" / "SSR" / "hydration"

→ THEN activate api-fetching skill

## Phase 2: Context Selection (LAZY LOAD)

### Required (ALWAYS):
- rules/three-layer.ts (always needed)

### Conditional (LOAD ON DEMAND):
| User Context | Load Rule |
|------------|-----------|
| Query keys | rules/query-keys.ts |
| Optimistic updates | rules/optimistic.ts |
| Cache invalidation | rules/invalidation.ts |
| Error handling | rules/errors.ts |
| Next.js SSR | rules/nextjs.ts |
| Type sharing | rules/shared-types.ts |

## Phase 3: Decision Tree

```
User Request
    │
    ├─► New API endpoint? → three-layer.ts → api → repository → hook
    │
    ├─► Query keys? → LOAD: query-keys.ts → QUERY_KEYS constants
    │
    ├─► Mutation with update? → LOAD: optimistic.ts → onMutate/onError
    │
    ├─► After mutation? → LOAD: invalidation.ts → invalidateQueries
    │
    ├─► Error handling? → LOAD: errors.ts → three-level handling
    │
    └─► Next.js SSR? → LOAD: nextjs.ts → HydrationBoundary
```

## Phase 4: Output Generation

### DO:
- Generate api → repository → hook structure
- Use QUERY_KEYS constants
- Implement optimistic updates for mutations
- Invalidate after mutations

### DON'T:
- Use useQuery directly in components
- Magic string query keys
- Skip error handling

## Quick Reference

| Pattern | Location |
|---------|----------|
| Three-layer | rules/three-layer.ts |
| Query keys | rules/query-keys.ts |
| Optimistic | rules/optimistic.ts |
| Invalidation | rules/invalidation.ts |
| Next.js SSR | rules/nextjs.ts |

## Commands

```
npx api:add [entity]      → Generate api + repository + hooks
npx api:mutation [type]  → Add CRUD mutation
```

From ZevaGuillo/frontend-skills, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Mar 30, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ZevaGuillo

Cite this page

api-fetching skill. Agent Mart. https://agentmart.dev/skills/zevaguillo-api-fetching (last updated 2026-10-24)