- name
- statusline-wizard
- description
- Interactive setup wizard for configuring Claude Code's custom status line with progress bars and customizable display options.
- disable-model-invocation
- true
# Status Line Wizard
Set up a custom status line for Claude Code with visual progress bars and configurable display options.
## Instructions
**CRITICAL**: This command MUST NOT accept any arguments. If the user provided any text after this command, COMPLETELY IGNORE it.
Follow the Setup Workflow defined in this skill (see the "Status Line Setup Skill" section below) to:
1. Detect the operating system (Mac/Linux/Windows)
2. Check for existing statusLine configuration and offer to back up if present
3. Run the configuration wizard using AskUserQuestion to gather preferences
4. Create the appropriate script file (`.sh` for Mac/Linux, `.ps1` for Windows)
5. Update `~/.claude/settings.json` with the statusLine configuration
6. Make the script executable on Mac/Linux using `chmod +x`
### Wizard Questions
Use AskUserQuestion with these grouped questions:
**Question 1 - Context Display** (multiSelect: true):
- Token count (50k/100k) - default selected
- Progress bar - default selected
- Model name - default selected
- Effort level (low/medium/high/xhigh/max/ultracode) - default selected
**Question 2 - Project Display** (multiSelect: true):
- Current directory - default selected
- Git branch - default selected
**Question 3 - Session Display** (multiSelect: true):
- Session duration - default selected
- Current time - default selected
- Claude Code version - default selected
- Session cost - NOT selected by default
**Question 4 - Usage Limits** (multiSelect: true):
- Rate limit usage (5h/7d) - default selected. Description: "Only shown on plans with rolling rate-limit windows (Pro/Max). Enterprise and API seats billed against a monthly spend cap have no rate limits, so the segment stays hidden — pick Monthly spend budget instead."
- Monthly spend budget (mo:$47.20/$2000 2.4%) - NOT selected by default. Description: "Month-to-date spend across all Claude Code sessions on this machine, as estimated locally by Claude Code. Counts only sessions rendered after setup."
AskUserQuestion allows at most 4 options per question, so rate limits and spend budget live in their own question rather than in Session Display.
**Questions 5 and 6 - Spend cap and reset** (only ask if "Monthly spend budget" was selected; send both in one AskUserQuestion call, single select each):
Question 5 - Monthly spend cap (USD):
- "No cap - show bare total" (Recommended if the user has no known cap) → `SPEND_LIMIT_USD=0`
- "$500" → `SPEND_LIMIT_USD=500`
- "$1000" → `SPEND_LIMIT_USD=1000`
- "$2000" → `SPEND_LIMIT_USD=2000`
The user can pick "Other" and type any amount; write the numeric value (digits and optional decimal point only, no currency symbol or thousands separators) into `SPEND_LIMIT_USD`. The cap is the seat's monthly spend limit shown on the Anthropic console usage page (e.g., "$0.96 of $2,000.00 spent").
Question 6 - When does the spend cap reset?
- "1st of the month at 00:00 UTC" (Recommended - what the Anthropic console uses) → `SPEND_RESET_DAY=1`, `SPEND_RESET_TIME=00:00`
- "1st of the month at midnight in my local time zone" → `SPEND_RESET_DAY=1` and `SPEND_RESET_TIME` set to local midnight converted to UTC using the machine's current offset (e.g., EDT is UTC-4, so `04:00`). Warn that daylight-saving changes shift this by an hour twice a year. If the local offset is ahead of UTC (e.g., UTC+2), local midnight on the 1st falls on the last day of the previous month in UTC, which `SPEND_RESET_DAY` (1-28) cannot express - explain this and use the UTC option instead.
- "A different day or time" → the user picks "Other" and types what the console shows, e.g. "Resets Wed, Sep 30, 8:00 PM EDT"
For "Other", convert the user's day and time to UTC before writing the variables. Example: "Sep 30, 8:00 PM EDT" is Oct 1 00:00 UTC, so write `SPEND_RESET_DAY=1` and `SPEND_RESET_TIME=00:00`. `SPEND_RESET_DAY` must be 1-28 (days 29-31 do not exist in every month) and `SPEND_RESET_TIME` must be `HH:MM` in 24-hour UTC. The script falls back to the 1st at 00:00 UTC if either value is invalid. Tell the user the UTC values you wrote so they can confirm.
### Success Message
After successful setup, display:
```
Status line configured successfully!
Script: ~/.claude/statusline.sh (or .ps1)
Settings: ~/.claude/settings.json
You should see your new status line below!
To customize later, run /statusline-edit or edit the SHOW_* variables at the top of the script file.
```
If the user enabled the monthly spend budget, append:
```
Monthly spend note: the "mo:" segment is Claude Code's local cost estimate for sessions
on this machine rendered from now on. It will not match the Anthropic console exactly;
use the console usage page for the authoritative figure.
```
---
# Status Line Setup Skill
This skill provides guidance for configuring Claude Code's status line with customizable display options, progress bars, and cross-platform support.
## When to Use This Skill
Invoke this skill when:
- Setting up a custom status line for Claude Code
- Configuring which elements to show/hide in the status line
- Adding a visual progress bar for context usage
- Setting up cross-platform status line scripts (bash/PowerShell)
## Setup Workflow
### Phase 1: Check Existing Configuration
1. Detect the operating system using Bash: `uname -s` (returns "Darwin" for macOS, "Linux" for Linux)
- If command fails or returns "MINGW"/"MSYS"/"CYGWIN", assume Windows
2. Read the user's settings file:
- **Mac/Linux**: `~/.claude/settings.json`
- **Windows**: `C:/Users/USERNAME/.claude/settings.json` (get USERNAME from environment)
3. Check if `statusLine` section already exists
4. If exists, ask user using AskUserQuestion:
- **Replace**: Back up existing file and create new configuration
- **Cancel**: Stop the setup process
### Phase 2: Configuration Wizard
Use the AskUserQuestion tool to gather user preferences. Group questions logically:
**Question 1: Context Information**
- Show model name (default: yes)
- Show token count e.g. "50k/100k" (default: yes)
- Show progress bar (default: yes)
- Show effort level e.g. "high" (default: yes)
**Question 2: Project Information**
- Show current directory (default: yes)
- Show git branch (default: yes)
**Question 3: Session Information**
- Show session cost (default: no)
- Show session duration (default: yes)
- Show current time (default: yes)
- Show Claude Code version (default: yes)
**Question 4: Usage Limits**
- Show rate limit usage - 5h and 7d windows (default: yes; hidden automatically on accounts without rolling windows)
- Show monthly spend budget - month-to-date spend across all sessions on this machine (default: no)
**Questions 5-6: Monthly spend cap and reset** (only when monthly spend budget was selected)
- Ask for the monthly cap in USD and write it to `SPEND_LIMIT_USD`; `0` means no cap (bare total)
- Ask when the cap resets and write the day of month (1-28, UTC) to `SPEND_RESET_DAY` and the time (HH:MM, 24h, UTC) to `SPEND_RESET_TIME`; convert whatever the user pastes from the console into UTC first
### Phase 3: Create Script File
Based on OS, create the appropriate script file:
**Mac/Linux**: `~/.claude/statusline.sh`
**Windows**: `C:/Users/USERNAME/.claude/statusline.ps1`
If script file already exists, back it up first with `.backup` extension.
### Phase 4: Update Settings
Update the settings.json file with the statusLine configuration:
**Mac/Linux**:
```json
{
"statusLine": {
"type": "command",
"command": "/Users/USERNAME/.claude/statusline.sh",
"padding": 0
}
}
```
**Windows**:
```json
{
"statusLine": {
"type": "command",
"command": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:/Users/USERNAME/.claude/statusline.ps1",
"padding": 0
}
}
```
### Phase 5: Make Executable (Mac/Linux only)
Run `chmod +x ~/.claude/statusline.sh` to make the script executable.
## Script Templates
### Bash Script Template (Mac/Linux)
```bash
#!/bin/bash
# =============================================================================
# Claude Code Status Line
# =============================================================================
# Configuration - Set these to customize your status line
# =============================================================================
SHOW_MODEL=true # Show model name (e.g., "Claude Opus 4.8")
SHOW_EFFORT=true # Show reasoning effort level (e.g., "high")
SHOW_TOKEN_COUNT=true # Show token usage count (e.g., "50k/100k")
SHOW_PROGRESS_BAR=true # Show visual progress bar
SHOW_DIRECTORY=true # Show current directory name
SHOW_GIT_BRANCH=true # Show current git branch
SHOW_COST=false # Show session cost (useful for API/Pro users)
SHOW_DURATION=true # Show session duration
SHOW_TIME=true # Show current time
SHOW_VERSION=true # Show Claude Code version
SHOW_RATE_LIMITS=true # Show rate limit usage (5h/7d windows; absent on Enterprise/API spend-cap seats)
SHOW_SPEND_BUDGET=false # Show month-to-date spend across all sessions on this machine (e.g., "mo:$47.20/$2000 2.4%")
SPEND_LIMIT_USD=0 # Monthly spend cap in USD for the spend segment (0 = no cap, show bare total)
SPEND_RESET_DAY=1 # Day of the month (1-28) the spend cap resets, in UTC
SPEND_RESET_TIME=00:00 # Time of day (HH:MM, 24h, UTC) the spend cap resets
# =============================================================================
input=$(cat)
model_name=$(echo "$input" | jq -r '.model.display_name')
effort_level=$(echo "$input" | jq -r '.effort.level // empty')
transcript_path=$(echo "$input" | jq -r '.transcript_path // empty')
current_dir=$(basename "$(echo "$input" | jq -r '.workspace.current_dir')")
version=$(echo "$input" | jq -r '.version')
usage=$(echo "$input" | jq '.context_window.current_usage')
host_pct=$(echo "$input" | jq -r '.context_window.used_percentage // empty')
cost=$(echo "$input" | jq -r '.cost.total_cost_usd')
duration_ms=$(echo "$input" | jq -r '.cost.total_duration_ms')
current_time=$(date +"%I:%M%p" | tr '[:upper:]' '[:lower:]')
# Ultracode reports as plain "xhigh" in the payload; detect it from the session
# transcript (the /effort command's stdout records the actual level chosen).
if [ "$effort_level" = "xhigh" ] && [ -n "$transcript_path" ] && [ -f "$transcript_path" ]; then
last_effort_set=$(grep -ho '<local-command-stdout>Set effort level to [a-z]*' "$transcript_path" 2>/dev/null | tail -1 | awk '{print $NF}')
[ "$last_effort_set" = "ultracode" ] && effort_level="ultracode"
fi
# Format cost
if [ "$cost" != "null" ] && [ -n "$cost" ]; then
cost_fmt=$(printf '$%.2f' "$cost")
else
cost_fmt='$0.00'
fi
# Format duration (ms to human readable)
if [ "$duration_ms" != "null" ] && [ -n "$duration_ms" ]; then
duration_s=$((duration_ms / 1000))
if [ $duration_s -lt 60 ]; then
duration_fmt="${duration_s}s"
elif [ $duration_s -lt 3600 ]; then
mins=$((duration_s / 60))
secs=$((duration_s % 60))
duration_fmt="${mins}m ${secs}s"
else
hours=$((duration_s / 3600))
mins=$(((duration_s % 3600) / 60))
duration_fmt="${hours}h ${mins}m"
fi
else
duration_fmt='0s'
fi
# Get git branch
git_branch=$(git -C "$(echo "$input" | jq -r '.workspace.current_dir')" branch --show-current 2>/dev/null)
if [ -z "$git_branch" ]; then
git_branch='-'
fi
# Build progress bar
build_progress_bar() {
local pct=$1
local color=$2
local bar_width=10
local filled=$((pct * bar_width / 100))
local empty=$((bar_width - filled))
local bar=""
for ((i=0; i<filled; i++)); do bar+="▓"; done
在 GitHub 查看