Skip to content
cccskills
FreePublished on GitHub

rust-agent-friendly-cli

Designs Rust command-line interfaces that are reliable for agents, scripts, and humans. Use when building or reviewing Rust binaries, clap command trees, diagnostics commands, codegen tools, or automation-facing workflows.

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md5.5 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Agent-Friendly CLI

Layer 2: Interface Design

Core Question

Can another agent run this command correctly without an interactive back-and-forth?

Before adding or changing a CLI:

  • Are all required decisions available as flags or stdin?
  • Does --help show the exact working examples?
  • Do failures tell the caller how to retry?

Thinking Prompt

  1. What is the automation contract?

    • Inputs: path, stdin, config file, environment, or all of them
    • Outputs: human text, JSON, files, or exit status
    • Side effects: read-only, write, network, or destructive
  2. Can it run unattended?

    • No prompts on the default path
    • Every prompt has an explicit flag alternative
    • Destructive commands have --dry-run plus --yes or --force
  3. Can failures be fixed from the message?

    • Explain what was wrong
    • Name the expected input shape
    • Include one or two exact retry commands

CLI Contract Checklist

AreaRequirement
InputAccept paths and stdin (--stdin or --input -) when useful
IdentityPreserve virtual source names with flags like --stdin-path
OutputOffer structured output such as --json for automation
HelpPut real examples in top-level and subcommand help
ErrorsReturn usage errors before doing work
SafetyRequire --dry-run and explicit confirmation for writes
Exit codesKeep stable meanings and document them

Rust Implementation Patterns

NeedRust Pattern
Command parsingclap::Parser or clap::CommandFactory
Example-rich helpafter_help / after_long_help constants
Usage validationDedicated validation function before execution
Stdin supportRead std::io::stdin() once at the command boundary
Structured outputSerialize response types with serde
Actionable errorsSmall error type with Display examples
Testingassert_cmd, snapshot tests, or parser unit tests

Exit Code Guide

CodeMeaning
0Command succeeded
1Command ran and found reportable issues or runtime failure
2Caller used the command incorrectly

Document any project-specific differences near the CLI help and tests.


Example Help Shape

Examples:
  stacc
  stacc status --json
  stacc install --editor codex --scope global --category rules --category skills --dry-run
  stacc install --editor codex --scope global --category rules --category skills --yes
  stacc sync-metadata --refresh-origin
  stacc check

Output:
  Exit 0 when the command succeeds.
  Exit 1 when the command cannot complete.
  Exit 2 for invalid command usage.

Error Message Shape

Error: install requires at least one --editor and one --category.

Examples:
  stacc install --editor codex --scope global --category rules --category skills --dry-run
  stacc install --editor codex --scope global --category rules --category skills --yes

Installability Contract

Cargo-installed binaries must work outside the checkout. For stacc, the binary owns the install engine, bundles the bootstrap script and configs, then materializes them at runtime.

cargo install --git https://github.com/heyAyushh/stacc --locked --force
stacc
stacc status --json

Use STACC_BUNDLE_ROOT=/path/to/cache when an agent needs deterministic bundle output.

Project Checks

For this repo, use the single check entrypoint:

stacc check

It runs:

  • cargo fmt --all -- --check
  • cargo test
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • bash -n install.sh
  • shellcheck -x install.sh when shellcheck is installed
  • Rust JSON validation for MCP, panel, and skill metadata files
  • cargo install --path plus installed-binary smoke checks against native Rust install planning

Use this stricter CI shape when shell lint is required:

stacc check --require-shellcheck

Quick Review Checklist

  • No required interactive prompts on automation paths
  • Every required input can be passed as a flag or stdin
  • --help includes real project commands, not placeholders
  • Usage validation happens before expensive work
  • Errors include expected shape plus retry examples
  • JSON or another stable machine format exists when output is consumed
  • Destructive paths support --dry-run and explicit confirmation
  • Help and usage errors are covered by tests

Common Mistakes

MistakeWhy WrongBetter
Prompting for required inputAgents cannot reliably answer promptsRequire flags or stdin
Hiding examples in README onlyCallers see --help firstPut examples in CLI help
Free-form output onlyScripts need stable fieldsAdd --json or a schema
Generic errorsCaller cannot self-correctInclude exact retry command
Late validationWastes work before failingValidate command shape first
Destructive defaultEasy to damage worktreesDefault to dry-run or require consent

Related Skills

  • error-handling - model usage errors and runtime failures cleanly
  • coding-guidelines - keep command modules idiomatic
  • anti-patterns - catch unwraps, panics, and hidden side effects

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Add an iOS App Clip target to an Expo app. Use when the user mentions App Clip, AASA, apple-app-site-association, appclips, smart app banner, or wants to ship a lightweight iOS Clip invoked from a URL alongside their parent app.

The English summary is being prepared. Showing the original description.

heyAyushh/stacc3Updated Sep 21, 2026

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

The English summary is being prepared. Showing the original description.

heyAyushh/stacc3Updated Sep 21, 2026

Add Agentation visual feedback toolbar to a Next.js project

The English summary is being prepared. Showing the original description.

heyAyushh/stacc3Updated Sep 21, 2026

Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.

The English summary is being prepared. Showing the original description.

heyAyushh/stacc3Updated Sep 21, 2026

Derive and implement first-principles audio-coupled haptic and kinetic UI feedback. Use when designing, reviewing, or coding haptics/audio for mobile apps, native iOS/Android, React Native/Expo, SwiftUI, games, detent pickers, toggles, sliders, page curls, scroll gestures, wallet/signature flows, Solana transactions, backend/realtime state changes, confirmations, settlements, and semantic UI events where feedback should follow signal math instead of ad hoc vibration calls.

The English summary is being prepared. Showing the original description.

heyAyushh/stacc3Updated Sep 21, 2026

Babysit a GitHub pull request during a user-approved monitoring window by polling review comments, CI checks/workflow runs, and mergeability state. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and report fresh review feedback. Use when the user asks Codex to monitor a PR, watch CI, handle review comments, or keep an eye on failures and feedback on an open PR.

The English summary is being prepared. Showing the original description.

heyAyushh/stacc3Updated Sep 21, 2026

See all skills by heyAyushh

Report a problem with this skill