# Github Interaction Skill

> Instructions and best practices for interacting with the GitHub API for AxKeyStore. Use when this capability is needed.

- Skill: `tomevault-io/github-interaction-skill` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/github-interaction-skill`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/github-interaction-skill/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/github-interaction-skill

---


# GitHub Interaction Skill

This skill outlines how to handle interactions with GitHub, including authentication and repository manipulation.

## Authentication (Device Flow)
Since AxKeyStore is a CLI tool, use the GitHub **Device Authorization Flow**.
1. **Request Device Code**: POST `https://github.com/login/device/code` with `client_id`.
2. **User Prompt**: Display `user_code` and the `verification_uri` to the user.
3. **Poll for Token**: Poll `https://github.com/login/oauth/access_token` until the user authorizes.
4. **Storage**: Save the resulting `access_token` locally.

## Repository Operations
Use the GitHub REST API (v3) to read and write files.

### Reading a File
- Endpoint: `GET /repos/{owner}/{repo}/contents/{path}`
- Headers: `Authorization: token OAUTH_TOKEN`, `Accept: application/vnd.github.v3+json`
- Response: contains `content` (base64 encoded) and `sha`.

### Writing/Updating a File
- Endpoint: `PUT /repos/{owner}/{repo}/contents/{path}`
- Body:
  ```json
  {
    "message": "Update keys",
    "content": "BASE64_ENCODED_CONTENT",
    "sha": "FILE_SHA" // Required if updating, omit if creating new
  }
  ```
- **Note**: Always fetch the latest `sha` before updating to avoid conflicts.

## Crates
- Recommend using `reqwest` for raw control or `octocrab` if interaction is complex.
- Ensure `serde_json` is used for parsing responses.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/basilgregory) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

