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.
git clone --depth 1 https://github.com/ItamarZand88/awesome-agent-conventionsWrote 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/itamarzand88/awesome-agent-conventions/rust)<a href="https://agentmods.dev/rules/itamarzand88/awesome-agent-conventions/rust"><img src="https://agentmods.dev/badge/rules/itamarzand88/awesome-agent-conventions/rust/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/itamarzand88/awesome-agent-conventions/rust"><img src="https://agentmods.dev/badge/rules/itamarzand88/awesome-agent-conventions/rust.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.01058 | $0.01058 |
| Opus 5.5 | $0.00423 | $0.00423 |
| Sonnet 5.5 | $0.00212 | $0.00212 |
| Haiku 4.5 | $0.00106 | $0.00106 |
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 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.
This is a copy
95% identical to rust — 1 line 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 — 87 lines — stays where its author put it; the contents beside it link to each section on GitHub.
description: "Rust best practices for Solana smart contract development using Anchor framework and Solana SDK" globs: programs//*.rs, src//.rs, tests/**/.ts alwaysApply: false
Rust + Solana (Anchor) Best Practices
Program Structure
- Structure Solana programs using
Anchorframework standards - Place program entrypoint logic in
lib.rs, notmain.rs - Organize handlers into modules (e.g.,
initialize,update,close) - Separate state definitions, errors, instructions, and utils
- Group reusable logic under a
utilsmodule (e.g., account validation) - Use
declare_id!()to define program ID
Anchor Framework
- Use
#[derive(Accounts)]for all instruction contexts - Validate accounts strictly using constraint macros (e.g.,
#[account(mut)],seeds,bump]) - Define all state structs with
#[account]and#[derive(AnchorSerialize, AnchorDeserialize)] - Prefer
Init,Close,Realloc,Mut, and constraint macros to avoid manual deserialization - Use
ctx.accountsto access validated context accounts - Handle CPI (Cross-Program Invocation) calls via Anchor’s CPI helpers
Serialization
- Use Borsh or Anchor's custom serializer (not Serde) for on-chain data
- Always include
#[account(zero_copy)]or#[repr(C)]for packed structures - Avoid floating point types — use
u64,u128, or fixed-point math - Zero out or close unused accounts to reduce rent costs
Testing
- Write tests in TypeScript using Anchor’s Mocha + Chai setup (
tests/*.ts) - Use
anchor.workspace.MyProgramto load deployed contracts - Use
provider.simulate()to inspect failed txs - Spin up a local validator (
anchor test) and reset between tests - Airdrop SOL to wallets with
provider.connection.requestAirdrop(...) - Validate program logs using
tx.confirmation.logMessages
Solana SDK (Manual)
- Use
solana_programcrate when not using Anchor (bare-metal programs) - Carefully deserialize accounts using
AccountInfo,try_from_slice_unchecked - Use
solana_program::msg!for lightweight debugging logs - Verify accounts via
is_signer,is_writable,key == expected - Never panic! Use
ProgramError::Custom(u32)orErrorCodeenums
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 · 87 lines · 1,058 tokens per session scan A afe2b3e22302
rust is a cursor rule published in the GitHub repository ItamarZand88/awesome-agent-conventions (34 stars, last pushed 2mo ago), licensed MIT. It adds 1,058 tokens to every session, about $0.0042 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 95% identical to rust, differing in 1 line, and is treated as a copy.
Other cursor rules, from other repositories
rust
Rust best practices for Solana smart contract development using Anchor framework and Solana SDK.
rust-general
General Rust rules for safe, idiomatic application and library development.
hatch3r-rust-patterns
Rust conventions covering 2024 edition idioms, error handling with thiserror/anyhow, ownership patterns, async with Tokio, testing, and Cargo workspaces.
rust-conventions
rust-conventions.
secure-dev-rust
These rules apply to all Rust code in the repository and aim to prevent common security risks through disciplined use of memory safety, input validation, error handling, and safe APIs.
rust-advanced
Enterprise-grade patterns for production systems including security, complex architecture, and deployment. Use this for high-stakes applications requiring authentication, comprehensive testing, and production deployment.