About ruby-cli
A skill for building Ruby command-line tools with Thor and Zeitwerk. It provides navigation for bootstrapping gems, adding commands, and creating terminal interfaces with Gum.
Key features
- 01Guidance for starting a CLI gem
- 02Thor command and subcommand patterns
- 03Zeitwerk autoloading conventions
- 04Thor output styling guidance
- 05Gum components for rich terminal interfaces
Use cases
- 01Bootstrap a Ruby CLI gem
- 02Add commands or subcommands to a tool
- 03Build terminal tables, prompts, or progress indicators
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ steveclarke/ dotfiles --skill ruby-cliAfter installing, type/ruby-cliin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/bootstrap.mdgum.mdpatterns.mdDetails
From the project READMERuby CLI Development
Build Ruby CLI tools using Thor for commands and Zeitwerk for autoloading.
Quick Navigation
- Starting a new CLI gem from scratch? See references/bootstrap.md
- Adding commands or subcommands? See references/patterns.md
- Thor syntax reference? See references/patterns.md
- Rich terminal UI with Gum? See references/gum.md
Core Principles
- Use compact class declarations:
class GemName::Cli::Main < GemName::Cli::Base - Use
extend selfinstead ofmodule_functionfor utility modules - Keep the Base class lean - add helpers as patterns emerge
Output Styling
For basic output, use Thor's built-in say "message", :color.
For rich terminal UI (headers, tables, spinners, confirmations), use the Gum gem:
ui.header("Section Title") # branded header with border
ui.success("Done!") # green checkmark
ui.error("Failed") # red X
ui.table(rows, columns: [...]) # formatted table
ui.spin("Working...") { ... } # spinner during work
See references/gum.md for setup and full API.
Tips & Gotchas
- Add
# rubocop:disable Rails/Outputto UI modules (stdout is intentional in CLIs) - The gum gem bundles the gum binary for common platforms;
GUM_INSTALL_DIRpoints it at a system install elsewhere
Comments
Markdown supported