jawn

Coding rules for Helicone’s Jawn backend and frontend, covering REST API controllers, database managers, and TanStack Query hooks for fetching and changing data.

In plain words
What is it for?
Use them when adding Jawn API endpoints, connecting controllers to database managers, implementing frontend data requests or updates, and defining the related types.
Why use it?
They keep related backend and frontend code organized in the same patterns, making new work easier to review and maintain. TanStack Query is a library for managing data loaded from APIs in user interfaces.

Cursor rule for Cursor

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/helicone/helicone/jawn
Clone the repo
git clone --depth 1 https://github.com/Helicone/helicone

Made for: Cursor.

Per session 543 This file is loaded in full into every session.
When invoked 543 The same file — it is already loaded in full.
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.00543 $0.00543
Opus 5 $0.00271 $0.00271
Sonnet 5 $0.00109 $0.00109
Haiku 4.5 $0.00054 $0.00054

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

Security

Grade A, and why

jawn 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/jawn.mdc · 73 lines

How it starts

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

Helicone Jawn Controller and TanStack Query Integration

Controller Pattern

  • Jawn controllers (valhalla/jawn/src/controllers/) follow a RESTful design with standard HTTP methods
  • Controllers use decorators like @Route, @Get, @Post, etc. from TSOA
  • Controllers accept JawnAuthenticatedRequest and return Result<T, string>
  • Required parameters should come before optional parameters in controller methods

Manager Pattern

  • Each controller has a corresponding manager (valhalla/jawn/src/managers/)
  • Managers extend BaseManager and handle database operations
  • Managers receive authParams from the controller request
  • Use dbExecute for database operations and wrap results in Result<T, string>

Frontend Hooks with TanStack Query

  • Use useJawnClient() to interact with Jawn controllers

  • Implement custom hooks with TanStack Query for data fetching and mutations

  • For GET requests:

    const query = useQuery({
      queryKey: ['resource', id],
      queryFn: async () => {
        const response = await jawn.GET('/v1/resource/{id}', {
          params: { path: { id } }
        });
        if (response.error) throw response.error;
        return response.data;
      }
    });
    
  • For mutations:

    const mutation = useMutation({
      mutationFn: async (input) => {
        const response = await jawn.POST('/v1/resource', {
          body: input
        });
        if (response.error) throw response.error;
        return response.data;
      },
      onSuccess: (data) => {
        // Invalidate queries
        queryClient.invalidateQueries({ queryKey: ['resource'] });
      }
    });
    

Type Definitions

  • Define request and response interfaces in the controller file
  • Use proper typing with TanStack Query
  • Handle Jawn response structure properly with error checking

URL State Management

  • Use URL parameters for persisting filter state between pages
  • Update URL when filter changes with useSearchParams from Next.js

Database Schema

  • Tables follow snake_case naming
  • Use proper indexes for performance
  • Implement proper RLS policies for security
  • Create functions for specialized operations (e.g., incrementing versions)

Read the full file on GitHub · 73 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 · 73 lines · 543 tokens per session scan A 691a78ad487b

Subscribe to this mod's changes

jawn is a cursor rule published in the GitHub repository Helicone/helicone (6,122 stars, last pushed 2d ago), licensed Apache-2.0. It adds 543 tokens to every session, about $0.0027 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.