Agent skill
react-tanstack-senior
Expertise senior/lead React developer 20 tahun dengan TanStack ecosystem (Query, Router, Table, Form, Start). Gunakan skill ini ketika: (1) Membuat aplikasi React dengan TanStack libraries, (2) Review/refactor kode React untuk clean code, (3) Debugging React/TanStack issues, (4) Setup project structure yang maintainable, (5) Optimasi performa React apps, (6) Memilih library yang tepat untuk use case tertentu, (7) Mencegah common bugs dan memory leaks, (8) Implementasi best practices KISS dan less is more. Trigger keywords: React, TanStack, React Query, TanStack Router, TanStack Table, TanStack Form, TanStack Start, Vinxi, clean code, refactor, performance, debugging.
Install this agent skill to your Project
npx add-skill https://github.com/mOdrA40/claude-codex-skills-directory/tree/main/frontend-skills/react-tanstack-mastery-skill
SKILL.md
React + TanStack Senior Developer Skill
Core Philosophy
KISS > Clever Code
Readability > Brevity
Explicit > Implicit
Composition > Inheritance
Colocation > Separation
Type Safety > Any
Quick Decision Tree
State Management:
- Server state → TanStack Query (WAJIB)
- URL state → TanStack Router search params
- Form state → TanStack Form atau React Hook Form
- Global UI state → Zustand (bukan Redux)
- Local UI state → useState/useReducer
Routing:
- SPA → TanStack Router
- Full-stack SSR → TanStack Start
- Existing Next.js → tetap Next.js
Project Setup Workflow
-
Determine project type:
- SPA/Client-only? → Vite + TanStack Router + Query
- Full-stack SSR? → TanStack Start (Vinxi-based)
- Existing project? → Incremental adoption
-
Initialize project → See folder-structure.md
-
Setup core dependencies → See recommended-libraries.md
TanStack Ecosystem References
| Library | When to Read |
|---|---|
| tanstack-query.md | Data fetching, caching, mutations |
| tanstack-router.md | Type-safe routing, loaders, search params |
| tanstack-table.md | Complex tables, sorting, filtering, pagination |
| tanstack-form.md | Form validation, field arrays, async validation |
| tanstack-start.md | Full-stack SSR framework |
Code Quality Standards
Naming Conventions
// Components: PascalCase dengan suffix deskriptif
UserProfileCard.tsx // ✓
UserCard.tsx // ✗ terlalu generic
user-profile.tsx // ✗ wrong case
// Hooks: camelCase dengan prefix 'use'
useUserProfile() // ✓
useGetUserProfile() // ✗ redundant 'Get'
getUserProfile() // ✗ missing 'use'
// Query keys: array dengan hierarchy
['users', 'list', { status }] // ✓
['usersList'] // ✗ tidak granular
`users-${status}` // ✗ string interpolation
// Files: kebab-case untuk non-components
api-client.ts // ✓
apiClient.ts // ✗
Component Structure Pattern
// 1. Imports (grouped: external → internal → types)
import { useSuspenseQuery } from '@tanstack/react-query'
import { userQueries } from '@/features/users/api'
import type { User } from '@/features/users/types'
// 2. Types (colocated, tidak di file terpisah kecuali shared)
interface UserCardProps {
userId: string
onSelect?: (user: User) => void
}
// 3. Component (single responsibility)
export function UserCard({ userId, onSelect }: UserCardProps) {
// 3a. Queries/mutations first
const { data: user } = useSuspenseQuery(userQueries.detail(userId))
// 3b. Derived state (useMemo hanya jika expensive)
const fullName = `${user.firstName} ${user.lastName}`
// 3c. Handlers (useCallback hanya jika passed to memoized children)
const handleClick = () => onSelect?.(user)
// 3d. Early returns untuk edge cases
if (!user.isActive) return null
// 3e. JSX (clean, minimal nesting)
return (
<article onClick={handleClick} className="user-card">
<h3>{fullName}</h3>
<p>{user.email}</p>
</article>
)
}
Anti-Patterns to AVOID
// ❌ NEVER: useEffect untuk data fetching
useEffect(() => {
fetch('/api/users').then(setUsers)
}, [])
// ✅ ALWAYS: TanStack Query
const { data: users } = useQuery(userQueries.list())
// ❌ NEVER: Prop drilling lebih dari 2 level
<Parent userData={user}>
<Child userData={user}>
<GrandChild userData={user} />
// ✅ ALWAYS: Context atau query di level yang butuh
function GrandChild() {
const { data: user } = useQuery(userQueries.current())
}
// ❌ NEVER: Premature optimization
const value = useMemo(() => a + b, [a, b]) // simple math
// ✅ ALWAYS: Optimize only when measured
const value = a + b // just calculate
// ❌ NEVER: Index as key untuk dynamic lists
{items.map((item, i) => <Item key={i} />)}
// ✅ ALWAYS: Stable unique identifier
{items.map(item => <Item key={item.id} />)}
Debugging Guide
See debugging-guide.md for:
- React DevTools profiling
- TanStack Query DevTools
- Memory leak detection
- Performance bottleneck identification
- Common error patterns
Common Pitfalls & Bugs
See common-pitfalls.md for:
- Stale closure bugs
- Race conditions
- Memory leaks patterns
- Hydration mismatches
- Query invalidation mistakes
Performance Checklist
□ Bundle size < 200KB gzipped (initial)
□ Largest Contentful Paint < 2.5s
□ No unnecessary re-renders (React DevTools)
□ Images lazy loaded
□ Code splitting per route
□ Query deduplication working
□ No memory leaks (heap snapshot stable)
Code Review Checklist
□ No `any` types (use `unknown` if needed)
□ No `// @ts-ignore` tanpa penjelasan
□ Error boundaries di route level
□ Loading states handled
□ Empty states handled
□ Error states handled
□ Accessibility (aria labels, keyboard nav)
□ No hardcoded strings (i18n ready)
□ No console.log in production code
□ Tests untuk business logic
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
nuxt-tanstack-mastery
Panduan senior/lead developer 20 tahun pengalaman untuk Vue.js 3 + Nuxt 3 + TanStack Query development. Gunakan skill ini ketika: (1) Membuat project Nuxt 3 baru dengan arsitektur production-ready, (2) Integrasi TanStack Query untuk data fetching, (3) Debugging Vue/Nuxt yang kompleks, (4) Review code untuk clean code compliance, (5) Optimisasi performa aplikasi Vue/Nuxt, (6) Setup folder structure yang scalable, (7) Mencari library terpercaya untuk Vue ecosystem, (8) Menghindari common pitfalls dan bugs, (9) Implementasi state management patterns, (10) Security hardening aplikasi Nuxt. Trigger keywords: vue, vuejs, nuxt, nuxtjs, tanstack, vue-query, composition api, pinia, vueuse, vue router, clean code vue, debugging vue, folder structure nuxt.
solidjs-solidstart-expert
Expert-level SolidJS and SolidStart development skill with 20+ years senior/lead engineer mindset. Comprehensive guidance for building production-ready, scalable web applications with fine-grained reactivity. Use when Claude needs to: (1) Create new SolidJS/SolidStart projects, (2) Implement TanStack Query/Router/Table/Form integration, (3) Build reactive components with signals/stores/resources, (4) Handle SSR/SSG/streaming with SolidStart, (5) Implement authentication and API routes, (6) Optimize bundle size and performance, (7) Debug reactivity issues and memory leaks, (8) Structure large-scale applications, (9) Implement type-safe patterns with TypeScript, (10) Handle error boundaries and suspense, (11) Build accessible UI components, (12) Deploy to Vercel/Netlify/Cloudflare. Triggers: "solid", "solidjs", "solidstart", "createSignal", "createStore", "createResource", "tanstack solid", "vinxi", "fine-grained reactivity".
clickhouse-principal-engineer
Principal/Senior-level ClickHouse playbook for analytical schema design, partitioning, ingestion, query performance, replication, storage strategy, and operating large-scale columnar systems. Use when: designing OLAP workloads, reviewing MergeTree layout, tuning analytical queries, building event analytics platforms, or operating ClickHouse in production.
mysql-principal-engineer
Principal/Senior-level MySQL playbook for schema design, indexing, transactions, replication, operational reliability, online migrations, and production workload tuning. Use when: designing relational systems, reviewing query/index strategy, operating MySQL fleets, debugging contention or replication lag, or hardening MySQL-backed applications.
mongodb-principal-engineer
Principal/Senior-level MongoDB playbook for document modeling, indexing, replication, sharding, query design, observability, and production reliability. Use when: designing document schemas, reviewing aggregation/query performance, operating replicas/shards, or hardening MongoDB-backed systems.
postgresql-principal-engineer
Principal/Senior-level PostgreSQL playbook for schema design, transactions, query tuning, indexing, reliability, migrations, observability, and production operations. Use when: designing relational schemas, reviewing SQL/query plans, fixing locks and slow queries, hardening migrations, or operating PostgreSQL in production.
Didn't find tool you were looking for?