Interact with GitHub repositories, issues, pull requests, and commits via the GitHub REST API. Use when the user mentions GitHub, repos, repositories, issues, PRs, pull requests, commits, releases, or asks to push/clone/fetch from GitHub.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Github?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/julienr2-github)
---
name: github
description: Interact with GitHub repositories, issues, pull requests, and commits via the GitHub REST API. Use when the user mentions GitHub, repos, repositories, issues, PRs, pull requests, commits, releases, or asks to push/clone/fetch from GitHub.
allowed-tools: Bash, Read, Write
---
# GitHub Skill
Access GitHub via the REST API. Pushing goes through the API too
(`gh_push.py`, below), not `git push`.
## Credentials
Uses the **`github`** connector → sets `$GITHUB_TOKEN` (Personal Access Token, classic or fine-grained). Load it per *Connectors* in CLAUDE.md, in the same shell block as the commands that use it, then `export GH_TOKEN="$GITHUB_TOKEN"` for the gh CLI.
- **API base:** `https://api.github.com`
In the sandbox, `$GITHUB_TOKEN` holds a placeholder, not the token: the
sandbox's proxy puts the real one in when it goes to GitHub as an
`Authorization: Bearer` header. Every `curl` below works that way. `git` doesn't:
it sends the token base64-encoded (Basic auth), where the proxy can't see it —
so push, branch and fetch with `gh_push.py`, which uses the API.
---
## REST API basics
All requests require these headers:
```bash
curl -s https://api.github.com/user \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28"
```
### Who am I
```bash
curl -s https://api.github.com/user \
-H "Authorization: Bearer ${GITHUB_TOKEN}"
```
### List my repos
```bash
curl -s "https://api.github.com/user/repos?per_page=100&sort=updated" \
-H "Authorization: Bearer ${GITHUB_TOKEN}"
```
### List issues / PRs assigned to me
```bash
curl -s "https://api.github.com/issues?filter=assigned&state=open" \
-H "Authorization: Bearer ${GITHUB_TOKEN}"
```
### Create an issue
```bash
curl -s -X POST https://api.github.com/repos/OWNER/REPO/issues \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
-d '{"title":"Bug: …","body":"Details…","labels":["bug"]}'
```
### Create a PR
```bash
curl -s -X POST https://api.github.com/repos/OWNER/REPO/pulls \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-d '{"title":"…","head":"feature-branch","base":"main","body":"…"}'
```
---
## Pushing code: `gh_push.py`
One commit with any number of files, through the API. Works in and out of the
sandbox. Load the connector first, in the same shell block.
```bash
GH=/jarvis/agent/skills/github/gh_push.py
# Read or edit a repo: download it (no git history)
python3 $GH fetch OWNER/REPO /tmp/REPO [--ref BRANCH]
# Push a folder as one commit (files laid over what's there)
python3 $GH push OWNER/REPO /tmp/REPO -m "Fix the footer" # default branch
python3 $GH push OWNER/REPO /tmp/REPO -m "…" --branch fix-footer # new branch from the default one → then open a PR
python3 $GH push OWNER/REPO ./site -m "…" --prefix docs # into a subfolder
python3 $GH push OWNER/REPO ./site -m "…" --replace # the folder becomes the whole repo
python3 $GH push OWNER/REPO ./x -m "…" --delete old/file.txt # also remove paths
# A landing page: new repo + content + GitHub Pages
python3 $GH push OWNER/my-landing ./site -m "Landing page" --create --public --replace
python3 $GH pages OWNER/my-landing # prints the site URL (Pages needs a public repo on a free plan)
```
Typical PR flow: `fetch` → edit the files → `push --branch <name>` → create the
PR with the API call above (`head` = that branch). Only the files you pass are
written: to change two files, put just those two (at their paths) in a folder
and push it — the rest of the repo stays as it is.
`git push` with the token in the URL (`https://x-access-token:${GITHUB_TOKEN}@github.com/…`)
works only outside the sandbox, where the variable holds the real token.
---
## Common use cases
| Task | Endpoint / command |
|---|---|
| List my open PRs | `GET /search/issues?q=is:pr+is:open+author:@me` |
| Find an issue by text | `GET /search/issues?q=…` |
| Comment on an issue/PR | `POST /repos/OWNER/REPO/issues/:n/comments` |
| Latest release of a repo | `GET /repos/OWNER/REPO/releases/latest` |
| Repo file contents | `GET /repos/OWNER/REPO/contents/PATH` |
| Push commits / a branch / a landing page | `gh_push.py` (above) |
## Notes
- Fine-grained tokens scope to specific repos — if a request returns 404 or 403, the token may not cover that repo.
- The Search API is rate-limited to 30 req/min. Regular endpoints: 5000 req/hour.
- `gh` CLI works for API commands (`GH_TOKEN=${GITHUB_TOKEN} gh pr list --repo OWNER/REPO`), not for
the ones that run `git` (`gh repo clone`, `gh pr checkout`).