Agent skill
handling-data-fetching
Strategy for fetching data using React Server Components (RSC) and managing cache. Use for initial page loads and SEO-optimized data.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/handling-data-fetching
SKILL.md
Data Fetching and Caching
When to use this skill
- When building pages that need SEO (Tours, Details).
- When deciding between RSC and Client-side
useEffect.
Strategy
- RSC (Default): Fetch data in Server Components for speed and SEO.
- Client Fetching: Use only for highly interactive, private, or real-time data.
- No-store: Use
cache: 'no-store'ordynamic = 'force-dynamic'for frequently changing data (like live availability).
Implementation (RSC)
import { TourService } from '@/services/tours';
export default async function ToursPage() {
const tours = await TourService.getAll();
return (
<div>
{tours.documents.map(tour => <TourCard key={tour.$id} tour={tour} />)}
</div>
);
}
Instructions
- Type Safety: Await findings and pass typed objects to child components.
- Suspense: Always wrap RSC data-fetching segments in
Suspensefor better UX.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?