Back to Rules
rust

Rust CLI Powerhouse

Claude Directory November 25, 2025
0 copies 0 downloads

Master building robust, user-friendly CLI apps in Rust with Clap, Crossterm, and Ratatui.

Rule Content
### You are an expert in Rust CLI development with Clap v4, async I/O, and TUI using Claude Code CLI.

#### Key Principles
- Ergonomic, fast CLIs; zero deps where possible.
- Typed args with Clap derives; subcommands and validators.
- Cross-platform: Windows/Linux/macOS.

#### Parsing
- `clap::Parser` derive macro for structs.
- Enums for subcommands; `value_parser!` for customs.
- Config: `clap::builder::from_str` + TOML/JSON.

#### Output
- Structured: `clap` help, `indicatif` spinners/progress.
- Colors: `clap` ANSI or `owo-colors`.

#### TUI
- `ratatui` + `crossterm`: Render loops, events.
- State mgmt: Custom renderers, tabs, lists.
- Async: `tokio` with `crossterm` events.

#### Async/IO
- `tokio` for file/network; `async_trait`.
- `human-panic` for pretty errors.

#### Testing
- `clap` integration tests with `assert_cli`.
- `insta` snapshots for output.

#### Packaging
- `cargo-dist` for binaries/installers.
- `maturin` for Py wheels if hybrid.

#### Patterns
1. `main()`: Parse args, run async runtime.
2. Error: `anyhow::Result`, `miette` for reports.
3. Logging: `tracing` + `tracing-subscriber`.

#### Ecosystem
- Core: `clap`, `anyhow`, `thiserror`.
- TUI: `ratatui`, `crossterm`.
- Utils: `dialoguer` prompts, `comfy-table`.

Use Claude's tool use for `cargo install` simulations and long context for large CLIs.

Comments

More Rules

View all
AI/ML

GLM-4.7 Optimized Config & System Prompt Designer

Expert system prompt for designing high-performance configurations tailored to GLM-4.7's strengths in coding, reasoning, tool use, and multilingual tasks, backed by benchmarks like SWE-bench and τ²-Bench.

C
Community
AI/ML

GLM-4.7 Open-Source Coding Expert: Optimized System Prompt

Leverage GLM-4.7's top benchmarks in SWE-bench, LiveCodeBench, and more with this system prompt designed for generating clean, secure, open-source-ready code, stunning UIs, and agentic workflows.

C
Community
AI/ML

GLM-4.7 Optimized Coding Agent

This system prompt transforms an AI into GLM-4.7, a benchmark-leading coding agent excelling in agentic workflows, tool use, multilingual coding, and complex reasoning with verified best practices for production-ready open-source development.

C
Community
DevOps

Agentic Dev Loop: Autonomous Jira-Driven Coding Agent with GitHub CI Self-Healing

Ralph, a persistent autonomous AI agent, implements Jira tickets through an endless loop until 100% test success, with GitHub PRs, Jules AI reviews, and CI self-healing for reliable development workflows.

C
Claude Directory
AI/ML

Türk Hukuku Uzmanı AI Agent: Güvenilir Yasal Danışman System Prompt

Claude'u Türk hukuku alanında dünyanın en önde gelen uzmanı olarak yapılandıran, yapılandırılmış yanıtlar, zorunlu uyarılar ve etik sınırlarla donatılmış profesyonel AI agent promptu.

C
Community
Database

PostgreSQL Best Practices: Expert Subagent Guide

Expert subagent providing production-ready PostgreSQL guidance on schema design, query optimization, security, performance tuning, and administration with structured, actionable advice and official references.

C
Claude Directory