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.
Add this skill
npx mdskills install openai/screenshotComprehensive cross-platform screenshot tool with clear rules, permission handling, and fallbacks
1---2name: "screenshot"3description: "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."4---567# Screenshot Capture89Follow these save-location rules every time:10111) If the user specifies a path, save there.122) If the user asks for a screenshot without a path, save to the OS default screenshot location.133) If Codex needs a screenshot for its own inspection, save to the temp directory.1415## Tool priority1617- Prefer tool-specific screenshot capabilities when available (for example: a Figma MCP/skill for Figma files, or Playwright/agent-browser tools for browsers and Electron apps).18- Use this skill when explicitly asked, for whole-system desktop captures, or when a tool-specific capture cannot get what you need.19- Otherwise, treat this skill as the default for desktop apps without a better-integrated capture tool.2021## macOS permission preflight (reduce repeated prompts)2223On macOS, run the preflight helper once before window/app capture. It checks24Screen Recording permission, explains why it is needed, and requests it in one25place.2627The helpers route Swift's module cache to `$TMPDIR/codex-swift-module-cache`28to avoid extra sandbox module-cache prompts.2930```bash31bash <path-to-skill>/scripts/ensure_macos_permissions.sh32```3334To avoid multiple sandbox approval prompts, combine preflight + capture in one35command when possible:3637```bash38bash <path-to-skill>/scripts/ensure_macos_permissions.sh && \39python3 <path-to-skill>/scripts/take_screenshot.py --app "Codex"40```4142For Codex inspection runs, keep the output in temp:4344```bash45bash <path-to-skill>/scripts/ensure_macos_permissions.sh && \46python3 <path-to-skill>/scripts/take_screenshot.py --app "<App>" --mode temp47```4849Use the bundled scripts to avoid re-deriving OS-specific commands.5051## macOS and Linux (Python helper)5253Run the helper from the repo root:5455```bash56python3 <path-to-skill>/scripts/take_screenshot.py57```5859Common patterns:6061- Default location (user asked for "a screenshot"):6263```bash64python3 <path-to-skill>/scripts/take_screenshot.py65```6667- Temp location (Codex visual check):6869```bash70python3 <path-to-skill>/scripts/take_screenshot.py --mode temp71```7273- Explicit location (user provided a path or filename):7475```bash76python3 <path-to-skill>/scripts/take_screenshot.py --path output/screen.png77```7879- App/window capture by app name (macOS only; substring match is OK; captures all matching windows):8081```bash82python3 <path-to-skill>/scripts/take_screenshot.py --app "Codex"83```8485- Specific window title within an app (macOS only):8687```bash88python3 <path-to-skill>/scripts/take_screenshot.py --app "Codex" --window-name "Settings"89```9091- List matching window ids before capturing (macOS only):9293```bash94python3 <path-to-skill>/scripts/take_screenshot.py --list-windows --app "Codex"95```9697- Pixel region (x,y,w,h):9899```bash100python3 <path-to-skill>/scripts/take_screenshot.py --mode temp --region 100,200,800,600101```102103- Focused/active window (captures only the frontmost window; use `--app` to capture all windows):104105```bash106python3 <path-to-skill>/scripts/take_screenshot.py --mode temp --active-window107```108109- Specific window id (use --list-windows on macOS to discover ids):110111```bash112python3 <path-to-skill>/scripts/take_screenshot.py --window-id 12345113```114115The 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.116117### Workflow examples118119- "Take a look at <App> and tell me what you see": capture to temp, then view each printed path in order.120121```bash122bash <path-to-skill>/scripts/ensure_macos_permissions.sh && \123python3 <path-to-skill>/scripts/take_screenshot.py --app "<App>" --mode temp124```125126- "The design from Figma is not matching what is implemented": use a Figma MCP/skill to capture the design first, then capture the running app with this skill (typically to temp) and compare the raw screenshots before any manipulation.127128### Multi-display behavior129130- On macOS, full-screen captures save one file per display when multiple monitors are connected.131- On Linux and Windows, full-screen captures use the virtual desktop (all monitors in one image); use `--region` to isolate a single display when needed.132133### Linux prerequisites and selection logic134135The helper automatically selects the first available tool:1361371) `scrot`1382) `gnome-screenshot`1393) ImageMagick `import`140141If none are available, ask the user to install one of them and retry.142143Coordinate regions require `scrot` or ImageMagick `import`.144145`--app`, `--window-name`, and `--list-windows` are macOS-only. On Linux, use146`--active-window` or provide `--window-id` when available.147148## Windows (PowerShell helper)149150Run the PowerShell helper:151152```powershell153powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1154```155156Common patterns:157158- Default location:159160```powershell161powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1162```163164- Temp location (Codex visual check):165166```powershell167powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -Mode temp168```169170- Explicit path:171172```powershell173powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -Path "C:\Temp\screen.png"174```175176- Pixel region (x,y,w,h):177178```powershell179powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -Mode temp -Region 100,200,800,600180```181182- Active window (ask the user to focus it first):183184```powershell185powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -Mode temp -ActiveWindow186```187188- Specific window handle (only when provided):189190```powershell191powershell -ExecutionPolicy Bypass -File <path-to-skill>/scripts/take_screenshot.ps1 -WindowHandle 123456192```193194## Direct OS commands (fallbacks)195196Use these when you cannot run the helpers.197198### macOS199200- Full screen to a specific path:201202```bash203screencapture -x output/screen.png204```205206- Pixel region:207208```bash209screencapture -x -R100,200,800,600 output/region.png210```211212- Specific window id:213214```bash215screencapture -x -l12345 output/window.png216```217218- Interactive selection or window pick:219220```bash221screencapture -x -i output/interactive.png222```223224### Linux225226- Full screen:227228```bash229scrot output/screen.png230```231232```bash233gnome-screenshot -f output/screen.png234```235236```bash237import -window root output/screen.png238```239240- Pixel region:241242```bash243scrot -a 100,200,800,600 output/region.png244```245246```bash247import -window root -crop 800x600+100+200 output/region.png248```249250- Active window:251252```bash253scrot -u output/window.png254```255256```bash257gnome-screenshot -w -f output/window.png258```259260## Error handling261262- On macOS, run `bash <path-to-skill>/scripts/ensure_macos_permissions.sh` first to request Screen Recording in one place.263- If you see "screen capture checks are blocked in the sandbox", "could not create image from display", or Swift `ModuleCache` permission errors in a sandboxed run, rerun the command with escalated permissions.264- If macOS app/window capture returns no matches, run `--list-windows --app "AppName"` and retry with `--window-id`, and make sure the app is visible on screen.265- If Linux region/window capture fails, check tool availability with `command -v scrot`, `command -v gnome-screenshot`, and `command -v import`.266- If saving to the OS default location fails with permission errors in a sandbox, rerun the command with escalated permissions.267- Always report the saved file path in the response.268
Full transparency — inspect the skill content before installing.