Cobalt — Data fetching

Define data-fetching patterns for Rocicorp Zero and TanStack Query in the Cobalt monorepo.

7|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/Cobalt-Money/Cobalt --skill cobalt-data-fetching
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Cobalt — Data fetching
Source: https://github.com/Cobalt-Money/Cobalt/tree/main/.agents/skills/cobalt/data-fetching
Command: npx skills add https://github.com/Cobalt-Money/Cobalt --skill cobalt-data-fetching

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill resolves architectural ambiguity in the Cobalt monorepo by defining clear boundaries between real-time data synchronization via Rocicorp Zero and HTTP-based data fetching via TanStack Query.

Core Features & Use Cases

  • Zero vs. TanStack Query Selection: Provides a definitive rule set for choosing the correct data lane based on whether the data is in the Postgres/Zero schema or a dedicated API route.
  • Standardized Implementation: Offers guidance on using queryOptions factories, route loaders, and prefetch patterns to ensure cache consistency and performance.
  • Use Case: When adding a new feature, use this guide to determine if you should implement a Zero subscription for live updates or a TanStack Query hook for HTTP-based data retrieval.

Quick Start

Explain the architectural criteria for choosing between Rocicorp Zero and TanStack Query for a new feature implementation in the Cobalt web application.

Frequently Asked Questions about Cobalt — Data fetching

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I use Rocicorp Zero versus TanStack Query for data fetching in a React monorepo?

Standardizing data fetching architecture resolves ambiguity by defining clear boundaries between real-time synchronization and HTTP retrieval, ensuring cache consistency and performance across React components and route loaders.

How do I implement query factory patterns for data fetching in React?

Implement data fetching using queryOptions factories and route loaders to standardize prefetch patterns, ensuring cache consistency and performance for HTTP-based API client interactions within the web application.

Does TanStack Query work with Rocicorp Zero in the same web application?

You need a React monorepo environment with defined Postgres/Zero schemas and dedicated API routes, requiring adherence to specific query factory patterns and context-aware data subscription strategies to maintain cache integrity.

What is the best way to standardize data fetching architecture across a monorepo?

Standardizing data fetching architecture resolves ambiguity by defining clear boundaries between real-time synchronization and HTTP retrieval, ensuring cache consistency and performance across React components and route loaders.

How do I maintain cache consistency when subscribing to real-time data in React?

Maintain cache consistency by adhering to specific query factory patterns and context-aware data subscription strategies, ensuring route loaders and React components interact correctly with the defined data lanes.

What are the limitations of mixing real-time subscriptions and HTTP data fetching in a monorepo?

Mixing them without clear architectural boundaries creates ambiguity and degrades cache integrity, requiring strict selection rules based on whether data originates from the Postgres schema or a dedicated API route.