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/perniemann/pncore/pn-rust-backendgit clone --depth 1 https://github.com/perniemann/pnCoreWrote 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/perniemann/pncore/pn-rust-backend)<a href="https://agentmods.dev/rules/perniemann/pncore/pn-rust-backend"><img src="https://agentmods.dev/badge/rules/perniemann/pncore/pn-rust-backend.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.00000 | $0.00910 |
| Opus 5 | $0.00000 | $0.00455 |
| Sonnet 5 | $0.00000 | $0.00182 |
| Haiku 4.5 | $0.00000 | $0.00091 |
Grade A, and why
pn-rust-backend 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 3d 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 — 50 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Rust / backend rules
Error handling
- Use
Result<T, E>for all fallible operations. Never.unwrap()or.expect()in production code paths — use?to propagate or handle explicitly. - Define a crate-level error enum using
thiserror. Useanyhowin binary crates (applications); usethiserrorin library crates. - Prefer
?overmatchfor error propagation in linear flows. Usematchwhen branches have different recovery strategies. - Provide context when wrapping errors:
.map_err(|e| AppError::Db(e.to_string()))with enough detail to debug without a stack trace.
Async
- Use
tokioas the async runtime. All I/O-bound operations must beasync— never block the executor with synchronous I/O (std::fs,std::thread::sleep). - For CPU-heavy work inside async code: use
tokio::task::spawn_blocking. - Use
tokio::timeoutortower::timeoutto bound all external calls (DB, HTTP). Unbounded I/O awaits cause silent hangs. - Share state across handlers via
Arc<AppState>passed through Axum'sStateextractor or Actix'sweb::Data.
Ownership and types
- Prefer references over cloning for large data. Profile before adding
.clone()to work around borrow checker pushback. - Use
Arc<T>for shared ownership in async code;Rc<T>is notSend. UseMutex/RwLockonly when mutation is needed. - Use newtype wrappers to distinguish semantically different values of the same primitive:
struct UserId(i64)prevents confusinguser_idwithorder_id. - Use
Option<T>for values that may legitimately be absent. Avoid sentinel values (-1,"") to represent absence.
Secrets and config
- All config and secrets from environment variables. Use
std::env::var("VAR").expect("VAR required")at startup — fail fast on missing config. - Use
dotenvyin development; never commit.envto git. - Consider
configcrate orenvyfor typed, validated config structs derived from environment.
Web framework patterns (Axum / Actix)
- Extract shared dependencies (DB pool, config, HTTP client) into
AppState. Inject viaState<Arc<AppState>>(Axum) orData<AppState>(Actix). - Implement
IntoResponse(Axum) orResponseError(Actix) on error types for centralized response formatting. - Use typed extractors for request parsing (
Json<CreateUserRequest>) — validators run before the handler body. - Apply middleware at the router level (logging, auth, rate limiting) rather than in individual handlers.
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.
- 3d ago First seen · 50 lines · 0 tokens per session scan A 0ceeaf0f0749
pn-rust-backend is a cursor rule published in the GitHub repository perniemann/pnCore (0 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 910 tokens. 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
1001-typescript
APPLY TypeScript best practices WHEN writing code TO ensure type safety, readability, and maintainability.
alembic-migrations
To add a non-nullable column and set a specific value for all existing rows without a persistent server default.
nauro-ship-task
Run the full planner -> executor -> reviewer -> tech-lead -> direct-user-confirm -> push chain through Cursor's native project workflow agents. Requires the four bundled .cursor/agents/nauro-.md definitions and fails closed without native dispatch.
aim
The aim of this project is to port the adk-python implementation to TypeScript (adk-ts). When porting code.
frontend
Frontend specific rules.
ts-return-types
Declare return types in top-level functions to support future edits by coding agents.