Index of every page on this site: llms.txt
All skills
mia-cx avatar

/gh-comment

@7acdf71
by mia.cxmia-cx/skills4 stars
Run it yourself

Use when posting, editing, or replying to anything on GitHub under the user's account: pull request and issue comments, inline comments on a diff line, review-thread replies, review bodies, and discussion posts. Also use it when another skill needs to publish its results to GitHub.

Use this Skill: https://skilld.dev/gh/mia-cx/skills/gh-comment

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈74 tokens for metadata: the name and description. ≈1.4k when used: this file.

Description uses 3.7% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈295 characters, or 3.7%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

GH comment

gh is authenticated as the user, so everything posted here appears under the user's name. The attribution header is what keeps that honest.

Attribution

Every comment body starts with this header, verbatim. GitHub renders it as a blue Note callout, set apart from the comment:

> [!NOTE]
> <actual model> commenting on behalf of <user's name, from AGENTS.md>.

<comment>

One wording for every case: a new conversation comment, an inline comment on a diff line, and a reply in a thread all say commenting.

<actual model> is the model that composed the text: claude-opus-5.5, gpt-6.1-sol, gpt-6-astra. Not the harness, not the orchestrator that dispatched the work, not the wrapper agent. A Claude orchestrator relaying a Codex report writes gpt-6.1-sol, because those are the words being published. When several models contributed, name the one that wrote the words and attribute the rest inline.

A reader deciding how much to trust a review verdict, a bug claim, or a "this is fine" needs to know a model wrote it and which one. The header is the only signal they get, so it goes on the routine comments too, not just the ones that feel consequential.

Bodies go in files

Write the body to a temp file and pass --body-file; comment bodies are markdown full of backticks, quotes, and newlines that an inline --body string mangles.

BODY="$(mktemp "${TMPDIR:-/tmp}/gh-comment.XXXXXX.md")"   # write the rendered body here

Images and video

gh posts text, so it cannot attach a file the way the web composer does; a local path in a comment body is a dead reference for every reader. Host the file first with the upload-file skill, then embed the URL it returns:

![failing dialog after the fix](https://i.mia.cx/file/2026/08/dialog-a1b2c3.png)

Screenshots, before/after pairs, recordings of a repro, and rendered charts all belong in the comment rather than described in prose; a reviewer arguing about UI behaviour from a text description is doing avoidable work.

Video from an external URL never renders a player. Tested on a GitHub comment: ![](), a <video> tag, a plain link, and a bare URL on its own line all fall back to a link or nothing. GitHub plays only what was uploaded through its own composer. So when a recording has to be seen inline, convert it to a GIF, which embeds like any other image:

ffmpeg -i clip.mp4 -vf "fps=12,scale=720:-1:flags=lanczos,split[a][b];[a]palettegen[p];[b][p]paletteuse" clip.gif

Otherwise link the mp4 and say what it shows plus how long it runs, so a reader can decide whether to download it:

[Screen recording: toast never dismisses (0:12)](https://i.mia.cx/file/2026/08/toast-bug-d4e5f6.mp4)

GIFs get large fast; keep them short and narrow, and prefer a still frame when one frame makes the point.

Anything uploaded this way is public to anyone with the URL. Screenshots of internal dashboards, tokens, customer data, or staging credentials stay out of the bucket.

Conversation comments

gh pr comment <n> --body-file "$BODY"                        # new comment
gh pr comment <n> --body-file "$BODY" --edit-last --create-if-none   # update in place, or create the first

Issues take the same flags: gh issue comment <n> --body-file "$BODY".

--edit-last targets the authenticated user's most recent comment on that PR, which may be something Mia typed by hand, not the comment you meant to update. When a comment must be updatable across a long-running job, own it with a hidden marker instead and look it up by that:

# last line of $BODY: <!-- gh-comment:review-relay -->
ID=$(gh api "repos/$OWNER/$REPO/issues/$N/comments" \
  --jq '.[] | select(.body | contains("<!-- gh-comment:review-relay -->")) | .id' | head -1)
[ -n "$ID" ] \
  && gh api -X PATCH "repos/$OWNER/$REPO/issues/comments/$ID" -F body=@"$BODY" \
  || gh pr comment "$N" --body-file "$BODY"

An edit posts no notification. When an update carries something subscribers need to see, post a new comment instead and say what changed.

Inline comments on a diff line

Anchored to a path, a line, and a commit. The line number is the one in that commit's diff, so a comment written against a stale head lands on the wrong code or 422s.

gh api "repos/$OWNER/$REPO/pulls/$N/comments" \
  -F body=@"$BODY" -f commit_id="$HEAD_SHA" -f path="src/auth/session.ts" \
  -F line=88 -f side=RIGHT

side=RIGHT is the post-change line; LEFT comments on a deleted line. For a multi-line range add -F start_line=<first>. Fetch $HEAD_SHA immediately before posting.

Replies in a review thread

Reply to an existing inline comment by its id, which keeps it in that thread rather than starting a new one:

gh api "repos/$OWNER/$REPO/pulls/$N/comments/$COMMENT_ID/replies" -F body=@"$BODY"

To reply and resolve in one pass, use the GraphQL addPullRequestReviewThreadReply + resolveReviewThread mutations; the review-relay skill's "Discussion thread mechanics" has the queries.

Before posting

  • The header is present as a [!NOTE] callout, followed by a blank line, and names the model that wrote the words.
  • The body renders as markdown: fenced blocks closed.
  • Inline comments cite the current head.
  • Posting is public and outward-facing: a comment can be edited or deleted afterward, but subscribers were already emailed the original.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    This skill facilitates posting and managing GitHub Pull Request comments using the GitHub CLI. It implements model attribution and media hosting via vendor-controlled infrastructure while providing explicit warnings against sharing sensitive credentials. The identified risks are limited to standard indirect prompt injection surfaces common in communication tools.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at 7acdf71. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated last month

README badge

README badge for mia-cx/skills/gh-comment