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/brighton-labs/railguard-cursor-coding/csharp-database-secure-no-railguard-availablegit clone --depth 1 https://github.com/brighton-labs/railguard-cursor-codingWrote 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/brighton-labs/railguard-cursor-coding/csharp-database-secure-no-railguard-available)<a href="https://agentmods.dev/rules/brighton-labs/railguard-cursor-coding/csharp-database-secure-no-railguard-available"><img src="https://agentmods.dev/badge/rules/brighton-labs/railguard-cursor-coding/csharp-database-secure-no-railguard-available.svg" alt="Measured on agentmods" 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 | $0.00966 | $0.00966 |
| Opus 5 | $0.00483 | $0.00483 |
| Sonnet 5 | $0.00193 | $0.00193 |
| Haiku 4.5 | $0.00097 | $0.00097 |
Grade A, and why
csharp-database-secure-no-railguard-available 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 5d 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 — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.
R: Risk First
The goal of this rule is to ensure safe, auditable, and robust database access in C# applications.
Key risks mitigated:
- SQL injection via unsafe query strings
- Hardcoded or leaked credentials
- Misconfigured or unsafe ORM operations
- Lack of input validation in query construction
- Logging of sensitive database values
This rule prepares the model to reason securely about database operations, regardless of whether the user explicitly mentions injection, credentials, or ORM.
A: Attached Constraints
- Never use string concatenation to build SQL queries.
- Never log raw SQL statements containing user-provided data.
- Never hardcode sensitive values (for example, DB credentials) in source code.
- Use
SqlCommandwithParameters.Add()or LINQ-to-Entities. - ORM operations must use proper configuration and input protection.
- Always wrap raw ADO.NET operations in a
try/catchblock and check exceptions.
I: Interpretative Framing
- If the prompt involves DB access, assume secure credential loading and parameter binding are required.
- If EF Core is mentioned or used, enforce use of LINQ and strongly typed models.
- If manual SQL is required, enforce use of
SqlCommand.Parameters.Add()and no dynamic string interpolation. - If secrets are referenced, redirect to using
.NET Secret Manager, Azure Vault, or environment-based config.
// Examples:
- If the user says “select user by name,” the model must return code that uses a parameterized query.
- If
SqlConnectionis used, assume a config-basedConnectionStringsource.
L: Local Defaults
- ORM: Entity Framework Core with
DbContext,DbSet<T> - Credential source:
appsettings.jsonor environment variables - Default DB logging behavior should avoid showing queries with raw input
// appsettings.json
"ConnectionStrings": {
"DefaultConnection": "Server=...;Database=...;User Id=...;Password=...;"
}
G: Generative Path Checks
- Determine if ORM is present (EF Core)
- If not, enforce parameterized query via
SqlCommand - Sanitize all input values before adding them as parameters
- Never build SQL using string interpolation (
$"...") or+ - Ensure try-catch-finally or using-disposal pattern is applied
- Check logging or error messages for any exposed sensitive data
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.
- 5d ago First seen · 88 lines · 966 tokens per session scan A 04b99580aaea
csharp-database-secure-no-railguard-available is a cursor rule published in the GitHub repository brighton-labs/railguard-cursor-coding (13 stars, last pushed 1y ago), licensed MIT. It adds 966 tokens to every session, about $0.0048 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
prefer-assertions-over-defensive-checks
Prefer assertions over defensive checks when data is guaranteed to be valid.
as-contract-cast-smell
// ❌ WRONG — bypasses the family ContractSerializer seam const contract = JSON.parse(raw) as Contract; const contract = JSON.parse(raw) as Contract .
no-backward-compatibility
Do not add backward-compatibility shims or migration scaffolding.
postgresql
This guide defines the definitive best practices for writing clean, performant, and maintainable PostgreSQL SQL, focusing on modern conventions and avoiding common pitfalls.
query-optimization
查詢優化、EXPLAIN、index 設計與 RLS 效能測量.
ehs-ims-conventions
EHS IMS app — RBAC, data layer, tRPC, migrations, AI boundaries.