Your coding agent writes code, opens pull requests, and fixes bugs on its own. It still cannot do the one thing you do by reflex: drop a screenshot into a comment. GitHub only accepts images dragged into its web editor, and there is no public API for it. gh-agent-screenshot closes that gap. One command uploads an image to any issue or PR and embeds it inline, stored in your own repo through GitHub's Git Data API. No Imgur, no S3, no upload token to leak.
gh extension install mgiovani/gh-agent-screenshot
# Optional: install the agent skill so AI coding agents know how to use it
npx skills add mgiovani/gh-agent-screenshotThe extension auto-selects the matching prebuilt binary for your host OS and architecture from the latest GitHub Release.
| Asset name | OS | Arch |
|---|---|---|
gh-agent-screenshot-darwin-amd64 |
macOS | x86_64 |
gh-agent-screenshot-darwin-arm64 |
macOS | Apple Silicon |
gh-agent-screenshot-linux-amd64 |
Linux | x86_64 |
gh-agent-screenshot-linux-arm64 |
Linux | aarch64 |
gh-agent-screenshot-windows-amd64.exe |
Windows | x86_64 |
# Append images to the issue/PR body (default, no flag needed)
gh agent-screenshot upload a.png b.png --repo owner/name --pr 42
# Print markdown image links only; still uploads to a git ref, just skips posting/editing
gh agent-screenshot upload a.png b.png --repo owner/name --issue 1 --print-only
# Post images as a new comment
gh agent-screenshot upload a.png b.png --repo owner/name --issue 1 --new-comment
# Append images to an existing comment
gh agent-screenshot upload a.png b.png --repo owner/name --issue 1 --update-comment <id>
# Explicitly append to the issue/PR body (same as the default)
gh agent-screenshot upload a.png b.png --repo owner/name --pr 42 --edit-body
# Replace the body/comment instead of appending to it
gh agent-screenshot upload a.png b.png --repo owner/name --pr 42 --overwrite--issue and --pr are mutually exclusive; one is required. The default write mode (no flag, or --edit-body) appends to the issue/PR body instead of replacing it. --update-comment also appends. Pass --overwrite to replace the body/comment instead — it's rejected with --print-only or --new-comment, which don't touch existing content. Appending reads the current body then writes the joined result, so two uploads racing against the same issue/PR/comment at the same time can still clobber each other; it isn't a concurrency-safe merge.
# Preview which branches would be deleted (no writes)
gh agent-screenshot prune --repo owner/name --dry-run
# Delete branches older than the default threshold (90 days)
gh agent-screenshot prune --repo owner/name --confirm
# Delete branches older than a custom threshold
gh agent-screenshot prune --repo owner/name --confirm --older-than-days 30--dry-run and --confirm are mutually exclusive. --older-than-days defaults to 90.
Each upload creates a blob via the Git Data API, assembles a tree and commit, then pushes to a throwaway refs/uploads/<id> branch. The resulting comment embeds a ?raw=true SHA-pinned URL that resolves directly to the blob content. Because the URL is under raw.githubusercontent.com and the repository is private, browsers authenticate the request via the logged-in GitHub session cookie: no token is exposed in the markdown, and the image renders inline for any collaborator who has repo access.
The private-repo inline render (image visible in a browser without a raw token) is verified by a logged-in browser session via cookie auth. CI cannot prove it automatically.
An agent skill is published so AI coding agents can learn how to use this extension. Install it with npx skills add mgiovani/gh-agent-screenshot (see Install) or browse it on skills.sh.
The skill teaches agents all write modes (default body append, --print-only, --new-comment, --update-comment, --edit-body, --overwrite) and the prune subcommand. See skills/gh-agent-screenshot/SKILL.md.
Licensed under the MIT License.

