К основному содержанию
скилл CX Codex

terminal-print — скилл для Claude Code: печать терминала

Скилл terminal-print собирает вывод терминала в PDF и отправляет его на сетевой принтер. Помогает распечатать сессию или обойти проблему пустых страниц на некоторых HP LaserJet Pro.

MIT 131 установок ★ 3 обновлён 2026-10-25

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add terrylica/cc-skills --skill terminal-print -a claude-code
Открыть на GitHub

Что делает terminal-print

Скилл берёт текст из буфера обмена iTerm2 или файла, удаляет ANSI-последовательности и формирует PDF через pandoc и xelatex. PDF открывается для предпросмотра перед печатью; флаг --no-preview позволяет пропустить этот шаг, а --no-print — только создать файл.

Для HP LaserJet Pro MFP 3101/3108/3201/3208/3301/3308 предусмотрен обход AirPrint: после настройки очереди socket-9100 с Generic PostScript PPD печать запускается с --bypass-airprint. Без pandoc и xelatex PDF не соберётся; для установки обоих инструментов скилл предлагает brew install --cask mactex.

Также можно выбрать очередь через --printer NAME или переменную TERMINAL_PRINT_PRINTER. Это скилл для macOS: буфер читает pbpaste, а печать отправляет через lpr.

Какие задачи решает

  • распечатать вывод терминала из iTerm2
  • создать PDF из файла сессии
  • сохранить терминальный лог в виде для печати
  • обойти пустые страницы при печати на перечисленных HP LaserJet Pro

Примеры запросов агенту

  • Распечатай вывод, который я скопировал из iTerm2.
  • Создай PDF из ~/session.log, не отправляя его на принтер.
  • Настрой обход AirPrint и распечатай вывод с --bypass-airprint.

Как установить terminal-print

1Через Skills CLI (Vercel)

npx skills add terrylica/cc-skills --skill terminal-print -a claude-code

2Вручную: положить файлы

~/.claude/skills/terminal-print/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/terminal-print/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о terminal-print

Как установить terminal-print в Claude Code?

Выполните npx skills add terrylica/cc-skills --skill terminal-print -a claude-code. Файл скилла будет доступен по пути ~/.claude/skills/terminal-print/SKILL.md.

Что делает terminal-print?

Преобразует вывод из буфера iTerm2 или файла в PDF, показывает предпросмотр и отправляет документ на сетевой принтер. Можно также создать PDF без печати.

Как исправить пустые страницы на HP LaserJet Pro?

Для перечисленных моделей сначала запустите setup-socket-9100-queue.sh, чтобы создать обходную очередь. Затем передайте --bypass-airprint скрипту print-terminal.sh.

Исходный текст

SKILL.md · MIT
---
name: terminal-print
description: Print iTerm2 terminal output to network printer. Also documents AirPrint blank-page workaround for HP LaserJet Pro MFP 3101/3108 family. TRIGGERS - print terminal, terminal PDF, print session output, AirPrint blank page, printer prints blank, lpr no output, HP LaserJet driverless blank, IPP-Everywhere blank page.
allowed-tools: Bash, Read
---

# Terminal Print

Print terminal output from iTerm2 to your HP network printer with a single command.

> **Self-Evolving Skill**: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.

## When to Use This Skill

Use this skill when:

- Printing terminal output to a network printer
- Creating PDF copies of command-line session output
- Archiving terminal logs in print-friendly format
- Sharing terminal output in meetings or documentation

## Quick Start

1. **Copy** terminal output in iTerm2 (Cmd+C)
2. **Invoke** this skill
3. **Review** PDF preview, press Enter to print

## How It Works

```
Clipboard → Strip ANSI → Markdown code block → pandoc/xelatex → PDF → Preview → Print
```

- **ANSI codes stripped**: Colors and escape sequences removed for clean B&W output
- **Monospace font**: DejaVu Sans Mono for proper character alignment
- **Landscape orientation**: Fits ~120 characters per line
- **US Letter paper**: Auto-detected from printer settings

## Execution

```bash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="$(cc-plugin-root doc-tools)/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh"
PRINT_EOF
```

## Options

Run with arguments by modifying the execution block:

```bash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="$(cc-plugin-root doc-tools)/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh" --no-preview
PRINT_EOF
```

| Flag                | Description                                                                                                                |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `--file FILE`       | Read from file instead of clipboard                                                                                        |
| `--no-preview`      | Skip PDF preview, print directly                                                                                           |
| `--no-print`        | Generate PDF only, don't send to printer                                                                                   |
| `--printer NAME`    | Override target printer queue (default: system default)                                                                    |
| `--bypass-airprint` | Use socket-9100 + PostScript queue. Workaround for HP LaserJet Pro MFP 3101/3108/3201/3208/3301/3308 AirPrint blank pages. |
| `-h, --help`        | Show help message                                                                                                          |

## Examples

### Print from clipboard (default)

```bash
# Copy terminal output in iTerm2, then:
/usr/bin/env bash << 'EOF'
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh"
EOF
```

### Print from file

```bash
/usr/bin/env bash << 'EOF'
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh" --file ~/session.log
EOF
```

### Generate PDF only (no print)

```bash
/usr/bin/env bash << 'EOF'
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh" --no-print
EOF
```

## Prerequisites

All dependencies are already available on macOS with MacTeX:

| Tool      | Purpose          | Status            |
| --------- | ---------------- | ----------------- |
| `pandoc`  | Markdown to PDF  | Required          |
| `xelatex` | PDF engine       | Required (MacTeX) |
| `pbpaste` | Clipboard access | Built-in          |
| `lpr`     | CUPS printing    | Built-in          |

## Output

- **PDF location**: `/tmp/terminal-output-YYYYMMDD_HHMMSS.pdf`
- **Markdown source**: `/tmp/terminal-YYYYMMDD_HHMMSS.md`
- **Cleanup**: macOS automatically cleans `/tmp` periodically

## Troubleshooting

### "No text in clipboard"

Copy terminal output first using Cmd+C in iTerm2.

### "Missing pandoc" or "Missing xelatex"

Install MacTeX: `brew install --cask mactex`

### Printer not found

Check printer status: `lpstat -p -d`

The script auto-detects the system default printer. Override with `--printer NAME` or set `TERMINAL_PRINT_PRINTER` in the environment.

### Blank page came out (or `lpr` reported success but nothing printed)

Strong fingerprint of the **HP LaserJet Pro MFP 3101/3108/3201/3208/3301/3308 AirPrint blank-page bug** — the printer's IPP-Everywhere PDF interpreter silently drops jobs while CUPS reports `completed`. Confirmed with this exact symptom on 2026-05-09.

**Quick fix:**

```bash
# 1. One-time setup of bypass queue (socket-9100 + Generic PostScript PPD)
"$(cc-plugin-root doc-tools)/skills/terminal-print/assets/setup-socket-9100-queue.sh"

# 2. Reprint with --bypass-airprint
bash "$(cc-plugin-root doc-tools)/skills/terminal-print/assets/print-terminal.sh" --bypass-airprint
```

**Full diagnostic playbook with command sequences and decision tree:** see [airprint-blank-page-troubleshooting.md](references/airprint-blank-page-troubleshooting.md).

Key takeaway: do not trust `lpstat -o` or `job-state=completed` — query the **printer's own job ledger** via `ipptool -tv ipp://<printer>.local.:631/ipp/print` for `job-impressions-completed` and `job-media-sheets-completed`. CUPS lies; the printer (mostly) tells the truth.

## Related Skills

- [pandoc-pdf-generation](../pandoc-pdf-generation/SKILL.md) - General Markdown to PDF conversion
- [asciinema-converter](../../../asciinema-tools/skills/asciinema-converter/SKILL.md) - Convert terminal recordings

## Post-Execution Reflection

After this skill completes, check before closing:

1. **Did the command succeed?** — If not, fix the instruction or error table that caused the failure.
2. **Did parameters or output change?** — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
3. **Was a workaround needed?** — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.

Only update if the issue is real and reproducible — not speculative.

© terrylica · MIT · terrylica/cc-skills

Похожие скиллы

Все скиллы по теме «Тексты и документация» →
cli-anything-iterm2 HKUDS Скилл cli-anything-iterm2 для Claude Code подключает агента к живым сессиям iTerm2 через Python API: отправляет команды, читает вывод и scrollback, создаёт и помечает панели. CX Codex +1 559установок iterm2 julianobarbosa Настраивает iTerm2 и tmux, управляет панелями и сессиями и разбирает неполадки. Помогает работать с терминалом на macOS. CX Codex +1 115установок terminal-ops affaan-m Скилл terminal-ops для работы с репозиторием через терминал: запускает команды, читает состояние git, разбирает падения CI и делает точечные правки с доказательством того, что проверено. CX Codex +1 6 200установок terminal-inserts Liamrjohnston Скилл terminal-inserts для Remotion-анимаций: рисует вставки с терминалом в сдержанном стиле, без неона и свечения. Сначала спрашивает формат и фон. CX Codex +1 1 600установок cmux-terminal-multiplexer reason-machines Скилл cmux-terminal-multiplexer организует сплиты терминала и запускает встроенный Chromium для Claude Code и других кодинг-агентов через CLI с адресацией по поверхностям. CX Codex +1 1 500установок ghostling-libghostty-terminal reason-machines Скилл ghostling-libghostty-terminal показывает, как собрать минимальный терминальный эмулятор на C-библиотеке libghostty-vt с окнами и отрисовкой через Raylib. CX Codex +1 1 100установок

Из того же набора79

Весь набор →
notion-sdk Скилл notion-sdk для Claude Code и Codex, работает с Notion через официальный Python SDK. Создаёт страницы и базы данных, запрашивает информацию, добавляет блоки контента — всё программно, без ручного ввода. CX Codex +1 133установок hooks-development Скилл hooks-development помогает создавать и отлаживать хуки Claude Code, особенно когда агент не видит их вывод. В нём разобраны форматы ответа и обработка событий. CX Codex +1 133установок asciinema-cast-format Скилл asciinema-cast-format для Claude Code помогает разбирать заголовки NDJSON и события терминала в записях .cast asciinema v3. CX Codex +1 132установок python-workspace Скилл python-workspace экспортирует котировки из MetaTrader 5 и переносит индикаторы MQL5 на Python с проверкой корреляции от 0.999. CX Codex +1 131установок doppler-workflows Скилл doppler-workflows помогает запускать публикацию Python-пакетов и AWS-команды с секретами из Doppler. Пригодится и для разбора ошибок авторизации. CX Codex +1 130установок ml-data-pipeline-architecture Скилл ml-data-pipeline-architecture для Claude Code помогает проектировать ML-пайплайны на Polars, Arrow и ClickHouse. Сравнивает Polars и Pandas, обрабатывает большие наборы данных и передаёт их в PyTorch. CX Codex +1 130установок clickhouse-pydantic-config Скилл clickhouse-pydantic-config для Claude Code собирает файл подключений DBeaver для ClickHouse из Pydantic-модели и переменных окружения. Локальная и облачная базы открываются в клиенте без ручного ввода. CX Codex +1 130установок issue-create Скилл issue-create превращает черновое описание в оформленный GitHub issue: определяет тип, подбирает метки из таксономии репозитория и предупреждает о дублях. CX Codex +1 129установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой