rust-best-practices

Guide Rust development with project structure, error handling, and tooling.

Updated Feb 12, 2026
One-click install
npx skills add https://github.com/kobogithub/knowledge --skill rust-best-practices-kobogithub
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-best-practices
Source: https://github.com/kobogithub/knowledge/tree/main/skills/rust-best-practices
Command: npx skills add https://github.com/kobogithub/knowledge --skill rust-best-practices-kobogithub

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance on Rust development best practices, helping developers write more robust, efficient, and maintainable code.

Core Features & Use Cases

  • Project Structure: Understand optimal layouts for CLI tools, libraries, and workspaces.
  • Error Handling: Learn idiomatic ways to handle errors using anyhow and thiserror.
  • Tooling: Master clap for CLI argument parsing, tracing for logging, and serde for serialization.
  • Testing: Implement unit, integration, and snapshot tests effectively.
  • CI/CD: Integrate Rust development workflows with GitHub Actions.
  • Use Case: A new Rust developer can use this Skill to quickly understand the recommended project structure, error handling patterns, and essential tooling for building a new CLI application.

Quick Start

Review the recommended project structure for a Rust CLI application.

Frequently Asked Questions about rust-best-practices

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

FAQPage Schema
What is the recommended project structure for a Rust CLI application?

The recommended Rust CLI project structure separates binaries and libraries into specific directories, allowing optimal layouts for workspaces and standalone applications. This ensures maintainable code organization and clear module boundaries.

How do I handle errors idiomatically in Rust using anyhow and thiserror?

Idiomatic Rust error handling uses thiserror for custom library error types and anyhow for flexible application-level error management. This pattern provides type-safe, context-rich error propagation throughout your binary or library code.

What's the best way to parse CLI arguments in Rust?

The best way to parse CLI arguments in Rust is using the clap crate. It provides declarative argument parsing, automatic help generation, and robust input validation for command-line applications.

Does this Rust guidance cover structured logging and serialization patterns?

This Rust guidance covers structured logging with the tracing crate and data serialization patterns using serde. These tools enable observability and efficient data format conversion across your application workflows.

How do I set up CI integration for Rust development workflows?

You can set up CI integration for Rust development workflows using GitHub Actions. This automates testing, formatting checks, and compilation, ensuring code quality standards are met before merging changes.

What testing strategies should I implement for Rust projects?

Rust testing strategies include implementing unit tests, integration tests, and snapshot tests effectively. Combining these layers ensures comprehensive coverage of internal logic and external module interfaces.