使用 Zellij 终端复用器控制交互式 CLI 程序。当需要运行需要键盘交互的 TUI 应用(htop、btop、lazygit、fzf)、REPL(python、bun repl)或分页器(less、bat)时使用此技能。不适用于非交互式命令(直接用 Bash)或文件编辑(直接用 Edit 工具)。
Controls interactive CLI programs in Zellij terminal multiplexer. Use when running TUI apps (htop, lazygit), REPLs, or pagers that require keyboard input, instead of non-interactive bash commands.
/plugin marketplace add cuipengfei/prompts/plugin install zellij-control@promptsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
# 获取会话名
zellij list-sessions
# 发送文本和按键(始终以 zellij 开头,便于批量授权)
zellij -s SESSION_NAME action write-chars 'command'
zellij -s SESSION_NAME action write-chars $'\n' # Enter
zellij -s SESSION_NAME action write-chars $'\x1b' # ESC
zellij -s SESSION_NAME action write-chars $'\x03' # Ctrl+C
zellij -s SESSION_NAME action write-chars $'\x04' # Ctrl+D
zellij -s SESSION_NAME action write-chars $'\t' # Tab
zellij -s SESSION_NAME action write-chars $'\x7f' # Backspace
# 方向键
zellij -s SESSION_NAME action write-chars $'\x1b[A' # 上
zellij -s SESSION_NAME action write-chars $'\x1b[B' # 下
zellij -s SESSION_NAME action write-chars $'\x1b[C' # 右
zellij -s SESSION_NAME action write-chars $'\x1b[D' # 左
# 读取屏幕(用 /dev/shm 内存文件系统,不写磁盘)
zellij -s SESSION_NAME action dump-screen /dev/shm/zj.txt && cat /dev/shm/zj.txt
zellij -s SESSION_NAME action dump-screen --full /dev/shm/zj.txt # 含回滚历史
zellij -s SESSION_NAME action new-pane # 新窗格
zellij -s SESSION_NAME action new-pane -d right # 向右
zellij -s SESSION_NAME action new-pane -d down # 向下
zellij -s SESSION_NAME action close-pane # 关闭当前窗格
zellij -s SESSION_NAME action focus-next-pane # 下一窗格
zellij -s SESSION_NAME action move-focus right # 向右移动焦点
| 工具 | 退出键 |
|---|---|
| htop, btop, lazygit, less, bat | q |
| fzf | ESC 或 Enter |
| Python REPL | Ctrl+D ($'\x04') |
| Bun REPL | .exit + Enter |
# 1. 获取会话
zellij list-sessions
# 2. 运行交互式程序
zellij -s SESSION_NAME action write-chars 'htop'
zellij -s SESSION_NAME action write-chars $'\n'
sleep 2
# 3. 读取输出
zellij -s SESSION_NAME action dump-screen /dev/shm/zj.txt && cat /dev/shm/zj.txt
# 4. 退出程序
zellij -s SESSION_NAME action write-chars 'q'
$'\n')sleep 1-3)/dev/shm/zj.txt 避免写磁盘zellij --help、zellij action --help、zellij action <cmd> --helpzellij 开头,不要用注释或变量赋值开头,否则需要逐一授权