andershi666/lobehub-hr-demo/data-fetching
Claude Code and agent skill by andershi666/lobehub-hr-demo
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Data fetching architecture guide using Service layer + Zustand Store + SWR. Use when implementing data fetching, creating services, working with store hooks, or migrating from useEffect. Triggers on data loading, API calls, service creation, or store data fetching tasks.
Install
npx vskill@latest install andershi666/lobehub-hr-demo/data-fetchingSKILL.md
The same SKILL.md was published earlier as gabrielmoreira/agent-skills-mirror/data-fetching.
LobeHub Data Fetching Architecture
Related Skills:-store-data-structures- How to structure List and Detail data in stores (Map vs Array patterns)
Architecture Overview
Core Principles
✅ DO
- Use Service Layer for all API calls
- Use Store SWR Hooks for data fetching (not useEffect)
- Use proper data structures - See
store-data-structuresskill for List vs Detail patterns - Use lambdaClient.mutate for write operations (create/update/delete)
- Use lambdaClient.query only inside service methods
❌ DON'T
- Never use useEffect for data fetching
- Never call lambdaClient directly in components or stores
- Never use useState for server data
- Never mix data structure patterns - Follow
store-data-structuresskill
Note: For data structure patterns (Map vs Array, List vs Detail), see thestore-data-structuresskill.
Layer 1: Service Layer
Purpose
- Encapsulate all API calls to lambdaClient
- Provide clean, typed interfaces
- Single source of truth for API operations
Service Structure
Service Guidelines
- One service per domain (e.g., agentEval, ragEval, aiAgent)
- Export singleton instance (
export const xxxService = new XxxService()) - Method names match operations (list, get, create, update, delete)
- Clear parameter types (use interfaces for complex params)
Layer 2: Store with SWR Hooks
Purpose
- Manage client-side state
- Provide SWR hooks for data fetching
- Handle cache invalidation
Data Structure: Seestore-data-structuresskill for how to structure List and Detail data.
Store Structure Overview
For complete initialState, reducer, and internal dispatch patterns, see thestore-data-structuresskill.
Create Actions
Store Guidelines
- SWR keys as constants at top of file
- useClientDataSWR for all data fetching (never useEffect)
- onSuccess callback updates store state
- Refresh methods use
mutate()to invalidate cache - Loading states in initialState, updated in onSuccess
- Mutations call service, then refresh relevant cache
Layer 3: Component Usage
Data Fetching in Components
Fetching List Data:
Fetching Detail Data:
Using Selectors (Recommended):
What NOT to Do
Mutations in Components
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinglobehub/.agents/skills/data-fetching/SKILL.md
Popularity
- 7-day trend score
- 0
Refreshed 30 Apr 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/andershi666/lobehub-hr-demo/data-fetching)