{"id":49702978,"url":"https://github.com/leonardomso/rust-skills","last_synced_at":"2026-07-17T22:40:30.928Z","repository":{"id":360056637,"uuid":"1137515714","full_name":"leonardomso/rust-skills","owner":"leonardomso","description":"A collection of 265 rules across 26 categories that AI coding agents can use to write   idiomatic, fast, and safe Rust.","archived":false,"fork":false,"pushed_at":"2026-06-14T22:51:13.000Z","size":443,"stargazers_count":257,"open_issues_count":1,"forks_count":39,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-06-15T00:20:09.706Z","etag":null,"topics":["agent-skills","ai-coding","best-practices","claude-code","code-quality","codex","coding-guidelines","copilot","llm","opencode","rust","rust-lang","rust-language"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonardomso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-01-19T13:22:27.000Z","updated_at":"2026-06-14T22:52:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leonardomso/rust-skills","commit_stats":null,"previous_names":["leonardomso/rust-skills"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leonardomso/rust-skills","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardomso%2Frust-skills","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardomso%2Frust-skills/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardomso%2Frust-skills/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardomso%2Frust-skills/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonardomso","download_url":"https://codeload.github.com/leonardomso/rust-skills/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardomso%2Frust-skills/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35598364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-17T02:00:06.162Z","response_time":116,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-skills","ai-coding","best-practices","claude-code","code-quality","codex","coding-guidelines","copilot","llm","opencode","rust","rust-lang","rust-language"],"created_at":"2026-05-08T08:00:42.628Z","updated_at":"2026-07-17T22:40:30.922Z","avatar_url":"https://github.com/leonardomso.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Rust Skills\n\n![rules](https://img.shields.io/badge/rules-265-blue)\n![categories](https://img.shields.io/badge/categories-26-blue)\n![Rust](https://img.shields.io/badge/Rust-1.96%20%2F%202024%20edition-orange)\n![license](https://img.shields.io/badge/license-MIT-green)\n\n265 Rust rules your AI coding agent can use to write better code. Current for Rust 1.96 (2024 edition).\n\nWorks with Claude Code, Cursor, Windsurf, Copilot, Codex, Aider, Zed, Amp, Cline, and pretty much any other agent that supports skills.\n\n## Why\n\nOut of the box, coding agents write *average* Rust — they clone to dodge the borrow checker, `.unwrap()` everything, and reach for `Box\u003cdyn Trait\u003e` when `impl Trait` would do. These rules encode what expert Rust actually looks like: idiomatic, fast, and safe. Each rule is small and focused, so the agent pulls in only what's relevant to the code in front of it.\n\n## Install\n\n```bash\nnpx add-skill leonardomso/rust-skills\n```\n\nThat's it. The CLI figures out which agents you have and installs the skill to the right place.\n\n## How to use it\n\nAfter installing, just ask your agent:\n\n```\n/rust-skills review this function\n```\n\n```\n/rust-skills is my error handling idiomatic?\n```\n\n```\n/rust-skills check for memory issues\n```\n\n```\n/rust-skills is this unsafe block sound?\n```\n\nThe agent loads the relevant rules and applies them to your code.\n\n## See it in action\n\nAsk the agent to review a function like this:\n\n```rust\n// before\nfn first_word(s: \u0026String) -\u003e String {\n    s.clone().split_whitespace().next().unwrap().to_string()\n}\n```\n\nWith these rules loaded, it knows to take `\u0026str` instead of `\u0026String`, drop the\nneedless `clone()` and allocation, and return an `Option` instead of panicking:\n\n```rust\n// after — applies own-slice-over-vec, own-borrow-over-clone, anti-unwrap-abuse\nfn first_word(s: \u0026str) -\u003e Option\u003c\u0026str\u003e {\n    s.split_whitespace().next()\n}\n```\n\n## What's in here\n\n265 rules split into 26 categories:\n\n| Category | Rules | What it covers |\n|----------|-------|----------------|\n| **Ownership \u0026 Borrowing** | 12 | When to borrow vs clone, Arc/Rc, lifetimes |\n| **Error Handling** | 12 | thiserror for libs, anyhow for apps, the `?` operator |\n| **Memory** | 17 | SmallVec, arenas, avoiding allocations, `mem::take`, drop order |\n| **Unsafe Code** | 7 | `SAFETY:` comments, Miri, `MaybeUninit`, 2024-edition unsafe |\n| **API Design** | 17 | Builder pattern, newtypes, sealed traits, `FromIterator` |\n| **Async** | 18 | Tokio patterns, channels, async fn in traits, cancel safety |\n| **Concurrency** | 4 | rayon, scoped threads, atomic ordering, thread-locals |\n| **Optimization** | 12 | LTO, inlining, PGO, SIMD |\n| **Numeric \u0026 Arithmetic** | 5 | Overflow handling, `as` vs `TryFrom`, float compare, `NonZero` |\n| **Type Safety** | 13 | Newtypes, parse don't validate, `Deref`, `Display`/`Debug` |\n| **Trait \u0026 Generics Design** | 6 | dyn vs generic, associated types, blanket impls, object safety, orphan rule |\n| **Conversions** | 3 | `TryFrom`, `FromStr`, `AsMut` |\n| **Const \u0026 Compile-Time** | 4 | `const fn`, const vs static, const generics, `const {}` blocks |\n| **Serde** | 8 | rename_all, default, flatten, enum tagging, validate-on-deserialize |\n| **Pattern Matching** | 5 | `let-else`, `matches!`, if-let chains, exhaustive matches |\n| **Macros** | 8 | `macro_rules!` hygiene, fragment specifiers, proc-macros with syn/quote |\n| **Closures** | 5 | Fn/FnMut/FnOnce bounds, returning `impl Fn`, move \u0026 disjoint capture |\n| **Collections** | 4 | HashMap/BTreeMap/IndexMap, Vec/VecDeque, sets, `BinaryHeap` |\n| **Naming** | 16 | Following Rust API Guidelines |\n| **Testing** | 15 | Proptest, mockall, criterion, loom, snapshot tests |\n| **Docs** | 12 | Doc examples, intra-doc links, README/crate-doc unification |\n| **Observability** | 7 | tracing over log, spans, structured fields, redacting secrets |\n| **Performance** | 13 | Iterators, entry API, faster hashers, I/O buffering |\n| **Project Structure** | 14 | Workspaces, module layout, features, MSRV |\n| **Linting** | 13 | Clippy config, CI setup, `unexpected_cfgs` |\n| **Anti-patterns** | 15 | Common mistakes and how to fix them |\n\nEach rule has:\n- Why it matters\n- A bad code example\n- A good code example\n- Links to related rules and sources\n\n## How it works\n\nThe design is built for low token cost and easy auditing:\n\n- **[`SKILL.md`](./SKILL.md)** is a lightweight index — every rule listed as a one-line summary, grouped by category, with a link to its file. The agent reads this first.\n- **[`rules/`](./rules)** holds one Markdown file per rule (`\u003cprefix\u003e-\u003cname\u003e.md`). The agent opens only the handful relevant to your code instead of loading all 218 — progressive disclosure keeps context small.\n- **Prefixes** (`own-`, `err-`, `unsafe-`, `async-`, …) map directly to categories, so an agent reviewing async code can pull just `async-`, `conc-`, and `own-` rules.\n\n`CLAUDE.md` and `AGENTS.md` are symlinks to `SKILL.md`, so the same content works across agent conventions.\n\n## Manual install\n\nIf `add-skill` doesn't work for your setup, here's how to install manually:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eClaude Code\u003c/b\u003e\u003c/summary\u003e\n\nGlobal (applies to all projects):\n```bash\ngit clone https://github.com/leonardomso/rust-skills.git ~/.claude/skills/rust-skills\n```\n\nOr just for one project:\n```bash\ngit clone https://github.com/leonardomso/rust-skills.git .claude/skills/rust-skills\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eOpenCode\u003c/b\u003e\u003c/summary\u003e\n\n```bash\ngit clone https://github.com/leonardomso/rust-skills.git .opencode/skills/rust-skills\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCursor\u003c/b\u003e\u003c/summary\u003e\n\n```bash\ngit clone https://github.com/leonardomso/rust-skills.git .cursor/skills/rust-skills\n```\n\nOr just grab the skill file:\n```bash\ncurl -o .cursorrules https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWindsurf\u003c/b\u003e\u003c/summary\u003e\n\n```bash\nmkdir -p .windsurf/rules\ncurl -o .windsurf/rules/rust-skills.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eOpenAI Codex\u003c/b\u003e\u003c/summary\u003e\n\n```bash\ngit clone https://github.com/leonardomso/rust-skills.git .codex/skills/rust-skills\n```\n\nOr use the AGENTS.md standard:\n```bash\ncurl -o AGENTS.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eGitHub Copilot\u003c/b\u003e\u003c/summary\u003e\n\n```bash\nmkdir -p .github\ncurl -o .github/copilot-instructions.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eAider\u003c/b\u003e\u003c/summary\u003e\n\nAdd to `.aider.conf.yml`:\n```yaml\nread: path/to/rust-skills/SKILL.md\n```\n\nOr pass it directly:\n```bash\naider --read path/to/rust-skills/SKILL.md\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eZed\u003c/b\u003e\u003c/summary\u003e\n\n```bash\ncurl -o AGENTS.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eAmp\u003c/b\u003e\u003c/summary\u003e\n\n```bash\ngit clone https://github.com/leonardomso/rust-skills.git .agents/skills/rust-skills\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCline / Roo Code\u003c/b\u003e\u003c/summary\u003e\n\n```bash\nmkdir -p .clinerules\ncurl -o .clinerules/rust-skills.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eOther agents (AGENTS.md)\u003c/b\u003e\u003c/summary\u003e\n\nIf your agent supports the [AGENTS.md](https://agents.md) standard:\n```bash\ncurl -o AGENTS.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md\n```\n\u003c/details\u003e\n\n## All rules\n\nSee [SKILL.md](./SKILL.md) for the full list with links to each rule file.\n\n## Sources \u0026 attribution\n\nThese rules are an independent synthesis of official Rust guidance, well-known books, and patterns drawn from widely-used open-source crates. They are not affiliated with or endorsed by the Rust project or any crate author. The text and code examples are original summaries — no substantial content is copied from the sources below.\n\n**Official Rust documentation**\n- [The Rust Reference](https://doc.rust-lang.org/reference/)\n- [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/)\n- [The Rustonomicon](https://doc.rust-lang.org/nomicon/) (unsafe code)\n- [Rust 2024 Edition Guide](https://doc.rust-lang.org/edition-guide/rust-2024/)\n- [The Cargo Book](https://doc.rust-lang.org/cargo/)\n- [Standard library docs](https://doc.rust-lang.org/std/) and [release notes](https://doc.rust-lang.org/releases.html)\n\n**Books \u0026 guides**\n- [The Rust Performance Book](https://nnethercote.github.io/perf-book/) — Nicholas Nethercote\n- [Rust Design Patterns](https://rust-unofficial.github.io/patterns/) — rust-unofficial\n- [Rust Atomics and Locks](https://marabos.nl/atomics/) — Mara Bos\n- [Effective Rust](https://effective-rust.com/) — David Drysdale\n\n**Tooling**\n- [Clippy lint documentation](https://rust-lang.github.io/rust-clippy/)\n- [Miri](https://github.com/rust-lang/miri)\n\n**Real-world codebases studied for idioms**\n- ripgrep, tokio, serde, clap, polars, axum, cargo, hyper, bevy, rayon, and dtolnay's crates (thiserror, anyhow, syn)\n\nThis project is MIT-licensed. Referenced upstream materials remain under their own licenses — the official Rust documentation and API Guidelines are dual [MIT](https://github.com/rust-lang/rust/blob/master/LICENSE-MIT) / [Apache-2.0](https://github.com/rust-lang/rust/blob/master/LICENSE-APACHE).\n\n## Contributing\n\nPRs welcome. To add or change a rule:\n\n1. Create `rules/\u003cprefix\u003e-\u003cname\u003e.md` using a `kebab-case` id with an existing category prefix (`own-`, `err-`, `mem-`, …).\n2. Follow the format of existing rules: a `\u003e` one-line summary, then `## Why It Matters`, `## Bad`, `## Good`, and `## See Also` (with links that resolve).\n3. Make sure code examples compile on current stable Rust.\n4. Add the rule to the index in `SKILL.md` (Quick Reference list + the category count) so it stays in sync.\n\n````markdown\n# prefix-rule-name\n\n\u003e One-line imperative summary.\n\n## Why It Matters\n\nTwo to four sentences.\n\n## Bad\n\n```rust\n// the anti-pattern\n```\n\n## Good\n\n```rust\n// the recommended pattern\n```\n\n## See Also\n\n- [other-rule](other-rule.md) - why it's related\n````\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonardomso%2Frust-skills","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonardomso%2Frust-skills","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonardomso%2Frust-skills/lists"}