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/nedcodes-ok/cursor-doctor/rustgit clone --depth 1 https://github.com/nedcodes-ok/cursor-doctorWhat 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.01085 | $0.01085 |
| Opus 5 | $0.00543 | $0.00543 |
| Sonnet 5 | $0.00217 | $0.00217 |
| Haiku 4.5 | $0.00109 | $0.00109 |
Grade A, and why
rust 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.
This is a copy
100% identical to rust — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
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.
Rust Cursor Rules
You are an expert Rust developer. Follow these rules:
Ownership & Borrowing
- Prefer borrowing (
&T,&mut T) over cloning —.clone()is a code smell unless the type is cheap to clone (small Copy types, Arc) - Use explicit lifetime annotations only when the compiler can't infer them (multiple references in, one reference out). Don't litter code with
'awhen elision handles it - Parameters:
&strover&String,&[T]over&Vec<T>— accepting the owned type forces callers to allocate unnecessarily. The reference form accepts both owned and borrowed Cow<'_, str>when a function sometimes allocates and sometimes doesn't — avoids cloning in the common path while allowing owned data when neededimpl AsRef<str>orInto<String>for parameters that should accept both&strandStringergonomically
Error Handling
thiserrorfor library errors (derive Error with structured variants).anyhowfor application code (captures any error with context)- Never
.unwrap()in production code — it panics with no context..expect("reason why this should never fail")is acceptable only for genuinely impossible states (verified by prior logic) ?operator for propagation — it's the entire error handling strategy in Rust. Design functions to returnResult<T, E>so?composes naturally- Add context with
.context("what we were trying to do")(anyhow) or.map_err(|e| MyError::Fetch { source: e })(thiserror) — raw propagation without context creates opaque error chains panic!only for programmer bugs (violated invariants, unreachable states). Never for user input, network errors, or file operations
Type System
- Newtype pattern for type safety:
struct UserId(u64)prevents passing anOrderIdwhere aUserIdis expected — zero runtime cost - Enums with data over boolean flags:
enum Status { Active, Suspended { reason: String, until: DateTime } }notis_active: bool, suspension_reason: Option<String> - Derive
Debug,Clone,PartialEqat minimum on data types. AddSerialize, Deserialize(serde) when the type crosses boundaries (API, storage, config) - Builder pattern (or
Default+ struct update) for types with many optional fields — don't make callers construct 10-field structs manually
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 · 1,085 tokens per session scan A 0ed760a09588
rust is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 5mo ago), licensed MIT. It adds 1,085 tokens to every session, about $0.0054 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to rust, differing in 0 lines, and is treated as a copy.
Other cursor rules, from other repositories
angular
Angular: signals, standalone components, RxJS patterns.
django
Django: models, views, ORM best practices.
java
Modern Java: records, sealed classes, streams, virtual threads.
javascript
Modern JavaScript: ES2023+, async patterns, common traps.
rust
Rust patterns: ownership, Result types, iterators.
accessibility
Accessibility: semantic HTML, ARIA, keyboard navigation, testing.