dotfiles/dot_claude/skills/charm-ux/SKILL.md
--- name: charm-ux description: Redesign shell script UX using Charmbracelet tools (gum, glow, etc). Use when the user asks to improve, redesign, or add interactive UX to a shell script, or mentions Charmbracelet/gum/glow. allowed-tools: Read Grep Glob Bash Edit Write WebFetch compatibility: Requires gum (brew install gum). Optional: glow (brew install glow). --- # Charmbracelet UX Redesign for Shell Scripts ## When to Use - When the user asks to redesign or improve UX of a shell script - Whe
npx skillsauth add smithbr/dotfiles dotfiles/dot_claude/skills/charm-uxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
~/.claude/rules/06-shell.md for shell coding standards~/.dotfiles/dotfiles/dot_local/bin/executable_sshkey (lines 1-110 for gum wrappers, full file for usage examples)-y / FORCE flags: Non-interactive mode must work without TTYgum is the primary tool; use glow for markdown rendering if already installed; avoid requiring additional installsgum table for tabular data, gum filter for fuzzy search, gum pager for long output)Consult the official docs for the full API when designing UX:
When a tool isn't installed, check its README for capabilities that might benefit the script. Suggest installation only if clearly valuable.
Add these near the top of the script, after set -euo pipefail and variable declarations. This is the baseline — adapt, extend, or pare down to fit the script.
# -- gum helpers (graceful degradation) --
HAS_GUM=false
command -v gum >/dev/null 2>&1 && [[ -t 1 ]] && HAS_GUM=true
_header() {
if [[ "${HAS_GUM}" == true ]]; then
gum style --bold --foreground 212 "$1"
else
printf '%s\n' "$1"
fi
}
_success() {
if [[ "${HAS_GUM}" == true ]]; then
gum log --level info "$1"
else
printf '%s\n' "$1"
fi
}
_warn() {
if [[ "${HAS_GUM}" == true ]]; then
gum log --level warn "$1" >&2
else
printf '%s\n' "$1" >&2
fi
}
_check() {
if [[ "${HAS_GUM}" == true ]]; then
gum style --foreground 76 " $(printf '\xe2\x9c\x93') $1"
else
printf ' %s\n' "$1"
fi
}
_cross() {
if [[ "${HAS_GUM}" == true ]]; then
gum style --foreground 196 " $(printf '\xe2\x9c\x97') $1"
else
printf ' %s\n' "$1"
fi
}
_item() {
if [[ "${HAS_GUM}" == true ]]; then
gum style --foreground 244 " $1"
else
printf ' %s\n' "$1"
fi
}
_box() {
local content="$1"
if [[ "${HAS_GUM}" == true ]]; then
printf '%s' "${content}" | gum style --border rounded --border-foreground 240 --margin "0 0" --padding "0 1"
else
printf '%s\n' "${content}" | sed 's/^/ /'
fi
}
_spin() {
local title="$1"
shift
if [[ "${HAS_GUM}" == true ]]; then
gum spin --spinner dot --title "${title}" -- "$@"
else
"$@"
fi
}
_box() must use piped input — passing multiline content as an argument to gum style causes blank-line artifacts. Always pipe via printf '%s' "${content}" | gum style ..._header "Source: detail" (colon separator)_warn "What went wrong" followed by _warn "Tip: how to fix it" — always give the user an actionable next step_spin wraps slow commands (network calls, API requests, key generation) but not fast local operationsgum choose / gum filter — selection from a listgum input / gum write — text input (single line / multiline)gum confirm — yes/no confirmationgum spin — spinner for slow operationsgum style — styled text, bordered boxesgum table — tabular data displaygum format — markdown rendering (or use glow for richer output)gum pager — scrollable long outputgum log — leveled log messages (info, warn, error, debug)gum file — file pickergum choose to pick a command, then prompt for required argumentsread -p, read -r) with gum input / gum choose / gum confirmprintf for headers/status) with wrapper functions_spingum format or glowbash -n and shellcheck --severity=style on the resultThe wrapper pattern above is a starting point, not a straitjacket. Each script has its own workflow. Consider:
gum table for scripts that display inventories, status matrices, or config summariesgum filter for scripts with many options (fuzzy search is better than a long gum choose list)gum pager for scripts that dump long logs or diffsgum write for scripts that accept multiline input (commit messages, notes)glow for scripts with rich help docs or README-style output--border double, --border thick, --border hidden depending on visual hierarchygum join --vertical / --horizontal for dashboard-style outputWhen deviating, document why in a code comment so future maintainers understand the choice.
HAS_GUM detection present (with TTY check)-y / FORCE / non-interactive flags bypass all prompts"Name: detail" format_spinbash -n passesshellcheck --severity=style passesscript | cat produces readable plain text)testing
Audit agent skills for compliance with the AgentSkills specification. Use when adding, modifying, or reviewing skills in the skills directory.
development
Audit and refactor shell scripts for consistency, safety, and modern best practices. Use when adding, modifying, or reviewing shell scripts.
development
Reviews code for security issues including injection vulnerabilities, auth flaws, and secrets in code.
testing
Stage and commit changes with a concise message. Use when the user asks to commit.