Agent Skill · OpenAI

screenshot

Use when the user explicitly asks for a desktop or system screenshot (full screen, specific app or window, or a pixel region), or when tool-specific capture capabilities are unavailable and an OS-level capture is needed.

Provider: OpenAI Path in repo: skills/.curated/screenshot/SKILL.md

Skill body

Screenshot Capture

Follow these save-location rules every time:

1) If the user specifies a path, save there. 2) If the user asks for a screenshot without a path, save to the OS default screenshot location. 3) If Codex needs a screenshot for its own inspection, save to the temp directory.

Tool priority

macOS permission preflight (reduce repeated prompts)

On macOS, run the preflight helper once before window/app capture. It checks Screen Recording permission, explains why it is needed, and requests it in one place.

The helpers route Swift’s module cache to $TMPDIR/codex-swift-module-cache to avoid extra sandbox module-cache prompts.

bash <path-to-skill>/scripts/ensure_macos_permissions.sh

To avoid multiple sandbox approval prompts, combine preflight + capture in one command when possible:

bash <path-to-skill>/scripts/ensure_macos_permissions.sh && \
python3 <path-to-skill>/scripts/take_screenshot.py --app "Codex"

For Codex inspection runs, keep the output in temp:

bash <path-to-skill>/scripts/ensure_macos_permissions.sh && \
python3 <path-to-skill>/scripts/take_screenshot.py --app "<App>" --mode temp

Use the bundled scripts to avoid re-deriving OS-specific commands.

macOS and Linux (Python helper)

Run the helper from the repo root:

python3 <path-to-skill>/scripts/take_screenshot.py

Common patterns:

python3 <path-to-skill>/scripts/take_screenshot.py
python3 <path-to-skill>/scripts/take_screenshot.py --mode temp
python3 <path-to-skill>/scripts/take_screenshot.py --path output/screen.png
python3 <path-to-skill>/scripts/take_screenshot.py --app "Codex"
python3 <path-to-skill>/scripts/take_screenshot.py --app "Codex" --window-name "Settings"
python3 <path-to-skill>/scripts/take_screenshot.py --list-windows --app "Codex"
python3 <path-to-skill>/scripts/take_screenshot.py --mode temp --region 100,200,800,600
python3 <path-to-skill>/scripts/take_screenshot.py --mode temp --active-window
python3 <path-to-skill>/scripts/take_screenshot.py --window-id 12345

The script prints one path per capture. When multiple windows or displays match, it prints multiple paths (one per line) and adds suffixes like -w<windowId> or -d<display>. View each path sequentially with the image viewer tool, and only manipulate images if needed or requested.

Workflow examples

bash <path-to-skill>/scripts/ensure_macos_permissions.sh && \
python3 <path-to-skill>/scripts/take_screenshot.py --app "<App>" --mode temp

Multi-display behavior

Linux prerequisites and selection logic

The helper automatically selects the first available tool:

1) scrot 2) gnome-screenshot 3) ImageMagick import

If none are available, ask the user to install one of them and retry.

Coordinate regions require scrot or ImageMagick import.

--app, --window-name, and --list-windows are macOS-only. On Linux, use --active-window or provide --window-id when available.

Windows (PowerShell helper)

Run the PowerShell helper:

powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1

Common patterns:

powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1
powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -Mode temp
powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -Path "C:\Temp\screen.png"
powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -Mode temp -Region 100,200,800,600
powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -Mode temp -ActiveWindow
powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -WindowHandle 123456

Direct OS commands (fallbacks)

Use these when you cannot run the helpers.

macOS

screencapture -x output/screen.png
screencapture -x -R100,200,800,600 output/region.png
screencapture -x -l12345 output/window.png
screencapture -x -i output/interactive.png

Linux

scrot output/screen.png
gnome-screenshot -f output/screen.png
import -window root output/screen.png
scrot -a 100,200,800,600 output/region.png
import -window root -crop 800x600+100+200 output/region.png
scrot -u output/window.png
gnome-screenshot -w -f output/window.png

Error handling