terminal-title

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Terminal Title

终端标题

Overview

概述

Automatically sets descriptive terminal window titles based on the task Claude is working on. Essential for developers running multiple Claude Code instances who need to quickly identify which terminal is handling which task.
根据Claude正在处理的任务自动设置描述性的终端窗口标题。对于运行多个Claude Code实例、需要快速识别哪个终端处理哪个任务的开发者而言,这一功能至关重要。

When to Use

使用时机

Always trigger this skill:
  • At the start of every new Claude Code session (after receiving the first user prompt)
  • When switching to a substantially different task (e.g., from "API Integration" to "Database Migration")
Trigger on task switches like these:
  • Switching from frontend work to backend work
  • Moving from debugging to new feature development
  • Changing from one module/component to a completely different one
  • Starting work on a different part of the system (e.g., from auth to payments)
Do NOT trigger for:
  • Follow-up questions about the same task ("Can you add a comment to that function?")
  • Small refinements to current work ("Make it blue instead of red")
  • Debugging the same feature you just built
  • Clarifications ("What did you mean by X?")
  • Iterating on the same component or module
  • Mid-task status updates or progress checks
务必触发此功能的场景:
  • 每个新Claude Code会话开始时(收到用户首个提示后)
  • 切换至完全不同的任务时(例如,从"API集成"切换到"数据库迁移")
此类任务切换需触发:
  • 从前端工作切换到后端工作
  • 从调试转向新功能开发
  • 从一个模块/组件切换到完全不同的模块/组件
  • 开始处理系统的不同部分(例如,从认证模块转向支付模块)
请勿触发的场景:
  • 同一任务的后续问题("能否为那个函数添加注释?")
  • 当前工作的小调整("把它改成蓝色而不是红色")
  • 调试刚构建的同一功能
  • 澄清疑问("你说的X是什么意思?")
  • 同一组件或模块的迭代优化
  • 任务进行中的状态更新或进度检查

How It Works

工作原理

  1. Extract Task Summary: Analyze the user's prompt to identify the high-level task
  2. Generate Title: Create a concise, descriptive title (max 40 characters)
  3. Set Title: Execute the
    scripts/set_title.sh
    script with the generated title
  4. No Confirmation Needed: This happens automatically in the background
  1. 提取任务摘要:分析用户的提示,识别核心任务
  2. 生成标题:创建简洁、描述性的标题(最多40个字符)
  3. 设置标题:执行
    scripts/set_title.sh
    脚本并传入生成的标题
  4. 无需确认:此过程在后台自动完成

Title Format Guidelines

标题格式指南

Good titles:
  • "API Integration: Auth Flow"
  • "Fix: Login Bug"
  • "DB Migration: Users Table"
  • "Build: Dashboard UI"
  • "Refactor: Payment Module"
Bad titles:
  • Too long: "Implementing the new authentication system with OAuth2.0 support" (exceeds 40 chars)
  • Too generic: "Working" or "Coding"
  • Too verbose: "The user wants me to help them with..."
Format pattern:
[Action/Category]: [Specific Focus]
Keep titles concise, actionable, and immediately recognizable.
优质标题示例:
  • "API Integration: Auth Flow"
  • "Fix: Login Bug"
  • "DB Migration: Users Table"
  • "Build: Dashboard UI"
  • "Refactor: Payment Module"
劣质标题示例:
  • 过长:"Implementing the new authentication system with OAuth2.0 support"(超过40字符)
  • 过于通用:"Working"或"Coding"
  • 过于冗长:"The user wants me to help them with..."
格式模板:
[Action/Category]: [Specific Focus]
标题需简洁、明确、易于快速识别。

Common Mistakes to Avoid

需避免的常见错误

❌ Too Verbose:
  • Bad: "Working on implementing the user authentication system with JWT tokens"
  • Good: "Build: JWT Auth"
❌ Too Vague:
  • Bad: "Code stuff"
  • Bad: "Working"
  • Good: "Refactor: API Layer"
❌ Including System Information:
  • Bad: "john-macbook-pro: Debug app"
  • Bad: "/Users/john/project: Build feature"
  • Good: "Debug: App Issues"
❌ Using Complete Sentences:
  • Bad: "I am working on the dashboard component"
  • Good: "Build: Dashboard UI"
❌ 过于冗长:
  • 错误示例:"Working on implementing the user authentication system with JWT tokens"
  • 正确示例:"Build: JWT Auth"
❌ 过于模糊:
  • 错误示例:"Code stuff"
  • 错误示例:"Working"
  • 正确示例:"Refactor: API Layer"
❌ 包含系统信息:
  • 错误示例:"john-macbook-pro: Debug app"
  • 错误示例:"/Users/john/project: Build feature"
  • 正确示例:"Debug: App Issues"
❌ 使用完整句子:
  • 错误示例:"I am working on the dashboard component"
  • 正确示例:"Build: Dashboard UI"

Implementation

实现方式

Execute the title script:
bash
bash scripts/set_title.sh "Your Title Here"
Example workflow:
bash
undefined
执行标题脚本:
bash scripts/set_title.sh "Your Title Here"
示例工作流:
undefined

User asks: "Help me debug the authentication flow in the API"

User asks: "Help me debug the authentication flow in the API"

bash scripts/set_title.sh "Debug: Auth API Flow"
bash scripts/set_title.sh "Debug: Auth API Flow"

User asks: "Create a React component for the user profile page"

User asks: "Create a React component for the user profile page"

bash scripts/set_title.sh "Build: User Profile UI"
bash scripts/set_title.sh "Build: User Profile UI"

User asks: "Write tests for the payment processing module"

User asks: "Write tests for the payment processing module"

bash scripts/set_title.sh "Test: Payment Module"
undefined
bash scripts/set_title.sh "Test: Payment Module"
undefined

Script Details

脚本详情

The
scripts/set_title.sh
script uses ANSI escape sequences to set the terminal title. It's compatible with:
  • macOS Terminal
  • iTerm2
  • Alacritty
  • Most modern terminal emulators (xterm, rxvt, screen, tmux)
The script accepts a single argument (the title string) and exits silently if no title is provided (fail-safe behavior).
scripts/set_title.sh
脚本使用ANSI转义序列设置终端标题。兼容以下终端:
  • macOS Terminal
  • iTerm2
  • Alacritty
  • 大多数现代终端模拟器(xterm、rxvt、screen、tmux)
该脚本接受单个参数(标题字符串),若未提供标题则静默退出(故障安全机制)。

Optional Customization

可选自定义设置

Users can optionally customize terminal titles with a prefix by setting the
CLAUDE_TITLE_PREFIX
environment variable:
bash
export CLAUDE_TITLE_PREFIX="🤖 Claude"
This produces titles like:
🤖 Claude | Build: Dashboard UI
Without the prefix, titles remain in the standard format:
Build: Dashboard UI
Note: You don't need to check for this variable or modify your behavior. The script handles this automatically.
用户可通过设置
CLAUDE_TITLE_PREFIX
环境变量,为终端标题添加可选前缀:
export CLAUDE_TITLE_PREFIX="🤖 Claude"
设置后生成的标题格式如下:
🤖 Claude | Build: Dashboard UI
若未设置前缀,标题将保持标准格式:
Build: Dashboard UI
注意: 你无需检查此变量或修改操作逻辑,脚本会自动处理这一设置。