Rust Development Workflow

Execute comprehensive Rust development workflow including cargo build, test, clippy, and fmt. Use when compiling, testing, or checking Rust code quality in the Miyabi project.

allowed_tools: Bash, Read, Grep, Glob

$ 설치

git clone https://github.com/ShunsukeHayashi/miyabi-mcp-bundle /tmp/miyabi-mcp-bundle && cp -r /tmp/miyabi-mcp-bundle/claude-plugins/miyabi-full/skills/rust-development ~/.claude/skills/miyabi-mcp-bundle

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


name: Rust Development Workflow description: Execute comprehensive Rust development workflow including cargo build, test, clippy, and fmt. Use when compiling, testing, or checking Rust code quality in the Miyabi project. allowed-tools: Bash, Read, Grep, Glob

🦀 Rust Development Workflow

Version: 2.0.0 Last Updated: 2025-11-22 Priority: ⭐⭐⭐⭐⭐ (P0 Level) Purpose: Rustビルド・テスト・品質チェックの最適化実行


📋 概要

Miyabiプロジェクトにおける完全なRust開発ワークフロー。 コード品質、型安全性、包括的テストを保証します。


🎯 P0: 呼び出しトリガー

トリガー
ビルド"build the project", "compile"
テスト"run tests", "test this"
品質チェック"check code quality", "lint"
コミット前"before committing"
新機能実装後"after implementing"

🔧 P1: コマンド別最適化

コマンド優先順位

コマンド用途平均時間頻度
cargo check型チェック(高速)10-30s
cargo buildデバッグビルド30-120s
cargo build --releaseリリースビルド60-300s
cargo testテスト実行60-180s
cargo clippyリントチェック30-60s
cargo fmtフォーマット5-10s
cargo docドキュメント生成30-60s

最適パターン

✅ GOOD: シーケンシャル実行(依存関係あり)
cargo build && cargo test && cargo clippy -- -D warnings && cargo fmt -- --check

❌ BAD: 個別実行(オーバーヘッド大)
cargo build → 結果確認 → cargo test → 結果確認 → ...

🚀 P2: ワークフロー別パターン

Pattern 1: クイックチェック(開発中)

# 最小限のチェック(2-3分)
cargo check && cargo test -- --test-threads=1

用途: コード変更の即時検証

Pattern 2: 標準ビルドサイクル(コミット前)

# フルチェック(5-10分)
cargo build --workspace && \
cargo test --workspace --all-features && \
cargo clippy --workspace --all-targets --all-features -- -D warnings && \
cargo fmt --all -- --check

用途: コミット前の品質保証

Pattern 3: クリーンビルド(問題発生時)

# クリーンビルド(10-15分)
cargo clean && \
cargo build --workspace && \
cargo test --workspace --all-features

用途: キャッシュ問題の解消

Pattern 4: リリースビルド(デプロイ前)

# リリース準備(15-20分)
cargo build --release --workspace && \
cargo test --release --workspace && \
cargo bench --no-run

用途: 本番デプロイ前の最終確認

Pattern 5: ドキュメント生成

# ドキュメント(3-5分)
cargo doc --workspace --no-deps --all-features

用途: API ドキュメント更新


⚡ P3: パフォーマンス最適化

並列ビルド設定

# CPUコア数に応じた並列度
cargo build -j 8
cargo test -- --test-threads=8

インクリメンタルビルド活用

# キャッシュ有効(高速)
target/debug/deps/
target/release/deps/

# キャッシュ無効化が必要な場合
CARGO_INCREMENTAL=0 cargo build

ビルド時間比較

条件フルビルドインクリメンタル
Debug2-3分10-30秒
Release5-10分30-60秒
Clean5-10分N/A

📊 プロジェクト固有設定

Cargo Workspace構造

miyabi-private/
├── Cargo.toml (workspace root)
├── crates/
│   ├── miyabi-types/      # コア型定義
│   ├── miyabi-core/       # 共通ユーティリティ
│   ├── miyabi-cli/        # CLIバイナリ
│   ├── miyabi-agents/     # Agent実装
│   ├── miyabi-github/     # GitHub API統合
│   ├── miyabi-worktree/   # Git Worktree管理
│   └── miyabi-llm/        # LLMプロバイダー抽象化
└── target/

依存関係チェック

# 主要依存関係
tokio         # 非同期ランタイム
async-trait   # Trait非同期メソッド
serde         # シリアライゼーション
octocrab      # GitHub API
tracing       # ログ

🛡️ エラーハンドリング

共通エラーパターン

エラー原因対処
error[E0277]Trait未実装async-trait使用確認
error[E0412]型未定義use文追加
error[E0433]モジュール未解決パス確認
Clippy警告コード品質警告に従い修正
fmt差分フォーマットcargo fmt実行

テスト失敗時

# 並列実行問題の場合
cargo test -- --test-threads=1

# 特定テストのデバッグ
cargo test test_name -- --nocapture

# 詳細出力
RUST_BACKTRACE=1 cargo test

✅ 成功基準

チェック項目基準
cargo build0 errors
cargo test100% pass
cargo clippy0 warnings
cargo fmt --check0 diff
cargo doc0 warnings

出力フォーマット

🦀 Rust Development Workflow Results

✅ Build: Success (X crates compiled)
✅ Tests: XX/XX passed (XXX assertions)
✅ Clippy: 0 warnings
✅ Format: All files properly formatted
✅ Docs: Generated successfully

Ready to commit ✓

🔗 関連ドキュメント

ドキュメント用途
context/rust.mdRust開発ガイドライン
context/rust-tool-use-rules.mdMCP Tool最適化
agents/RUST_COMMANDS_OPTIMIZATION.mdAgent向け最適化

📝 関連Skills

  • Agent Execution: Agent実行前のビルド確認
  • Git Workflow: コミット前の品質チェック
  • Security Audit: セキュリティ監査との統合

Repository

ShunsukeHayashi
ShunsukeHayashi
Author
ShunsukeHayashi/miyabi-mcp-bundle/claude-plugins/miyabi-full/skills/rust-development
3
Stars
1
Forks
Updated4d ago
Added1w ago