Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/steipete/agent-rules/screenshot-automationgit clone --depth 1 https://github.com/steipete/agent-rulesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/steipete/agent-rules/screenshot-automation)<a href="https://agentmods.dev/rules/steipete/agent-rules/screenshot-automation"><img src="https://agentmods.dev/badge/rules/steipete/agent-rules/screenshot-automation.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02038 |
| Opus 5 | $0.00000 | $0.01019 |
| Sonnet 5 | $0.00000 | $0.00408 |
| Haiku 4.5 | $0.00000 | $0.00204 |
Grade A, and why
screenshot-automation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
Copies of this mod
1 near-identical copy found in the catalogue:
- screenshot-automation — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 290 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Screenshot Automation Guide
This guide provides reusable AppleScript patterns for taking automated screenshots of applications, particularly useful for documentation, testing, and visual verification.
Core Concepts
Application Identification
Applications can be identified through multiple methods:
- Bundle ID: Most reliable for packaged apps (e.g.,
com.company.AppName) - Process Name: May differ from app name (e.g., "Electron" for dev builds)
- Absolute Path: Most reliable for development builds and non-standard locations
Basic Screenshot Script
-- Script to take an unattended screenshot of an app window
-- Set appPath to the full path of the application
try
-- Set this to the full path of the application
set appPath to "/Applications/YourApp.app"
-- Generate timestamp for unique filename
set currentDate to do shell script "date '+%Y-%m-%d_%H-%M-%S'"
set desktopPath to (path to desktop folder as text)
set posixDesktopPath to POSIX path of desktopPath
set screenshotPath to posixDesktopPath & "app_screenshot_" & currentDate & ".png"
-- Extract app name from path
set appName to do shell script "basename " & quoted form of appPath & " .app"
-- Check if app is running and get process name
set isRunning to false
set appProcessName to ""
-- Try to identify by bundle ID first
try
set appBundleID to do shell script "mdls -name kMDItemCFBundleIdentifier -raw " & quoted form of appPath
tell application "System Events"
set allProcesses to every process
repeat with currentProcess in allProcesses
try
if bundle identifier of currentProcess is appBundleID then
set isRunning to true
set appProcessName to name of currentProcess
exit repeat
end if
end try
end repeat
end tell
on error
-- Fallback to app name matching
set appProcessName to appName
tell application "System Events"
if exists process appProcessName then
set isRunning to true
end if
end tell
end try
-- Launch app if not running
if not isRunning then
do shell script "open " & quoted form of appPath
delay 2 -- Wait for app to launch
-- Identify the launched process
tell application "System Events"
set newProcesses to every process
repeat with currentProcess in newProcesses
try
set processName to name of currentProcess
if processName contains appName then
set appProcessName to processName
set isRunning to true
exit repeat
end if
end try
end repeat
end tell
end if
-- Verify we have a valid process
if appProcessName is "" or not isRunning then
return "Could not determine process name for app at path: " & appPath
end if
-- Take the screenshot
tell application "System Events"
tell process appProcessName
-- Bring to front
try
set frontmost to true
delay 0.5 -- Allow time to come to front
on error errMsg
log "Note: Could not bring " & appProcessName & " to front: " & errMsg
end try
if (count of windows) > 0 then
set appWindow to window 1
set windowPosition to position of appWindow
set windowSize to size of appWindow
set windowX to item 1 of windowPosition
set windowY to item 2 of windowPosition
set windowWidth to item 1 of windowSize
set windowHeight to item 2 of windowSize
-- Validate dimensions
if windowWidth is 0 or windowHeight is 0 then
return "Window has zero dimensions"
end if
delay 0.5 -- Final delay for window readiness
set regionString to windowX & "," & windowY & "," & windowWidth & "," & windowHeight
do shell script "screencapture -x -R" & regionString & " " & quoted form of screenshotPath
return "Screenshot saved to: " & screenshotPath
else
return "No windows found for " & appProcessName
end if
end tell
end tell
on error errMsg
return "Error: " & errMsg
end try
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 290 lines · 0 tokens per session scan A c590f28c5c97
screenshot-automation is a cursor rule published in the GitHub repository steipete/agent-rules (5,695 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,038 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
code-optimization
Guidelines for optimizing duplicate and poorly structured code.
type-inference
Derive TypeScript types from Zod schemas - no hand-written interfaces for wire shapes.
paperfit
PaperFit project rule for LaTeX visual typesetting optimization.
frontend-architecture
Vite + React SPA architecture - directory layout, providers, bundle splitting. Tailwind styling in tailwind.mdc.
workers-cache
Workers Cache - Cache-Control, gateway exports cache off, RPC vs fetch.
boundaries
Package dependency boundaries - tag map and enforced invariants.