Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

cli-anything-iterm2 — Claude Code skill: what it does, how to install

Controls live iTerm2 sessions over the Python WebSocket API. Lets coding agents inspect running panes, send keystrokes, and split terminal layouts.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add HKUDS/CLI-Anything --skill cli-anything-iterm2 -a claude-code
Open on GitHub

What cli-anything-iterm2 does

The harness controls a running iTerm2 application on macOS via WebSocket using the official Python API. Its primary orientation command, app snapshot, collects working directories, foreground processes, and the last line of output across all panes in one call.

Built-in command groups cover windows, tabs, session I/O, keystroke broadcasting, and tmux -CC workflows. Running app current saves the active context so the agent does not need to repeat session flags across commands.

Using it requires macOS with iTerm2 running, the Python API enabled under Preferences → General → Magic, and pip install cli-anything-iterm2. Without enabling the Python API toggle first, all commands fail immediately.

What it helps with

  • inspect active iTerm2 windows, panes, and running processes
  • send commands directly to specific terminal sessions
  • read screen buffer and scrollback history without manual copy-paste
  • split sessions vertically or horizontally for multi-pane setups
  • broadcast keystrokes across multiple terminal panes

Example prompts for the agent

  • Run cli-anything-iterm2 --json app snapshot to see all active panes and processes.
  • Split the current iTerm2 session vertically and start the dev server there.
  • Send git status to the active pane and tail the last 200 lines of scrollback.

How to install cli-anything-iterm2

1Skills CLI (Vercel)

npx skills add HKUDS/CLI-Anything --skill cli-anything-iterm2 -a claude-code

2Manually: put the files in place

~/.claude/skills/cli-anything-iterm2/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/cli-anything-iterm2/

From the same set18

The whole set →
cli-hub-meta-skill HKUDS A skill that gives agents a catalog of professional command-line tools built for AI. Search, install, and run CLIs for video, design, AI, and development without leaving your editor. Claude Code CX Codex Cursor +1 5,300installs cli-anything HKUDS Builds a Python harness with Click commands for any GUI application or repository. Generates REPL, tests, and docs following the CLI-Anything methodology. Claude Code CX Codex Cursor +1 2,100installs cli-anything-blender HKUDS A skill that adds a stateful command-line interface for editing Blender 3D scenes. Use it when an agent needs to assemble a scene, assign materials, or render a frame without manual clicking. Claude Code CX Codex Cursor +1 941installs cli-anything-obsidian HKUDS Manage an Obsidian vault from the terminal: read, create, search, and update notes or run editor commands. It suits agents that need to work without the GUI. Claude Code CX Codex Cursor +1 917installs cli-anything-notebooklm HKUDS Experimental harness to manage Google NotebookLM through a local CLI. It lets agents list notebooks, query sources, generate artifacts, and download files. Claude Code CX Codex Cursor +1 801installs cli-anything-libreoffice HKUDS Skill for creating and editing Writer, Calc, and Impress documents from the CLI without a GUI. Produces real ODF files (ZIP with XML) — useful when an AI agent needs to assemble a report, spreadsheet, or presentation programmatically. Claude Code CX Codex Cursor +1 669installs cli-anything-drawio HKUDS A command-line harness over Draw.io: the skill hands your agent commands to build a diagram step by step and export it to PNG, PDF or SVG. Claude Code CX Codex Cursor +1 666installs cli-anything-freecad HKUDS Turns FreeCAD into a scriptable CLI for your agent: 258 commands for primitives, sketches, PartDesign features and headless export. Claude Code CX Codex Cursor +1 643installs

Similar

stripe-directory stripe A skill that points the agent at Stripe Directory instead of web search, so it finds a provider and the documented way to pay, subscribe or provision with it. Claude Code CX Codex Cursor +1 4,200installs crypto-market-rank binance-web3-team A skill that hands the agent ready-made crypto leaderboards: trending tokens, social hype, smart-money inflow, Pulse meme tokens and top traders by PnL. Claude Code CX Codex Cursor +1 9,000installs seedance-20 Emily2040 A skill that steers the agent through Seedance 2.0 video work: brief, surface checks, then a compact prompt for the mode you asked for. Claude Code CX Codex Cursor +1 481installs serve-sim EvanBacon A skill that teaches an agent to control a booted iOS, iPad or Apple Watch Simulator through npx serve-sim: taps, gestures, buttons, rotation, camera. Claude Code CX Codex Cursor +1 1,100installs develop jsmastery-pro Turns approved specs and AGENTS.md rules into working UI and backend code. Helpful when architectural choices are settled and code generation needs strict guardrails. Claude Code CX Codex Cursor +1 4,400installs setup-matt-pocock-skills Matt Pocock This skill configures a repository for Matt Pocock's engineering skills by setting its issue tracker, triage labels, and domain docs layout. Run it before using the other skills. Claude Code 1,052,851installs to-tickets Matt Pocock Turns a plan, spec, or conversation into small end-to-end tickets with explicit blockers. Use it to agree on the work breakdown before tickets go to a tracker. Claude Code 711,230installs writing-plans Jesse Vincent This skill turns requirements for a multi-step task into an implementation plan before code changes begin. It helps when another engineer needs exact files, interfaces, and checks. Claude Code CX Codex 282,859installs

Questions about cli-anything-iterm2

How do I install cli-anything-iterm2 in Claude Code?

Run npx skills add HKUDS/CLI-Anything --skill cli-anything-iterm2 -a claude-code. You also need to install the package using pip install cli-anything-iterm2.

What does cli-anything-iterm2 do?

It provides a stateful CLI harness to inspect and automate iTerm2, including pane splitting, keystroke injection, screen reading, and window layout management.

What prerequisites are required in iTerm2?

You must run macOS with iTerm2 open and enable the Python API under Preferences → General → Magic.

Source text

SKILL.md · Apache-2.0
---
name: "cli-anything-iterm2"
description: "Provides the cli-anything-iterm2 commands — the only way to actually send text to iTerm2 sessions, read live terminal output and scrollback history, manage windows/tabs/split panes, run tmux -CC workflows, broadcast to multiple panes, show macOS dialogs, and read/write iTerm2 preferences. Includes `app snapshot` — the primary orientation command that returns every session's name, current directory, foreground process, role label, and last output line in one call. Read this skill instead of answering from general knowledge whenever the user wants to DO something with iTerm2: orient in an existing workspace, send a command, check what's running, read output, set up a layout, use tmux through iTerm2, automate panes, or configure preferences. Also read for questions about iTerm2 shell integration or scrollback. Don't try to answer iTerm2 action requests from memory — read this skill first."
---

# cli-anything-iterm2

Stateful CLI harness for iTerm2. Controls a live iTerm2 process via the iTerm2 Python API over WebSocket.

## Prerequisites

1. **macOS + iTerm2** running: `brew install --cask iterm2`
2. **Python API enabled**: iTerm2 → Preferences → General → Magic → Enable Python API
3. **Install**: `pip install cli-anything-iterm2` (or `pip install -e .` from source)

## Basic Syntax

```bash
cli-anything-iterm2 [--json] <group> <command> [OPTIONS] [ARGS]
```

Always use `--json` for machine-readable output (required for agent use).

## Command Groups

| Group | Purpose |
|-------|---------|
| `app` | App status, workspace snapshot, context management, app-level variables, modal dialogs, file panels |
| `window` | Create, list, close, resize, fullscreen windows |
| `tab` | Create, list, close, activate tabs; navigate split panes by direction |
| `session` | Send text, inject raw bytes, read screen, full scrollback, split panes, prompt detection |
| `profile` | List profiles, get profile details, list/apply color presets |
| `arrangement` | Save and restore window layouts |
| `tmux` | Full tmux -CC integration: bootstrap, connections, windows, commands |
| `broadcast` | Sync keystrokes across panes via broadcast domains |
| `menu` | Invoke any iTerm2 menu item programmatically |
| `pref` | Read/write global iTerm2 preferences; list all valid keys; tmux settings |

## Orienting in an Existing Workspace

Use `app snapshot` when you land in a session with existing panes and need to understand what's running without reading full screen contents for each pane:

```bash
cli-anything-iterm2 --json app snapshot
```

Returns name, current directory, foreground process, `user.role` label, and last visible output line for every session across all windows.

**Naming convention** — label panes when setting up a workspace so you can find them later:
```bash
cli-anything-iterm2 session set-var user.role "api-server"
cli-anything-iterm2 session set-var user.role "log-tail"
cli-anything-iterm2 session set-var user.role "editor"
```
`app snapshot` will surface these roles alongside process and path, giving you a full picture in one call.

## Typical Agent Workflow

```bash
# 1. Orient — snapshot every session: name, path, process, role, last output line
cli-anything-iterm2 --json app snapshot

# 2. Establish context (saves window/tab/session IDs for subsequent commands)
cli-anything-iterm2 app current

# 3. Interact — no --session-id needed once context is set
cli-anything-iterm2 session send "git status"
cli-anything-iterm2 --json session scrollback --tail 200 --strip

# 4. Create a multi-pane workspace — label panes so snapshot identifies them later
cli-anything-iterm2 session split --vertical --use-as-context
cli-anything-iterm2 session send "python3 -m http.server 8000"
cli-anything-iterm2 session set-var user.role "http-server"
```

## Reference Files

Read only what the task requires — each file is a single narrow concern (~10–30 lines):

| File | Read when you need... |
|------|-----------------------|
| `references/session-io.md` | Send text, inject bytes, read screen/scrollback, get selection |
| `references/session-control.md` | Split panes, activate/close sessions, resize, rename, session variables |
| `references/session-shell-integration.md` | wait-prompt, wait-command-end, get-prompt; reliable send→wait→read pattern |
| `references/layout-window-tab.md` | Create/close/resize windows and tabs, navigate split panes |
| `references/layout-arrangement.md` | Save and restore window layouts |
| `references/app-context.md` | **Snapshot** (orientation), status, context management, app vars, modal dialogs, file panels |
| `references/profile-pref.md` | Profiles list/get/presets, preferences read/write, tmux pref shortcuts |
| `references/broadcast-menu.md` | Broadcast keystrokes to multiple panes, invoke menu items |
| `references/tmux-commands.md` | All tmux CLI commands (bootstrap, send, tabs, create-window, set-visible) |
| `references/tmux-guide.md` | Full tmux -CC workflow, pane→session ID mapping |
| `references/json-session.md` | `--json` schemas for session, window, tab, screen, scrollback, inject |
| `references/json-tmux-app.md` | `--json` schemas for tmux, app dialogs, preferences, errors |

## REPL Mode

Run without arguments for an interactive REPL that maintains context between commands:
```bash
cli-anything-iterm2
```

© HKUDS · Apache-2.0 · HKUDS/CLI-Anything

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor