backend

backend is a cursor rule for Cursor from mckaywrigley/o1-pro-template-system. It costs 9 tokens per session (1,699 once invoked), scanned A, original, MIT.

A set of rules for the server and database code of a web application using Postgres, Supabase, Drizzle ORM, and server actions. It defines where schemas go and which fields and database practices to use.

In plain words
What is it for?
Use it when adding or changing database tables, schemas, server actions, user-related records, or backend code that reads and writes data.
Why use it?
It keeps database definitions organized and consistent across the project. It also prevents the coding agent from changing migration files or omitting common record fields and deletion behavior.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding or changing database tables, schemas, server actions, user-related records, or backend code that reads and writes data.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/mckaywrigley/o1-pro-template-system/backend
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/mckaywrigley/o1-pro-template-system

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 backend

README.md
[![agentmods](https://agentmods.dev/badge/rules/mckaywrigley/o1-pro-template-system/backend/github.svg)](https://agentmods.dev/rules/mckaywrigley/o1-pro-template-system/backend)
Your own site
<a href="https://agentmods.dev/rules/mckaywrigley/o1-pro-template-system/backend"><img src="https://agentmods.dev/badge/rules/mckaywrigley/o1-pro-template-system/backend/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 backend

Your own site · 80×15
<a href="https://agentmods.dev/rules/mckaywrigley/o1-pro-template-system/backend"><img src="https://agentmods.dev/badge/rules/mckaywrigley/o1-pro-template-system/backend.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9 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,699 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.00009 $0.01699
Opus 5.5 $0.00004 $0.00680
Sonnet 5.5 $0.00002 $0.00340
Haiku 4.5 $0.00001 $0.00170

Measured yesterday against content hash 3e8a424edccc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

backend 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 yesterday.

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/backend.mdc · 248 lines

How it starts

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

Backend Rules

Follow these rules when working on the backend.

It uses Postgres, Supabase, Drizzle ORM, and Server Actions.

General Rules

  • Never generate migrations. You do not have to do anything in the db/migrations folder inluding migrations and metadata. Ignore it.

Organization

Schemas

  • When importing schemas, use @/db/schema
  • Name files like example-schema.ts
  • All schemas should go in db/schema
  • Make sure to export the schema in db/schema/index.ts
  • Make sure to add the schema to the schema object in db/db.ts
  • If using a userId, always use userId: text("user_id").notNull()
  • Always include createdAt and updatedAt columns in all tables
  • Make sure to cascade delete when necessary
  • Use enums for columns that have a limited set of possible values such as:
import { pgEnum } from "drizzle-orm/pg-core"

export const membershipEnum = pgEnum("membership", ["free", "pro"])

membership: membershipEnum("membership").notNull().default("free")

Example of a schema:

db/schema/todos-schema.ts

import { boolean, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core"

export const todosTable = pgTable("todos", {
  id: uuid("id").defaultRandom().primaryKey(),
  userId: text("user_id").notNull(),
  content: text("content").notNull(),
  completed: boolean("completed").default(false).notNull(),
  createdAt: timestamp("created_at").defaultNow().notNull(),
  updatedAt: timestamp("updated_at")
    .defaultNow()
    .notNull()
    .$onUpdate(() => new Date())
})

export type InsertTodo = typeof todosTable.$inferInsert
export type SelectTodo = typeof todosTable.$inferSelect

And exporting it:

db/schema/index.ts

export * from "./todos-schema"

And adding it to the schema in db/db.ts:

db/db.ts

import { todosTable } from "@/db/schema"

const schema = {
  todos: todosTable
}

And a more complex schema:

import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core"

export const chatsTable = pgTable("chats", {
  id: uuid("id").defaultRandom().primaryKey(),
  userId: text("user_id").notNull(),
  name: text("name").notNull(),
  createdAt: timestamp("created_at").defaultNow().notNull(),
  updatedAt: timestamp("updated_at")
    .defaultNow()
    .notNull()
    .$onUpdate(() => new Date())
})

export type InsertChat = typeof chatsTable.$inferInsert
export type SelectChat = typeof chatsTable.$inferSelect

Read the full file on GitHub · 248 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. yesterday First seen · 248 lines · 9 tokens per session scan A 3e8a424edccc

Subscribe to this mod's changes

backend is a cursor rule published in the GitHub repository mckaywrigley/o1-pro-template-system (142 stars, last pushed 1y ago), licensed MIT. It adds 9 tokens to every session and 1,699 once invoked, about $0.0000 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-10-14.