ragrabbit: Cursor rule for Cursor

.cursorrules

cursorrules is a cursor rule for Cursor from madarco/ragrabbit. It costs 1,453 tokens per session, scanned A, original, MIT.

A set of code-style and project-structure rules for a TypeScript monorepo, meaning a repository that contains multiple related applications and packages. It covers naming, modular code, authentication, UI placement, database schemas, and server actions.

In plain words
What is it for?
It is for writing TypeScript, organizing UI components, adding authentication, defining database schemas with DrizzleORM, creating server actions, and generating or applying database migrations.
Why use it?
It gives contributors consistent conventions for where code belongs and how common full-stack tasks should be implemented. This reduces mismatched patterns across the project.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

This is madarco/ragrabbit's own configuration. It tells Cursor how to work on ragrabbit itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ragrabbit configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { Badge } from "../badge";.

Reuse

Borrowing it

Nothing to install: this file belongs to madarco/ragrabbit. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/madarco/ragrabbit/main/.cursorrules
Clone the repo
git clone --depth 1 https://github.com/madarco/ragrabbit

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 cursorrules

README.md
[![agentmods](https://agentmods.dev/badge/rules/madarco/ragrabbit/cursorrules/github.svg)](https://agentmods.dev/rules/madarco/ragrabbit/cursorrules)
Your own site
<a href="https://agentmods.dev/rules/madarco/ragrabbit/cursorrules"><img src="https://agentmods.dev/badge/rules/madarco/ragrabbit/cursorrules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cursorrules

Your own site · 80×15
<a href="https://agentmods.dev/rules/madarco/ragrabbit/cursorrules"><img src="https://agentmods.dev/badge/rules/madarco/ragrabbit/cursorrules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,453 This file is loaded in full into every session.
When invoked 1,453 The same file — it is already loaded in full.
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.01453 $0.01453
Opus 5.5 $0.00581 $0.00581
Sonnet 5.5 $0.00291 $0.00291
Haiku 4.5 $0.00145 $0.00145

Measured 2mo ago against content hash a6ed2b85df43, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cursorrules 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 2mo 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.

.cursorrules · 168 lines

How it starts

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

Code Style and Structure:

  • Write concise, technical TypeScript code with accurate examples
  • Prefer iteration and modularization over code duplication
  • Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)

Fullstack development:

  • The main app is saas/app
  • Use the packages/auth package for authentication, which exposes an auth function, eg: const session = await authOrLogin(); const email = session.user.email
  • Put the components for the UI in the packages/design package: put them in packages/design/components/section name/
  • Put the data schema in the packages/db package using DrizzleORM and PostgreSQL. The db can be acquired with import db from "@repo/db", the schema with import { usersTable } from "@repo/db/schema", the DrizzleOrm utilities with import { eq } from "@repo/db/drizzle"
  • When updating the db schema, run cd apps/saas && pnpm drizzle-kit generate to generate the new migrations while pnpm drizzle-kit migrate to apply them to the db.
  • For API routes prefer using Server Actions in the apps/saas app directly, inside the same folder as the page and route
  • For Server Actions, uses the this uses next-safe-action package and prefer using the authActionClient from the packages/actions package, eg: const result = await authActionClient.schema(mySchema).metadata({ name: "myAction" }).action(async ({ parsedInput, ctx }) => { ... });
  • Calling a Server Action from a page can be done directly eg: const { data: result } = await myAction({}); or const { executeAsync} = useAction(myAction); const { data } = await executeAsync();

Naming Conventions:

  • Use lowercase with dashes for directories (e.g., components/auth-wizard)
  • Favor named exports for components

TypeScript Usage:

  • Use TypeScript for all code; prefer interfaces over types
  • Avoid enums; use maps instead
  • Use functional components with TypeScript interfaces, eg export default function MyComponent({ myProp }: { myProp: string }) { ... }

Syntax and Formatting:

  • Use the "function" keyword for pure functions
  • Use declarative JSX

Error Handling and Validation:

  • Prioritize error handling: handle errors and edge cases early
  • Use early returns and guard clauses
  • Implement proper error logging and user-friendly messages
  • Use Zod for form validation (use z.coerce... with number values)
  • Model expected errors as return values in Server Actions
  • Use error boundaries for unexpected errors

UI and Styling:

  • Use Shadcn UI, Radix, and Tailwind Aria for components and styling
  • Implement responsive design with Tailwind CSS; use a mobile-first approach
  • Put the components for the UI in the @repo/design/ package
  • Use the cn function for tailwind classes from @repo/design/lib/utils
  • Use the import "@repo/design/..." always instead of @/, eg import { Button } from "@repo/design/shadcn/button"
  • To import design components, use the path: "@repo/design/components/...". For Shadcn components, use the path: "@repo/design/shadcn/..."
  • To add a missing Shadcn component, run cd packages/design && shadcn add ...
  • To import icons, use the path: "@repo/design/base/icons" this exposes lucide-react icons.
  • Always generate also a Storybook story for each component, put it next to the component file.
  • For Forms, use the EasyForm component from the @repo/design/components/form package.

An Example Storybook story:

import { Meta, StoryObj } from "@storybook/react";
import { Badge } from "../badge";

const meta: Meta<typeof Badge> = {
  title: "UI/Custom/Badge",
  component: Badge,
  argTypes: {
    variant: {
      control: "select",
      options: ["default", "primary", "secondary", "success", "warning", "danger"],
    },
  },
};

export default meta;
type Story = StoryObj<typeof Badge>;

export const Default: Story = {
  args: {
    children: "Default Badge",
  },
};

And example of an EasyForm:

const form = useForm<IndexFormValues>({
  resolver: zodResolver(addIndexSchema),
  defaultValues: { urls: [{ value: "" }] },
  mode: "onChange",
});

// Multi field array:
const urlsFieldArray = useFieldArray({
  name: "urls",
  control: form.control,
});

<EasyForm form={form} onSubmit={onSubmit} message="Form submitted successfully">
  <EasyFormFieldText
    form={form}
    name="name"
    title="Name"
    description="Please enter your full name"
    placeholder="John Doe"
  />
  <EasyFormFieldText
    form={form}
    name="email"
    title="Email"
    description="Enter your email address"
    placeholder="[email protected]"
  />
  <EasyFormMultiTextField
    form={form}
    field={field}
    name="multiField"
    title="Multi Field"
    description="This is a multi EasyFormFieldText component"
    placeholder="Enter some text"
  />
  <EasyFormFieldNumber form={form} field={field} name="multiField" title="Multi Field" />
  <EasyFormFieldSwitch form={form} name="switch" title="Switch" label="Switch Label" />
  <EasyFormSubmit form={form} isExecuting={false} />
</EasyForm>

Read the full file on GitHub · 168 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. 2mo ago First seen · 168 lines · 1,453 tokens per session scan A a6ed2b85df43

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository madarco/ragrabbit (135 stars, last pushed 10mo ago), licensed MIT. It adds 1,453 tokens to every session, about $0.0058 per session on Opus 5.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.

Related

cursorrules compared with cursor rules from other repositories

cursorrules next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cursorrulesmadarco/ragrabbitCursor rule13510mo agoMITA1,453Cursor
testingthedaviddias/llms-txt-hubCursor rule924yesterdaynoneA1,167Cursor
functionsthedaviddias/llms-txt-hubCursor rule924yesterdaynoneA506Cursor
jsdoc-commentsthedaviddias/llms-txt-hubCursor rule924yesterdaynoneA411Cursor
rulesthedaviddias/llms-txt-hubCursor rule924yesterdaynoneA461Cursor
nextjsthedaviddias/llms-txt-hubCursor rule924yesterdaynoneA157Cursor
sharedthedaviddias/llms-txt-hubCursor rule924yesterdaynoneA154Cursor