Home
cd ../playbooks
Developer ToolsIntermediate

Programmatic Screen Capture

Capture screenshots programmatically on macOS — find window IDs, control application windows via AppleScript, and capture specific windows for documentation and visual workflows.

10 minutes
By daymadeSource
#macos#screenshots#automation#documentation#applescript

Manual screenshots break automation and miss the exact window you need. This playbook lets Claude find, control, and capture any macOS window precisely.

Who it's for: technical writers, developers, documentation authors, QA engineers

Example

"Capture the Excel window for my docs" → Claude finds the window ID, positions it, and saves a clean PNG of exactly that window

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

Or install from your terminal:
npx ccplaybooks add capture-screen
# Capture Screen

Programmatic screenshot capture on macOS: find windows, control views, capture images.

## Quick Start

```bash
# Find Excel window ID
swift scripts/get_window_id.swift Excel

# Capture that window (replace 12345 with actual WID)
screencapture -x -l 12345 output.png

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

Capture screenshots programmatically on macOS — find window IDs, control application windows via AppleScript, and capture specific windows for documentation and visual workflows.

What's Inside

The template covers:

  • Step 1: Get Window ID (Swift)
  • Step 2: Control Window (AppleScript)
  • Step 3: Capture (screencapture)
  • Multi-Shot Workflow
  • Failed Approaches (DO NOT USE)
  • Permission Troubleshooting

Quick Start

Step 1: Create a Project Folder

Make a dedicated folder for this workflow and open it in Claude Code.

Step 2: Download the Template

Click Download above to save the template, then drop it into your project as CLAUDE.md (or paste it into your existing one).

Step 3: Start Working

Tell Claude what you need in plain language — it will follow the template's workflow automatically. For example:

Capture the Excel window for my docs

Claude reads the template and runs the steps for you.

$Related Playbooks

Developer Tools

Continue Claude Work

Recover actionable context from local .claude session artifacts and continue interrupted work — without running claude --resume — by inspecting history first.

10 minutes
Intermediate
Developer Tools

AI Agent Builder

Build AI agents with tools, memory, and multi-step reasoning - ChatGPT, Claude, Gemini integration patterns

10 minutes
Advanced
Developer Tools

Browser Automation Assistant

Automate web browser interactions, scraping, testing, and workflow automation with Puppeteer/Playwright

10 minutes
Advanced
Developer Tools

Composio SDK with Claude Code: Connect 250+ APIs in Minutes

Connect Claude Code to 250+ APIs using Composio SDK. Build AI agents that send emails, create GitHub issues, and post to Slack — not just generate text.

15 minutes
Advanced
Developer Tools

Auth & Authorization Patterns

A battle-tested checklist for implementing authentication and authorization correctly — password hashing, short-lived JWTs with refresh tokens, OAuth2 Authorization Code + PKCE, the four token claims to always validate, RBAC/ABAC at the service layer, and session-fixation and cookie-flag defenses, each with the why behind it.

5 minutes
Intermediate
Developer Tools

Android Restore Credentials

Implement Android's Restore Credentials feature with androidx.credentials — the two-tier background/foreground restoration architecture, the createCredential fallback for devices without end-to-end encryption, sign-in and deletion flows with real Kotlin code, and the backend guidelines a client-side implementation must hand off to the developer, not implement itself.

10 minutes
Intermediate
Developer Tools

Autonomous Skill Optimizer

Evaluate and iteratively improve SKILL.md files with a research-grounded 9-dimension rubric and a critical insight most self-improvement loops miss: absolute LLM-judge scores are too noisy (±8 points on unchanged text) for keep/revert decisions — only a same-judge, same-call paired comparison between two versions cancels that noise out reliably.

15 minutes
Advanced
Developer Tools

Better Web Typography

Web typography engineering as a review discipline, not a style guide — CSS properties over raw variable-font tags, a semantic type scale with descending heading sizes, deliberate text-wrap usage (balance vs. pretty), tabular numbers for changing values, mobile input zoom fixes, and a severity-rated review report format with a concrete common-mistakes table.

5 minutes
Intermediate
Developer Tools

Automated PR Code Review

High-signal automated PR review using parallel agents with a validation pass that filters out false positives before anything gets posted.

10 minutes
Advanced
Developer Tools

Auto Repo Setup

Turn Claude Code into an environment doctor that diagnoses, fixes, and verifies a codebase so non-technical teammates can run it without understanding the stack.

10 minutes
Intermediate
Developer Tools

Artifacts Builder

Create elaborate multi-component HTML artifacts using React, Tailwind CSS, and shadcn/ui components with professional bundling.

15 minutes
Advanced
Developer Tools

Claude Code Cost Optimizer

A static audit of a project's Claude Code setup for the handful of well-known token-cost leaks — oversized CLAUDE.md prepended every turn, bloated memory files, never-invoked skills loaded into the index, unscoped subagent fan-out, and the cache-killing hook that silently ~10x's cost — each with a PASS/WARN/FAIL check and a concrete fix, ranked by biggest win per effort.

5 minutes
Beginner

Browse all Developer Tools playbooks →