用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/majiayu000/claude-skill-registry --skill interactive-menu-builder命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
LLM token logprobs and calibration. Per-decision confidence, ECE, Brier, reliability diagrams, low-confidence triage.
Analyze LLM token logprobs and calibration. Use for per-decision confidence, ECE, Brier scores, reliability diagrams, and low-confidence triage.
回顾最近 N 天的 Claude Code 使用记录——扫描原始会话数据,按主题分组汇总"我都做了什么",并从个人操作系统视角输出模式、风险与增删建议。当用户说 /recap、"看看我这几天做了什么"、"回顾一下我最近的会话"、"这两天我用 claude 干了啥"、"活动回顾" 时使用。
基于 SOC 职业分类
正在显示 SKILL.md
| name | interactive-menu-builder |
| version | 1.0.0 |
| description | Build multi-level interactive CLI menus for bash scripts |
| author | workspace-hub |
| category | bash |
| tags | ["bash","menu","cli","interactive","tui","navigation"] |
| platforms | ["linux","macos"] |
Patterns for building professional multi-level interactive menus in bash scripts. Extracted from workspace-hub's workspace CLI and repository_sync tools.
✅ Use when:
❌ Avoid when:
Single-level menu with numbered options:
#!/bin/bash
# ABOUTME: Basic interactive menu pattern
# ABOUTME: Simple numbered option selection
# Colors
CYAN='\033[0;36m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
show_menu() {
clear
echo -e "${CYAN}═══════════════════════════════════════${NC}"
echo -e "${CYAN} Main Menu${NC}"
echo -e "${CYAN}═══════════════════════════════════════${NC}"
echo ""
echo " 1) Option One"
echo " 2) Option Two"
echo " 3) Option Three"
echo ""
echo " 0) Exit"
echo ""
echo -e "${CYAN}═══════════════════════════════════════${NC}"
echo ""
}
handle_choice() {
local choice="$1"
case "$choice" in
1)
echo
;;
2)
;;
3)
;;
0)
0
;;
*)
-e
;;
}
;
show_menu
-p choice
handle_choice
-p
Hierarchical menu with breadcrumb navigation:
#!/bin/bash
# ABOUTME: Multi-level menu system with navigation stack
# ABOUTME: Pattern from workspace-hub workspace CLI
# Navigation stack
declare -a MENU_STACK=("main")
CURRENT_MENU="main"
# Menu definitions
declare -A MENU_TITLES=(
["main"]="Main Menu"
["repo"]="Repository Management"
["repo_ops"]="Repository Operations"
["compliance"]="Compliance & Standards"
["tools"]="Development Tools"
)
# Go to submenu
push_menu() {
local menu="$1"
MENU_STACK+=("$menu")
CURRENT_MENU="$menu"
}
# Go back
pop_menu() {
if [[ ${#MENU_STACK[@]} -gt 1 ]]; then
unset 'MENU_STACK[-1]'
CURRENT_MENU="${MENU_STACK[-1]}"
fi
}
# Display breadcrumb
show_breadcrumb() {
local crumb=""
for menu in "${MENU_STACK[@]}"; do
[[ -n "" ]] && crumb+=
crumb+=
-e
}
() {
clear
-e
-e
-e
show_breadcrumb
}
() {
clear
-e
show_breadcrumb
-e
}
() {
choice=
main)
1) push_menu ;;
2) push_menu ;;
3) push_menu ;;
4) run_system_config ;;
5) run_help ;;
0) 0 ;;
;;
repo)
1) run_repo_sync ;;
2) run_configure_urls ;;
3) run_check_status ;;
4) push_menu ;;
0) pop_menu ;;
;;
}
() {
main) show_main_menu ;;
repo) show_repo_menu ;;
}
;
show_current_menu
-p choice
handle_menu
Display data in formatted tables:
#!/bin/bash
# ABOUTME: Table display functions for CLI menus
# ABOUTME: Format data in aligned columns with headers
# Print table header
print_table_header() {
local -a headers=("$@")
local format=""
# Build format string
for header in "${headers[@]}"; do
format+="%-20s "
done
echo ""
printf "${CYAN}${format}${NC}\n" "${headers[@]}"
printf "${CYAN}%s${NC}\n" "$(printf '─%.0s' {1..80})"
}
# Print table row
print_table_row() {
local format=""
local -a values=("$@")
for _ in "${values[@]}"; do
format+="%-20s "
done
printf "${format}\n" "${values[@]}"
}
() {
print_table_header
repo ;
category=$(get_category )
status=$(get_status )
branch=$(get_branch )
) status= ;;
) status= ;;
) status= ;;
print_table_row
}
Let users select from a list:
#!/bin/bash
# ABOUTME: Selection list patterns
# ABOUTME: Single and multi-select from numbered lists
# Single selection
select_single() {
local prompt="$1"
shift
local -a options=("$@")
echo ""
for i in "${!options[@]}"; do
echo " $((i+1))) ${options[$i]}"
done
echo ""
echo " 0) Cancel"
echo ""
read -p "$prompt: " choice
if [[ "$choice" == "0" ]]; then
return 1
elif [[ "$choice" -ge 1 && "$choice" -le ${#options[@]} ]]; then
SELECTED="${options[$((choice-1))]}"
return 0
else
echo -e "${RED}Invalid selection"
1
}
() {
prompt=
-a options=()
-a selected=()
i ;
-p input
[[ == ]];
SELECTED=()
0
num ;
[[ -ge 1 && -le ]];
selected+=()
SELECTED=()
[[ -gt 0 ]]
}
repos=( )
select_single ;
select_multiple ;
Request user confirmation:
#!/bin/bash
# ABOUTME: Confirmation dialog patterns
# ABOUTME: Yes/No prompts with defaults
# Simple yes/no
confirm() {
local prompt="${1:-Are you sure?}"
local default="${2:-n}" # Default to no
if [[ "$default" == "y" ]]; then
prompt+=" [Y/n]: "
else
prompt+=" [y/N]: "
fi
read -p "$prompt" response
response="${response:-$default}"
[[ "${response,,}" == "y" || "${response,,}" == "yes" ]]
}
# Confirmation with explanation
confirm_action() {
local action="$1"
local details="$2"
echo ""
echo -e "${YELLOW}⚠ Confirmation Required${NC}"
echo ""
echo "Action: $action"
[[ -n ]] &&
confirm
}
() {
action=
confirm_word=
-e
-e
-p response
[[ == ]]
}
confirm ;
-rf logs/*
confirm_dangerous ;
Show progress during operations:
#!/bin/bash
# ABOUTME: Progress indicator patterns
# ABOUTME: Spinners, bars, and status updates
# Spinner
spinner() {
local pid=$1
local message="${2:-Processing}"
local spin='⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'
local i=0
while kill -0 "$pid" 2>/dev/null; do
i=$(( (i+1) % ${#spin} ))
printf "\r${CYAN}%s${NC} %s" "${spin:$i:1}" "$message"
sleep 0.1
done
printf "\r${GREEN}✓${NC} %s\n" "$message"
}
# Usage
long_running_task &
spinner $! "Running long task..."
# Progress bar
progress_bar() {
local current=$1
local total=$2
local width=40
local percent=$((current * 100 / total))
local filled=$((current * width / total))
local empty=$((width - filled))
printf
|
|
}
total=100
i $( 1 );
progress_bar
0.05
() {
message=
}
() {
message=
-e
}
() {
message=
-e
}
() {
message=
-e
}
Full implementation from workspace CLI:
#!/bin/bash
# ABOUTME: Complete multi-level menu system
# ABOUTME: Template for workspace-hub style CLI tools
set -e
# ─────────────────────────────────────────────────────────────────
# Configuration
# ─────────────────────────────────────────────────────────────────
SCRIPT_NAME="$(basename "$0")"
VERSION="1.0.0"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
MAGENTA='\033[0;35m'
BOLD='\033[1m'
NC='\033[0m'
# Menu state
CURRENT_MENU="main"
declare -a MENU_HISTORY=()
# ─────────────────────────────────────────────────────────────────
# Utility Functions
# ─────────────────────────────────────────────────────────────────
clear_screen() {
printf "\033c"
}
print_header() {
local title="$1"
local width=60
echo ""
echo -e "${CYAN}$(printf '═%.0s' $(seq 1 $width))${NC}"
printf "${CYAN}%*s${NC}\n" $(((+width)/))
-e
}
() {
[[ -gt 0 ]];
path=
menu ;
[[ -n ]] && path+=
path+=
path+=
-e
}
() {
num=
text=
desc=
[[ -n ]] &&
}
() {
-p
}
() {
MENU_HISTORY+=()
CURRENT_MENU=
}
() {
[[ -gt 0 ]];
CURRENT_MENU=
}
() {
clear_screen
print_header
print_option 1
print_option 2
print_option 3
print_option 4
print_option 5
print_option 6
print_option 0
}
() {
clear_screen
print_header
print_breadcrumb
print_option 1
print_option 2
print_option 3
print_option 4
print_option 0
}
() {
clear_screen
print_header
print_breadcrumb
print_option 1
print_option 2
print_option 3
print_option 0
}
() {
-e
-e
wait_key
}
() {
-e
wait_key
}
() {
choice=
1) navigate_to ;;
2) navigate_to ;;
3) navigate_to ;;
4) run_system_config ;;
5) run_help ;;
6) run_about ;;
0) ; 0 ;;
*) -e ; 1 ;;
}
() {
choice=
1) run_sync_repos ;;
2) run_clone_repos ;;
3) run_check_status ;;
4) navigate_to ;;
0) navigate_back ;;
*) -e ; 1 ;;
}
() {
choice=
1) run_propagate_config ;;
2) run_verify_compliance ;;
3) run_install_hooks ;;
0) navigate_back ;;
*) -e ; 1 ;;
}
() {
;
main)
show_main_menu
-p choice
handle_main_menu
;;
repo)
show_repo_menu
-p choice
handle_repo_menu
;;
compliance)
show_compliance_menu
-p choice
handle_compliance_menu
;;
*)
CURRENT_MENU=
;;
}
main
0 always goes back/exitsq as alternative to 0 for exit