Claude Codeのステータスラインをカスタマイズする
ども、大瀧です。
Claude Codeのプロンプト入力の下の数行には初期化時のエラーやShift+Tabでのモード切替など様々な情報が表示されますが、ユーザーの好みにカスタマイズすることもできます。本記事ではカスタマイズの方法をご紹介します。
また、本記事は クラスメソッド × AI駆動開発 Advent Calendar 2025 - Adventar 6日目の記事です。
ステータスラインの設定
Claude Codeでは本設定をステータスラインと呼び、スラッシュコマンド /statusline で設定変更します。
────────────────────────────────────────────────────────────────────────────────────────────────────
> /statusline
────────────────────────────────────────────────────────────────────────────────────────────────────
/statuslineコマンドの初回実行では、シェルの既存の端末文字列(PS1)を引き合いにするようですが、私の環境では設定が無かったためいくつかの候補を提案してくれました。
> /statusline is setting up statusLine…
⎿ Allowed 3 tools for this command
⏺ I'll create a task to configure your status line from your shell PS1 configuration.
⏺ statusline-setup(Configure statusLine from PS1)
⎿ Done (4 tool uses · 5.0k tokens · 11s)
⏺ The agent checked for PS1 configuration in your shell files but didn't find a custom prompt
setting, which means you're using the default shell prompt.
You have a few options for configuring your statusLine:
1. Create a default statusLine with common information like current directory and git branch
2. Create a custom statusLine based on your preferences (you can tell me what information
you'd like to display)
3. Check if you have a custom prompt configured elsewhere (for example, if you're using a
framework like Oh My Zsh or Starship)
What would you like to do? If you'd like a custom status line, just let me know what
information you want displayed (e.g., current directory, git branch, username, hostname, time,
model name, etc.).
今回は2のカスタムステータスラインを選択してみます。
────────────────────────────────────────────────────────────────────────────────────────────────────
> 2
────────────────────────────────────────────────────────────────────────────────────────────────────
⏺ Great! I'll help you create a custom statusLine. What information would you like to display in
your status line?
Some common options include:
- Current directory / working directory
- Git branch and status
- Username
- Hostname
- Current time
- Model name (e.g., "Sonnet 4.5")
- Exit status of last command
- Custom text or separators
Please let me know which elements you'd like to include, and I'll configure your statusLine
accordingly.
>
希望する表示項目を促されたので、以下のようにカレントディレクトリとGitの情報をリクエストしてみると、構成ファイルの出力形式を2通りからの選択を示されました。
────────────────────────────────────────────────────────────────────────────────────────────────────
> Current directory and Git branch / status
────────────────────────────────────────────────────────────────────────────────────────────────────
⏺ statusline-setup(Configure statusLine with directory and git)
⎿ Done (8 tool uses · 6.3k tokens · 51s)
⏺ Perfect! I've got the configuration for your statusLine. The agent provided two options to set
this up:
Option 1: Inline command (simpler)
Update your ~/.claude/settings.json with a single inline command that displays the directory
name and git status.
Option 2: Separate script file (cleaner and more maintainable)
Create a bash script at ~/.claude/statusline-command.sh and reference it in your
settings.json.
Both options will display:
- Current directory name (just the folder name, not the full path)
- Git branch (if in a git repository)
- Git status indicator (* if there are uncommitted changes)
Example outputs:
- my-project on main
- my-project on feature-branch* (with uncommitted changes)
- otaki.ryuta (when not in a git repository)
Would you like me to help you set up one of these options? I can create the necessary files
for you.
今回はシンプルに ~/.claude/settings.json ファイルにステータスラインの設定を追加する1を選択してみます。
────────────────────────────────────────────────────────────────────────────────────────────────────
> 1
────────────────────────────────────────────────────────────────────────────────────────────────────
⏺ I'll set up Option 1 for you by updating your ~/.claude/settings.json file with the inline
command configuration.
⏺ Read(.claude/settings.json)
⎿ Read 1 line
⏺ Read(.claude/settings.json)
⎿ Read 1 line
⏺ filesystem - read_text_file (MCP)(path: "/Users/otaki.ryuta/.claude/settings.json")
⎿ {
"content": ""
}
⏺ The settings file is currently empty. I'll now add the statusLine configuration with the
inline command:
⏺ Write(.claude/settings.json)
⎿ Wrote 7 lines to .claude/settings.json
{
"statusLine": {
"type": "command",
"command": "input=$(cat); cwd=$(echo \"$input\" | jq -r '.workspace.current_dir');
dir_name=$(basename \"$cwd\"); git_info=\"\"; if git -C \"$cwd\" rev-parse --git-dir >
/dev/null 2>&1; then branch=$(git -C \"$cwd\" --no-optional-locks branch --show-current
2>/dev/null); [ -z \"$branch\" ] && branch=$(git -C \"$cwd\" --no-optional-locks rev-parse
--short HEAD 2>/dev/null) && branch=\"detached:$branch\"; if ! git -C \"$cwd\"
--no-optional-locks diff --quiet 2>/dev/null || ! git -C \"$cwd\" --no-optional-locks diff
--cached --quiet 2>/dev/null; then status=\"*\"; else status=\"\"; fi; git_info=\" on
$branch$status\"; fi; echo \"$dir_name$git_info\""
}
}
(確認メッセージが出るので[1. Yes]を選択)
⏺ Perfect! I've configured your statusLine with Option 1. Your ~/.claude/settings.json file has
been updated with the inline command configuration.
Your status line will now display:
- Current directory name (just the folder name)
- Git branch (when in a git repository)
- Git status indicator (* when there are uncommitted changes)
The changes should take effect in your next Claude Code session. You'll see output like:
- otaki.ryuta (current directory, not in git)
- my-project on main (in a git repo on main branch)
- my-project on feature-branch* (with uncommitted changes)
────────────────────────────────────────────────────────────────────────────────────────────────────
>
────────────────────────────────────────────────────────────────────────────────────────────────────
otaki.ryuta
最後の「otaki.ryuta」がカレントディレクトリ名です。確かにステータスライン設定が反映されました。Gitローカルリポジトリ配下では以下のようにGitの情報も表示されます。便利ですね。
────────────────────────────────────────────────────────────────────────────────────────────────────
>
────────────────────────────────────────────────────────────────────────────────────────────────────
mcp-sample on main
仕組みとしては、シンプルにコマンドの実行結果を表示するものとのことです。以下のドキュメントに詳しい説明があります。
今回のようにコマンドで選択せずに構成ファイルに直接記述することもできるので、コマンドはステータスラインにどんな情報が出せるのかを聞きつつ、対話的にセットするものと理解しました。
まとめ
Claude Codeのプロンプト入力の下に好みの情報を表示する、ステータスライン機能をご紹介しました。補助的な情報をいろいろ表示させて、Claude Codeを便利に使っていきましょう!
参考URL








