agentleFS
glslangglslang/windbg-mcp/.claude/skills/release-rust-crates-io/SKILL.md

release-rust-crates-io

Skill21 starsChanged 11 days agoMITView on GitHub

Release a Rust crate to crates.io with mandatory preflight checks, user-confirmed version bump and git tag (following repo tag conventions), GitHub release, and post-publish verification from crates.io. Use when the user asks to release or publish a Rust crate, ship a version to crates.io, cut a crate release, tag and publish a Rust library, or run a crates.io release workflow.

  • Reads credentials
  • Deletes or force-pushes
  • Installs packages
  • Commits and pushes

The file

Show its rules and text

We split this skill into the rules it gives an agent

26 rules. About 0 are common, 17 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every step and every check is mandatory: Do not skip, defer, or proceed on failure.

    line 10
  2. Distinctive:

    Workspace?: If multiple publishable crates, list them and confirm which to release (or release in dependency order — dependencies before …

    line 24
  3. Very specific:

    If [package].publish = false, stop — crate is not publishable.

    line 27
  4. Distinctive:

    If the working tree has uncommitted changes, ask whether to commit them first or stash.

    line 29
  5. Distinctive:

    Before any checks or version edits, present the release target and wait for explicit confirmation.

    line 33
  6. Very specific:

    If ambiguous, suggest patch bump from current Cargo.toml and ask.

    line 52
  7. Very specific:

    Use AskQuestion or ask conversationally.

    line 54
  8. Distinctive:

    Only after confirmation, update version in all required places:

    line 63
  9. Very specific:

    Commit the version bump (unless the user wants it folded into an existing commit — confirm).

    line 70
  10. Very specific:

    If no prior release tags exist, check CONTRIBUTING.md, RELEASING.md, or .github/workflows/*release* for documented convention.

    line 90
  11. Distinctive:

    Verify the tag does not already exist:

    line 94
  12. Distinctive:

    Run all checks below. Every command must exit 0.

    line 103
  13. Distinctive:

    Wait for explicit confirmation: before creating the tag. If the user wants a different tag, adjust only if it still matches repo convention …

    line 144
  14. Distinctive:

    Only after step 4 confirmation:

    line 148
  15. Distinctive:

    If the version bump commit is not yet on the remote, push the branch first:

    line 155
  16. Very specific:

    Verify credentials (token in ~/.cargo/credentials.json — do not print it).

    line 163
  17. Distinctive:

    If publish fails (name taken, version exists, manifest error), do not delete the tag unless the user asks.

    line 172
  18. Very specific:

    Create a GitHub release for the tag (prefer gh):

    line 178
  19. Distinctive:

    If no CHANGELOG section exists, use a one-line body or ask the user for release notes.

    line 186
  20. Very specific:

    If gh is unavailable, stop and tell the user to create the release manually: …

    line 188
  21. Distinctive:

    Use a temp directory outside the source repo:

    line 205
  22. Very specific:

    Write src/main.rs (and tests/integration.rs if needed) with a minimal but meaningful exercise of the public API — import the crate, call at …

    line 220
  23. Distinctive:

    All must pass. On failure:

    line 237
  24. Distinctive:

    Checks: all mandatory checks passed

    line 252
  25. Distinctive:

    When releasing multiple workspace crates in one session:

    line 257
  26. Distinctive:

    Run step 3 once at workspace root (or scoped per crate — all checks still mandatory).

    line 261

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Release Rust Crate to crates.io

End-to-end release: confirm version → mandatory preflight checks → user-confirmed tag → cargo publish → GitHub tag/release → smoke test against the published crate on crates.io.

Every step and every check is mandatory. Do not skip, defer, or proceed on failure. Stop and ask the user only when a gate fails or a decision is required.

0. Detect repo and crate

From the repo root (or the path the user gave):

git rev-parse --show-toplevel
cargo metadata --no-deps --format-version 1

Determine:

  • Package name and current version from the target crate's Cargo.toml ([package].name, [package].version).
  • Workspace? If multiple publishable crates, list them and confirm which to release (or release in dependency order — dependencies before dependents).
  • Default branch (main / master).

If [package].publish = false, stop — crate is not publishable.

If the working tree has uncommitted changes, ask whether to commit them first or stash. Do not tag or publish on a dirty tree unless the user explicitly approves.

1. Confirm release version (required — do not proceed without approval)

Before any checks or version edits, present the release target and wait for explicit confirmation.

Gather context:

# Current version (workspace: add -p <crate>)
cargo pkgid 2>/dev/null | sed 's/.*#//' || grep '^version' Cargo.toml

# Latest published on crates.io (may 404 for first release)
curl -s "https://crates.io/api/v1/crates/<crate-name>" | jq -r '.crate.max_version // "none"'

# Recent git tags for this repo
git tag -l --sort=-v:refname | head -20

Propose a target version using, in order:

  1. Version the user already stated in the request.
  2. Semver bump inferred from commits since the last tag (feat → minor, fix/chore → patch, breaking/! → major) — state the reasoning.
  3. If ambiguous, suggest patch bump from current Cargo.toml and ask.

Use AskQuestion or ask conversationally. Present:

  • Current version in Cargo.toml: X.Y.Z
  • Latest on crates.io (if any): A.B.C
  • Proposed release version: N.E.W
  • Bump type: patch / minor / major / pre-release (and why)

Wait for explicit confirmation of the target version. If the user picks a different version, use that.

Only after confirmation, update version in all required places:

  • [package].version in Cargo.toml (and Cargo.lock via cargo check / cargo build)
  • Workspace members that depend on the crate internally, if they pin path versions
  • CHANGELOG.md (or project equivalent) — add a section for the new version if the project keeps one
  • Any other repo files that embed the version (README badges, etc.) — search git grep for the old version string

Commit the version bump (unless the user wants it folded into an existing commit — confirm). Re-read Cargo.toml to verify the confirmed version is on disk before step 2.

2. Detect tag convention (required)

Tags must match this repo's existing convention, not a assumed default.

git tag -l --sort=-v:refname | head -30
git ls-remote --tags origin | awk '{print $2}' | sed 's|refs/tags/||' | sort -V | tail -20

Infer the pattern from recent release tags (ignore junk tags like test, snapshot):

Observed tagsConventionExample for version 1.2.3
v1.0.0, v1.1.0v prefixv1.2.3
1.0.0, 1.1.0bare semver1.2.3
crate-name-v1.0.0prefixed with crate name<crate-name>-v1.2.3
release-1.0.0custom prefixmatch existing prefix + version

If no prior release tags exist, check CONTRIBUTING.md, RELEASING.md, or .github/workflows/*release* for documented convention. If still unclear, ask the user which format to use.

Record: tag template = <confirmed-version> with the repo's prefix/suffix applied.

Verify the tag does not already exist:

git tag -l '<proposed-tag>'
git ls-remote --tags origin "refs/tags/<proposed-tag>"

3. Mandatory preflight checks

Run all checks below. Every command must exit 0. Fix failures and re-run the full suite from the top — do not cherry-pick.

rustup component add clippy rustfmt   # install if missing; do not skip
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
cargo build --release
cargo doc --no-deps --all-features
cargo publish --dry-run

For workspaces, scope with -p <crate> when releasing one member; still run the full list.

Additionally verify (fail if missing):

  • Cargo.toml has license (or license-file), description, and repository/homepage as appropriate.
  • README and LICENSE are included in the published package (confirm via dry-run output).
  • CHANGELOG documents the confirmed release version (when the project maintains one).

Report a checklist — every item must show pass:

[ ] cargo fmt --check
[ ] cargo clippy
[ ] cargo test --all-features
[ ] cargo build --release
[ ] cargo doc
[ ] cargo publish --dry-run
[ ] manifest metadata
[ ] changelog (if applicable)

4. Confirm tag (required — do not proceed without approval)

Propose the tag using the convention from step 2 and the version from step 1:

  • Proposed tag: <proposed-tag> (state the detected convention)
  • Target commit: current HEAD short SHA + one-line subject
  • Crate: <name> version <confirmed-version>

Wait for explicit confirmation before creating the tag. If the user wants a different tag, adjust only if it still matches repo convention (or document a one-time exception with user approval).

5. Create and push tag

Only after step 4 confirmation:

git tag -a <proposed-tag> -m "Release <crate-name> <confirmed-version>"
git push origin <proposed-tag>

If the version bump commit is not yet on the remote, push the branch first:

git push origin HEAD

6. Publish to crates.io

Verify credentials (token in ~/.cargo/credentials.json — do not print it). Re-run dry-run, then publish:

cargo publish --dry-run
cargo publish
# Workspaces:
cargo publish -p <crate-name>

If publish fails (name taken, version exists, manifest error), do not delete the tag unless the user asks. Report the error and stop.

On success, note that crates.io index propagation can take 1–10 minutes.

7. GitHub release

Create a GitHub release for the tag (prefer gh):

gh release create <proposed-tag> \
  --title "<crate-name> <confirmed-version>" \
  --notes "$(cat CHANGELOG.md 2>/dev/null | sed -n '/## \[<confirmed-version>\]/,/## \[/p' | head -n -1 || echo 'Release <confirmed-version>')"

If no CHANGELOG section exists, use a one-line body or ask the user for release notes.

If gh is unavailable, stop and tell the user to create the release manually: https://github.com/<owner>/<repo>/releases/new?tag=<proposed-tag>.

8. Post-publish verification (required)

Confirm the crate is consumable from crates.io, not the local path.

8a. Wait for index

Poll until the version appears (cap at ~10 min, 30s intervals):

cargo search <crate-name> --limit 1
curl -s "https://crates.io/api/v1/crates/<crate-name>/<confirmed-version>" | jq -r '.version.num // empty'

8b. Create ephemeral smoke-test project

Use a temp directory outside the source repo:

SMOKE=$(mktemp -d)
cd "$SMOKE"
cargo init --name <crate-name>-smoke --bin

Pin the published version (no path dependency):

[dependencies]
<crate-name> = "= <confirmed-version>"

Write src/main.rs (and tests/integration.rs if needed) with a minimal but meaningful exercise of the public API — import the crate, call at least one exported type or function, assert a known result. Derive tests from the crate's own unit tests or README examples when possible.

For library-only crates, prefer a lib smoke project:

cargo init --name <crate-name>-smoke-test --lib

8c. Run smoke tests

cd "$SMOKE"
cargo build
cargo test
cargo run   # if binary smoke project

All must pass. On failure:

  1. Report the error clearly (dependency resolution, API break, missing feature flag, etc.).
  2. Do not yank the crate unless the user explicitly requests it.
  3. Suggest fixes (yank + patch release, docs correction, etc.).

Clean up: rm -rf "$SMOKE".

9. Final report

Print:

  • Published: <crate-name> <confirmed-version> on crates.io
  • Tag: <proposed-tag> pushed to origin (convention: …)
  • GitHub release: URL (gh release view <proposed-tag> --json url -q .url)
  • Checks: all mandatory checks passed
  • Smoke test: passed against crates.io =<confirmed-version>

Workspace releases

When releasing multiple workspace crates in one session:

  1. Confirm version for each crate with the user (step 1 per crate).
  2. cargo metadata --no-deps --format-version 1 → resolve publish order (dependencies before dependents).
  3. Run step 3 once at workspace root (or scoped per crate — all checks still mandatory).
  4. One tag per repo is typical; confirm tag strategy with the user when crates version independently.
  5. Publish each crate in order; run step 8 smoke test for each published crate.

Inputs the user might give

InputBehavior
"dry run" / "preflight only"Run steps 0–1 (version confirmation), 2 (tag convention), and 3 (checks). Propose tag in step 4 but do not create it. No publish, GitHub release, or smoke test.
-p <crate>Scope all commands to that workspace member.
Explicit version (e.g. "release 2.1.0")Use as the confirmed version in step 1; still require user confirmation before editing files.

There is no "skip smoke test", "skip clippy", or "skip GitHub release" path in a full release.

Gotchas

  • cargo publish publishes the local tree, not necessarily what's on GitHub. Push commits before publishing if the remote should match.
  • Re-publishing the same version is impossible. Confirm the target version carefully in step 1.
  • Tag convention ≠ semver in Cargo.toml. A repo may tag 1.2.3 while others use v1.2.3 — always derive from existing tags.
  • Feature flags / MSRV: smoke test with default features; if the crate is heavily feature-gated, also run smoke tests with --all-features.
  • Binary crates: smoke test via cargo install <crate> --version <confirmed-version> when a binary entry point is the primary artifact.
  • Pre-release semver (1.0.0-alpha.1): confirm explicitly in step 1; tag and publish as-is.
  • crates.io token scopes: publish needs publish-new / publish-update. If login fails, point user to https://crates.io/settings/tokens .

Download now (ZIP)

Does 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.