cargo

Manage Rust project dependencies in Cargo.toml using cargo add, remove, and upgrade.

Updated Jun 15, 2025
One-click install
npx skills add https://github.com/patrickhaahr/dotfiles --skill cargo-patrickhaahr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cargo
Source: https://github.com/patrickhaahr/dotfiles/tree/main/opencode/.config/opencode/skills/cargo
Command: npx skills add https://github.com/patrickhaahr/dotfiles --skill cargo-patrickhaahr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill eliminates the manual editing of Cargo.toml by steering dependency management through cargo add, ensuring the latest compatible versions and proper resolution.

Core Features & Use Cases

  • Add dependencies with cargo add to ensure correct versions and automatic resolution, including features, dev-dependencies, and build-dependencies where applicable.
  • Remove dependencies with cargo remove to keep Cargo.toml clean and consistent.
  • Upgrade dependencies with cargo upgrade and verify health with cargo tree and cargo outdated.

Quick Start

Use cargo add to add a dependency, for example: cargo add serde

Frequently Asked Questions about cargo

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Rust dependencies without manually editing Cargo.toml?

You can add Rust dependencies without manually editing Cargo.toml by using the cargo add command. This automatically resolves correct versions and updates the manifest, including features, dev-dependencies, and build-dependencies.

What is the best way to upgrade and remove Rust crate dependencies?

The best way to upgrade and remove Rust crate dependencies is by using cargo upgrade and cargo remove commands. These ensure your Cargo.toml stays clean and consistent with the latest compatible versions.

Does cargo add support adding dev-dependencies and build-dependencies in Rust projects?

Yes, cargo add supports adding dev-dependencies and build-dependencies in Rust projects. It ensures correct versions and automatic resolution for all dependency types, keeping your Cargo.toml properly structured.

How do I check Rust dependency health and verify outdated crates?

To check Rust dependency health and verify outdated crates, use the cargo tree and cargo outdated commands. These tools help you visualize dependency graphs and identify packages needing upgrades.

Do I need the cargo-edit extension to manage Rust dependencies with cargo commands?

Yes, you need the cargo-edit extension installed to manage Rust dependencies with cargo commands. It provides the required cargo add, cargo remove, and cargo upgrade functionality for automated Cargo.toml editing.

Why does manually editing Cargo.toml cause dependency resolution issues in Rust?

Manually editing Cargo.toml can cause dependency resolution issues because it risks incorrect version specifications and missing features. Using cargo add ensures proper version resolution and automatic feature management for Rust projects.