trpc

trpc is a cursor rule for Cursor from maccman/ai-monorepo-scaffold. It costs 11 tokens per session (878 once invoked), scanned A, original, MIT.

Project rules for using tRPC, a way to call server procedures with shared TypeScript types, together with React Query for loading and updating data.

In plain words
What is it for?
Use them when defining React data queries and mutations through the project’s tRPC client and React Query helpers.
Why use it?
They keep client requests, cache keys, and server-client type information consistent across the application.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use them when defining React data queries and mutations through the project’s…

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/maccman/ai-monorepo-scaffold/trpc
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.

Clone the repo
git clone --depth 1 https://github.com/maccman/ai-monorepo-scaffold

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for trpc

README.md
[![agentmods](https://agentmods.dev/badge/rules/maccman/ai-monorepo-scaffold/trpc.svg)](https://agentmods.dev/rules/maccman/ai-monorepo-scaffold/trpc)
Your own site
<a href="https://agentmods.dev/rules/maccman/ai-monorepo-scaffold/trpc"><img src="https://agentmods.dev/badge/rules/maccman/ai-monorepo-scaffold/trpc.svg" alt="Measured on agentmods" height="20"></a>
Per session 11 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 878 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00011 $0.00878
Opus 5 $0.00005 $0.00439
Sonnet 5 $0.00002 $0.00176
Haiku 4.5 $0.00001 $0.00088

Measured 7d ago against content hash b9be78f539f7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

trpc 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 7d 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/trpc.mdc · 71 lines

What it actually says

The project integrates tRPC with @tanstack/react-query by consistently using helper methods provided by the tRPC client. This approach standardizes how queries and mutations are defined and how their respective React Query keys are generated.

Key characteristics of tRPC usage in this codebase:

  1. Client Initialization:

    • The tRPC client is obtained within custom React hooks using const trpc = useTRPC(). This useTRPC hook is typically imported from a central client setup file (e.g., @/client/trpc).
  2. Using queryOptions for Queries:

    • When setting up queries with useQuery from @tanstack/react-query, instead of manually defining query keys and fetcher functions, the code leverages a queryOptions helper method available on each tRPC query procedure.
    • This method takes the query input as its first argument and an optional object for tRPC/React Query options (like enabled) as its second argument.
    • Example:
      // In use-conversation-messages.ts
      const messagesQuery = useQuery(
        trpc.message.list.queryOptions(
          conversationId ? { conversationId } : skipToken,
          { enabled: queryEnabled },
        ),
      );
      
      // In use-tenant.ts
      const { data: tenant } = useQuery(trpc.tenant.getTenant.queryOptions());
      
  3. Using mutationOptions for Mutations:

    • Similarly, for mutations with useMutation from @tanstack/react-query, a mutationOptions helper method is used. This method is available on each tRPC mutation procedure.
    • It can be called without arguments or with an object containing tRPC-specific options. The result is then spread into the useMutation hook's options, often alongside React Query mutation callbacks like onMutate, onSuccess, onError, and onSettled.
    • Example:
      // In use-chat-assets.ts
      const createPresignedUrlMutation = useMutation(
        trpc.asset.generatePresignedUrl.mutationOptions(),
      );
      
      // In use-conversation-delete.ts
      const mutation = useMutation({
        ...trpc.conversation.delete.mutationOptions(),
        onMutate: async (variables) => { /* ... */ },
        onSuccess: () => { /* ... */ },
        // ... other callbacks
      });
      
  4. Generating Query Keys with queryKey:

    • For operations that require direct interaction with the React Query cache (e.g., invalidating queries, setting query data optimistically), a queryKey helper method is used. This method is available on tRPC query procedures and takes the query input as an argument.
    • Example:
      // In use-conversation-messages.ts
      queryClient.invalidateQueries({
        queryKey: trpc.conversation.list.queryKey({}),
      });
      
      queryClient.setQueryData(
        trpc.message.list.queryKey({ conversationId: message.conversationId }),
        // ... updater function
      );
      
  5. Procedure Path:

    • tRPC procedures are accessed via a path on the initialized trpc client object, typically structured as trpc.namespace.procedureName (e.g., trpc.message.list, trpc.asset.generatePresignedUrl).
  6. Integration with useQueryClient:

    • The useQueryClient hook from @tanstack/react-query is frequently used for cache manipulation tasks like invalidating data, performing optimistic updates, and cancelling outgoing requests, especially within mutation lifecycle callbacks.

This consistent use of queryOptions, mutationOptions, and queryKey helper methods streamlines the integration with @tanstack/react-query, ensuring that query keys are generated correctly and that options are passed in a standardized way. It abstracts away some of the manual setup that might be seen in other tRPC and React Query integrations.

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. 7d ago First seen · 71 lines · 11 tokens per session scan A b9be78f539f7

Subscribe to this mod's changes

trpc is a cursor rule published in the GitHub repository maccman/ai-monorepo-scaffold (304 stars, last pushed 10mo ago), licensed MIT. It adds 11 tokens to every session and 878 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.