agent-browser-automati…
Automate browser interactions for development testing using Puppeteer MCP
Generate production-ready Rust CLI application with modern architecture and comprehensive scaffolding
How it fires
How this command gets triggered: by you, by Claude, or both.
/scaffold-rust-cliContext preview
What this command does when you run it.
Generate production-ready Rust CLI application with modern architecture and comprehensive scaffolding
allowed-tools: Bash(cargo:*), Write, Read, Bash(mkdir:*), Bash(fd:*), Bash(rg:*), Bash(gdate:*) name: "Scaffold Rust Cli" description: "Generate production-ready Rust CLI application with modern architecture and comprehensive scaffolding" author: "wcygan" tags: ["scaffold","rust"] version: "1.0.0" created_at: "2025-07-14T00:00:00Z" updated_at: "2025-07-14T00:00:00Z"
STEP 1: Initialize project structure and validate environment
TRY:
# Create session state file
echo '{
"sessionId": "'$SESSION_ID'",
"projectName": "'$ARGUMENTS'",
"status": "initializing",
"completedSteps": [],
"dependencies": [],
"features": []
}' > /tmp/scaffold-rust-cli-$SESSION_ID.jsonIF Rust not available:
STEP 2: Configure modern Cargo.toml with production-ready dependencies
**Core Dependencies Configuration:**
[package]
name = "$ARGUMENTS"
version = "0.1.0"
edition = "2021"
authors = ["Your Name <your.email@example.com>"]
description = "A modern CLI application"
license = "MIT OR Apache-2.0"
repository = "https://github.com/username/$ARGUMENTS"
readme = "README.md"
keywords = ["cli", "terminal", "command-line"]
categories = ["command-line-utilities"]
[dependencies]
# Core CLI framework with derive features
clap = { version = "4.5", features = ["derive", "env", "color", "suggestions"] }
# Error handling and logging
anyhow = "1.0"
thiserror = "1.0"
env_logger = "0.11"
log = "0.4"
# Terminal UI and styling
colored = "2.1"
indicatif = "0.17"
dialoguer = "0.11"
console = "0.15"
# Signal handling and graceful shutdown
ctrlc = "3.4"
signal-hook = "0.3"
tokio = { version = "1.37", features = ["full"] }
# Serialization and configuration
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
toml = "0.8"
# Filesystem and path utilities
dirs = "5.0"
walkdir = "2.5"
# User experience improvements
human-panic = "2.0"
is-terminal = "0.4"
[dev-dependencies]
# Testing framework
assert_cmd = "2.0"
predicates = "3.1"
tempfile = "3.10"
tokio-test = "0.4"
[[bin]]
name = "$ARGUMENTS"
path = "src/main.rs"STEP 3: Create comprehensive project directory structure
# Navigate to project directory
cd $ARGUMENTS
# Create organized source structure
mkdir -p src/{cli,commands,config,error,utils}
mkdir -p tests/{integration,fixtures}
mkdir -p docs/examples
mkdir -p .github/workflows
# Create essential files
touch src/{main.rs,cli.rs,lib.rs}
touch src/commands/{mod.rs,init.rs,status.rs}
touch src/{config.rs,error.rs}
touch src/utils/{mod.rs,logging.rs,signals.rs}
touch tests/integration/{cli_tests.rs,command_tests.rs}
touch README.md CHANGELOG.md LICENSESTEP 4: Implement main.rs with robust architecture
**Core Application Structure:**
use anyhow::Result;
use clap::Parser;
use std::process;
mod cli;
mod commands;
mod config;
mod error;
mod utils;
use cli::Cli;
use utils::{logging, signals};
#[tokio::main]
async fn main() {
// Set up human-readable panic messages in production
human_panic::setup_panic!();
// Initialize logging early
logging::init();
// Set up graceful shutdown handling
let shutdown_handler = signals::setup_shutdown_handler();
// Parse CLI arguments
let cli = Cli::parse();
// Execute main application logic
let result = tokio::select! {
result = run_app(cli) => result,
_ = shutdown_handler => {
log::info!("Received shutdown signal, cleaning up...");
Ok(())
}
};
if let Err(err) = result {
log::error!("Application error: {:?}", err);
eprintln!("Error: {}", err);
process::exit(1);
}
}
async fn run_app(cli: Cli) -> Result<()> {
log::debug!("Starting application with args: {:?}", cli);
match cli.command {
commands::Commands::Init(args) => commands::init::execute(args).await,
commands::Commands::Status(args) => commands::status::execute(args).await,
}
}STEP 5: Implement CLI structure with clap derive patterns
**CLI Argument Parsing (src/cli.rs):**
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "$ARGUMENTS")]
#[command(about = "A modern CLI application", long_about = None)]
#[command(version, author)]
pub struct Cli {
/// Enable verbose output (-v, -vv, -vvv)
#[arg(short, long, action = clap::ArgAction::Count)]
pub verbose: u8,
/// Configuration file path
#[arg(short, long, value_name = "FILE")]
pub config: Option<PathBuf>,
/// Disable colored output
#[arg(long)]
pub no_color: bool,
/// Output format
#[arg(long, value_enum, default_value_t = OutputFormat::Human)]
pub format: OutputFormat,
#[command(subcommand)]
pub command: crate::commands::Commands,
}
#[derive(clap::ValueEnum, Clone, Debug)]
pub enum OutputFormat {
Human,
Json,
Yaml,
}STEP 6: Create modular command structure wit
A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.
Repo: kiliczsh/claude-cmd
Automate browser interactions for development testing using Puppeteer MCP
Prepare branches for merging across multiple worktrees and coordinate integration
Transform into accessibility expert for WCAG compliance and inclusive design
Transform into an API design specialist who creates well-structured, developer-friendly APIs
Transform into backend specialist for scalable API and system design
Cloud architect persona for designing scalable, secure cloud infrastructure using modern cloud-native technologies