---
name: github
description: Post to GitHub with gh - pull request bodies with uploaded images (`gh --attach`) and a render check, PR comments, replies inside review threads, and issues. Gives the GitHub block syntax and safe edits that keep bot sections below the footer. The text comes from clins:post; clins:create-pr uses this skill for its GitHub steps. Use whenever you post, comment, reply, or file an issue on GitHub, or upload images to a GitHub post.
user-invocable: true
argument-hint: "[pr | comment | reply | issue] [number or URL to update] [any language changes]"
title: github
canonical_url: https://skilld.dev/gh/clins1994/skills/github
last_updated: 2026-10-25T23:02:24.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install clins1994/skills/github`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/github`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/clins1994/skills/github) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/github`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/github --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/github --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# /clins:github — Post to GitHub

This skill sends a post to GitHub. The text (leads, details blocks, languages, footer, check) comes from [`clins:post`](../post/SKILL.md). The footer names `clins:github`, except on a pull request body, where it names `clins:create-pr`. To open a pull request, start with [`clins:create-pr`](../create-pr/SKILL.md). It uses this skill for the GitHub steps.

## Rules

- Never merge, approve or close a PR.
- Never post a comment that asks a review bot for a review (`@greptileai ...`), unless that bot's skill says to (for Greptile, [`clins:greptile`](../greptile/SKILL.md), "Triggering"). Many bots review every push by themselves, and each request is a paid review.
- Send text from a file (`--body-file`, `-F body=@file`), never inline, so newlines and backticks survive.
- In a public repo, an attached image is public.

## Preflight

This skill uses the `gh` CLI. It does not cover the GitHub MCP server yet ([`CONTRIBUTING.md`](../../CONTRIBUTING.md#ideas) lists it as an open idea). If `gh` is missing, tell the user to install it, and stop.

1. `gh auth status`.
2. For images, make sure that you have write access to the repo that gets the PR: `gh api repos/<owner>/<repo> --jq .permissions.push`. A PR from a fork to an upstream repo usually has none. If the answer is `false`, use the placeholder path in "Pull request body with images". If it is `true`, also make sure that `gh --version` is 2.99 or newer (for `--attach`). If it is older, tell the user to upgrade `gh`, and stop.
3. `gh repo view --json nameWithOwner,visibility`.
4. Read the repo's `AGENTS.md`, `CLAUDE.md`, and `.github/` templates. Their headings and required lines win.

## GitHub syntax

- Collapsed block: `<details><summary><b>🇬🇧 More details</b> · 3 min read</summary>`, a blank line, the content, a blank line, `</details>`. The blank line after `</summary>` is required, or GitHub shows raw Markdown. Use `<b>`, not a heading, in `<summary>`, and keep the read time outside the `<b>`. A heading adds its own top margin below the `---` divider, so the gap doubles.
- Footer: the line from `clins:post`, with a `---` divider directly above it and blank lines around the divider.
- Never `<details open>`. Never Linear's `>>>`.
- Mention: `@login`. Link: `#123` or `owner/repo#123`.
- Check with `check_post.py --platform github --skill github` (or `--skill create-pr` for a pull request body).

## Pull request body with images

If the [`clins:fork-review`](../fork-review/SKILL.md) skill is installed, check its setting before `gh pr create` on a repo the user doesn't own. It may want the PR on the user's fork first. Without that skill, post as usual.

Run `gh` from the folder that holds the body and the images, so the `./` paths in the body match. That folder is outside the repo, so pass `-R` and `--head`. Push the branch first.

```bash
gh pr create -R <owner>/<repo> --head <branch> --title "<title>" --body-file body.md --assignee <login> \
  --attach ./login-before.png --attach ./login-after.png     # add --draft if not ready
gh pr edit <n> -R <owner>/<repo> --body-file body.md [--attach ./new.png]
gh pr view <n> -R <owner>/<repo> --json body -q .body > body.md                # fetch to update
```

Every `--attach` path must match a path in the body exactly. `gh` uploads each file to GitHub's attachment store and writes a `https://github.com/user-attachments/assets/...` URL in its place. Nothing is committed, so no review runs.

**Check that the images render:**

1. The body from `gh pr view` has only `user-attachments` URLs, and no `./` path.
2. Fetch each image from the HTML GitHub renders for you:

   ```bash
   gh api repos/<owner>/<repo>/pulls/<n> -H "Accept: application/vnd.github.html+json" --jq .body_html \
     | grep -oE 'src="https://[^"]*(user-images|user-attachments)[^"]*"' | sed 's/^src="//;s/"$//;s/&amp;/\&/g' \
     | while read -r u; do curl -sL -o /dev/null -w '%{http_code} %{content_type}\n' "$u"; done
   ```

   Every line must be `200 image/...` or `200 video/...`.
3. In a private repo, an unauthenticated request to `github.com/user-attachments/...` returns 404 even when members see the image. That is expected.

### Without write access

`gh --attach` needs write access to the repo. Without it, `gh pr create` and `gh pr edit` fail with "attaching files requires write access to the repository". The GitHub API has no other supported upload. So the user adds the images in the browser:

1. Replace each image in the body with a placeholder in the same table cell. The placeholder names the file, for example `` 📎 **Paste `login-before.png` here** ``. Keep the caption row.
2. Post the full title and body without `--attach`.
3. Make sure that no `./` path is left in the body from `gh pr view`.
4. Tell the user the local path of each image. Ask them to open the PR in the browser, edit the description, and paste each image over its placeholder. The web editor uploads images for any account that can edit the PR.
5. After the user says the images are in, run the render check above.

Do not call undocumented upload endpoints (for example `uploads.github.com/user-attachments/assets`). Do not commit the images to the repo as a workaround.

## PR comment

```bash
gh pr comment <n> -R <owner>/<repo> --body-file post.md
gh api repos/<owner>/<repo>/issues/comments/<id> -q .body > post.md            # fetch to update
gh api -X PATCH repos/<owner>/<repo>/issues/comments/<id> -F body=@post.md
```

## Reply in a review thread

Reply in the thread, not as a new top-level comment. `<id>` is the review comment's id: its `id` in `gh api repos/<owner>/<repo>/pulls/<n>/comments`, or the `databaseId` of the thread's first comment in the GraphQL `reviewThreads` query. Both are the same number:

```bash
gh api repos/<owner>/<repo>/pulls/<n>/comments/<id>/replies -F body=@post.md
```

A short post is usually right: "Fixed in abc1234." Resolve the thread only if the user asked, or if the fix does exactly what the comment asked.

## Issue

Headings, unless the repo's issue template has its own: Context, Work, Done when. Translate them for each other language, for example in japanese: 背景, やること, 完了条件.

```bash
gh issue create -R <owner>/<repo> --title "<title>" --body-file post.md [--assignee <login>] [--label <name>]
gh issue view <n> -R <owner>/<repo> --json body -q .body > post.md            # fetch to update
gh issue edit <n> -R <owner>/<repo> --body-file post.md
```

## Updating any post

Fetch it, change it with `clins:post` ("Updating a post"), keep everything below the footer exactly as it is, check, then save with the matching command. Keep image URLs that are already there unless you replace those images.
