macwright: Skill for Claude Code

.claude/macwright-skills/skills/safari-automation/SKILL.md

macwright-safari-automation is a skill for Claude Code from ruchit-p/macwright. It costs 94 tokens per session (3,657 once invoked), scanned A, original, MIT.

A guide for controlling Safari on macOS with MacWright tools. It explains how browser element positions, window coordinates, sidebars, and screenshots relate to each other.

In plain words
What is it for?
It is for finding page elements, calculating where to click, and interacting with web pages by position during Safari automation.
Why use it?
It helps prevent clicks from landing in the wrong place when the coordinates shown by Safari, the operating system, and screenshots differ.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is ruchit-p/macwright's own configuration. It tells Claude Code how to work on macwright itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything macwright configures →

Part of the macwright-skills plugin — 3 skills shipped together

Reuse

Borrowing it

Nothing to install: this file belongs to ruchit-p/macwright. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ruchit-p/macwright/master/.claude/macwright-skills/skills/safari-automation/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/ruchit-p/macwright

Made for: Claude Code.

Or install macwright-skills, the plugin that ships this one along with the rest of its 3 skills.

Wrote 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.

agentmods badge for macwright-safari-automation

README.md
[![agentmods](https://agentmods.dev/badge/skills/ruchit-p/macwright/safari-automation/github.svg)](https://agentmods.dev/skills/ruchit-p/macwright/safari-automation)
Your own site
<a href="https://agentmods.dev/skills/ruchit-p/macwright/safari-automation"><img src="https://agentmods.dev/badge/skills/ruchit-p/macwright/safari-automation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for macwright-safari-automation

Your own site · 80×15
<a href="https://agentmods.dev/skills/ruchit-p/macwright/safari-automation"><img src="https://agentmods.dev/badge/skills/ruchit-p/macwright/safari-automation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,657 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00094 $0.03657
Opus 5 $0.00047 $0.01828
Sonnet 5 $0.00019 $0.00731
Haiku 4.5 $0.00009 $0.00366

Measured 8d ago against content hash f2fb72ce47b1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

macwright-safari-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 8d 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.

.claude/macwright-skills/skills/safari-automation/SKILL.md · 365 lines

How it starts

The opening of the file, as written. The whole thing — 365 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MacWright Safari Automation

Covers Safari-specific automation using macwright MCP tools, focusing on the coordinate system and element finding.

Coordinate System

The screen uses logical pixels (1728x952 on this machine). CSS pixels from getBoundingClientRect() = logical pixels (do NOT multiply by devicePixelRatio even though DPR=2).

Screenshots are 1280px wide max — at scale 1280/1728 ≈ 0.741x. Do not use screenshot pixel positions as click coordinates.

Viewport Formula

To convert viewport-relative coordinates to screen coordinates:

viewport_left = window_right - innerWidth
viewport_top  = window_bottom - innerHeight

screen_x = viewport_left + element.getBoundingClientRect().left
screen_y = viewport_top  + element.getBoundingClientRect().top

Get window bounds via AppleScript:

tell application "Safari"
  set b to bounds of window 1  -- returns {left, top, right, bottom}
end tell

Get viewport dimensions via safari_js:

JSON.stringify({innerWidth: window.innerWidth, innerHeight: window.innerHeight})

Why this works with sidebars: window_right - innerWidth accounts for any left-side sidebar automatically, since innerWidth shrinks by the sidebar width.

The click_element Tool (preferred over find_element + click)

For the most common case of "find element and click it", use click_element directly:

click_element(selector: 'a', wait: 1500, screenshot: true)
→ {clicked: "a", at: {x: 321, y: 339}, text: "Learn more"}
// Page navigates, screenshot shows result

Auto-wait — use timeout to wait for element to appear before clicking (Playwright-style):

click_element(selector: '#finish', timeout: 10000)
// Polls every 200ms until element appears, then clicks it
// Eliminates wait_for_element + click_element 2-step pattern

SPA navigation — use jsClick for React/GitHub/Turbo apps:

click_element(selector: 'a[data-hovercard-type="issue"]', jsClick: true)
// Dispatches MouseEvent instead of native mouse — triggers JS event handlers
// Supports modifiers: jsClick + modifiers=['Meta'] for Cmd+click

Read the full file on GitHub · 365 lines

Changes

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.

  1. 8d ago First seen · 365 lines · 94 tokens per session scan A f2fb72ce47b1

Subscribe to this mod's changes

macwright-safari-automation is a skill published in the GitHub repository ruchit-p/macwright (0 stars, last pushed 27d ago), licensed MIT. It adds 94 tokens to every session and 3,657 once invoked, about $0.0005 per session on Opus 5. 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-31.

Related

Other skills, from other repositories

macos-harness

Control a whole Mac from one persistent Python session with screenshots, PID-targeted input, an animated virtual pointer, targeted Apple Accessibility, Apple Events, Browser Harness CDP, and filesystem access. Use for native, Electron, browser, dialog, file, or cross-app tasks without moving the physical cursor or…

browser-use/macos-harness · 71 tokens

humanize-automation

Human-like mouse, keyboard and scroll behavior for behavioral bot bypass.

uphiago/recon-skills · 18 tokens

browser-control

Control web pages in an existing Chromium remote-debugging session with deterministic sagui commands or the browser-only AI Agent. Use when Claude Code needs to inspect tabs, observe semantic elements, navigate, click, type, send keys, scroll, or complete a browser goal through CDP without controlling native macOS UI…

NakaokaRei/SwiftAutoGUI · 72 tokens

browser-harness-authoring

Use when mapping a repeatable website workflow into a verified Hermes skill so later runs can follow known steps instead of rediscovering the site. Surveys browser compatibility, semantic targets, failure modes, recovery paths, decision gates, and expiry using dummy data and no irreversible submissions.

AtlasOmnia/hermes-custom-pack · 60 tokens

reddit-browse-and-post

Let an agent read Reddit by default, and publish only after the user explicitly opts in and approves the exact post. Everything here is account-agnostic: the user supplies credentials through environment variables or a browser login, never through chat.

AtlasOmnia/hermes-custom-pack · 54 tokens

macos-control

Control macOS GUI applications via mouse automation, keyboard input, screenshots, image recognition, and AppleScript execution. Use when you need to interact with macOS app UIs, take screenshots, click buttons, type text, scroll, drag, or locate images on screen.

NakaokaRei/SwiftAutoGUI · 58 tokens