smithery.ai

rdos-rust-patterns

Rust best practices and overall approach for R-DOS development. Use when writing Rust code, implementing features, handling errors, or structuring code in the R-DOS codebase.

First seen Apr 5, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,392 B
  • docs SUMMARY.md 200 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

R-DOS Rust Patterns

R-DOS is a retro DOS-style file manager TUI in Rust using ratatui. It recreates Q-DOS II (1991, Gazelle Systems) with modern Rust patterns.

Error Handling

// Use Result for fallible operations
pub fn load_data(&mut self) -> Result<(), String> {
    let output = Command::new("tool")
        .output()
        .map_err(|e| format!("Failed to run: {}", e))?;

    if !output.status.success() {
        return Err(String::from_utf8_lossy(&output.stderr).to_string());
    }
    Ok(())
}

State Types

Always derive common traits and use Default:

#[derive(Debug, Clone, Default)]
pub struct MyState {
    pub view: MyView,
    pub items: Vec<MyItem>,
    pub selected: usize,
    pub error: Option<String>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum MyView {
    #[default]
    List,
    Detail,
    Error,
}

External Processes

Suppress stdout/stderr for background processes:

use std::process::{Command, Stdio};

Command::new("player")
    .arg(&file_path)
    .stdout(Stdio::null())
    .stderr(Stdio::null())
    .spawn();

File Operations

Pattern for sibling file detection:

pub fn detect_siblings(&mut self) {
    let Some(ref file_path) = self.file_path else { return };
    let Some(parent) = file_path.parent() else { return };

    let mut siblings: Vec<PathBuf> = std::fs::read_dir(parent)
        .into_iter()
        .flatten()
        .filter_map(|e| e.ok())
        .map(|e| e.path())
        .filter(|p| p.is_file() && is_valid_file(p))
        .collect();

    siblings.sort();
    self.current_index = siblings.iter().position(|p| p == file_path).unwrap_or(0);
    self.sibling_files = siblings;
}

Documentation

//! Module-level doc comment
//!
//! Extended description.

/// Function documentation
pub fn my_function() { ... }

Quality Checks

Run before committing:

cargo fmt -- --check
cargo clippy -- -D warnings
cargo test

Avoid

  • Sentinel values (use Option<T>)
  • Ignoring clippy warnings
  • Hardcoded paths (use config or cwd)
  • Blocking the main thread (use background threads for long operations)