MCPInstall

tanstack-integration-best-practices

Best practices for integrating TanStack Query with TanStack Router and TanStack Start. Patterns for full-stack data flow, SSR, and caching coordination.

Installs
2.9K
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/deckardger/tanstack-agent-skills --skill tanstack-integration-best-practices
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads tanstack-integration-best-practices automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

TanStack Integration Best Practices

Guidelines for integrating TanStack Query, Router, and Start together effectively. These patterns ensure optimal data flow, caching coordination, and type safety across the stack.

When to Apply

  • Setting up a new TanStack Start project
  • Integrating TanStack Query with TanStack Router
  • Configuring SSR with query hydration
  • Coordinating caching between router and query
  • Setting up type-safe data fetching patterns

Rule Categories by Priority

PriorityCategoryRulesImpact
CRITICALSetup3 rulesFoundational configuration
CRITICALSSR Integration1 ruleRouter + Query SSR setup
HIGHData Flow4 rulesCorrect data fetching patterns
MEDIUMCaching3 rulesPerformance optimization
MEDIUMSSR2 rulesAdditional SSR patterns

Quick Reference

Setup (Prefix: setup-)

  • setup-query-client-context — Pass QueryClient through router context
  • setup-provider-wrapping — Correctly wrap with QueryClientProvider
  • setup-stale-time-coordination — Coordinate staleTime between router and query

Data Flow (Prefix: flow-)

  • flow-loader-query-pattern — Use loaders with ensureQueryData
  • flow-suspense-query-component — Use useSuspenseQuery in components
  • flow-mutations-invalidation — Coordinate mutations with query invalidation
  • flow-server-functions-queries — Use server functions for query functions

Caching (Prefix: cache-)

  • cache-single-source — Let TanStack Query manage caching
  • cache-preload-coordination — Coordinate preloading between router and query
  • cache-invalidation-patterns — Unified invalidation patterns

SSR Integration (Prefix: ssr-)

  • ssr-dehydrate-hydrate — Use setupRouterSsrQueryIntegration for automatic SSR

Additional SSR (Prefix: ssr-)

  • ssr-per-request-client — Create QueryClient per request
  • ssr-streaming-queries — Handle streaming with queries

How to Use

Each rule file in the rules/ directory contains:

  1. Explanation — Why this pattern matters
  2. Bad Example — Anti-pattern to avoid
  3. Good Example — Recommended implementation
  4. Context — When to apply or skip this rule

Full Reference

See individual rule files in rules/ directory for detailed guidance and code examples.

FAQ

What does the tanstack-integration-best-practices skill do?

Best practices for integrating TanStack Query with TanStack Router and TanStack Start. Patterns for full-stack data flow, SSR, and caching coordination.

How do I install tanstack-integration-best-practices?

Run npx skills add https://github.com/deckardger/tanstack-agent-skills --skill tanstack-integration-best-practices in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/tanstack-integration-best-practices/ (personal) or .claude/skills/tanstack-integration-best-practices/ (project).

Which AI agents can use tanstack-integration-best-practices?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is tanstack-integration-best-practices safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains tanstack-integration-best-practices?

It is published by deckardger in deckardger/tanstack-agent-skills. It has 2,913 recorded installs.

More from deckardger/tanstack-agent-skills

View all →

tanstack-query-best-practices

deckardger/tanstack-agent-skills

TanStack Query (React Query) best practices for data fetching, caching, mutations, and server state management. Activate when building data-driven React applications with server state.

tanstack-start-best-practices

deckardger/tanstack-agent-skills

TanStack Start best practices for full-stack React applications. Server functions, middleware, SSR, authentication, and deployment patterns. Activate when building full-stack apps with TanStack Start.

tanstack-router-best-practices

deckardger/tanstack-agent-skills

TanStack Router best practices for type-safe routing, data loading, search params, and navigation. Activate when building React applications with complex routing needs.

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.