agentleFS
Greg-KleinGreg-Klein/implementation-factory/skills/gh-github-api/SKILL.md

gh-github-api

Skill1 starsChanged 34 days agoMITView on GitHub

Recipes and traps for the `gh` CLI and the GitHub API when the ticket is a GitHub issue - reading an issue with its comments, attachments, sub-issues and dependencies, opening a pull request from a description file, requesting a reviewer and reading it back, publishing the consolidated review. Use whenever the ticket URL is a GitHub one (`/<owner>/<repo>/issues/<n>`), and whenever a gh command returns without error but changed nothing (reviewer not set, stacked pull request closed).

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. Greg-Klein/implementation-harness★ 1100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository13 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the caller authorized a correction or a remark on another issue:

    line 57

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

gh / GitHub API - recipes and traps

Everything GitHub goes through gh, never WebFetch. The ticket URL gives the host, the owner, the repository and the number: https://<host>/<owner>/<repo>/issues/<number>.

Inside the checkout of the ticket's repository, gh takes the repository from origin, and gh api replaces {owner} and {repo} in a path. Elsewhere, name it: --repo <owner>/<repo> (--repo <host>/<owner>/<repo> on a host other than github.com) for a subcommand, the full path and --hostname <host> for gh api.

gh api has --jq, which glab api has not: filter the answer on the command line instead of reading a whole JSON body.

Reading a ticket

gh issue view <number> --comments
gh api "repos/{owner}/{repo}/issues/<number>" --jq '{title, state, labels: [.labels[].name], body}'

The first is the readable form, description then comments. The second is for a field the first does not print.

Sub-issues and parent. GitHub has no epic. A ticket may have a parent issue and sub-issues:

gh api "repos/{owner}/{repo}/issues/<number>/sub_issues" --jq '.[] | {number, title, state}'
gh api "repos/{owner}/{repo}/issues/<number>/parent" --jq '{number, title, state}'

The second answers 404 when the issue has no parent: that is an answer, not a failure.

Dependencies. "Blocked by" and "blocking" are a native relation, read from both sides:

gh api "repos/{owner}/{repo}/issues/<number>/dependencies/blocked_by" --jq '.[] | {number, title, state}'
gh api "repos/{owner}/{repo}/issues/<number>/dependencies/blocking" --jq '.[] | {number, title, state}'

An empty array means no relation. A plain mention of another issue in the text (#12) is not a dependency, only a reason to read that issue.

Linked pull requests. gh issue view <number> --json closedByPullRequestsReferences lists the pull requests that declare they close the ticket.

Images and files attached to the issue. They are links in the body (https://github.com/user-attachments/assets/<id>, or https://github.com/<owner>/<repo>/assets/...). On a private repository those links need a signed address, which the HTML form of the body carries:

gh api "repos/{owner}/{repo}/issues/<number>" -H "Accept: application/vnd.github.full+json" --jq .body_html

Take each image address out of that HTML (private-user-images.githubusercontent.com/... with its jwt parameter, valid a few minutes) and download it at once with curl -sSL "<address>" -o .claude/tasks/assets/<name>. The comments have the same form under repos/{owner}/{repo}/issues/<number>/comments. Then Read each file to actually look at it, and name it after what it shows. A file that could not be downloaded is recorded as unreachable in the ticket context, never silently dropped. Never print a token, and never put one on a command line.

The ticket status

A GitHub issue has no lifecycle status: only open and closed, and the pull request closes it at merge time through its Closes keyword. Move nothing. No label, no project field, no assignment, no closing by hand. The caller says in its final report that the status was left alone because the forge has none.

Writing on another ticket

When the caller authorized a correction or a remark on another issue:

gh issue comment <number> --body-file <file>
gh issue edit <number> --body-file <file>

Both read the text from a file, so backticks and quotes survive. An edit replaces the whole body: read the current one first, change the sentence concerned in the file, and read the result back with gh issue view.

Pull request delivery

For an authorized pull request creation or consolidated review publication, read pull-request.md. Do not publish merely because a report or URL is supplied. The caller provides the branch, the base, the exact content, the reviewer policy and whether delivery is ready or draft.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.