# Dallay Corvus Rust

> Rust

- Skill: `tomevault-io/dallay-corvus-rust` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/dallay-corvus-rust`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/dallay-corvus-rust/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/dallay-corvus-rust

---


# Rust

General-purpose Rust guidance centered on correctness, clarity, safety, and maintainability.
Use this as the base skill before layering repo-specific rules.

## When to Use

- Any Rust implementation or review task
- Ownership/borrowing design questions
- `Result`/error handling decisions
- Trait and module design
- Async boundary decisions
- Test strategy and performance-sensitive changes

## Critical Patterns

### Prefer explicit ownership over accidental cloning

- Borrow first: `&str`, `&Path`, `&[T]`, `&T`
- Move ownership only when the callee truly needs it
- Clone only at real lifetime or concurrency boundaries
- Reach for `Arc<T>` only when shared ownership is required

See [references/ownership-and-borrowing.md](references/ownership-and-borrowing.md).

### Use `Result` for fallible behavior

- Model expected failures with `Result<T, E>`
- Prefer `thiserror` for domain errors in libraries/services
- Add context at orchestration boundaries
- Avoid `unwrap()` / `expect()` in production paths unless failure is truly impossible

See [references/error-handling.md](references/error-handling.md).

### Design with traits and small modules

- Keep modules focused on one concern
- Use traits for replaceable behavior and testability
- Hide internals behind small public APIs
- Prefer composition over giant god-structs and giant enums

### Test the contract, not the implementation trivia

- Add regression tests for bugs
- Keep unit tests close to the module
- Use integration tests when behavior crosses module boundaries
- Benchmark only after correctness is covered

See [references/testing-and-validation.md](references/testing-and-validation.md).

## Decision Table

| Problem | Prefer |
|---|---|
| Need read-only access | borrow |
| Need domain-specific failure | typed error enum |
| Swappable behavior | trait + small impl |
| Bug fix | failing regression test first |
| Hot path change | measure before optimizing |

## Code Examples

```rust
#[derive(thiserror::Error, Debug)]
pub enum ConfigError {
    #[error("failed to read config at {path}: {source}")]
    Read {
        path: std::path::PathBuf,
        source: std::io::Error,
    },
}
```

## Commands

```bash
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test
```

## Resources

- **References**: see [`references/`](references/)
- **Assets**: see [`assets/`](assets/) for starter templates

---
> Source: [dallay/corvus](https://github.com/dallay/corvus) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-16 -->

