--- name: annotate-screenshots description: >- Bake hand-drawn boxes, arrows, labels, freeform strokes, and redactions onto a screenshot so a PR reviewer or teammate sees exactly what changed and where to look, instead of reading a caption and hunting for it. Use this whenever a screenshot needs a callout — "point at the new button", "circle the bug", "arrow to the diff", "blur out the API key in this screenshot", "mark up this image before I attach it". Covers both annotating a live page during capture (`uploads screenshot --annotate`, CSS selector targeting) and annotating an image you already have (`uploads annotate`, pixel/freeform coordinates only). For getting the resulting image into a GitHub PR or issue, hand off to the github-screenshots skill — this skill only covers producing the annotated image. --- # Annotating screenshots ## When to annotate Add annotations when a screenshot needs to draw the reader's eye somewhere specific — a new element, a bug, a diff — rather than leaving them to find it in the caption. A plain before/after pair is often enough; reach for annotation when "look at the top-right corner" is easier to say with an arrow than with words, or when a screenshot contains a secret that must be hidden before it's shared anywhere (uploads.sh URLs are public). Two commands, same underlying spec format: | Command | Input | Targeting | | ------------------------------------------------------- | ------------------------- | ----------------------------------------------- | | `uploads screenshot --annotate ` | captures a live page | CSS selectors (preferred) or pixel coordinates | | `uploads annotate --spec ` | an existing PNG/JPEG file | pixel coordinates only — selectors are rejected | **Prefer selectors, resolved live, over guessing pixel coordinates.** An agent estimating `x`/`y`/`w`/`h` by eye is unreliable — it's easy to point at the wrong element or clip a box awkwardly. `uploads screenshot --annotate` resolves a CSS selector against the real DOM at capture time (local backend only in v1 — `--via remote` rejects selector-bearing specs up front), so use it whenever you're capturing the page yourself. Fall back to pixel coordinates with `uploads annotate` only when you're marking up an image you already have and there's no live page to query — a screenshot someone else took, a photo, a diagram exported from elsewhere. ## The spec format A spec is a JSON document: `{ "version": 1, "annotations": [...] }`. `annotations` is a non-empty array; each entry has a `type` plus fields for that type. House style (color, stroke weight, sketchy roughness, font) is fixed and not configurable — the one style knob is a per-annotation `color` override. Annotation types: | Type | Required fields | Notes | | -------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | | `box` | `x, y, w, h` (or `selector`) | outlines a region | | `arrow` | `from, to` points (or `selector`) | `to` = element center when resolved from a selector; `from` defaults to an offset above-right if omitted | | `label` | `text`, plus `target` or `at` point (or `selector`) | a callout bubble with a leader line to `target` | | `draw` | `points` (>= 2 `[x, y]` pairs) | freeform stroke, pixel-only, no selector support | | `redact` | `x, y, w, h` (or `selector`), optional `style: "blur" \| "solid"` | hides a region (default `solid`; always `solid` for secrets) | | `svg` | `fragment` (raw SVG; no ` --via local --annotate ./spec.json ...`. This is one call — no separate "capture then annotate" round-trip. 2. **Annotate an existing image** with `uploads annotate --spec ...` when there's no live page (an image from elsewhere, or a second annotation pass on something already captured). 3. **Attach the result to a PR or issue** — this skill stops at producing the annotated PNG. Hand off to the **github-screenshots** skill for hosting, embedding, and the managed attachments comment (`uploads attach`, `uploads put --pr`, before/after tables, etc.). Invalid specs fail fast with per-annotation error messages (`annotations[i]: `); a selector that matches nothing on the page fails the command naming the selector rather than silently skipping it. See `uploads annotate --help` / `uploads screenshot --help` for the full flag reference, including `--seed` (deterministic sketchy rendering) and `--format json`.