Computer use

From stevehuang0115/crewly · View interactive version

Computer use is an AI agent skill from the GitHub repository stevehuang0115/crewly. Control the macOS desktop: take screenshots, move/click the mouse, type text, and read app content via Accessibility API. Uses native macOS APIs (screencapture, CoreGraphics, System Events, Accessibility) with zero external dependencies.

How to use this skill

Skill file

Desktop Automation (Computer Use)

Control the macOS desktop by taking screenshots, moving/clicking the mouse, typing text, and reading app content via Accessibility API (no screenshots needed).

Actions

Screenshot

Capture the screen (or a region) to an image file.

bash execute.sh '{"action":"screenshot"}'
bash execute.sh '{"action":"screenshot","output":"/tmp/my-screenshot.png"}'

Move Mouse

Move the mouse cursor to a specific coordinate.

bash execute.sh '{"action":"move","x":500,"y":300}'

Click

Click at a specific coordinate. Supports left click, right click, and double click.

bash execute.sh '{"action":"click","x":500,"y":300}'
bash execute.sh '{"action":"click","x":500,"y":300,"button":"right"}'
bash execute.sh '{"action":"click","x":500,"y":300,"button":"double"}'

Type Text

Type a string of text using simulated keystrokes.

bash execute.sh '{"action":"type","text":"Hello, world!"}'

List Apps

List all running GUI applications with their names and bundle IDs.

bash execute.sh '{"action":"list-apps"}'

Focus App

Bring a specific app to the foreground.

bash execute.sh '{"action":"focus-app","appName":"discover"}'

Read UI (Accessibility API)

Read the UI element tree from a specific app. Returns structured data including element roles, titles, values, and positions — without taking a screenshot.

bash execute.sh '{"action":"read-ui","appName":"discover"}'
bash execute.sh '{"action":"read-ui","appName":"discover","maxDepth":4}'

Output includes: element roles (button, text, image, etc.), titles, values (text content), descriptions, positions, sizes, and child elements.

Get Text (Accessibility API)

Extract all visible text content from an app's UI. Faster than read-ui when you only need text, not the full element structure.

bash execute.sh '{"action":"get-text","appName":"discover"}'

Output: Array of {role, text} objects with deduplicated text content.

Scroll

Scroll within the focused app or a specific app.

bash execute.sh '{"action":"scroll","direction":"down"}'
bash execute.sh '{"action":"scroll","direction":"up","amount":5}'
bash execute.sh '{"action":"scroll","direction":"down","amount":3,"appName":"discover"}'

Parameters

| Parameter | Required | Default | Description |

|------------|----------------|----------------------|--------------------------------------------------|

| action | Yes | - | One of: screenshot, move, click, type, list-apps, focus-app, read-ui, get-text, scroll, check-accessibility |

| x | For move/click | - | X coordinate (pixels from left) |

| y | For move/click | - | Y coordinate (pixels from top) |

| button | No | left | Click button: left, right, or double |

| text | For type | - | Text string to type |

| output | No | /tmp/screenshot.png| Screenshot output file path |

| appName | For read-ui/get-text/focus-app | - | macOS process name of the target app |

| maxDepth | No | 3 | Max depth for UI tree traversal (read-ui) |

| direction| For scroll | down | Scroll direction: up, down, left, right |

| amount | No | 3 | Number of scroll units |

Check Accessibility

Check whether the current process has Accessibility permission. Run this first before using read-ui or get-text.

bash execute.sh '{"action":"check-accessibility"}'

Output: {"trusted": true/false, "message": "..."} with instructions if permission is missing.

Requirements

1. Open System Settings > Privacy & Security > Accessibility

2. Enable the terminal app running this script (e.g., Terminal, iTerm2, VS Code)

3. Restart the terminal after granting permission

4. Run check-accessibility to verify

Typical Workflows

Visual Workflow (screenshot-based)

  1. Take a screenshot to see the current screen state
  2. Identify the coordinates of the target element
  3. Move the mouse and/or click on the target
  4. Optionally type text into a focused field
  5. Take another screenshot to verify the result

Content Reading Workflow (Accessibility API — no screenshots)

  1. Use list-apps to find the target app's process name
  2. Use focus-app to bring the app to the foreground
  3. Use get-text to read all visible text content
  4. Use scroll to navigate, then get-text again for new content
  5. Use read-ui when you need element positions for clicking

Hybrid Workflow (recommended)

  1. Use get-text to read content (fast, no screenshot)
  2. Use read-ui to get element positions when you need to interact
  3. Only use screenshot when visual context is needed (images, layout)
  4. This reduces screenshot usage by 80%+ while maintaining full control

Notes on iPad Apps (e.g., 小红书/discover)

iPad apps running on macOS via Apple Silicon may have limited Accessibility API support. Some elements may not expose their text content through the accessibility tree. In such cases:

Which control surface to use

Crewly has three ways to act on a screen. Pick the lowest one that can do

the job — each step down costs more tokens, breaks more easily, and disturbs

the user more.

| Need | Use | Why |

|---|---|---|

| Anything a Crewly skill or connector already does (mail, Drive, Slack, calendar, git, files) | that skill | No screen at all. Fastest and cannot misclick. |

| Content of a web page, or acting as the signed-in user in Chrome | remote-browser | Real Chrome, real session, per-agent bound tab, and the user sees a takeover banner. |

| An Electron app (VS Code, Slack, Notion, Figma) | desktop-app-control | Accessibility snapshot with element refs — no coordinates. Needs the app started with a debug port. |

| Native macOS apps, system dialogs, anything the above cannot reach | computer-use | Last resort: screen coordinates and pixels. Slowest and most fragile. |

computer-use refuses destructive key combos, typing into password fields and

driving credential apps, holds a machine-wide lock while it works, and logs

every action to ~/.crewly/desktop-actions.jsonl. Run

{"action":"check-permissions"} first — without Screen Recording and

Accessibility every action fails, and the refusal tells you what to grant.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.