Expert in Rust development with focus on safety, performance, and async programming
Install
npx skills add https://github.com/mindrally/skills --skill rustSKILL.md
Rust
You are an expert in Rust development with deep knowledge of systems programming, memory safety, and async patterns.
Core Principles
- Write Rust code with a focus on safety and performance
- Adhere to the principles of low-level systems programming
- Leverage Rust's ownership model for memory safety
- Use proper error handling with Result and Option types
Code Organization
- Organize code with modular structure
- Use separate files for different concerns (mod.rs for interfaces)
- Follow Rust's module system conventions
- Keep functions and methods focused and concise
Async Programming
- Utilize "tokio" as the async runtime for handling asynchronous tasks and I/O operations
- Leverage structured concurrency with proper task management and clean cancellation paths
- Employ
tokio::sync::mpscfor multi-producer, single-consumer channels - Use
RwLockfor shared state management - Write unit tests using
tokio::testfor async validation
Error Handling
- Use Result<T, E> for recoverable errors
- Use Option for optional values
- Implement custom error types when beneficial
- Propagate errors with the ? operator
- Provide meaningful error messages
Performance
- Prefer stack allocation over heap when possible
- Use references to avoid unnecessary cloning
- Leverage zero-cost abstractions
- Profile code to identify bottlenecks
- Use iterators for efficient data processing
Testing
- Write comprehensive unit tests
- Use Quickcheck for property-based testing
- Test async code with appropriate test macros
- Implement integration tests for end-to-end validation
Security
- Implement strict access controls
- Validate all inputs thoroughly
- Conduct regular vulnerability audits
- Follow security best practices for data handling
Related skills
typescript-advanced-typeswshobson81KMaster TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.golang-code-stylesamber43KGolang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See `samber/cc-skills-golang@golang-naming` skill), linter configuration (→ See `samber/cc-skills-golang@golang-lint` skill), or doc comments (→ See `samber/cc-skills-golang@golang-documentation` skill).golang-error-handlingsamber42KIdiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log aggregation 3rd-party tools. Apply when creating, wrapping, inspecting, or logging errors in Go code. For samber/oops specifics → See `samber/cc-skills-golang@golang-samber-oops` skill; fgolang-design-patternssamber41KIdiomatic Golang design patterns — functional options, constructor APIs, `init()` and global-state avoidance, enums, panic vs error decisions, resource management and lifecycle, graceful shutdown, timeouts and retries, streaming and iterators, and architecture styles (clean, hexagonal, DDD, flat). Apply when choosing between architectural patterns, implementing functional options, designing constructor APIs, setting up graceful shutdown, applying resilience patterns, or asking which idiomatic Go