rust-project

Guide Rust project architecture with workspace structures and async patterns.

258|26|Updated Dec 9, 2025
One-click install
npx skills add https://github.com/majiayu000/claude-arsenal --skill rust-project
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-project
Source: https://github.com/majiayu000/claude-arsenal/tree/main/skills/rust-project
Command: npx skills add https://github.com/majiayu000/claude-arsenal --skill rust-project

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Rust projects need a scalable architecture that embraces ownership, workspace patterns, and robust error handling. This Skill outlines workspace structure, async patterns, and idiomatic Rust best practices.

Core Features & Use Cases

  • Ownership-first design: Emphasizes borrow checker and zero-copy patterns.
  • Workspace structure: Encourages a Cargo workspace for multi-crate projects.
  • Async with Tokio: Recommendations for asynchronous architectures and observability.
  • Use Case: Organize a web service with multiple crates (api/core/db) in a single workspace.

Quick Start

Create a Cargo workspace with crates for api, core, and infra; add Tokio-based runtime and SQLx for data access.

Frequently Asked Questions about rust-project

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Rust project with multiple crates using workspaces?

Rust workspaces organize multi-crate projects in a single repository. Create a Cargo.toml at the root with a [workspace] section listing member crates (e.g., api, core, db), then define each crate in its own subdirectory. This enables shared dependencies, unified builds, and modular architecture for web services and libraries.

What's the best way to handle errors in Rust applications?

Use error-handling crates like thiserror for custom error types and anyhow for error wrapping in applications. Define custom error enums with derive macros, propagate errors with the ? operator, and leverage pattern matching for context-specific handling. This approach provides type safety and clear error chains across your codebase.

How do I implement async patterns in Rust with Tokio?

Tokio provides an async runtime for non-blocking I/O and concurrent tasks. Mark async functions with async/await syntax, spawn tasks with tokio::spawn, and use Tokio utilities like channels and timers. For web services, pair Tokio with frameworks like Axum to handle multiple requests concurrently with minimal overhead.

What ownership and borrowing patterns should I follow in production Rust?

Ownership patterns ensure memory safety without garbage collection. Use references for borrowed data, move ownership when necessary, and leverage zero-copy patterns through borrowing. Structure your crates to minimize cloning, pass references in public APIs, and respect the borrow checker to achieve safe, efficient code.

Can I use Serde and SQLx together in a Rust web service?

Yes. Serde serializes and deserializes data to JSON or other formats; SQLx provides type-safe database queries. Combine them: define structs with Serde derives for API serialization and SQLx derives for database mappings. This pattern ensures end-to-end type safety from database to HTTP responses.

What observability tools should I integrate into a Rust service?

Use the tracing crate for structured logging and distributed tracing. Integrate with observability backends like OpenTelemetry or vendor-specific tools. Add context propagation across async tasks and HTTP requests to track request flows, latencies, and errors in production Rust services.