tanstack-start-guide

A set of coding rules for TanStack Start, a framework for building React web applications. It recommends where to keep data, form values, URL settings, and server-only operations.

In plain words
What is it for?
Use it while building TanStack Start pages, data fetching, forms, mutations, URL-driven interfaces, and server functions.
Why use it?
It helps prevent application state from being stored in the wrong place and encourages consistent, type-safe patterns.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/jahands/prompts/tanstack-start-guide
Clone the repo
git clone --depth 1 https://github.com/jahands/prompts
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,163 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00017 $0.01163
Opus 5 $0.00009 $0.00581
Sonnet 5 $0.00003 $0.00233
Haiku 4.5 $0.00002 $0.00116

Measured 2d ago against content hash 6a129ad1faa7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tanstack-start-guide scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

cursor-rules/tanstack-start-guide.mdc · 160 lines

How it starts

The opening of the file, as written. The whole thing — 160 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Is it a mutation (create/update/delete)? → Use server function + useMutation

Is it UI state that should be shareable? → Use search params in the URL

Is it temporary UI state (form inputs, toggles)? → Use useState/useReducer locally

Is it derived from other state? → Calculate it during render (useMemo if expensive)

Does it need to sync with external systems? → Use useEffect (this is the ONLY valid use case)

// Component just consumes data function ProductList() { const { category } = Route.useParams() const { data } = useSuspenseQuery({ queryKey: ['products', category], }) // No loading state needed - Suspense handles it }

</example>
</data-fetching-patterns>

<state-management-principles>
- Server state is not client state - don't mix them
- URL state > Context > Component state (in order of preference)
- One source of truth per piece of data
- Mutations should be optimistic by default
- Form state can be local until submission
</state-management-principles>

<server-functions>
<rule>
<name>Server functions for all mutations and server-only logic</name>
<why>Type-safe RPC, automatic validation, progressive enhancement</why>
<requirements>
- Always validate inputs with schemas
- Return meaningful responses for optimistic updates
- Handle both FormData (no-JS) and JSON submissions
- Never expose sensitive operations to client bundles
</requirements>
</rule>
</server-functions>

<react-patterns>
- Components are pure functions - no side effects during render
- Effects are escape hatches, not go-to solutions
- Suspense boundaries at route level for best streaming
- Error boundaries colocated with Suspense boundaries
- Prefer composition over prop drilling or context
- CSS handles animations, not JavaScript state machines
</react-patterns>

<performance-guidelines>
- Code splits at route boundaries automatically
- Lazy load below-the-fold components
- Preload likely next navigations
- Stream HTML as soon as possible
- Keep client bundles small for edge deployment
- Use platform capabilities (KV, R2) over custom solutions
</performance-guidelines>

<type-safety-requirements>
- Every route param must be validated
- Search params need schema validation
- Server function inputs/outputs fully typed
- No `any` types in route definitions
- Leverage inference over explicit types
</type-safety-requirements>

Read the full file on GitHub · 160 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 160 lines · 17 tokens per session scan A 6a129ad1faa7

Subscribe to this mod's changes

tanstack-start-guide is a cursor rule published in the GitHub repository jahands/prompts (19 stars, last pushed 7mo ago), licensed MIT. It adds 17 tokens to every session and 1,163 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.