From charm-ruby
This skill provides comprehensive guidance for building beautiful, interactive command-line applications in Ruby using the charm-ruby ecosystem (bubbletea, lipgloss, bubbles, huh, glamour, harmonica, gum, bubblezone, ntcharts). It helps users design CLI tools with Bubble Tea's Model-View-Update architecture, style terminal output with Lipgloss, integrate pre-built Bubbles components, create interactive forms with Huh, add mouse support with Bubblezone, render terminal charts with ntcharts, and package CLI tools as Ruby gems for distribution on RubyGems.org.
npx claudepluginhub lorismaz/rails-claude-code-plugins --plugin charm-rubyThis skill uses the workspace's default tool permissions.
This skill provides comprehensive guidance for building beautiful, interactive command-line applications in Ruby using the charm-ruby ecosystem (bubbletea, lipgloss, bubbles, huh, glamour, harmonica, gum, bubblezone, ntcharts). It helps users design CLI tools with Bubble Tea's Model-View-Update architecture, style terminal output with Lipgloss, integrate pre-built Bubbles components, create int...
examples/interactive-form.rbexamples/progress-spinner.rbexamples/simple-counter.rbexamples/styled-list.rbreferences/accessibility-guidelines.mdreferences/bubble-tea-architecture.mdreferences/bubbles-components.mdreferences/bubblezone-mouse.mdreferences/cli-ux-best-practices.mdreferences/gem-distribution.mdreferences/harmonica-animation.mdreferences/huh-forms.mdreferences/lipgloss-styling.mdreferences/ntcharts-visualization.mdreferences/testing-tui-applications.mdGenerates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
This skill provides comprehensive guidance for building beautiful, interactive command-line applications in Ruby using the charm-ruby ecosystem (bubbletea, lipgloss, bubbles, huh, glamour, harmonica, gum, bubblezone, ntcharts). It helps users design CLI tools with Bubble Tea's Model-View-Update architecture, style terminal output with Lipgloss, integrate pre-built Bubbles components, create interactive forms with Huh, add mouse support with Bubblezone, render terminal charts with ntcharts, and package CLI tools as Ruby gems for distribution on RubyGems.org.
Use this skill when the user asks about:
Note: The charm-ruby gems are Ruby ports of the original Go libraries from Charm.sh. While the API is similar, some Go-specific patterns (like Goroutine initialization) have been adapted for Ruby. If you encounter unexpected behavior, check that you're using the Ruby-specific patterns shown in this documentation.
Install the core charm-ruby gems:
# Gemfile
gem "bubbletea" # MVU architecture
gem "lipgloss" # Terminal styling
gem "bubbles" # Pre-built components
gem "glamour" # Markdown rendering
gem "harmonica" # Spring animations
gem "gum" # Shell script helpers
gem "bubblezone" # Mouse event zones
gem "ntcharts" # Terminal charts
# Huh requires GitHub install until gem name resolved
gem "huh", github: "marcoroth/huh-ruby"
Then run bundle install.
Bubble Tea implements the Elm-inspired MVU pattern for building interactive terminal applications. Every Bubble Tea app has three core methods:
require "bubbletea"
class MyModel
include Bubbletea::Model
def initialize
@count = 0
end
def init
nil # No initial command
end
def update(msg)
case msg
when Bubbletea::KeyMsg
case msg.string
when "q", "ctrl+c"
return self, Bubbletea.quit
when "up", "k"
@count += 1
when "down", "j"
@count -= 1
end
end
[self, nil]
end
def view
"Count: #{@count}\n\nPress up/down to change, q to quit"
end
end
Bubbletea.run(MyModel.new)
KeyMsg, MouseMsg, or custom messages from commandsupdate, don't mutate in placeFor detailed architecture patterns, see references/bubble-tea-architecture.md.
Lipgloss provides CSS-like styling for terminal output with support for colors, borders, padding, margins, and alignment.
require "lipgloss"
# Create a style with method chaining
style = Lipgloss::Style.new
.bold(true)
.foreground("#FAFAFA")
.background("#7D56F4")
.padding(1, 2)
.border(:rounded)
.border_foreground("#FF0000")
# Apply style to text
styled_text = style.render("Hello, World!")
puts styled_text
Lipgloss automatically adapts to terminal capabilities:
"#FF5733"# Adaptive color (light bg / dark bg)
style = Lipgloss::Style.new
.foreground(Lipgloss.adaptive_color("#000000", "#FFFFFF"))
# Padding: top, right, bottom, left (or single value for all)
style.padding(1, 2, 1, 2)
# Margins
style.margin(1, 2)
# Width and alignment
style.width(40).align(:center)
# Borders: :normal, :rounded, :double, :thick, :hidden
style.border(:rounded).border_foreground("#888888")
For complete styling reference, see references/lipgloss-styling.md.
Bubbles provides ready-to-use components that integrate with Bubble Tea's MVU architecture.
| Component | Purpose |
|---|---|
| Spinner | Animated loading indicators |
| TextInput | Single-line text input with cursor |
| TextArea | Multi-line text editing |
| List | Scrollable, selectable item list |
| Table | Formatted data tables |
| Progress | Progress bar with percentage |
| Viewport | Scrollable content area |
Components maintain their own state and expose update and view methods:
require "bubbles"
class MyModel
include Bubbletea::Model
def initialize
@spinner = Bubbles::Spinner.new
@spinner.style = :dots # :line, :dots, :minidots, :jump, etc.
@loading = true
end
def init
@spinner.tick # Start spinner animation
end
def update(msg)
if @loading
spinner, cmd = @spinner.update(msg)
@spinner = spinner
return [self, cmd]
end
[self, nil]
end
def view
if @loading
"Loading... #{@spinner.view}"
else
"Done!"
end
end
end
For all component patterns, see references/bubbles-components.md.
Huh simplifies building interactive forms with validation, styling, and multiple input types.
require "huh"
form = Huh::Form.new do |f|
f.group do |g|
g.input :name, title: "What's your name?", placeholder: "Enter name..."
g.select :color, title: "Favorite color?", options: %w[Red Green Blue]
g.confirm :agree, title: "Do you agree to the terms?"
end
end
result = form.run
puts "Name: #{result[:name]}"
puts "Color: #{result[:color]}"
puts "Agreed: #{result[:agree]}"
input: Single-line text with optional validationtext: Multi-line text areaselect: Single choice from optionsmulti_select: Multiple choicesconfirm: Yes/No questionf.input :email,
title: "Email address",
validate: ->(v) { v.include?("@") ? nil : "Invalid email" }
For complete form patterns, see references/huh-forms.md.
Gum provides a Ruby interface for creating interactive shell script prompts without building full Bubble Tea applications. Perfect for quick scripts and CLI utilities.
require "gum"
# Simple text input
name = Gum.input(placeholder: "Enter your name")
# With header and default value
email = Gum.input(
header: "Contact Information",
placeholder: "email@example.com",
value: ENV["USER_EMAIL"]
)
# Single selection
color = Gum.choose("Red", "Green", "Blue", header: "Pick a color")
# Multiple selection
features = Gum.choose(
"Authentication",
"Database",
"API",
"Testing",
header: "Select features to enable",
no_limit: true # Allow multiple selections
)
# Simple yes/no
if Gum.confirm("Delete all files?")
delete_files
end
# With custom prompt
proceed = Gum.confirm(
"Deploy to production?",
affirmative: "Yes, deploy",
negative: "No, cancel"
)
# Show spinner while executing a block
result = Gum.spin(title: "Installing dependencies...") do
system("bundle install")
end
# With custom spinner style
Gum.spin(title: "Building project...", spinner: :dots) do
system("rake build")
end
# Interactive fuzzy filter
selected = Gum.filter(
items,
placeholder: "Search...",
header: "Select a file"
)
# Print styled text
Gum.style("Success!", foreground: "#00FF00", bold: true)
# Create a styled box
Gum.style(
"Welcome to My CLI",
border: :rounded,
padding: "1 2",
foreground: "#FFFFFF",
background: "#7D56F4"
)
Larger applications compose multiple components and screens:
class App
include Bubbletea::Model
SCREEN_MENU = :menu
SCREEN_FORM = :form
SCREEN_RESULT = :result
def initialize
@screen = SCREEN_MENU
@menu = MenuModel.new
@form = FormModel.new
@result = nil
end
def update(msg)
case @screen
when SCREEN_MENU
@menu, cmd = @menu.update(msg)
if @menu.selected
@screen = SCREEN_FORM
end
when SCREEN_FORM
@form, cmd = @form.update(msg)
if @form.submitted
@result = process(@form.data)
@screen = SCREEN_RESULT
end
end
[self, cmd]
end
def view
case @screen
when SCREEN_MENU then @menu.view
when SCREEN_FORM then @form.view
when SCREEN_RESULT then render_result(@result)
end
end
end
view methods fast; avoid heavy computationupdate logic by calling with mock messagesreferences/testing-tui-applications.md for comprehensive patternsreferences/cli-ux-best-practices.md for comprehensive UX patternsNO_COLOR environment variable--no-color flag for explicit controlreferences/accessibility-guidelines.md for complete guidelinesPackage your CLI as a Ruby gem for easy installation via RubyGems.org.
my-cli/
├── Gemfile
├── my-cli.gemspec
├── bin/
│ └── my-cli # Executable
├── lib/
│ ├── my_cli.rb # Main entry
│ └── my_cli/
│ ├── version.rb
│ ├── cli.rb # CLI class
│ └── model.rb # Bubble Tea model
└── README.md
Gem::Specification.new do |spec|
spec.name = "my-cli"
spec.version = MyCli::VERSION
spec.authors = ["Your Name"]
spec.summary = "A beautiful CLI tool"
spec.executables = ["my-cli"]
spec.require_paths = ["lib"]
spec.add_dependency "bubbletea"
spec.add_dependency "lipgloss"
spec.add_dependency "bubbles"
spec.required_ruby_version = ">= 2.7.0"
end
For complete distribution guide, see references/gem-distribution.md.
Working code examples are available in the examples/ directory:
simple-counter.rb - Minimal Bubble Tea applicationinteractive-form.rb - Huh form with validationstyled-list.rb - Lipgloss-styled selectable listprogress-spinner.rb - Async operation with spinner feedbackFor advanced functionality, see the detailed reference guides:
references/ntcharts-visualization.md - Terminal charts (sparklines, bar charts, line charts, heatmaps)references/bubblezone-mouse.md - Mouse event handling and clickable zonesreferences/harmonica-animation.md - Spring physics animations with angular_frequency and damping_ratioFor building production-quality CLI applications:
references/cli-ux-best-practices.md - Comprehensive CLI UX patterns (errors, help, progress, colors)references/accessibility-guidelines.md - NO_COLOR support, screen readers, keyboard navigationreferences/testing-tui-applications.md - Unit testing models, integration testing with Aruba