Skip to content
Development
Skill

/writing-rust

Idiomatic Rust development. Use when writing Rust code, Cargo crates/workspaces,

From plugin
cc-thingz
3828 skills6 agents

Claude Code

$ npx -y skills add alexei-led/cc-thingz --skill writing-rust --agent claude-code

SKILL.md

writing-rust.SKILL.md
description: Idiomatic Rust development. Use when writing Rust code, Cargo crates/workspaces,
  Rust tests, or rustfmt/clippy/cargo workflows. Emphasizes ownership, Result errors,
  small APIs, stdlib-first dependencies, fast cargo feedback, and behavior tests.
  NOT for Go, Python, TypeScript, shell scripts, or infra-only work.
name: writing-rust

Rust Development

Covers crates, workspaces, and Rust CLIs. Check `Cargo.toml`, `rust-toolchain.toml`, and CI before using newer syntax or APIs. Project conventions win over these defaults.

Version and Features

  • Stay within `package.rust-version` (MSRV) and the pinned toolchain unless the task is an upgrade.
  • Use Edition 2024 syntax only when the crate sets `edition = "2024"`.
  • Keep features additive. Do not assume `--all-features` compiles when the crate documents mutually exclusive features.

Defaults

  • Stdlib and existing crates first. `thiserror` for library error enums and `anyhow` for application glue only when the crate already uses them or boilerplate justifies it.
  • Newtypes for IDs, tokens, and validated values; enums for states. Private first, then `pub(crate)`, then `pub`.
  • Implement `From`, `TryFrom`, `AsRef`, `FromStr`, and `Display` before ad hoc conversion methods.
  • Parsing and validation return `Result` with a typed error. `unwrap`/`expect` in production code only with a named local invariant.
  • When the borrow checker objects, fix the data flow before reaching for `clone()`. Use lifetimes in APIs only for real zero-copy needs.
  • Async only where the runtime or I/O boundary requires it. Never hold a blocking mutex guard across `.await`. Bound channels, queues, and retries.
  • Keep secrets out of `Debug` output, logs, errors, and snapshots.
  • `unsafe`: small blocks behind a safe API, a `// SAFETY:` comment stating the invariant, and focused tests or configured Miri.

Checks

Use the project's configured Cargo commands first. While editing, run focused checks (`cargo check -p <crate>`, `cargo test -p <crate> <name>`); before finishing, run the full gates:

cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test --all-targets   # or cargo nextest run, when the project uses nextest
cargo test --doc           # --all-targets and nextest both skip doctests

Test behavior through the public API with valid, invalid, and boundary cases, not private helpers. Never run `cargo clean` as a routine fix; it throws away the incremental cache.

References

  • [testing.md](references/testing.md): read when adding or reshaping tests, or when the test loop is slow.
  • [linting.md](references/linting.md): read when changing rustfmt, Clippy, or workspace/feature check flags.

Done when the relevant build/test/lint checks pass on what you changed, or you name each check that did not run and why.

Read more
@alexei-led
Ships withcc-thingz

Portable skills, agents, hooks, and Pi-native extensions for Claude Code, Codex CLI, GitHub Copilot, Cursor, Grok, and Pi. Gemini is retired.

3828 skills6 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
38
Star history of alexei-led/cc-thingz on GitHub, a chart by star-history.com

Other skills on cc-thingz.

releasing-code

releasing-code

Prepare, publish, or repair a software release and write its release notes. Use for cutting a versioned release or editing…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react4d252k
@facebook@facebookInstall Skill

Questions about writing-rust.

Which coding agents can use writing-rust?
writing-rust installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.