Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/brendadeeznuts1111/betting-brain-v3npx agentmods add rules/brendadeeznuts1111/betting-brain-v3/database-patternsWrote 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.
[](https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/database-patterns)<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/database-patterns"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/database-patterns/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.
<a href="https://agentmods.dev/rules/brendadeeznuts1111/betting-brain-v3/database-patterns"><img src="https://agentmods.dev/badge/rules/brendadeeznuts1111/betting-brain-v3/database-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02036 | $0.02036 |
| Opus 5.5 | $0.00814 | $0.00814 |
| Sonnet 5.5 | $0.00407 | $0.00407 |
| Haiku 4.5 | $0.00204 | $0.00204 |
Grade A, and why
database-patterns 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 314 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Database Patterns
🔍 Code Searchability Patterns
Find database-patterns Issues with ast-grep
# Find env.$DB.prepare($QUERY)
# Find await stmt.bind($$$).all()
# Find await stmt.bind($$$).first()
# Find normalizeD1Result<$$$>($$$)
ast-grep --pattern 'env.$DB.prepare($QUERY)' src/
ast-grep --pattern 'await stmt.bind($$$).all()' src/
ast-grep --pattern 'await stmt.bind($$$).first()' src/
ast-grep --pattern 'normalizeD1Result<$$$>($$$)' src/
sg -p 'env.$DB.prepare($QUERY)' src/
sg -p 'await' src/
sg -p 'await' src/
sg -p 'normalizeD1Result<$$$>($$$)' src/
database-patterns Discovery Commands
sg search "env.ANALYTICS.prepare" src/
sg search "normalizeD1Result" src/
sg search ".bind(" src/
sg search ".all()" src/
Search Examples
# Find all database queries
sg search 'env.$DB.prepare($QUERY)' src/
# Find D1 result normalization
sg search 'await' src/
# Find parameterized queries
sg search 'await' src/
# Find query execution patterns
sg search 'normalizeD1Result<$$$>($$$)' src/
D1 Database Usage
Environment Bindings
Primary Databases:
ANALYTICS- Main betting analytics databaseRAW_FEED_DB- Raw feed database
Configuration: wrangler.toml
Query Patterns
Parameterized Queries (CRITICAL)
// ✅ CORRECT: Parameterized query
const result = await env.ANALYTICS.prepare(`
SELECT * FROM line_movements
WHERE eid = ? AND ts > ?
LIMIT ?
`).bind(eventID, timestamp, limit).all();
// ❌ WRONG: String interpolation (SQL injection risk)
const result = await env.ANALYTICS.prepare(`
SELECT * FROM line_movements
WHERE eid = '${eventID}' AND ts > '${timestamp}'
LIMIT ${limit}
`).all();
Type Safety
import { normalizeD1Result } from '../utils/request';
// Query with type conversion
const result = await env.ANALYTICS.prepare(`
SELECT eid, mt, ts, old_line, new_line
FROM line_movements
WHERE eid = ?
ORDER BY ts DESC
LIMIT ?
`).bind(eventID, limit).all();
// Normalize with proper typing
type Movement = {
eid: string;
mt: string;
ts: string;
old_line: number;
new_line: number;
};
const movements = normalizeD1Result<Movement>(result);
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.
- 1mo ago First seen · 314 lines · 2,036 tokens per session scan A 6c2870855ffe
database-patterns is a cursor rule published in the GitHub repository brendadeeznuts1111/betting-brain-v3 (8 stars, last pushed yesterday), licensed MIT. It adds 2,036 tokens to every session, about $0.0081 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-31.
Other cursor rules, from other repositories
typescript-imports
Golden rule: import each symbol from the module that defines it. A package index.ts may barrel only its own ./ modules — never another package.
family-instance-domain-actions
Family instance domain action implementation patterns.
no-family-vocabulary-in-framework
The framework domain (packages/1-framework) carries no family- or target-specific vocabulary — types, fields, hooks, or strategy values — and, outside the CLI and the PSL parser's grammar names, no Prisma version name before 8. Enforced by the no-family-vocabulary Biome plugin plus the lint:ratchets ratchet.
no-target-branches
Never branch on target - use adapters instead.
contract-space-package-layout
On-disk layout for packages that expose a contract space (extensions, internal monorepo packages, aggregate-root apps).
no-bare-casts
No bare as casts in production TypeScript. Use blindCast (value) from @internal/utils/casts as the auditable escape hatch, castAs (value) for declarative-only assertions, or rewrite to eliminate the cast. as const is exempt. Test files are exempt.