Back to Skills

managing-cargo-dependencies

Cargo.toml dependency management patterns for HASH workspace. Use when adding dependencies, managing workspace dependencies, organizing Cargo.toml sections, setting version pinning, configuring default features, or working with public dependencies.

1,401stars110forksUpdated 1/23/2026

Security Assessment

Safe(100/100)
Security Score100/100

About managing-cargo-dependencies

The 'managing-cargo-dependencies' skill provides guidance on effectively managing Cargo.toml files in the HASH repository's workspace. It helps developers follow best practices for adding, updating, and removing dependencies in Rust projects. By adhering to a strict dependency management pattern, this skill ensures consistency and compatibility across different packages within the workspace. It provides a structured approach to organizing dependencies into distinct sections, making it easier to maintain large projects and collaborate within teams.

FAQ

How do I add a new dependency to my Cargo.toml?

To add a new dependency, first check if it's already listed in the workspace root Cargo.toml. If not, add it using a caret version specifier in the workspace root. Then, include it in the appropriate section (public or private) in the package's Cargo.toml using 'workspace = true'.

Can I use exact version numbers for dependencies?

No, exact version numbers with the '=' prefix are not allowed in the workspace root Cargo.toml. Instead, use caret version specifiers like '^1.2.3' for more flexible dependency management.

What does the 'public = true' flag do?

'public = true' is used to mark dependencies that are exposed in the public API of the package. This ensures that other packages can depend on them and access their functionality.

Are there any restrictions on how dependencies should be organized?

Yes, dependencies should be organized into four sections within Cargo.toml: public workspace dependencies, public third-party dependencies, private workspace dependencies, and private third-party dependencies. Each section should have a comment header, even if the section is empty.

Install managing-cargo-dependencies

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

hashintel/hash