Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Capture Ui?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-capture-ui)
---
name: capture-ui
description: Take screenshots, GIFs, or videos of the running Cherry Studio app. Use when a task needs a still image or a recording of its UI.
---
# Capturing Cherry Studio UI
Get a verified CDP endpoint through `cherry-electron-dev`, which owns instance discovery and launch.
Capture through that endpoint: it reaches only the renderer, so the desktop and other windows stay
out of frame and focus stays where it is.
Capture with [scripts/capture.mjs](scripts/capture.mjs), run from the repository root so
`@playwright/test` resolves. It works on the main window; pass `--target <url part>` for another.
## Find Elements
```bash
node .agents/skills/capture-ui/scripts/capture.mjs describe --port <cdp_port>
```
It lists each visible control with its role, name, and box in CSS pixels, after a line with the
viewport size and `devicePixelRatio`, and marks Tab stops. Take locators and clip areas from it.
Rows that share a box are a control and its wrapper, which a locator by name matches together.
## Steps
Write the steps as a module outside the repository:
```js
export default async ({ page, shot, annotate }) => {
await page.getByLabel('Chat', { exact: true }).click()
await shot('chat', { x: 0, y: 0, width: 680, height: 400 })
}
```
`page` is a Playwright `Page`, and `shot(name, clip)` saves `<out>/<name>.png`. Run them with:
```bash
node .agents/skills/capture-ui/scripts/capture.mjs run <steps.mjs> --port <cdp_port> --out <dir>
```
## Screenshot
`clip` takes CSS pixels; the file comes out in device pixels (`devicePixelRatio` times larger).
Clip at capture time rather than cropping afterwards.
The shared `ScrollArea` hides its scrollbar 1.5 s after scrolling stops. To keep the thumb in a
still, scroll last and take the screenshot right after.
## Annotations
To show what the screen does not, such as keyboard focus without a focus ring or the keys pressed,
use `annotate`:
- `annotate.followFocus()` draws a box that follows keyboard focus.
- `annotate.badge(text, at?)` shows a label such as a key name, in the bottom right corner unless
`at` gives `{ left, top }`.
The overlays take no clicks or focus, stay hidden from assistive technology, and are removed when
the run ends. Any other overlay you add needs the same: `pointer-events: none`,
`aria-hidden="true"`, no `tabindex`, and removal afterwards.
## Window Size
For a state that depends on the window size, such as content that overflows only in a shorter
window, add `--viewport <width>x<height>` to `run`. It reflows the page without resizing the window,
keeps `devicePixelRatio`, and ends with the run.
## GIF or Video
Add `--record` to `run` to record the steps, with the opening and closing states held on screen.
Then encode, cropping in CSS pixels as for `clip`:
```bash
node .agents/skills/capture-ui/scripts/capture.mjs encode <dir> <out>.gif --crop <x>,<y>,<w>,<h>
```
A GIF plays inline and loops, which suits a few seconds; an MP4 (`<out>.mp4`) plays in a player,
suits longer flows, and takes no alt text on GitHub.
Frames arrive only when the page repaints, so keep the window unminimized and on screen.
Both commands stop when ffmpeg is missing. Ask the user whether to install it, for example with
`brew install ffmpeg` on macOS, and record only after they decide.
## Outside the Renderer
The Dock, native menus, notifications, and system dialogs are not in the renderer. Only macOS
`screencapture` reaches them, and it records the real screen, including whatever else is on it, and
may need the window in front. Ask the user before using it.
## Check the Output
Open every image. For a recording, open the first and last frames that `run` prints, and check that
the two durations `encode` prints match, so a dropped or frozen capture is caught before anyone else
sees it.
Store captures where the calling workflow keeps its artifacts, or under `.context/capture-ui/`.