图像写作
- 作者仓库星标 1,187
- 叉子 185
- 作者更新于 2026年6月14日 10:01
- 作者仓库 claude-code-skills
- 领域
- 通用
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @daymade · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- macOS
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- Shell 执行
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: terminal-screenshot
description: > Render the colored output of a terminal command into a PNG image, then read that image to judg…
category: 通用
runtime: 无特殊运行时
---
# terminal-screenshot 输出预览
## PART A: 任务判断
- 适用问题:通用任务拆解、检查和交付。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Why this exists / The method: capture, then render / Step 1 — Capture full-fidelity ANSI to a file”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于通用任务拆解、检查和交付,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Why this exists / The method: capture, then render / Step 1 — Capture full-fidelity ANSI to a file”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、执行终端命令、写入/修改文件、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、执行终端命令、写入/修改文件;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/tmp`、`/dev` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、执行终端命令、写入/修改文件。
先用一个小任务确认它会围绕“Why this exists / The method: capture, then render / Step 1 — Capture full-fidelity ANSI to a file”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: terminal-screenshot
description: > Render the colored output of a terminal command into a PNG image, then read that image to judg…
category: 通用
source: daymade/claude-code-skills
---
# terminal-screenshot
## 什么时候使用
- 看不见终端颜色时,将 ANSI 输出渲染成 PNG 适合处理通用任务拆解、检查、交付和复盘,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常不需要额外…
- 面向通用任务拆解、检查和交付,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Why this exists / The method: capture, then render / Step 1 — Capture full-fidelity ANSI to a file」组织步骤,不把推断写成作者事实。
- 读取文件、执行终端命令、写入/修改文件;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "terminal-screenshot" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Why this exists / The method: capture, then render / Step 1 — Capture full-fidelity ANSI to a file
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、执行终端命令、写入/修改文件 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Terminal Screenshot
Render the colored output of a terminal command into a PNG image, then read that image to judge the result visually.
Why this exists
When a command's output arrives as a tool result, Claude sees plain text plus raw
escape codes like \x1b[48;2;92;30;34m — not the rendered colors. That makes it
impossible to honestly answer "is the diff's add/remove contrast strong enough?"
or "did this theme come out too dark?". Reading hex values is guessing. This skill
turns the output into an image so the judgement is based on what a human would
actually see on screen.
The method: capture, then render
Two separate steps. Keep them separate — that separation is the whole trick.
Step 1 — Capture full-fidelity ANSI to a file
Most CLIs drop or downgrade colors when they detect they're not writing to a
real terminal (a pipe or a child process). Force full coloring and save to a
.ansi file. The exact flag depends on the tool — recipes below.
The single most important rule: never let the renderer run the command for you.
freeze --execute "git diff | delta" looks convenient but produces a degraded
result — delta (and lazygit, and anything that probes terminal capabilities) runs
inside freeze's child pty, detects a reduced environment, and silently drops its
background blocks, line-number column, and header box. Capture in a normal shell
first, render second.
Step 2 — Render the ANSI file to PNG, then read it
Use the bundled wrapper, which prefers freeze and falls back to a stdlib
renderer + headless Chrome:
scripts/render_ansi.sh <input.ansi> <output.png> [background_hex]
Then read the PNG with the Read tool and judge the colors.
Background color must match the real terminal, or a dark theme verified on a white page looks wrong. On macOS with Ghostty:
ghostty +show-config --default | grep '^background' # e.g. 282c34 (the default)
Pass it as #282c34. If unknown, a dark terminal is usually near #1d1f21–#282c34.
Capture recipes per tool
Pick a --width close to the real terminal (≈100–120) so wrapping matches.
| Tool | Capture command (writes full-color ANSI) |
|---|---|
| delta (git diff) | git --no-pager diff | delta --dark --line-numbers --width=110 > /tmp/x.ansi |
| git diff (native) | git -c color.ui=always --no-pager diff > /tmp/x.ansi |
| bat | bat --color=always --style=numbers <file> > /tmp/x.ansi |
| eza | eza -la --color=always --icons > /tmp/x.ansi |
| ls (GNU) | ls -la --color=always > /tmp/x.ansi |
| ls (macOS/BSD) | CLICOLOR_FORCE=1 ls -laG > /tmp/x.ansi |
| ripgrep | rg --color=always 'pattern' <path> > /tmp/x.ansi |
| anything else | CLICOLOR_FORCE=1 <cmd> > /tmp/x.ansi or <cmd> --color=always, or wrap in a real pty: script -q /dev/null <cmd> |
Note delta always emits its configured colors even to a file, so the only trap
for delta is Step 1's rule (don't render it via freeze --execute).
Full example: verify a delta color change
# after editing [delta] colors in gitconfig, in any repo with a diff:
git --no-pager diff | delta --dark --line-numbers --width=110 > /tmp/diff.ansi
scripts/render_ansi.sh /tmp/diff.ansi /tmp/diff.png "#282c34"
# then: Read /tmp/diff.png and judge whether add/remove contrast is clear
TUI programs (lazygit, htop, top) — out of scope
Full-screen TUIs paint with cursor positioning, not a linear ANSI stream, so they
can't be captured this way. To check a TUI's colors, verify the underlying piece
in isolation — e.g. for lazygit's diff, render git diff | delta as above (lazygit
calls the same delta config). For a true TUI screenshot, run it in a real terminal
and capture the screen (a screencapture/computer-use task), not this skill.
Installing freeze (the preferred renderer)
freeze is charmbracelet/freeze — it
renders ANSI to PNG/SVG/WebP with faithful background blocks and nice chrome.
Do not run brew install freeze — that installs an unrelated GUI app of the
same name (a cask). The CLI lives in charmbracelet's tap or via go install:
# Option A — Homebrew tap (needs GitHub reachable)
brew install charmbracelet/tap/freeze
# Option B — go install (works behind a firewall via a Go module mirror)
GOPROXY=https://goproxy.cn,direct GOSUMDB=off \
go install github.com/charmbracelet/freeze@latest
# binary lands in "$(go env GOPATH)/bin/freeze"
GOSUMDB=off is needed when the checksum database (sum.golang.org) is
unreachable and go install hangs on "verifying module ... 504".
If freeze can't be installed, the wrapper automatically falls back to the bundled
scripts/ansi2html.py (stdlib only) + headless Chrome — no extra dependency
beyond a Chrome install. The fallback uses a fixed window size; widen
--window-size in render_ansi.sh if output is clipped.
Bundled scripts
scripts/render_ansi.sh— render a captured.ansifile to PNG (freeze, else Chrome fallback). This is the entry point; call it after Step 1.scripts/ansi2html.py— stdlib ANSI→HTML converter used by the fallback path. Handles 24-bit truecolor, 256-color, bold, and resets, preserving background color blocks (the part naive renderers drop).
Common pitfalls
- Letting the renderer run the command (
freeze --execute "delta …") → degraded output. Capture in a normal shell first, render the file second. - Non-TTY strips color → force it (
--color=always/CLICOLOR_FORCE=1/script -q /dev/null). - Wrong background color → a dark CLI theme rendered on a white page misjudges contrast. Use the real terminal background.
- Light/dark mismatch → if the terminal is dark, the CLI's colors must be its
dark variant. Verifying a
light=trueconfig against a dark terminal shows inverted, hard-to-read colors (and is itself the bug, not the renderer's fault). brew install freezeinstalls the wrong (GUI cask) tool — use the tap orgo install.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核