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/matank001/cursor-security-rules/secure-sql-usagegit clone --depth 1 https://github.com/matank001/cursor-security-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.00586 | $0.00586 |
| Opus 5 | $0.00293 | $0.00293 |
| Sonnet 5 | $0.00117 | $0.00117 |
| Haiku 4.5 | $0.00059 | $0.00059 |
Grade A, and why
secure-sql-usage 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 — 53 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Secure SQL Usage
These rules apply to all code that interacts with SQL databases, regardless of language or framework, including generated code.
All violations must include a clear explanation of which rule was triggered and why, to help developers understand and fix the issue effectively.
Generated code must not violate these rules. If a rule is violated, a comment must be added explaining the issue and suggesting a correction.
1. Always Use Parameterized Queries and Prepared Statements
- Rule: Never construct SQL queries by concatenating or interpolating user input directly into the query string. Always use parameterized queries or prepared statements provided by your database library. Prepared statements ensure that user input is treated as data, not executable code, and are the most effective way to prevent SQL injection.
- Example (unsafe, Python):
cursor.execute(f"SELECT * FROM users WHERE username = '{username}'") - Example (safe, Python):
cursor.execute("SELECT * FROM users WHERE username = ?", (username,)) - Example (unsafe, PHP):
$query = "SELECT * FROM users WHERE username = '" . $_GET['username'] . "'"; $result = mysqli_query($conn, $query); - Example (safe, PHP - using prepared statements):
$stmt = $conn->prepare("SELECT * FROM users WHERE username = ?"); $stmt->bind_param("s", $_GET['username']); $stmt->execute(); $result = $stmt->get_result();
2. Validate and Sanitize All Input
- Rule: All external input used in queries must be validated for type, length, and format. Apply allow-lists where possible.
3. Avoid Dynamic SQL Unless Absolutely Necessary
- Rule: Do not use dynamic SQL (e.g., building table or column names from user input) unless there is no alternative. If unavoidable, strictly validate and allow-list all dynamic parts.
4. Use Least Privilege Database Accounts
- Rule: Connect to the database using accounts with the minimum privileges required for the task. Never use admin or superuser accounts for application queries.
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 · 53 lines · 586 tokens per session scan A 86042862605f
secure-sql-usage is a cursor rule published in the GitHub repository matank001/cursor-security-rules (379 stars, last pushed 1y ago), licensed MIT. It adds 586 tokens to every session, about $0.0029 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
ankra-cli
Ankra CLI rules and best practices for managing Kubernetes clusters via the Ankra platform.
go-backend-scalability-cursorrules-prompt-file
Cursor rules for Go development with backend scalability.
cloudflare-email-telegram-cursorrules-prompt-file
Cursor rules for setting up email-to-Telegram forwarding via Cloudflare Email Routing and Workers using the mail2tg CLI.
flutter-riverpod-cursorrules-prompt-file
Cursor rules for Flutter Riverpod.
angular-novo-elements-cursorrules-prompt-file
Cursor rules for Angular development with Novo Elements UI library.
automl-hyperparameter-optimization
AutoML and hyperparameter optimization rules for Python ML projects using Ray Tune, Optuna, PyCaret, and time-series AutoML libraries.