Marketplace

Dependency Management for Cargo and npm

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

$ Installieren

git clone https://github.com/ShunsukeHayashi/Miyabi /tmp/Miyabi && cp -r /tmp/Miyabi/packages/mcp-bundle/claude-plugins/miyabi-full/skills/dependency-management ~/.claude/skills/Miyabi

// tip: Run this command in your terminal to install the skill


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

📦 Dependency Management

Version: 2.0.0 Last Updated: 2025-11-22 Priority: ⭐⭐⭐ (P2 Level) Purpose: Cargo/npm依存関係の追加・更新・監査


📋 概要

Rust (Cargo) と Node.js (npm) の依存関係管理、 バージョン競合解決、セキュリティ監査を提供します。


🎯 P0: 呼び出しトリガー

トリガー
依存更新"update dependencies"
バージョン競合"why is there a version conflict?"
依存追加"add a new dependency"
定期更新"weekly/monthly dependency updates"

🔧 P1: コマンド一覧

Cargo(Rust)

コマンド用途頻度
cargo add <crate>依存追加
cargo update全依存更新週次
cargo update -p <crate>特定更新随時
cargo tree依存ツリー調査時
cargo auditセキュリティ監査週次
cargo-udeps未使用検出月次

npm(Node.js)

コマンド用途頻度
npm install <pkg>依存追加
npm update全依存更新週次
npm auditセキュリティ監査週次
npm outdated古い依存確認月次

🚀 P2: 更新戦略

更新頻度ガイドライン

バージョン頻度リスク
Patch (x.x.Y)週次1.0.0 → 1.0.1
Minor (x.Y.0)月次1.0.0 → 1.1.0
Major (Y.0.0)四半期1.0.0 → 2.0.0

Pattern 1: 安全な更新

# Step 1: 現状確認
cargo outdated

# Step 2: Patch更新(安全)
cargo update

# Step 3: テスト
cargo test --all

# Step 4: 監査
cargo audit

Pattern 2: 特定クレート更新

# 特定クレートのみ
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"] }
# crates/miyabi-core/Cargo.toml
[dependencies]
tokio = { workspace = true }
serde = { workspace = true }

🛡️ セキュリティ監査

自動監査設定

# 監査実行
cargo audit

# 修正可能な脆弱性を自動修正
cargo audit fix

# CI用(失敗時に終了)
cargo audit --deny warnings

未使用依存検出

# インストール
cargo install cargo-udeps

# 実行(nightly必要)
cargo +nightly udeps

✅ 成功基準

チェック項目基準
cargo audit0 vulnerabilities
cargo tree -d最小限の重複
cargo-udeps未使用なし
ビルド成功
テスト全パス

🔗 関連Skills

  • Rust Development: ビルド確認
  • Security Audit: 脆弱性対応
  • Git Workflow: 更新コミット

Repository

ShunsukeHayashi
ShunsukeHayashi
Author
ShunsukeHayashi/Miyabi/packages/mcp-bundle/claude-plugins/miyabi-full/skills/dependency-management
11
Stars
6
Forks
Updated5d ago
Added1w ago