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.
npx agentmods add rules/squirrelogic/cursor-rules/data-accessgit clone --depth 1 https://github.com/squirrelogic/cursor-rulesWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01790 | $0.01790 |
| Opus 5 | $0.00895 | $0.00895 |
| Sonnet 5 | $0.00358 | $0.00358 |
| Haiku 4.5 | $0.00179 | $0.00179 |
Grade A, and why
data-access 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.
How it starts
The opening of the file, as written. The whole thing — 257 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Data Access Layer Structure
Overview
Best practices for implementing data access through query and mutation modules. These modules serve as the single source of truth for database operations and should be used by server actions.
-
File Organization
lib/data/ ├── mutations/ │ ├── organizations.ts │ ├── users.ts │ └── comments.ts └── queries/ ├── organizations.ts ├── users.ts └── comments.ts -
Query Module Structure
- Place all read operations in
queries/directory - Name files after the primary entity they query
- Return consistent data structures
// ✅ DO: Consistent error handling and return types import { organizations, organizationMembers } from '@/db/schema/organizations' import { eq, or } from 'drizzle-orm' import { createDrizzleSupabaseClient } from '@/db' export async function getUserOrganization(userId: string) { try { const db = await createDrizzleSupabaseClient() const orgs = await db.rls((tx) => tx .select() .from(organizations) .innerJoin(organizationMembers, eq(organizations.id, organizationMembers.organization_id)) .where(or(eq(organizations.owner_id, userId), eq(organizationMembers.user_id, userId))) .limit(1), ) return { data: orgs[0] || null, error: null } } catch (error) { return { data: null, error: error instanceof Error ? error : new Error('Failed to fetch organization') } } }// ❌ DON'T: Inconsistent error handling or return types export async function getUserOrganization(userId: string) { const db = await createDrizzleSupabaseClient() const orgs = await db.rls((tx) => tx.select().from(organizations).where(eq(organizations.owner_id, userId)) ) return orgs[0] // ❌ No error handling, inconsistent return type } - Place all read operations in
-
Mutation Module Structure
- Place all write operations in
mutations/directory - Name files after the primary entity they modify
- Handle transactions and related updates
// ✅ DO: Handle transactions and related updates import { organizations, organizationMembers } from '@/db/schema/organizations' import { createDrizzleSupabaseClient } from '@/db' import { eq } from 'drizzle-orm' export async function createOrganization(name: string, logoUrl: string | null, ownerId: string) { try { const db = await createDrizzleSupabaseClient() const org = await db.rls((tx) => tx .insert(organizations) .values({ name, logo_url: logoUrl, owner_id: ownerId, }) .returning(), ) // Related update in the same transaction await db.rls((tx) => tx.insert(organizationMembers).values({ organization_id: org[0].id, user_id: ownerId, role: 'owner', }), ) return { data: org[0], error: null } } catch (error) { return { data: null, error: error instanceof Error ? error : new Error('Failed to create organization') } } } - Place all write operations in
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.
- yesterday First seen · 257 lines · 1,790 tokens per session scan A 158100544465
data-access is a cursor rule published in the GitHub repository squirrelogic/cursor-rules (20 stars, last pushed 1y ago), licensed MIT. It adds 1,790 tokens to every session, about $0.0089 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.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.
specs
This directory contains product and tech specs for Streamlit features.