home/common/programs/ai/pi-coding-agent/skills/preview/SKILL.md
Display code, diffs, images, and other content in a tmux pane or popup. Auto-detects nvim/megaterm for floating popups.
npx skillsauth add megalithic/dotfiles previewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Display content in a tmux pane or popup next to the pi agent. Supports code files, JSON, markdown, diffs, images, logs, and more.
preview-ai script must be in PATH (installed via dotfiles)Display content in a preview pane or popup.
/preview [options] [type] <content>
Options:
-m, --mode <mode> - Preview mode: tmux-split, tmux-float, auto (default)--auto-close-after <seconds> - Auto-close pane after N seconds--delta - Explicit delta flag (delta is now the default)-h, --help - Show helpModes:
tmux-split - Side pane (default outside nvim)tmux-float - Large popup window (default inside nvim/megaterm)auto - Auto-detect: popup if inside nvim, split otherwiseContent Types:
json - JSON content (inline or file path)markdown - Markdown content (inline or file path)diff - jj diff arguments (e.g., "-r @") - uses deltalog - jj log arguments (e.g., "-n 5")bead - Bead task ID - renders with glowfile - File path to preview with batimage - Image file path (uses chafa or kitty protocol)cmd - Shell command to execute (prefix with "cmd:")auto - Auto-detect type (default)Examples:
# Preview JSON
/preview json '{"foo": "bar"}'
/preview json /path/to/data.json
# Preview diffs
/preview diff -r @ # Uses delta for diff viewing
/preview diff # Current working copy changes
# Preview files
/preview file ~/.config/nvim/init.lua
/preview /tmp/output.log # Auto-detects type
# Preview markdown
/preview markdown "# Hello World"
/preview /path/to/README.md
# Preview images
/preview image /path/to/screenshot.png
# Preview with auto-close
/preview --auto-close-after 5 diff # Auto-close after 5 seconds
# Preview jj log
/preview log -n 10
/preview log -r 'main..'
# Explicit mode selection
/preview --mode tmux-float diff # Force popup mode
/preview -m tmux-split file foo.lua # Force split pane mode
Ctrl+Shift+P - Quick preview of current diff (equivalent to /preview diff)The preview extension wraps the existing preview-ai bash script which:
Auto-detection:
$NVIM set): Uses tmux display-popup (large floating window)tmux split-window (side pane)Safe pane management:
Content rendering:
jq for formattingglow for renderingdelta for syntax-highlighted diff viewingchafa for terminal display or kitty protocolbat with syntax highlightingjj log with paging disabledClosing the preview:
q or Escape to close the preview pane/popupError: "Preview requires tmux"
Error: "preview-ai failed"
preview-ai is in PATH: which preview-aibat, glow, jq, delta, chafaPreview pane not appearing:
preview-ai diff in a terminalImage preview not working:
chafa is installed: which chafapreview file /path/to/image.png to see actual output~/.dotfiles/bin/preview-ai - The underlying bash scripttesting
Apply Strunk's timeless writing rules to ANY prose humans will read - documentation, commit messages, error messages, explanations, reports, or UI text. Makes your writing clearer, stronger, and more professional.
tools
Web search using DuckDuckGo (free, unlimited). Falls back to pi-web-access extension for content extraction.
tools
Interact with web pages using agent-browser CLI. MUST run 'browser connect 9222' FIRST to use existing browser with authenticated sessions.
tools
Remote control tmux sessions for interactive CLIs (python, gdb, etc.) by sending keystrokes and scraping pane output.