技能 senior-rust-practices
🦀

senior-rust-practices

安全 🌐 網路存取📁 檔案系統存取⚙️ 外部命令

إتقان بنية مساحات العمل Rust وأفضل الممارسات

هل تواجه صعوبة في تنظيم مشاريع Rust؟ توفر هذه المهارة أنماطًا مُختبرة ميدانيًا لتصميم مساحات العمل القابلة للتوسع، من النموذج الأولي إلى الإنتاج. تعلم كيف يُنظم المطورون الأكبر سنًا قواعد بيانات Rust الكبيرة بحدود واضحة وبنية قابلة للصيانة.

支援: Claude Codex Code(CC)
📊 70 充足
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「senior-rust-practices」。 How should I structure a Rust workspace for a microservice with shared domain logic?

預期結果:

  • Use a layered architecture with 4 crates:
  • - core/: Pure domain logic, no IO dependencies
  • - storage/: Database implementations with traits
  • - api/: HTTP handlers and DTOs
  • - cli/: Binary that wires everything together
  • Keep core synchronous and free of tokio/sqlx dependencies

正在使用「senior-rust-practices」。 How do I organize dependencies in a Rust workspace?

預期結果:

  • Use workspace.dependencies in root Cargo.toml:
  • Centralize versions with: anyhow = '*', serde = { version = '*', features = ['derive'] }
  • Then reference with workspace = true in each crate
  • This prevents version drift across crates

正在使用「senior-rust-practices」。 What testing approach works best for Rust workspaces?

預期結果:

  • Follow the testing pyramid:
  • 1. Unit tests in each crate (mod tests {})
  • 2. Integration tests in crates/<crate>/tests/
  • 3. E2E tests sparingly with real dependencies
  • 4. Add property tests with procoloq for correctness-critical code

安全審計

安全
v5 • 1/16/2026

This is a documentation-only skill containing Rust best practices guidance. No executable code, scripts, or network operations exist. The static analyzer flagged documentation patterns (shell syntax in examples, git commands, file paths) as security issues, but these are all benign references within documentation. All 103 detected patterns are FALSE POSITIVES - the skill is safe for publication.

2
已掃描檔案
551
分析行數
3
發現項
5
審計總數
審計者: claude 查看審計歷史 →

品質評分

38
架構
100
可維護性
87
內容
21
社群
100
安全
91
規範符合性

你能建構什麼

Design scalable Rust architecture

Structure large Rust projects with clear crate boundaries and maintainable dependencies for teams.

Establish Rust coding standards

Define workspace conventions, testing strategies, and quality gates for Rust projects.

Set up Rust CI/CD pipelines

Implement automated testing, linting, and security checks for Rust workspaces.

試試這些提示

Workspace structure
I need to create a Rust workspace for a web service with core business logic, database layer, and API handlers. What's the recommended structure?
Dependency management
How should I organize dependencies in a workspace to avoid version conflicts and keep builds fast?
Testing strategy
What's the best testing approach for a Rust workspace with multiple crates? How do I balance unit, integration, and e2e tests?
Production readiness
What CI checks and quality gates should I implement for a production Rust service? Include tooling recommendations.

最佳實務

  • Start with 2-5 crates maximum and split only when compile times become painful
  • Use workspace.dependencies to centralize version management across all crates
  • Keep async code at the edges - make core logic synchronous when possible

避免

  • Creating too many small crates creates unnecessary complexity and maintenance burden
  • Leaking implementation details from core to other architectural layers
  • Using unwrap() in library code instead of proper error handling with thiserror

常見問題

When should I use a Rust workspace instead of a single crate?
Use workspaces when you have multiple crates that ship together, need shared CI/tooling, or have different dependency profiles.
How many crates should I have in my workspace?
Start with 2-5 crates maximum. Split only when compile times are painful or boundaries are well-defined.
Can I use async/await in my core domain logic?
Avoid async in core. Keep it synchronous and pure. Async should be at the edges where IO operations happen.
How do I manage dependencies across workspace crates?
Use workspace.dependencies in root Cargo.toml to centralize versions, then reference with workspace = true in each crate.
What testing approach works best for workspaces?
Use unit tests in each crate, integration tests at boundaries, and sparing e2e tests. Aim for a pyramid with most tests being unit tests.
How does this compare to other Rust architecture guides?
This focuses on practical production-tested patterns that emphasize keeping architectural boundaries hard and starting simple.