dnouri

tmux

8
0
# Install this skill:
npx skills add dnouri/ai-config --skill "tmux"

Install specific skill from multi-skill repository

# Description

Run dev servers, background tasks, or any long-running process in tmux sessions. Use instead of nohup or & with bash tool.

# SKILL.md


name: tmux
description: Run dev servers, background tasks, or any long-running process in tmux sessions. Use instead of nohup or & with bash tool.


tmux for Long-Running Processes

Use tmux for any process that needs to run independently (dev servers, background tasks, long-running scripts). Do not use nohup, &, or other backgrounding techniques with the bash tool.

Start a Process

tmux new-session -d -s <name> '<command> > /tmp/pi-tmux-<name>.log 2>&1'

Naming: Use descriptive names like dev-server, build-kernel, test-run.

Examples:

# Simple command
tmux new-session -d -s dev-server 'npm run dev > /tmp/pi-tmux-dev-server.log 2>&1'

# Compound commands - use braces to capture all output
tmux new-session -d -s build '{ npm install && npm run build; } > /tmp/pi-tmux-build.log 2>&1'

List Sessions

tmux ls

Read Output

For long-running processes, use log files (these persist even after the process exits):

# Read with the read tool
/tmp/pi-tmux-<name>.log

# Or tail for recent output
tail -100 /tmp/pi-tmux-<name>.log

For interactive tools (REPLs, prompts), capture the current screen:

tmux capture-pane -t <name> -p

Allow ~0.5 seconds after starting a session before reading output.

Stop a Session

tmux kill-session -t <name>

Send Input

If a process needs input:

tmux send-keys -t <name> "input text" Enter

Special keys: Enter, Escape, C-c (Ctrl+C), C-d (Ctrl+D), Up, Down, Space, BSpace (backspace)

Note: Keys are separate arguments, not escape sequences. Use "text" Enter, not "text\n".

Rules

  1. Always redirect output to /tmp/pi-tmux-<name>.log so you can read it later
  2. Use descriptive session names - they're easier to manage than PIDs
  3. Check tmux ls before creating sessions to avoid name conflicts
  4. Always clean up: kill sessions without asking; remove log files at your own discretion

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.