statusline-generator by daymade/claude-code-skills
npx skills add https://github.com/daymade/claude-code-skills --skill statusline-generator此技能提供用于创建和自定义 Claude Code 状态行的工具和指南。它生成针对竖屏优化的多行状态行,与 ccusage 集成以进行会话/每日成本跟踪,显示 git 分支状态,并支持颜色自定义。
此技能在以下情况下激活:
安装默认的多行状态行:
运行安装脚本:
bash scripts/install_statusline.sh
重启 Claude Code 以查看状态行
默认状态行显示:
用户名 (模型) [会话成本/每日成本]当前路径广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
[git:分支*+]或者,通过以下方式手动安装:
将 scripts/generate_statusline.sh 复制到 ~/.claude/statusline.sh
使其可执行:chmod +x ~/.claude/statusline.sh
更新 ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "bash /home/username/.claude/statusline.sh",
"padding": 0
}
}
状态行使用针对竖屏优化的 3 行布局:
用户名 (Sonnet 4.5 [1M]) [$0.26/$25.93]
~/workspace/java/ready-together-svc
[git:feature/branch-name*+]
优势:
通过 ccusage 进行成本跟踪:
[$会话/$每日]要求: ccusage 必须已安装并在 PATH 中。有关安装和故障排除,请参阅 references/ccusage_integration.md。
模型名称自动缩短:
"Sonnet 4.5 (with 1M token context)" → "Sonnet 4.5 [1M]""Opus 4.1 (with 500K token context)" → "Opus 4.1 [500K]"这节省了水平空间,同时保留了关键信息。
Git 分支状态显示:
* - 已修改或暂存的文件+ - 未跟踪的文件[git:main*+] - 已修改的文件和未跟踪的文件路径被缩短:
~/home/username/workspace/project → ~/workspace/project针对可见性优化的默认颜色:
\033[01;32m)\033[01;36m)\033[01;35m)\033[01;37m)\033[01;33m)\033[01;31m)通过编辑 ~/.claude/statusline.sh 并修改最终 printf 语句中的 ANSI 颜色代码来自定义颜色。有关可用颜色,请参阅 references/color_codes.md。
示例:将用户名更改为蓝色
# 找到此行:
printf '\033[01;32m%s\033[00m \033[01;36m(%s)\033[00m%s\n\033[01;37m%s\033[00m\n%s' \
# 将 \033[01;32m(绿色)更改为 \033[01;34m(蓝色):
printf '\033[01;34m%s\033[00m \033[01;36m(%s)\033[00m%s\n\033[01;37m%s\033[00m\n%s' \
通过修改最终的 printf 转换为单行布局:
# 替换为:
printf '\033[01;32m%s\033[00m \033[01;36m(%s)\033[00m:\033[01;37m%s\033[00m%s%s' \
"$username" "$model" "$short_path" "$git_info" "$cost_info"
如果 ccusage 不可用或不需要:
printf 中移除 $cost_info 的 %s有关详细信息,请参阅 references/ccusage_integration.md。
添加自定义信息(例如,主机名、时间):
# 在最终 printf 之前添加变量:
hostname=$(hostname -s)
current_time=$(date +%H:%M)
# 更新 printf 以包含新元素:
printf '\033[01;32m%s@%s\033[00m \033[01;36m(%s)\033[00m%s [%s]\n...' \
"$username" "$hostname" "$model" "$cost_info" "$current_time" ...
检查:
ccusage 是否已安装?运行 which ccusageccusage:ccusage session --json --offline -o descls -lh /tmp/claude_cost_cache_*.txt解决方案: 有关详细故障排除,请参阅 references/ccusage_integration.md。
解决方案: 使用 references/color_codes.md 为您的终端背景调整颜色。亮色 (01;3X) 通常比常规色 (00;3X) 更可见。
检查:
chmod +x ~/.claude/statusline.sh检查:
git branch --show-current包含所有功能(多行、ccusage、git、颜色)的主要状态行脚本。将其复制到 ~/.claude/statusline.sh 以供使用。
自动安装脚本,用于复制状态行脚本并更新 settings.json。
用于自定义状态行颜色的完整 ANSI 颜色代码参考。当用户请求颜色自定义时加载。
关于 ccusage 集成、缓存策略、JSON 结构和故障排除的详细说明。当用户遇到成本跟踪问题或想了解其工作原理时加载。
每周安装数
165
代码仓库
GitHub 星标数
721
首次出现
2026年1月21日
安全审计
安装于
claude-code150
opencode141
codex139
gemini-cli137
github-copilot130
cursor129
This skill provides tools and guidance for creating and customizing Claude Code statuslines. It generates multi-line statuslines optimized for portrait screens, integrates with ccusage for session/daily cost tracking, displays git branch status, and supports color customization.
This skill activates for:
Install the default multi-line statusline:
Run the installation script:
bash scripts/install_statusline.sh
Restart Claude Code to see the statusline
The default statusline displays:
username (model) [session_cost/daily_cost]current_path[git:branch*+]Alternatively, manually install by:
Copy scripts/generate_statusline.sh to ~/.claude/statusline.sh
Make it executable: chmod +x ~/.claude/statusline.sh
Update ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "bash /home/username/.claude/statusline.sh",
"padding": 0
}
}
The statusline uses a 3-line layout optimized for portrait screens:
username (Sonnet 4.5 [1M]) [$0.26/$25.93]
~/workspace/java/ready-together-svc
[git:feature/branch-name*+]
Benefits:
Cost tracking via ccusage:
[$session/$daily] in magentaRequirements: ccusage must be installed and in PATH. See references/ccusage_integration.md for installation and troubleshooting.
Model names are automatically shortened:
"Sonnet 4.5 (with 1M token context)" → "Sonnet 4.5 [1M]""Opus 4.1 (with 500K token context)" → "Opus 4.1 [500K]"This saves horizontal space while preserving key information.
Git branch status shows:
* - Modified or staged files+ - Untracked files[git:main*+] - Modified files and untracked filesPaths are shortened:
~/home/username/workspace/project → ~/workspace/projectDefault colors optimized for visibility:
\033[01;32m)\033[01;36m)\033[01;35m)\033[01;37m)\033[01;33m)\033[01;31m)Customize colors by editing ~/.claude/statusline.sh and modifying the ANSI color codes in the final printf statement. See references/color_codes.md for available colors.
Example: Change username to blue
# Find this line:
printf '\033[01;32m%s\033[00m \033[01;36m(%s)\033[00m%s\n\033[01;37m%s\033[00m\n%s' \
# Change \033[01;32m (green) to \033[01;34m (blue):
printf '\033[01;34m%s\033[00m \033[01;36m(%s)\033[00m%s\n\033[01;37m%s\033[00m\n%s' \
Convert to single-line layout by modifying the final printf:
# Replace:
printf '\033[01;32m%s\033[00m \033[01;36m(%s)\033[00m%s\n\033[01;37m%s\033[00m\n%s' \
"$username" "$model" "$cost_info" "$short_path" "$git_info"
# With:
printf '\033[01;32m%s\033[00m \033[01;36m(%s)\033[00m:\033[01;37m%s\033[00m%s%s' \
"$username" "$model" "$short_path" "$git_info" "$cost_info"
If ccusage is unavailable or not desired:
%s for $cost_info from the final printfSee references/ccusage_integration.md for details.
Add custom information (e.g., hostname, time):
# Add variable before final printf:
hostname=$(hostname -s)
current_time=$(date +%H:%M)
# Update printf to include new elements:
printf '\033[01;32m%s@%s\033[00m \033[01;36m(%s)\033[00m%s [%s]\n...' \
"$username" "$hostname" "$model" "$cost_info" "$current_time" ...
Check:
ccusage installed? Run which ccusageccusage manually: ccusage session --json --offline -o descls -lh /tmp/claude_cost_cache_*.txtSolution: See references/ccusage_integration.md for detailed troubleshooting.
Solution: Adjust colors for your terminal background using references/color_codes.md. Bright colors (01;3X) are generally more visible than regular (00;3X).
Check:
chmod +x ~/.claude/statusline.shCheck:
git branch --show-currentMain statusline script with all features (multi-line, ccusage, git, colors). Copy this to ~/.claude/statusline.sh for use.
Automated installation script that copies the statusline script and updates settings.json.
Complete ANSI color code reference for customizing statusline colors. Load when users request color customization.
Detailed explanation of ccusage integration, caching strategy, JSON structure, and troubleshooting. Load when users experience cost tracking issues or want to understand how it works.
Weekly Installs
165
Repository
GitHub Stars
721
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code150
opencode141
codex139
gemini-cli137
github-copilot130
cursor129
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
152,900 周安装