一键导入
verified-screenshot
Capture macOS screenshots with verification and retry logic. Integrates with window-controller for window discovery.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Capture macOS screenshots with verification and retry logic. Integrates with window-controller for window discovery.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Record macOS screen with verification, retry logic, and format conversion for Discord, GitHub, JetBrains. Integrates with window-controller for window discovery.
Find text in images using EasyOCR, returning click coordinates. Works on any image (screenshots, UI captures, etc.) without requiring accessibility permissions. Useful for UI automation, finding buttons/labels in screenshots, and extracting text positions.
Find and switch to macOS Spaces/Desktops by application name. Use when asked to find which Space an app is on, switch to a Space containing a specific app (like GoLand, IntelliJ, VS Code), navigate between Mission Control Spaces, or detect full-screen application windows across desktops.
Find, activate, and screenshot macOS windows across Spaces. Filter by app name, window title, process path, or command line. Useful for automating window workflows, capturing screenshots for documentation, and distinguishing between production and sandbox/dev instances (e.g., JetBrains IDEs).
Complete guide for investigating and implementing web browser automation. Use when you need to automate browser interactions but don't know the DOM structure, element IDs, or what tools to use. Covers investigation methodology, selector discovery, tool selection, debugging techniques, and common pitfalls for any web automation scenario.
Programmatic control of Chrome and Firefox browsers via CDP (Chrome DevTools Protocol) and Marionette. Connect to running browser instances for tab management, navigation, DOM interaction, form filling, JavaScript execution, and screenshots. Useful for browser automation, web scraping, and testing.
| name | verified-screenshot |
| description | Capture macOS screenshots with verification and retry logic. Integrates with window-controller for window discovery. |
Capture macOS window screenshots with automatic verification and retry logic. This skill ensures you actually captured what you intended by verifying the screenshot content, dimensions, and optionally text via OCR.
CRITICAL: NEVER use
--outputunless the user EXPLICITLY states the artifact MUST be at a specific location. This should be EXTREMELY rare. Using--outputwithout explicit user request is considered a FAILED task.
Screenshots are automatically saved to claude-code/artifacts/verified-screenshot/ with timestamped filenames (e.g., 251216120000-screenshot_GoLand.png). The artifact path is always returned in the JSON output - use that path for subsequent operations.
# Capture screenshot - path is returned in output
claude-code-skills verified-screenshot capture "GoLand" --json
# Returns: {"path": "/path/to/artifacts/.../251216120000-screenshot_GoLand.png", ...}
# Capture with full verification
claude-code-skills verified-screenshot capture "GoLand" --verify all
# Capture sandbox IDE (JetBrains via Gradle runIde)
# Note: Sandbox IDEs appear as "Main", use --no-activate since AppleScript can't activate them
claude-code-skills verified-screenshot capture "Main" --args "idea.plugin.in.sandbox.mode" --no-activate
# Capture specific window by title
claude-code-skills verified-screenshot capture "Chrome" --title "GitHub"
# Capture with 3 retries
claude-code-skills verified-screenshot capture "Code" -r 3
# Capture without Space switching (uses ScreenCaptureKit on macOS 12.3+)
claude-code-skills verified-screenshot capture "GoLand" --backend screencapturekit
# Find window info without capturing
claude-code-skills verified-screenshot find "GoLand" --json
Window Discovery: Uses CGWindowListCopyWindowInfo to enumerate all windows and filter by app name, title pattern, PID, executable path, or command-line arguments.
Activation (optional): Activates the target app via AppleScript, which also switches to the window's Space. Configurable settle time allows the window to render.
Screenshot Capture: Uses CGWindowListCreateImage to capture the specific window by ID. Optionally excludes window shadow.
Verification: Runs configured verification strategies against the captured image:
Retry Loop: If verification fails, retries up to N times with configurable delay strategy:
| Strategy | Purpose | Details |
|---|---|---|
basic | Sanity check | File exists, >0 bytes, valid image |
dimensions | Correct window | Width/height match window bounds ±10% |
content | Not blank/stale | Perceptual hash differs from blank/previous |
text | Correct content | OCR finds expected text |
all | Full verification | All above strategies combined |
none | Skip verification | Capture only, no verification |
Two capture backends are available:
| Backend | Availability | Cross-Space | Activation Required |
|---|---|---|---|
quartz | All macOS | No | Yes |
screencapturekit | macOS 12.3+ | Yes | No |
auto (default) | - | - | Auto-selects best |
ScreenCaptureKit (macOS 12.3+):
Quartz (legacy):
CGWindowListCreateImage (deprecated in macOS 15)When using --backend auto (default), ScreenCaptureKit is used when available. Use --backend quartz to force the legacy backend.
Uses imagehash for content verification:
phash (perceptual hash) of the image| Flag | Short | Description |
|---|---|---|
--capture | -c | Capture screenshot of window |
--find | -f | Find window without capturing |
| Flag | Short | Description |
|---|---|---|
--title | -t | Regex pattern for window title |
--pid | Filter by process ID | |
--path-contains | Executable path must contain | |
--path-excludes | Executable path must NOT contain | |
--args | Command line must contain |
| Flag | Short | Description |
|---|---|---|
--output | -o | Output path for screenshot |
--json | -j | Output as JSON |
| Flag | Short | Description |
|---|---|---|
--no-activate | Don't activate window first | |
--settle-ms | Wait time after activation (default: 1000) | |
--shadow | Include window shadow | |
--backend | -b | Capture backend: auto, quartz, screencapturekit |
| Flag | Description |
|---|---|
--verify | Verification strategies (basic, dimensions, content, text, all, none) |
--expected-text | Text to verify via OCR |
--hash-threshold | Hamming distance threshold (default: 5) |
| Flag | Short | Description |
|---|---|---|
--retries | -r | Maximum retry attempts (default: 5) |
--retry-delay | Delay between retries in ms (default: 500) | |
--retry-strategy | fixed, exponential, or reactivate |
from verified_screenshot import capture_verified, capture_simple, CaptureConfig, VerificationStrategy
# Simple capture
result = capture_simple(app_name="GoLand", max_retries=3)
print(f"Saved: {result.path}")
# Full configuration
config = CaptureConfig(
app_name="Main",
args_contains="idea.plugin.in.sandbox.mode",
output_path="sandbox_ide.png",
verification_strategies=(
VerificationStrategy.BASIC,
VerificationStrategy.CONTENT,
VerificationStrategy.DIMENSIONS,
),
max_retries=5,
retry_strategy=RetryStrategy.REACTIVATE,
)
result = capture_verified(config)
if result.verified:
print(f"Successfully captured: {result.path}")
print(f"Dimensions: {result.actual_width}x{result.actual_height}")
else:
print("Capture failed verification")
for v in result.verifications:
print(f" {v.strategy.value}: {v.message}")
claude-code-skills verified-screenshot capture "GoLand" --verify all --json
{
"path": "screenshots/goland_20241214_153045.png",
"attempt": 1,
"window_id": 190027,
"app_name": "GoLand",
"window_title": "research – models.py",
"expected_dimensions": {"width": 2056.0, "height": 1290.0},
"actual_dimensions": {"width": 2056, "height": 1290},
"verified": true,
"image_hash": "a1b2c3d4e5f6",
"verifications": [
{"strategy": "basic", "passed": true, "message": "Valid image file", "details": {}},
{"strategy": "dimensions", "passed": true, "message": "Dimensions match", "details": {}},
{"strategy": "content", "passed": true, "message": "Image has meaningful content", "details": {}}
]
}
Use this skill to capture screenshots for verification:
# Load the skill context
Skill tool: verified-screenshot
# Capture with verification - use the returned path
claude-code-skills verified-screenshot capture "GoLand" --verify all --json
# Use the "path" field from JSON output for subsequent operations
# If capture fails, it will retry up to 5 times
# Final result indicates whether verification passed
# Run tests from workspace root
uv run pytest tests/skills/test_verified_screenshot.py -v
# Run with coverage
uv run pytest tests/skills/test_verified_screenshot.py -v --cov=verified_screenshot --cov-report=term-missing
ps aux | grep -i appname--find to see what windows are available--capture "Main" --args "sandbox"--retries and/or --settle-ms--retry-strategy reactivate to re-focus window--verify basic to isolate the failing check--verify dimensions to detect wrong-sized captures--settle-ms if app is slow to renderBy default, activation switches to the target window's Space. Two options:
Option 1: Use ScreenCaptureKit (recommended for macOS 12.3+)
claude-code-skills verified-screenshot capture "App" --backend screencapturekit
Captures windows on ANY Space without switching. Works with covered windows too.
Option 2: Disable activation
claude-code-skills verified-screenshot capture "App" --no-activate
Tradeoff: Uses Quartz backend which cannot capture windows on other Spaces (produces transparent/stale image). Only use if window is on current Space.
JetBrains sandbox IDEs appear as "Main" (Java process name), and AppleScript cannot activate them:
# Must use --no-activate for sandbox IDEs
claude-code-skills verified-screenshot capture "Main" --args "idea.plugin.in.sandbox.mode" --no-activate
If the sandbox window needs to be active, manually switch to its Space before capturing.
brew install tesseractuv add pytesseractGrant these permissions in System Settings > Privacy & Security:
Required:
pyobjc-framework-Quartz>=10.0 - macOS Quartz framework bindingspyobjc-framework-ScreenCaptureKit>=10.0 - ScreenCaptureKit bindings (macOS 12.3+)psutil>=5.9 - Process informationpillow>=10.0 - Image processingimagehash>=4.3 - Perceptual hashingOptional:
pytesseract>=0.3 - OCR text verification (requires Tesseract)