SuperAPI AI Directory

rust development workflow

Coding & development

View repository

Updated 10-16 04:42

About this skill

🦀 Rust Development Workflow

Version: 2.0.0 Last Updated: 2025-11-22 Priority: ⭐⭐⭐⭐⭐ (P0 Level) Purpose: Optimized execution of Rust build, test, and quality checks


📋 Overview

Complete Rust development workflow in the Miyabi project. Ensures code quality, type safety, and comprehensive testing.


🎯 P0: Invocation Triggers

Trigger Example
Build "build the project", "compile"
Test "run tests", "test this"
Quality check "check code quality", "lint"
Before commit "before committing"
After implementing a new feature "after implementing"

🔧 P1: Per-Command Optimization

Command Priority

Command Purpose Average time Frequency
cargo check Type check (fast) 10-30s High
cargo build Debug build 30-120s High
cargo build --release Release build 60-300s Low
cargo test Test execution 60-180s High
cargo clippy Lint check 30-60s Medium
cargo fmt Format 5-10s High
cargo doc Documentation generation 30-60s Low

Optimal Patterns

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

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

🚀 P2: Per-Workflow Patterns

Pattern 1: Quick check (during development)

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

Purpose: Immediate verification of code changes

Pattern 2: Standard build cycle (before commit)

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

Purpose: Quality assurance before commit

Pattern 3: Clean build (when problems occur)

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

Purpose: Resolving cache issues

Pattern 4: Release build (before deployment)

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

Purpose: Final check before production deployment

Pattern 5: Documentation generation

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

Purpose: API documentation update


⚡ P3: Performance Optimization

Parallel build settings

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

Leveraging incremental builds

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

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

Build time comparison

Condition Full build Incremental
Debug 2-3 minutes 10-30 seconds
Release 5-10 minutes 30-60 seconds
Clean 5-10 minutes N/A

📊 Project-Specific Settings

Cargo Workspace structure

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/

Dependency check

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

🛡️ Error Handling

Common error patterns

Error Cause Action
error[E0277] Trait not implemented async-traitCheck usage
error[E0412] Type undefined useAdd statement
error[E0433] Module unresolved Check path
Clippy warning Code quality Fix according to the warning
fmt diff Formatting cargo fmtExecute

When tests fail

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

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

# 詳細出力
RUST_BACKTRACE=1 cargo test

✅ Success Criteria

Check item Criteria
cargo build 0 errors
cargo test 100% pass
cargo clippy 0 warnings
cargo fmt --check 0 diff
cargo doc 0 warnings

Output Format

🦀 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 ✓

🔗 Related Documentation

Documentation Purpose
context/rust.md Rust Development Guidelines
context/rust-tool-use-rules.md MCP Tool Optimization
agents/RUST_COMMANDS_OPTIMIZATION.md Optimization for Agents

📝 Related Skills

  • Agent Execution: Build verification before Agent execution
  • Git Workflow: Quality check before commit
  • Security Audit: Integration with security audits