tmux terminal-multiplexer usage. Use when spawning or driving tmux sessions/windows/panes from a script or agent, capturing pane output, targeting panes by id, or when the user mentions tmux. Covers detection, spawning, send-keys, capture-pane, and lifecycle.
Ships in tmux. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Practical tmux primitives for scripting and agent automation. Examples below are
illustrative; for the drain worker's operational launch sequence see
dev-flow/scripts/drain-worker-launch.
[ -n "$TMUX" ] && echo "inside tmux"
$TMUX is set inside a tmux pane. Use it to decide between new-window (you are
inside a session) and a detached new-session (you are not).
Always target panes by their pane id (%N), never by index — indices
renumber when panes close.
# Inside an existing session: a new window, print its pane id
pane=$(tmux new-window -P -F '#{pane_id}') # -> %12
# No session yet: a detached, named session sized for a TUI
pane=$(tmux new-session -d -s mywork -x 220 -y 50 -P -F '#{pane_id}') # -> %12
A detached new-session defaults to 80×24, which cramps a full-screen TUI;
set -x/-y explicitly.
send-keys sends literal text or a key. Send text and the submit separately —
a fast/long send can race the program's input handling:
tmux send-keys -t %12 -l 'echo hello' # -l = literal text, no submit
tmux send-keys -t %12 Enter # submit (C-m also works)
tmux capture-pane -p -t %12 # print visible pane to stdout
tmux capture-pane -p -S -200 -t %12 # include 200 lines of scrollback
tmux list-sessions -F '#{session_name}'
tmux list-panes -t mywork -F '#{pane_id} #{pane_active}'
tmux kill-pane -t %12
tmux kill-session -t mywork
tmux new-window -t mywork -n build # named window in a session
tmux select-layout -t mywork tiled # even-horizontal | even-vertical | tiled | main-vertical
tmux copy-mode -t %12 # enter copy/scroll mode
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/tmux:tmuxfrom tmux
npx claudepluginhub fzymgc-house/fzymgc-house-skills --plugin tmux