---
name: rust-pro-c700524454d5
description: Master Rust 1.75+ development with async runtime (Tokio/smol).
category: development
version: 4.1.0-fractal
layer: master-skill
---

# Rust Professional Development

> **Goal**: Write idiomatic, high-performance, and memory-safe Rust code following standard community practices (The Rust Way).

## 1. Core Principles

- **Ownership & Borrowing**: strictly enforce ownership rules. Avoid `.clone()` unless necessary. Use `Arc<Mutex<T>>` or `RwLock<T>` for shared state only when message passing (`mpsc`) is not viable.
- **Error Handling**: Use `Result<T, E>` with `thiserror` for libraries and `anyhow` for applications. Never use `.unwrap()` in production code; use `.expect()` with a context message or `?` operator.
- **Async Runtime**: Default to `tokio` for general purpose apps. Use `join_all` for parallel execution of futures.
- **Type System**: Leverage traits and generics for zero-cost abstractions. Use `New Type` pattern to enforce validation at compile time.

## 2. Toolchain & Ecosystem

- **Build System**: `cargo`
- **Linter**: `clippy` (Treat warnings as errors in CI)
- **Formatter**: `rustfmt`
- **Testing**: Built-in `#[test]` and `cargo test`. Use `mockall` for mocking traits.

## 3. Recommended Project Structure

```text
my_crate/
├── Cargo.toml
├── src/
│   ├── main.rs          # Binary entry point
│   ├── lib.rs           # Library entry point
│   ├── bin/             # Additional binaries
│   ├── models/          # Data structures
│   ├── error.rs         # Central error definition
│   └── utils.rs         # Helper functions
└── tests/               # Integration tests
    └── integration_test.rs
```

## 4. Common Dependencies (The Standard Stack)

- **Async**: `tokio`, `futures`
- **Web**: `axum` or `actix-web`
- **Serialization**: `serde`, `serde_json`
- **Error Handling**: `anyhow`, `thiserror`
- **Tracing/Logging**: `tracing`, `tracing-subscriber`
- **config**: `config` crate for environment management

## 5. Security & Performance

- **Memory**: Use `String` only when ownership is needed; prefer `&str` for function arguments.
- **Unsafe**: Avoid `unsafe` blocks unless absolutely necessary and documented with `// SAFETY:` comment explaining why it holds.
- **Vectors**: Pre-allocate vectors with `Vec::with_capacity(n)` if size is known.

## 6. Implementation Workflow

1.  **Define Types**: Start with `struct` and `enum` definitions.
2.  **Define Traits**: Outline behavior using traits.
3.  **Implement Logic**: Implement traits for types.
4.  **Wire up**: Connect components in `main.rs` or `lib.rs`.
5.  **Test**: Write unit tests alongside code and integration tests in `tests/`.

---

**Anti-Patterns to Avoid**:
- Excessive use of `Box<dyn Trait>` (prefer generics with static dispatch).
- Ignoring `Result` (always handle or propagate).
- Global mutable state (use dependency injection or actor pattern).


---
Source attribution: Dokhacgiakhoa
Original project: https://github.com/Dokhacgiakhoa/antigravity-ide/blob/c4a059bbf7a8d6b2162071f0fbfe74053faa6d20/.agent/skills/rust-pro/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Dave AI.

## Upstream license notice

MIT License

Copyright (c) 2026 Dokhacgiakhoa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

================================================================================
UNIVERSAL ACKNOWLEDGEMENTS & REFERENCES
================================================================================

This project is authored and maintained by Dokhacgiakhoa.
Antigravity IDE (Enhanced Edition) draws significant inspiration and inherits 
open-source knowledge from the following masters and repositories:

1. Antigravity Kit (Core Reference)
   - Original Author: vudovn
   - Link: https://github.com/vudovn/antigravity-kit

2. Antigravity Awesome Skills (Skill Metadata Reference)
   - Original Author: sickn33
   - Link: https://github.com/sickn33/antigravity-awesome-skills

3. UI/UX Pro Max (Design Philosophy Reference)
   - Original Author: sickn33
   - Link: https://github.com/sickn33/ui-ux-pro-max

4. Model Context Protocol (MCP) standards
   - Authors: Anthropic & Ecosystem Contributors
   - Link: https://modelcontextprotocol.io/

5. High-Performance Web Standards
   - Inspiration: Vercel Engineering & Anthony Fu (antfu)

6. Strategic Knowledge Extraction
   - Inspiration: Fabric Patterns (danielmiessler)

*Note: All trademarks and copyrights belong to their respective owners. 
The references above reflect research-level inspiration and antecedent 
contributions. These parties are not involved in the management of this repository.*



# Dave AI resource metadata

Creator / publisher: Dokhacgiakhoa
Original project: https://github.com/Dokhacgiakhoa/antigravity-ide/blob/c4a059bbf7a8d6b2162071f0fbfe74053faa6d20/.agent/skills/rust-pro/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering, Product Management
Roles: Backend Developer, DevOps / SRE, ML / AI Engineer, Product Manager, Technical Product Manager
Specialties: Word Documents, Frontend, Testing
Tools: Anyhow, Axum, Serde, Thiserror, Tokio
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 3436d27233a74ff33f1da1e0206a78af4279b786a7570facaf0137e4afcbc7d6
