capture-screen

Captures macOS window screenshots by window ID using Swift, AppleScript, and screencapture.

Updated Apr 21, 2026
One-click install
npx skills add https://github.com/HuuBar/skill-routing-experiment --skill capture-screen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: capture-screen
Source: https://github.com/HuuBar/skill-routing-experiment/tree/main/unified_skills/daymade/capture-screen
Command: npx skills add https://github.com/HuuBar/skill-routing-experiment --skill capture-screen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Automates macOS window screenshot capture by locating a target window, controlling the UI, and saving a high-quality image for documentation or verification.

Core Features & Use Cases

  • Window discovery: identify a running application's window ID using a Swift CGWindowListCopyWindowInfo routine.
  • UI control: manipulate the active window's view through AppleScript to adjust zoom, scroll, or focus before capture.
  • Automated capture: save a screenshot with screencapture using the obtained window ID for repeatable, multi-shot workflows in tutorials or QA.

Quick Start

Fetch the target window ID with the bundled Swift script and capture it using screencapture.

Frequently Asked Questions about capture-screen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate macOS screenshot capture for a specific application window?

Automating macOS screenshot capture involves using a Swift routine to locate the target window ID via CGWindowListCopyWindowInfo, then passing that ID to the screencapture command to save the image. This approach enables repeatable, multi-shot workflows for documentation or QA testing.

Can I adjust the UI of an application before taking a programmatic screenshot on macOS?

Yes, UI adjustments are supported before taking a programmatic screenshot on macOS. The Skill uses AppleScript to manipulate the active window's view, allowing you to control zoom, scroll, or focus states immediately prior to executing the screencapture command for accurate UI testing results.

What is the best way to capture multiple screenshots for QA testing across different macOS apps?

The best way to capture multiple screenshots for QA testing across macOS apps is to combine Swift for window discovery and AppleScript for UI control. This programmatic method retrieves specific window IDs and automates the screencapture utility, ensuring repeatable, high-quality image output for verification workflows.

Do I need Swift to discover window IDs for automated screencapture on macOS?

Yes, Swift is required to discover window IDs for automated screencapture on macOS. The Skill relies on a bundled Swift script utilizing the CGWindowListCopyWindowInfo routine to identify a running application's window ID, which is then passed to the screencapture utility for image output.

Why use AppleScript for macOS window control instead of just using the screencapture command?

AppleScript is used for macOS window control because the screencapture command alone cannot manipulate UI states. By using AppleScript to adjust zoom, scroll, or focus before capture, you ensure the target window is in the correct visual state for high-quality documentation and verification images.

Are there limitations when using CGWindowListCopyWindowInfo for macOS window screenshots?

A limitation when using CGWindowListCopyWindowInfo for macOS window screenshots is that the target application must be actively running to locate its window ID. Additionally, AppleScript UI control is subject to the accessibility permissions granted to the script, which may affect automated capture workflows.