rust-crates-publish
Skill0 starsChanged 3 days agoMITView on GitHub
Release and publish Rust crates to crates.io safely - required and recommended Cargo.toml metadata, SemVer and breaking-change checks with cargo-semver-checks, CHANGELOG and git tags, cargo package --list and publish --dry-run, publishing workspace crates in dependency order, crates.io trusted publishing or scoped tokens from CI, yanking, and release-plz or cargo-release automation. Includes an offline pre-flight script that checks description and license, keywords and categories against crates.io limits, SemVer version, path, git and wildcard dependencies that crates.io rejects, estimated package size against the 10 MB limit, the CHANGELOG entry and the release tag. Use when the user wants to publish a crate, cut a release, bump a version, check for breaking changes, fix "cargo publish" errors, or automate releases.
- Reads credentials
- Installs packages
- Commits and pushes
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rust-async-reviewSkill
- rust-borrow-checkerSkill
- rust-dependency-auditSkill
- rust-error-handlingSkill
- rust-lint-ciSkill
- rust-testing-benchesSkill
- rust-unsafe-reviewSkill
- rust-workspace-setupSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 47
If it reports breaking changes, the version must be a major bump (or minor for 0.x).
- Very specific: line 57
Stop if --list shows anything private.
- Distinctive: line 59
Prefer that the user runs it, or that CI does via trusted publishing.
- Very specific: line 67
After publishing: check the crates.io page and the docs.rs build, create the GitHub release from the changelog section.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Publishing to crates.io
Goal: a release that builds for users exactly as tested, with correct metadata, a
SemVer-correct version, a changelog entry and a matching tag. Publishing is permanent
(versions can be yanked, never deleted or overwritten), so every step before
cargo publish is a dry run.
Paths below are relative to this skill's folder (in Claude Code: ${CLAUDE_SKILL_DIR}).
When to use
- "Publish this crate", "release 0.3.0", "what version should this be?"
cargo publisherrors: missing description/license, path or git dependencies, "all dependencies must have a version requirement specified", package too large- Releasing several workspace crates, automating releases from CI
When not to use
- Dependency hygiene before a release:
rust-dependency-audit(run it first) - CI for tests and lints:
rust-lint-ci - Workspace layout and inheritance:
rust-workspace-setup
Workflow
- Pre-flight (read-only, offline), per crate to publish:
Fix everypython3 scripts/publish_check.py crates/mycrate python3 scripts/publish_check.py crates/mycrate --tag v0.3.0 --jsonhighandmediumfinding; field reference in references/release.md. - Pick the version with SemVer rules for Rust (0.x: minor = breaking), then check:
If it reports breaking changes, the version must be a major bump (or minor for 0.x). Breaking-change table in references/release.md.cargo install --locked cargo-semver-checks # ask before installing cargo semver-checks check-release -p mycrate - Update
version, the CHANGELOG section (date, Added/Changed/Fixed/Removed) and README examples. Show the diff to the user. - Build exactly what will be uploaded:
Stop ifcargo package --list -p mycrate # files in the .crate; look for test data, secrets, .env cargo publish --dry-run -p mycrate # builds the packaged crate from a clean copy cargo test --workspace --all-features && cargo doc --no-deps -p mycrate--listshows anything private. - Publish only with explicit confirmation from the user, naming crate and version.
Prefer that the user runs it, or that CI does via trusted publishing. Never ask for,
print or store a crates.io token.
Workspaces: publish in dependency order (leaf crates first); recent cargo can publish several packages at once (cargo publish -p mycrate # user runs this, or CI on tag push git tag v0.3.0 && git push origin v0.3.0cargo publish --workspace), check your version. - After publishing: check the crates.io page and the docs.rs build, create the GitHub
release from the changelog section. If the release is broken, publish a fix and
cargo yank --version 0.3.0 mycrate(yank stops new lockfiles from picking it; it does not delete anything).
Automation options
| Tool | What it does |
| release-plz | opens a release PR with version bumps + changelog from conventional commits, publishes on merge |
| cargo-release | local cargo release minor --execute: bump, commit, tag, publish, push |
| plain CI | tag push -> workflow runs tests, cargo publish with trusted publishing |
Workflow sketches and the trusted-publishing setup are in references/release.md.
Output
publish_check tiny-slug 1.2.0: READY (1 info)
semver-checks: no breaking changes since 1.1.0 -> minor bump is correct
cargo package --list: 9 files, 14 KiB; cargo publish --dry-run: ok
Next (needs your confirmation): cargo publish -p tiny-slug && git tag v1.2.0 && git push origin v1.2.0Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

