rust-patterns

Define Rust coding standards for naming, error handling, and database access.

Updated Jan 30, 2026
One-click install
npx skills add https://github.com/framecastdev/framecast --skill rust-patterns-framecastdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-patterns
Source: https://github.com/framecastdev/framecast/tree/main/.claude/skills/rust-patterns
Command: npx skills add https://github.com/framecastdev/framecast --skill rust-patterns-framecastdev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Establishes consistent Rust coding conventions, error handling patterns, and database access guidelines to improve code readability, maintainability, and collaboration across Rust projects.

Core Features & Use Cases

  • Naming conventions for Entities (PascalCase), DTOs (suffix with purpose), Repositories (suffix with Repository), Services (suffix with Service), Handlers (verb prefixes), and Errors (suffix with Error).
  • Standard error handling: library-level errors via thiserror, application-level errors via anyhow, and guidance for mapping to HTTP responses.
  • Database access patterns with sqlx: repository methods, transaction examples, and typical query patterns.
  • Recommended crates: axum, sqlx, serde, thiserror, anyhow, validator, tokio, etc.

Quick Start

Follow the conventions to scaffold a new Rust feature with proper naming, error handling, and data access patterns.

Frequently Asked Questions about rust-patterns

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

FAQPage Schema
What's the best way to standardize Rust error handling across library and application layers?

Standardize Rust error handling by using thiserror for library-level errors and anyhow for application-level errors. This separation provides precise error mapping for HTTP responses while maintaining flexible error context propagation in application code.

How do I structure database access patterns in Rust using sqlx?

Structure database access patterns in sqlx by defining repository methods within dedicated repository modules. This approach encapsulates transaction examples and typical query patterns, ensuring consistent data access logic across your Rust project.

What naming conventions should I use for Rust entities, services, and handlers?

Use PascalCase for Entities, suffix DTOs with their purpose, and append Repository or Service to those respective structs. Handlers should use verb prefixes, and errors must end with Error to maintain clear Rust code conventions.

Does this Rust coding convention guideline support web frameworks like axum?

Yes, these Rust coding conventions recommend using axum alongside sqlx, serde, and tokio. The guidelines include mapping application errors to HTTP responses, ensuring your axum web services follow standardized error handling and data access patterns.

How do I scaffold a new Rust feature following standard repository and service patterns?

Scaffold a new Rust feature by defining entities, creating corresponding repositories for sqlx data access, and implementing services for business logic. Apply standard naming and use thiserror or anyhow for consistent error handling throughout the module.