github-api

A guide for calling GitHub's REST API, the web interface developers use to access repositories, issues, pull requests, and files programmatically. It covers authentication and safe UTF-8 text handling.

In plain words
What is it for?
Use it to create issues or pull requests, read repository files, commit text or binary files, and update files through GitHub's API.
Why use it?
It reduces common API mistakes, including missing headers, exposed tokens, and corrupted non-English text when files are read and written.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/abel30567/fermi-mcp/github-api
Any agent
npx skills add abel30567/fermi-mcp --skill github-api
Clone the repo
git clone --depth 1 https://github.com/abel30567/fermi-mcp

Made for: Claude Code, Codex.

Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 735 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00036 $0.00735
Opus 5 $0.00018 $0.00367
Sonnet 5 $0.00007 $0.00147
Haiku 4.5 $0.00004 $0.00073

Measured yesterday against content hash 0145f9b19680, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

github-api scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/worker/seeds/skills/github-api/SKILL.md · 51 lines

How it starts

The opening of the file, as written. The whole thing — 51 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GitHub API workflow

Auth

Always call through execute (codemode.fetch_url) or fetch_url with:

  • Header Authorization: Bearer {{secret:GITHUB_TOKEN}} (never inline a raw token; the secret is scoped to api.github.com)
  • Header User-Agent: Fermi-Agent (GitHub rejects requests without one)
  • API base: https://api.github.com

Common recipes

  • Create issue: POST /repos/{owner}/{repo}/issues { title, body, labels }
  • Create PR: POST /repos/{owner}/{repo}/pulls { title, head, base, body }
  • Read file: GET /repos/{owner}/{repo}/contents/{path} (body is base64)
  • Write file: PUT /repos/{owner}/{repo}/contents/{path} { message, content: <base64>, sha?, branch? }

CRITICAL: UTF-8 encoding (corruption hazard)

atob/btoa alone and Buffer.from(...) in the Worker sandbox corrupt multi-byte UTF-8 (em-dashes, arrows, smart quotes) — each read-modify-write round trip adds mojibake. Always use the symmetric pair:

  • READ: decodeURIComponent(escape(atob(b64.replace(/\n/g, ''))))
  • WRITE: btoa(unescape(encodeURIComponent(content))) Or the byte-exact TextDecoder/TextEncoder loop for binary-safe handling. Also: -style escapes only resolve inside JS string literals — when generating JSX/text via templates, insert real unicode characters.

Large binary commits — blob-rename technique (preferred)

The model cannot reliably transcribe >3K chars of base64. When a large file must be committed:

  1. Have the USER push the file to the repo under any filename.
  2. GET /repos/{o}/{r}/contents/{tmp} to get the blob SHA.
  3. POST /repos/{o}/{r}/git/trees with base_tree = HEAD tree, adding the blob at the desired path (and sha: null entries to delete the temp file).
  4. POST /repos/{o}/{r}/git/commits with that tree + parent HEAD.
  5. PATCH /repos/{o}/{r}/git/refs/heads/{branch} to the new commit. Zero file bytes pass through model context — only SHA pointers.

Fallback: R2 chunk relay (file not yet on GitHub)

Split base64 into ~1000-char chunks, write each via fs_write to assets/<name>/<i>, then one execute reads all chunks, concatenates, verifies magic bytes + length, and PUTs to GitHub with the auth header above.

Read the full file on GitHub · 51 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 51 lines · 36 tokens per session scan A 0145f9b19680

Subscribe to this mod's changes

github-api is a skill published in the GitHub repository abel30567/fermi-mcp (1 stars, last pushed 5d ago), licensed MIT. It adds 36 tokens to every session and 735 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.