Skip to content
Skills Library
Programming · Building & coding

cargo-workflows

/cargo-workflows

Use when managing Cargo workspaces, feature flags, build scripts, CI caching, dependency auditing, or Cargo.lock with Rust.

Licence
Apache-2.0
Last repository change
10.11.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 10.11.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Use when managing Cargo workspaces, feature flags, build scripts, CI caching, dependency auditing, or Cargo.lock with Rust.

Original author description

Use when managing Cargo workspaces, feature flags, build scripts, CI caching, dependency auditing, or Cargo.lock with Rust.

How it works

  1. Finding the toolchain and the workspace root
  2. Setting up workspaces and feature flags
  3. Writing build scripts that rerun only when they should
  4. Caching CI and running nextest
  5. Auditing dependencies and managing the lockfile
  6. Diagnosing the real paths before blaming the build
  7. What you hand back
Original SKILL.md headings · 52 lines, 885 words
SKILL.md preview
---
name: cargo-workflows
description: 'Use when managing Cargo workspaces, feature flags, build scripts, CI caching, dependency auditing, or Cargo.lock with Rust.'
---

# Cargo workflows

You keep the Cargo side of a Rust project honest: workspaces that resolve, features that stay additive, build scripts that rerun only when inputs change, CI caches that actually hit, test runs under nextest, audits with no surprises, and a lockfile that matches what was intended. You write only local files the user names (`Cargo.toml`, `build.rs`, `Cargo.lock`, CI workflow files, report files), which rollback covers through `git checkout --`, `git reset`, or `rm` for new reports. Nothing here mutates anything remote. The job is done when the requested workflow builds or runs cleanly, or when the failing command and its cause are reported.

What you need before starting:

- Project path, required: the workspace root or member crate.
- Task, required: workspace setup, feature flags, build script, CI caching, `cargo nextest`, dependency audit, or `Cargo.lock` management.
- Rust version, optional: defaults to 1.99.1 with edition 2024.
- Target crate or feature names, optional: used for scoped builds, tests, and updates.
- CI platform, optional: GitHub Actions, GitLab CI, or local runner.

## Finding the toolchain and the workspace root

Run `rustc --version` and `cargo --version`, then locate the workspace root by finding the `Cargo.toml` that holds `[workspace]` or the root package. This step is done when the toolchain version and the workspace root are known.

## Setting up workspaces and feature flags

For workspace setup, create or edit the root `Cargo.toml` with `[workspace]`, `members`, `resolver = "2"`, `[workspace.dependencies]`, and `[workspace.package]`, and have members inherit with `version.workspace = true` and `edition.workspace = true`. Pattern details live in `references/workspace-patterns.md`. This step is done when `cargo check --workspace` succeeds. When the workspace will not build, check the `members` paths, the resolver, and missing `Cargo.toml` files, fix, and rerun.

For feature flags, configure `[features]` in the member `Cargo.toml`, keep features additive, use `dep:optional_dep` syntax for optional dependencies, and set `resolver = "2"`. Verify with `cargo check --no-default-features` and `cargo check --all-features`. This step is done when the requested feature combinations build cleanly. When feature unification leaks across the workspace, confirm `resolver = "2"`, split dev and prod feature edges, and inspect with `cargo tree -e features`.

## Writing build scripts that rerun only when they should

Add or edit `build.rs` at the crate root, emitting `cargo:rerun-if-changed=...`, `cargo:rustc-link-lib`, `cargo:rustc-link-search`, `cargo:rustc-cfg`, `cargo:rustc-env`, and `cargo:warning` directives. This step is done when `cargo build` reruns the script only when inputs change and the crate links or generates correctly. When the script reruns too often, add a `cargo:rerun-if-changed` line for every input file and environment variable.

## Caching CI and running nextest

For CI caching, configure `Swatinem/rust-cache@v2` or `actions/cache@v6` (Node 24 runtime; self-hosted runners need 2.327.1 or newer) to cache `~/.cargo/registry` and `target/`, and set `[profile.release] incremental = false` when release builds must stay deterministic. This step is done when CI logs show cache hits and build times are stable. On cache misses, verify the cache keys include `Cargo.lock` and that both `target/` and `~/.cargo` are restored.

For test execution, install `cargo-nextest 0.9.150` and run `cargo nextest run`, adding a `nextest.toml` with profiles for CI and local runs. This step is done when the tests pass under the chosen profile.

## Auditing dependencies and managing the lockfile

For dependency auditing, run `cargo audit` from `cargo-audit 0.22.2`, `cargo deny check` from `cargo-deny 0.20.2`, or `cargo machete`, with `deny.toml` configured for licenses, duplicate versions, and banned crates. This step is done when the tool reports no blocking findings or names each one. When an audit blocks the build, address the advisory, add a rationale to `deny.toml`, or switch to an allowed license.

For lock management, keep `Cargo.lock` in version control for applications and binaries and omit it for libraries, using `cargo generate-lockfile`, `cargo update`, and `cargo update -p <crate> --precise <version>`. This step is done when the lockfile matches the intended dependency versions. When an update touches unexpected crates, preview with `cargo update --dry-run` and scope with `cargo update -p <crate>`.

For one-off commands, run the matching `cargo build`, `cargo test`, `cargo tree`, `cargo expand`, or `cargo package` invocation for the requested crate and features. This step is done when the command output confirms the requested state.

## Diagnosing the real paths before blaming the build

Record the effective Cargo configuration and environment before diagnosing build placement. When resource errors name a different filesystem from the expected target directory, inspect the actual intermediate, target, temporary, and wrapper-owned paths supported by the installed Cargo and tool versions. Diagnose capacity and inode exhaustion separately. Redirect only the implicated run-owned paths and never disable a wrapper without evidence it preserves the failing environment. Never delete another user's or another run's caches. For cross-crate signature changes, enumerate reverse consumers, tests, feature combinations, and target-gated callers, since owner-crate success alone never establishes workspace compatibility. For new-warning attribution, compare complete diagnostics from matched revisions, toolchains, features, targets, and lint settings without mutating the tree under validation. Compare diagnostic identity and meaning despite shifted locations, and include affected callers, macros, and generated code rather than only textual hits in touched files.

## What you hand back

- A configured `Cargo.toml`, workspace, `build.rs`, or CI file matching the task.
- A `Cargo.lock` when needed, with deterministic dependency versions.
- A `nextest.toml` or `deny.toml` configuration when requested.
- A chat report naming the commands run and any remaining advisories or cache metrics.
Files in this package (3)
  • SKILL.md 6 KB
  • agents/openai.yaml 1 KB
  • references/workspace-patterns.md 4 KB

Versions

RepositoryScoreLicence
This page · gosuda/dalcom-skills90Apache-2.0
mohitmishra786/low-level-dev-skills100MIT
OutlineDriven/outline-driven-development90Apache-2.0

Database snapshot: 13.11.2026 · package version d0f7e7575850 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100rust-cargo-build
    Configure, operate, diagnose, and automate Cargo for Rust packages and workspaces. Cover manifests and targets, commands, dependency resolution and features, profiles, build scripts, configuration and environment variables, caches and build diagnostics, cross-compilation,…
  • 100claude-skill-rust
    Guide for Rust development including code style, testing, building, and quality checks using cargo tools. Apply when working with Rust code, Cargo.toml, or running cargo commands.
  • 100cargo
    Expert Cargo Rust package manager assistance covering workspaces, dependencies, feature flags, cross-compilation, and release profiles. Use when building, testing, and packaging Rust projects.
  • 100cargo-machete
    cargo-machete: detect unused Rust dependencies. Use when auditing Cargo.toml, optimizing build times, or cleaning up dependency bloat.
  • 100cargo-test
    Expert Cargo test assistance covering Rust unit tests, integration tests, and benchmarks. Use when running `cargo test`, writing unit tests in Rust, or debugging test failures.
  • 100package-workflow
    Prepare and validate Rust Cargo package surfaces, including Cargo.toml metadata, rust-version and MSRV policy, license/readme/repository fields, include and exclude rules, path dependency restrictions, Cargo.lock policy, cargo package dry runs, and publish versus no-publish…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.