code-quality

Enforce Rust code quality standards for error handling and correctness.

23.8k|1.2k|Updated Aug 26, 2023
One-click install
npx skills add https://github.com/tursodatabase/turso --skill code-quality-tursodatabase
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-quality
Source: https://github.com/tursodatabase/turso/tree/main/.claude/skills/code-quality
Command: npx skills add https://github.com/tursodatabase/turso --skill code-quality-tursodatabase

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

General correctness rules and Rust-pattern guidelines to maintain high-quality, reliable code. It helps teams avoid bugs and over-engineering by enforcing clear comments and robust patterns.

Core Features & Use Cases

  • Correctness-first guidelines: rules to catch edge cases, minimize unsafe code, and assert invariants.
  • Rust patterns: recommended patterns like exhaustive matching, type-safe enums, minimal allocations.
  • Code maintainability: guidelines on commenting, documentation, and avoiding structural bloat.
  • Use Case: A Rust project undergoes a code review to ensure no silent failures and prefer explicit error handling.

Quick Start

Review a Rust function to ensure it asserts invariants, uses Result<_, _>, and avoids unwraps; refactor as needed for correctness.

Frequently Asked Questions about code-quality

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

FAQPage Schema
How do I enforce Rust code quality standards during a code review?

To enforce Rust code quality during reviews, check that functions assert invariants, use explicit Result<_, _> error handling, avoid unwraps, and match exhaustively. This prevents silent failures and ensures correctness.

What are the best practices for error handling in Rust to prevent data corruption?

Best practices for Rust error handling involve preferring explicit Result<_, _> types over unwraps to avoid silent failures. Asserting invariants and using exhaustive matching further prevents data corruption and bugs.

When do I need to assert invariants in Rust functions?

You need to assert invariants in Rust functions whenever specific conditions must hold true to prevent bugs and data corruption. Asserting invariants catches edge cases early, ensuring code correctness and robustness.

How do I minimize allocations and avoid structural bloat in Rust projects?

To minimize allocations and avoid structural bloat in Rust, follow production-grade patterns like type-safe enums and minimal allocations. Clear comments and robust patterns help maintain readability and prevent over-engineering.

Can I use these code review guidelines for Rust projects of any size?

Yes, you can use these code review guidelines for Rust projects of any size. The rules scale from small functions to large refactoring tasks, guiding maintenance to ensure correctness, readability, and safety.

Why does my Rust code fail to catch edge cases during refactoring?

Rust code may fail to catch edge cases during refactoring if it lacks invariant checks and exhaustive matching. Applying correctness-first guidelines and explicit error handling prevents these silent failures.