Building Rust Crates logo

Building Rust Crates

Community
wdm0006
building-rust-crates

Sets up, tests, and publishes Rust crates — Cargo project layout, a fmt/clippy/test CI gate that actually gates, MSRV pinning, feature-flag hygiene, and crates.io publishing with cargo-release. Use when creating a Rust crate, wiring GitHub Actions for Rust, debugging a clippy or MSRV CI failure, or preparing a crates.io release.

Overview

Publisherwdm0006
Repositorypython-skills
Skill namebuilding-rust-crates
Stars
111
Forks
17
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by wdm0006 on GitHub. Read the source before you install it.

Installation

Install the Building Rust Crates AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/wdm0006/python-skills/tree/main/skills/rust/crates
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wdm0006/python-skills.git /tmp/python-skills
mkdir -p .claude/skills
cp -r /tmp/python-skills/skills/rust/crates .claude/skills/building-rust-crates
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Building Rust Crates in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Building Rust Crates on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Building Rust Crates is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Building Rust Crates

Starting point. This skill captures the load-bearing Rust project conventions; extend it with reference files (a full Cargo.toml, a CI workflow, a clippy config) as the patterns firm up, following the same one-owner discipline as the Python skills.

Rust's tooling is unusually good, which makes it easy to ship a crate that compiles but fails other people: a lint gate that only runs locally, an MSRV you advertise but never test, or a feature flag that breaks when a downstream unifies it. The rules below make the gate mean what it says.

Project layout & Cargo.toml essentials

toml
[package]
name = "my-crate"
version = "0.1.0"
edition = "2021"          # pin the edition explicitly
rust-version = "1.74"     # your MSRV — CI must actually test this
license = "MIT OR Apache-2.0"
description = "One line; required by crates.io"
repository = "https://github.com/owner/my-crate"

[dependencies]
# minimum compatible versions, not exact pins — let downstreams unify
serde = { version = "1", features = ["derive"], optional = true }

[features]
default = []
serde = ["dep:serde"]     # gate optional deps behind features

Library code lives in src/lib.rs; a binary in src/main.rs or src/bin/. Keep Cargo.lock out of git for a library, in git for a binary/app.

The CI gate: fmt + clippy-as-error + test

A green cargo build proves nothing about style or lints. Run all four, and make clippy warnings fail — otherwise the lint job is decorative:

yaml
- uses: dtolnay/rust-toolchain@stable      # pin the toolchain, not "latest"
  with: { components: rustfmt, clippy }
- run: cargo fmt --all --check              # formatting is a gate, not a suggestion
- run: cargo clippy --all-targets --all-features -- -D warnings
- run: cargo test --all-features

-D warnings is the load-bearing flag: without it clippy prints warnings and exits 0, so a "clippy" job stays green while lints pile up. Use --all-features so feature-gated code is actually compiled and linted.

Test the MSRV you advertise

rust-version in Cargo.toml is a promise. If CI only runs stable, a dependency bump or a newer-than-MSRV language feature can silently raise your real minimum while the manifest still claims the old one. Add an MSRV cell that pins the exact version:

yaml
strategy:
  matrix:
    rust: [stable, "1.74"]   # 1.74 == the rust-version in Cargo.toml

If you don't want to maintain an MSRV, delete rust-version rather than let it lie.

Feature-flag hygiene

Cargo unifies features across a dependency graph: if any crate in the build enables your serde feature, it's on for everyone. So every feature combination must compile on its own and together.

  • Test the extremes: cargo test --no-default-features and cargo test --all-features. A --no-default-features build that fails means a downstream who opts out of your defaults can't use the crate.
  • Never make one feature silently depend on another's items without declaring it in [features]; a downstream enabling only the first gets a compile error.

Don't .unwrap() in library code

.unwrap()/.expect() on a Result/Option in a library turns a recoverable error into a panic that aborts the caller's process. Return Result with a real error type (thiserror for libraries, anyhow for binaries) and let the caller decide. Reserve unwrap for tests and for invariants you've just locally proven.

Publishing to crates.io

bash
cargo publish --dry-run     # validates metadata + that it packages cleanly
cargo publish               # irreversible: a version can be yanked, never reused

Prefer cargo-release to automate the version bump + tag + publish in one tag-triggered step, mirroring the Python release-automation pattern. crates.io enforces semver on the version number but not on your API — bump the major yourself on a breaking change, and never re-publish a yanked version's number.

Checklist

Rust crate health:
- [ ] edition and rust-version (MSRV) pinned in Cargo.toml
- [ ] license + description + repository set (crates.io requires them)
- [ ] CI runs cargo fmt --check, clippy -D warnings, and test
- [ ] clippy job actually fails on warnings (-D warnings present)
- [ ] MSRV tested as its own matrix cell (or rust-version removed, not left lying)
- [ ] builds with --no-default-features AND --all-features
- [ ] no .unwrap()/.expect() on fallible paths in library code
- [ ] cargo publish --dry-run passes before a real release
- [ ] Cargo.lock committed for a binary, ignored for a library

Frequently asked questions

What does the Building Rust Crates AI skill do?

Sets up, tests, and publishes Rust crates — Cargo project layout, a fmt/clippy/test CI gate that actually gates, MSRV pinning, feature-flag hygiene, and crates.io publishing with cargo-release. Use when creating a Rust crate, wiring GitHub Actions for Rust, debugging a clippy or MSRV CI failure, or preparing a crates.io release.

Why use Building Rust Crates on TypingMind?

Because you install it once and use it with any model. Building Rust Crates is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Building Rust Crates in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wdm0006/python-skills/tree/main/skills/rust/crates. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Building Rust Crates?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Building Rust Crates?

As many as you like. As long as a model supports skills, you can use Building Rust Crates with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Building Rust Crates AI skill free?

Yes. It is published on GitHub by wdm0006 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇