Skip to content

bikeindex/bike_index / .claude/skills/github-pr-images

github-pr-images

Verified

Embed a local image file into an existing GitHub PR — either in the PR body or as a comment. Trigger when a request pairs a local image (screenshot, .png/.jpg, CleanShot capture, before/after) with an existing PR (by #number, URL, branch name, or "the open PR"), regardless of verb — attach, embed, add, put, post, drop, show, document. Also covers visually documenting test runs, bug repros, UI states, or CI failures on an existing PR. Uploads through `gh`'s `--attach` flag — except in the Claude Code web sandbox, where `gh` doesn't work and images are hosted through the PR branch's history instead. It also owns the PR's one `## Screenshots` comment — finding, creating, editing and verifying it — so other workflows (the `pr` skill's screenshot phase) hand it a composed body that references local image paths, and it posts it.

FileKindSize
SKILL.mdskill md8.1 KB
assets/commit_images.shexecutablescript3.8 KB
assets/inline_attachments.rbscript1.2 KB
references/web-sandbox.mdmarkdown5.0 KB

assets/inline_attachments.rb

View on GitHub
# Usage: ruby .claude/skills/github-pr-images/assets/inline_attachments.rb <owner/repo> <comment-id>
#
# `gh --attach` rewrites only markdown `![](path)` references; an `<img src="path">`
# keeps its local path and the upload is appended as `![<basename>](url)` instead,
# with the basename's dots turned to spaces.
# This moves each appended URL into the `src` naming that file, drops the appended
# lines, and PATCHes the comment.
require "json"
require "open3"

repo, id = ARGV
abort "usage: #{$0} <owner/repo> <comment-id>" unless repo && id

path = "repos/#{repo}/issues/comments/#{id}"
body = JSON.parse(Open3.capture2("gh", "api", path).first).fetch("body")

appended = /^!\[([^\]]+)\]\((https:\/\/github\.com\/user-attachments\/assets\/[0-9a-f-]+)\)\s*/
inlined = body.scan(appended).reduce(body.gsub(appended, "").rstrip + "\n") do |result, (name, url)|
  result.gsub(/src="(?:[^"]*\/)?#{Regexp.escape(name).gsub("\\ ", "[. ]")}\.\w+"/, %(src="#{url}"))
end

leftover = inlined.scan(/src="(?!https?:)([^"]+)"/).flatten
abort "no upload matched: #{leftover.join(", ")}" if leftover.any?

out, status = Open3.capture2("gh", "api", "-X", "PATCH", path, "-F", "body=@-", "--jq", ".html_url", stdin_data: inlined)
abort "PATCH failed" unless status.success?
puts out
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 323kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 323kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 323kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall