name: Dependency Management for Cargo and npm
description: Manage Rust and Node.js dependencies including adding, updating, auditing, and resolving conflicts. Use when updating dependencies or resolving version conflicts.
allowed-tools: Bash, Read, Write, Edit, Grep, Glob
# 特定クレートのみ
cargo update -p tokio
# バージョン指定(Cargo.toml)
[dependencies]
tokio = "1.35" # 1.35.x の最新
Pattern 3: 依存ツリー調査
# 全体ツリー
cargo tree
# 特定クレートの依存元
cargo tree -i tokio
# 重複検出
cargo tree -d
⚡ P3: バージョン競合解決
競合パターン
パターン
症状
解決策
複数バージョン
cargo tree -d で検出
統一バージョン指定
非互換feature
コンパイルエラー
feature調整
循環依存
リンクエラー
依存構造見直し
解決例
# Cargo.toml - バージョン統一
[workspace.dependencies]
tokio = { version = "1.35", features = ["full"] }
[dependencies]
tokio = { workspace = true }
# feature競合確認
cargo tree -f "{p} {f}"
📊 Workspace依存管理
推奨構造
# ルート Cargo.toml
[workspace]
members = ["crates/*"]
[workspace.dependencies]
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }