図解ウォークスルー

Claude Code ステータスライン(statusline)の設定方法:/statusline コマンドで一発

Windows の実録画面になぞって、Claude Code のステータスラインを有効化する手順を解説。/statusline の実行、まっさらなデフォルトの選び方、生成される statusline-command.sh の承認、そして下部に表示される「ユーザー名・ディレクトリ・ブランチ・モデル・コンテキスト使用率」バーの読み方まで。

Claude Code terminal confirming Your status line is configured with a sample harddik | ~/Dvs/project | main | Claude Opus 4.6 | ctx:42% status line and an explanation of the username, directory, branch, model and context window segments
録画内の「Your status line is configured!」確認画面 — サンプル行(harddik | ~/Dvs/project | main | Claude Opus 4.6 | ctx:42%)と各セグメントの凡例。2026年3月収録。

読了約 5 分 · 図解 13 ステップ

要点だけ

claude で起動し、/statusline と入力、設定の質問に答えるだけ。Windows ではシェル設定が見つからないため、選択肢3の「まっさらなデフォルト」が最短ルート:~/.claude/statusline-command.sh を生成し、~/.claude/settings.json を更新して、ターミナル下部にユーザー名・現在のディレクトリ・Git ブランチ・モデル・コンテキスト使用率を表示します。diff の承認ダイアログで許可すれば、以降は「ステータスラインを更新して」と頼むだけで変更できます。

ソース動画について

このページの全フレームは ProgrammingKnowledge2 のスクリーン録画から — Windows の D:\Dev での Claude Code v2.1.83 セッション(Opus 4.6 · 1M コンテキスト · Claude Max)、2026年3月収録。

フレームはクレジット付きで利用し、各ステップから動画の該当秒にリンクしています。ナレーションの引用はなく、本文は画面の内容から執筆し code.claude.com/docs と突き合わせて確認しました。

ターミナルで Claude Code を開く

エディタもダッシュボードも不要。PowerShell ウィンドウ1つで完結します。

  1. 1

    CLI を起動する

    Windows PowerShell を開き(ターミナルは何でも可、録画は PowerShell)、プロジェクトフォルダに cd して claude と入力。Enter でそのディレクトリ内で CLI が起動します。

    Windows PowerShell window with the claude command typed at the PS D:\Dev> prompt to launch the Claude Code CLI
    PowerShell のプロンプトで claude 起動コマンドを入力したところ(D:\Dev)。0:18 の場面を見る
  2. 2

    ウェルカムボックス

    Claude Code はバージョン(録画では v2.1.83)、プラン、使用中のモデル — Claude Max アカウントの 1M コンテキストウィンドウ付き Opus 4.6 — を示すウェルカムボックスで迎えます。以降の操作はすべてこのターミナルセッション内で行われます。

    Claude Code v2.1.83 welcome box in a Windows terminal showing Welcome back DRIS!, the Opus 4.6 1M context window model line and the Claude Max plan for the D:\Dev project
    Claude Max プランの D:\Dev で起動した Claude Code v2.1.83 セッション。0:22 の場面を見る

/statusline コマンドを実行する

スラッシュコマンド1つで、専用のセットアップエージェントに処理が渡ります。

  1. 3

    スラッシュコマンドを入力

    入力ボックスに /statusline と打つと、補完メニューに関連コマンドが2つ表示されます:/statusline(「Set up Claude Code's status line UI」)と、バージョン・モデル・アカウント・API 接続・ツール状態をその場で表示する /status。/statusline を送信します。

    Claude Code slash command autocomplete menu listing /statusline to set up the status line UI next to /status which shows version, model, account, API connectivity and tool statuses
    コマンドメニューの /status の真上に並ぶ /statusline の補完候補。0:32 の場面を見る
  2. 4

    エージェントが引き取る

    /statusline の送信は設定のトグルではありません — statusline-setup(「Configure statusline from PS1」)という小さなセットアップエージェントが起動し、シェルとプラットフォームに合った設定を判断します。Initializing のスピナーとともに動き始めます。

    Claude Code terminal right after /statusline is submitted with the statusline-setup Configure statusline from PS1 tool call highlighted and an Initializing spinner below it
    コマンド送信直後に動き出す statusline-setup エージェント。0:42 の場面を見る

セットアップの質問に答える

Windows には変換できるシェル設定がないため、まっさらなデフォルトが最速です。

  1. 5

    既存の PS1 を探す

    エージェントはまずシェルのプロンプト定義を探し、C:\Users\<ユーザー名>\.bashrc や .bash_profile を読んで変換できる PS1 がないか確認します。この Windows マシンにはありませんでした。

    statusline-setup tool output in Claude Code showing Read calls on C:\Users\drisa\.bashrc and .bash_profile while it searches for an existing PS1 prompt definition
    .bashrc と .bash_profile を読んで PS1 を探す Read 呼び出し。0:52 の場面を見る
  2. 6

    3つの選択肢

    Windows ではエージェントが「couldn't find standard shell config files」と報告し、3つの選択肢を提示します:1. PS1 を貼って変換してもらう、2. WSL や Git Bash など別の場所にある設定ファイルを指定する、3. まっさらなステータスラインを設定する —「user, directory, model, and context usage を表示する堅実なデフォルト」。

    Claude Code reply on Windows saying the agent couldn't find standard shell config files with three numbered options to paste a PS1, point to a WSL or Git Bash config, or set up a fresh statusline showing user, directory, model and context usage
    Windows でシェル設定が見つからなかった後の質問 — 番号付き3選択肢。1:02 の場面を見る
  3. 7

    まっさらな設定を選ぶ

    動画の作者は 3 を入力します。フルリセットのデフォルトは既存のシェルプロンプトに依存しないため Windows で最短 — macOS や Linux でも PS1 を訳したくないなら同じ選択が使えます。

    Claude Code input box with the answer 3 typed beneath the three statusline setup options to request the fresh default statusline
    3 と答えてまっさらなデフォルトのステータスラインをリクエスト。1:24 の場面を見る
  4. 8

    デフォルトを生成

    回答が届くと、statusline-setup エージェントはタスクを「Setup fresh default statusline」に切り替えて設定を開始 — 何かに手を加える前に現在の ~/.claude/settings.json を読みます。

    Claude Code statusline-setup tool switching to Setup fresh default statusline with Initializing and Configuring spinners after option 3 is confirmed
    選択肢3の確定後に実行される Setup fresh default statusline。1:48 の場面を見る

生成されたスクリプトを確認・承認する

設定に手を加える前に、Claude が差分を全部見せてくれます。

  1. 9

    diff を承認

    Claude は書き込む内容をそのまま見せてくれます:ステータス JSON を jq で解析してコンテキスト率・git ブランチ・モデル名を取り出し、printf で1行に整形する小さな bash スクリプトです。ダイアログは「Do you want to make this edit to statusline-command.sh?」と尋ね — 作者は選択肢2の「Yes, and allow Claude to edit its own settings for this session」を選び、以降の変更の再承認を省きます。

    Green added-lines diff of the generated statusline-command.sh bash script in Claude Code above the Do you want to make this edit approval dialog with Yes, Yes and allow further edits, and No choices
    生成された statusline-command.sh の差分と承認ダイアログ。2:10 の場面を見る
  2. 10

    書き込まれるファイル

    承認後、ツールのアクションリストには2つの変更点が並びます:~/.claude/statusline-command.sh の作成(バーを描画するスクリプト)と ~/.claude/settings.json の更新(Claude Code にそれを実行させる設定)。

    statusline-setup tool in Claude Code listing Create C:\Users\drisa\.claude\statusline-command.sh and Update settings.json actions after the edit was approved
    アクションリストに並ぶ Create statusline-command.sh と Update settings.json。2:22 の場面を見る

設定完了を確認する

同じターミナルの下部にバーが表示され、後でカスタマイズするためのパス2つも分かります。

  1. 11

    49秒で完了

    実行は「Done (5 tool uses · 6.4k tokens · 49s)」で終了。ターミナルの下端に注目 — エージェントが説明を終える前に、新しいバー harddik | d:/Dev がすでに表示されています。

    Claude Code showing the statusline-setup result Done (5 tool uses, 6.4k tokens, 49s) with a Refining spinner while the new harddik | D:/Dev status line already renders at the bottom of the terminal
    ツール呼び出しの完了と、下部にすでに描画された本物のステータス行。2:48 の場面を見る
  2. 12

    各セグメントの意味

    確認メッセージはサンプル — harddik | ~/Dvs/project | main | Claude Opus 4.6 | ctx:42% — と凡例を示します:ユーザー名、(短縮表示の)現在のディレクトリ、リポジトリ内なら Git ブランチ、アクティブなモデル、コンテキストウィンドウ使用率。

    Claude Code confirmation reading Your status line is configured with a sample harddik | ~/Dvs/project | main | Claude Opus 4.6 | ctx:42% line and a five-item legend explaining the username, directory, branch, model and context segments
    「Your status line is configured!」— サンプル行と5セグメントの凡例。3:06 の場面を見る
  3. 13

    設定の場所

    覚えるべきパスは2つ:設定は ~/.claude/settings.json、スクリプトは ~/.claude/statusline-command.sh。表示内容を変えたくなったら、Claude に「update the status line」と頼むだけで手動編集は不要です。

    Claude Code session summary stating the config lives in ~/.claude/settings.json with the script at ~/.claude/statusline-command.sh, above the rendered harddik | d:/Dev status line at the bottom of the terminal
    2つのファイルパスを示す最終サマリーと、下部の実表示バー。3:12 の場面を見る

よくある質問