Awesome-omni-skill github
Access GitHub repositories via the GitHub REST API. Use this skill when the user wants to interact with GitHub including reading files, creating/updating files, listing repos, managing branches, viewing commits, working with issues, or managing pull requests. All scripts use PEP 723 inline metadata for dependencies and run via `uv run`. Requires GITHUB_TOKEN environment variable (a Personal Access Token with appropriate scopes).
git clone https://github.com/diegosouzapw/awesome-omni-skill
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/cli-automation/github" ~/.claude/skills/diegosouzapw-awesome-omni-skill-github-2b9f34 && rm -rf "$T"
skills/cli-automation/github/SKILL.md- curl piped into shell
- makes HTTP requests (curl)
Skill Overview
This skill provides access to GitHub repositories via a set of Python scripts that wrap the GitHub REST API.
Prerequisites
Tool Dependency:
- The scripts in this skill require the uv package manager/runner. Most cloud-based AI agents haveuv
pre-installed (or they can install it). Local agents should install it viauv
or see the uv installation docs.curl -LsSf https://astral.sh/uv/install.sh | sh
Environment Variables (must be set before running any script):
- A GitHub Personal Access Token (classic or fine-grained) with appropriate scopesGITHUB_TOKEN
Recommended Token Scopes (for classic PAT):
- Full control of private repositories (orrepo
for public only)public_repo
- Read organization membership (optional, for org repos)read:org
Important: Use a fine-grained personal access token when possible for better security. Configure only the repositories and permissions you need.
Network Access
Important: The scripts in this skill require network access to the following domain:
api.github.com
If you (the AI agent) have network restrictions, the user may need to whitelist this domain in the agent's settings for this skill to function.
Common Code Used by All Scripts
This skill uses a shared common module (
github_common.py) to centralize authentication, token management, HTTP header construction, repository string parsing, error handling, and retry logic with exponential backoff.
All scripts import from
github_common.py, which makes maintenance easier and ensures consistent behavior across all operations.
API Versioning
This skill uses explicit GitHub API versioning for long-term stability:
- API Version:
2022-11-28 - Header:
X-GitHub-Api-Version: 2022-11-28
This ensures consistent behavior even if GitHub releases new API versions with breaking changes.
Available Scripts
All scripts include PEP 723 inline metadata declaring their dependencies. Just run with
uv run — no manual dependency installation needed.
Repository Operations
List Repositories (scripts/repo_list.py
)
scripts/repo_list.pyuv run scripts/repo_list.py # List your repos uv run scripts/repo_list.py --user octocat # List user's repos uv run scripts/repo_list.py --org github # List org's repos uv run scripts/repo_list.py --type public --sort updated --json
| Argument | Description |
|---|---|
| List repos for this user |
| List repos for this organization |
| Filter: all, public, private, forks, sources, member |
| Sort by: created, updated, pushed, full_name |
| Results per page (max 100, default: 30) |
| Page number (default: 1) |
, | Output as JSON |
Get Repository Contents (scripts/repo_contents.py
)
scripts/repo_contents.pyuv run scripts/repo_contents.py owner/repo # Root listing uv run scripts/repo_contents.py owner/repo --path README.md # Get file uv run scripts/repo_contents.py owner/repo --path src/ # List directory uv run scripts/repo_contents.py owner/repo --path config.json --ref develop --json
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | Path to file or directory (default: root) |
, | Git ref (branch, tag, or commit SHA) |
, | Output as JSON with full metadata |
Get Repository Tree (scripts/repo_tree.py
)
scripts/repo_tree.pyuv run scripts/repo_tree.py owner/repo # Full tree uv run scripts/repo_tree.py owner/repo --ref develop # Specific branch uv run scripts/repo_tree.py owner/repo --path src/ # Filter by path uv run scripts/repo_tree.py owner/repo --json
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | Git ref (branch, tag, or commit SHA) |
, | Filter to paths starting with this prefix |
, | Output as JSON |
File Operations
Create or Update File (scripts/file_write.py
)
scripts/file_write.py# Create new file uv run scripts/file_write.py owner/repo \ --path docs/README.md \ --content "# Documentation" \ --message "Add docs" # Update existing file (SHA required) uv run scripts/file_write.py owner/repo \ --path README.md \ --content "# Updated" \ --message "Update README" \ --sha abc123... # From local file uv run scripts/file_write.py owner/repo \ --path remote/script.py \ --from-file local/script.py \ --message "Upload script" # Create an executable script (with --mode) uv run scripts/file_write.py owner/repo \ --path scripts/build.sh \ --from-file build.sh \ --message "Add build script" \ --mode 755
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | Path for the file in the repo (required) |
, | File content as string |
, | Read content from this local file |
, | Commit message (required) |
| SHA of file being replaced (required for updates) |
, | Branch to commit to |
| File mode (e.g., 755 for executable). Creates a second commit to set mode. |
, | Output as JSON |
Note on
: The GitHub Contents API doesn't support setting file modes directly. When --mode
--mode is specified, the script first creates/updates the file, then makes a second commit to set the mode using the Git Data API. Common modes: 755 (executable), 644 (regular file).
Change File Mode (scripts/file_chmod.py
)
scripts/file_chmod.pyChange file permissions (mode) for existing files. Useful for making scripts executable or reverting to regular file mode.
# Make a single file executable uv run scripts/file_chmod.py owner/repo --path script.py --mode 755 # Make multiple files executable in one commit uv run scripts/file_chmod.py owner/repo \ --path scripts/build.sh \ --path scripts/deploy.sh \ --path scripts/test.py \ --mode 755 # Remove executable bit uv run scripts/file_chmod.py owner/repo --path script.py --mode 644 # On a specific branch with custom message uv run scripts/file_chmod.py owner/repo \ --path scripts/run.py \ --mode 755 \ --branch develop \ --message "Make run.py executable"
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | Path to file (required, can be repeated for multiple files) |
, | Target mode (required, e.g., 755 or 644) |
, | Branch to commit to (default: main) |
| Commit message (auto-generated if not provided) |
, | Output as JSON |
Common modes:
- Executable file (rwxr-xr-x)755
- Regular file (rw-r--r--)644
How it works: This script uses the Git Data API to modify file modes, which requires creating a new tree object and commit. Multiple files can be changed in a single commit for efficiency. Files that already have the target mode are skipped with a warning.
Delete File (scripts/file_delete.py
)
scripts/file_delete.pyuv run scripts/file_delete.py owner/repo \ --path docs/old.md \ --sha abc123... \ --message "Remove old doc"
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | Path to the file to delete (required) |
| SHA of the file to delete (required) |
, | Commit message (required) |
, | Branch to delete from |
, | Output as JSON |
Branch Operations
List Branches (scripts/branch_list.py
)
scripts/branch_list.pyuv run scripts/branch_list.py owner/repo uv run scripts/branch_list.py owner/repo --json
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
| Results per page (max 100, default: 30) |
| Page number (default: 1) |
, | Output as JSON |
Create Branch (scripts/branch_create.py
)
scripts/branch_create.pyuv run scripts/branch_create.py owner/repo --name feature/new-feature uv run scripts/branch_create.py owner/repo --name hotfix/123 --from develop uv run scripts/branch_create.py owner/repo --name release/v1.0 --from abc123...
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | Name for the new branch (required) |
, | Source branch or commit SHA |
, | Output as JSON |
Delete Branch (scripts/branch_delete.py
)
scripts/branch_delete.pyuv run scripts/branch_delete.py owner/repo --name feature/old-branch uv run scripts/branch_delete.py owner/repo --name merged-branch --force
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | Branch name to delete (required) |
, | Skip confirmation prompt |
, | Output as JSON |
Commit Operations
List Commits (scripts/commit_list.py
)
scripts/commit_list.pyuv run scripts/commit_list.py owner/repo uv run scripts/commit_list.py owner/repo --branch develop uv run scripts/commit_list.py owner/repo --path src/main.py uv run scripts/commit_list.py owner/repo --author octocat uv run scripts/commit_list.py owner/repo --since 2024-01-01 --json
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | Branch name |
, | Filter to commits affecting this path |
, | Filter by author username or email |
| Only commits after this date (ISO 8601) |
| Only commits before this date (ISO 8601) |
| Results per page (max 100, default: 30) |
| Page number (default: 1) |
, | Output as JSON |
Get Commit Details (scripts/commit_get.py
)
scripts/commit_get.pyuv run scripts/commit_get.py owner/repo abc123def456 uv run scripts/commit_get.py owner/repo abc123def456 --json
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
| Commit SHA (required) |
, | Output as JSON |
Issue Operations
List Issues (scripts/issue_list.py
)
scripts/issue_list.pyuv run scripts/issue_list.py owner/repo uv run scripts/issue_list.py owner/repo --state all uv run scripts/issue_list.py owner/repo --labels "bug,urgent" uv run scripts/issue_list.py owner/repo --assignee octocat --json
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
| Filter: open, closed, all (default: open) |
| Comma-separated list of label names |
| Filter by assignee username |
| Sort by: created, updated, comments |
| Sort direction: asc, desc |
| Results per page (max 100) |
| Page number |
, | Output as JSON |
Create Issue (scripts/issue_create.py
)
scripts/issue_create.pyuv run scripts/issue_create.py owner/repo --title "Bug report" --body "Description..." uv run scripts/issue_create.py owner/repo --title "Feature" --labels "enhancement" uv run scripts/issue_create.py owner/repo --title "Task" --assignees "user1,user2"
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | Issue title (required) |
, | Issue body/description |
| Comma-separated list of label names |
| Comma-separated list of usernames |
| Milestone number |
, | Output as JSON |
Update Issue (scripts/issue_update.py
)
scripts/issue_update.pyuv run scripts/issue_update.py owner/repo 123 --title "New title" uv run scripts/issue_update.py owner/repo 123 --state closed uv run scripts/issue_update.py owner/repo 123 --state closed --reason not_planned uv run scripts/issue_update.py owner/repo 123 --labels "bug,urgent" uv run scripts/issue_update.py owner/repo 123 --assignees "user1,user2"
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
| Issue number to update (required) |
, | New title |
, | New body/description |
, | New state: open, closed |
| Close reason: completed, not_planned |
| Comma-separated labels (replaces existing) |
| Comma-separated usernames (replaces existing) |
| Milestone number (0 to clear) |
, | Output as JSON |
Pull Request Operations
List Pull Requests (scripts/pr_list.py
)
scripts/pr_list.pyuv run scripts/pr_list.py owner/repo uv run scripts/pr_list.py owner/repo --state all uv run scripts/pr_list.py owner/repo --base main uv run scripts/pr_list.py owner/repo --sort updated --json
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
| Filter: open, closed, all (default: open) |
| Filter by base branch |
| Filter by head branch |
| Sort by: created, updated, popularity, long-running |
| Sort direction: asc, desc |
| Results per page (max 100) |
| Page number |
, | Output as JSON |
Create Pull Request (scripts/pr_create.py
)
scripts/pr_create.pyuv run scripts/pr_create.py owner/repo --title "Add feature" --head feature-branch uv run scripts/pr_create.py owner/repo --title "Fix bug" --head fix-123 --base develop uv run scripts/pr_create.py owner/repo --title "WIP" --head wip-branch --draft
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
, | PR title (required) |
, | Branch containing changes (required) |
, | Branch to merge into (default: default branch) |
| PR description |
, | Create as draft PR |
, | Output as JSON |
Get Pull Request Details (scripts/pr_get.py
)
scripts/pr_get.pyuv run scripts/pr_get.py owner/repo 123 uv run scripts/pr_get.py owner/repo 123 --json
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
| Pull request number (required) |
, | Output as JSON |
Merge Pull Request (scripts/pr_merge.py
)
scripts/pr_merge.pyuv run scripts/pr_merge.py owner/repo 123 uv run scripts/pr_merge.py owner/repo 123 --method squash uv run scripts/pr_merge.py owner/repo 123 --method rebase uv run scripts/pr_merge.py owner/repo 123 --method squash --title "Feature (#123)"
| Argument | Description |
|---|---|
| Repository in owner/repo format (required) |
| Pull request number (required) |
, | Merge method: merge, squash, rebase |
, | Custom commit title |
| Custom commit message body |
| Expected head SHA (for safety) |
, | Output as JSON |
Common Patterns
Setting Credentials
# Set for current session export GITHUB_TOKEN="ghp_xxxxxxxxxxxx" # Or inline with command GITHUB_TOKEN="ghp_xxx" uv run scripts/repo_list.py
Updating a File (Full Workflow)
To update a file, you need its current SHA:
# 1. Get the current file with its SHA uv run scripts/repo_contents.py owner/repo --path README.md --json > file_info.json # 2. Extract the SHA SHA=$(jq -r '.sha' file_info.json) # 3. Update the file with the SHA uv run scripts/file_write.py owner/repo \ --path README.md \ --content "New content here" \ --message "Update README" \ --sha "$SHA"
Creating and Merging a PR (Full Workflow)
# 1. Create a branch uv run scripts/branch_create.py owner/repo --name feature/my-feature # 2. Make changes (push commits via git or file_write.py) uv run scripts/file_write.py owner/repo \ --path feature.py \ --content "# New feature" \ --message "Add feature" \ --branch feature/my-feature # 3. Create a PR uv run scripts/pr_create.py owner/repo \ --title "Add my feature" \ --head feature/my-feature \ --body "This PR adds..." # 4. Merge the PR uv run scripts/pr_merge.py owner/repo 123 --method squash # 5. Delete the branch uv run scripts/branch_delete.py owner/repo --name feature/my-feature --force
JSON Output for Processing
All scripts support
--json for machine-readable output:
# List repos and filter with jq uv run scripts/repo_list.py --json | jq '.[] | select(.language == "Python")' # Get commit count uv run scripts/commit_list.py owner/repo --json | jq 'length' # Get all open PR numbers uv run scripts/pr_list.py owner/repo --json | jq '.[].number'
Error Handling
Scripts exit with non-zero status on errors. Common issues:
- 401 Unauthorized: Check that
is set and validGITHUB_TOKEN - 403 Forbidden: Token lacks required scopes, or rate limit exceeded
- 404 Not Found: Repository, file, or branch doesn't exist (or token lacks access)
- 409 Conflict: SHA mismatch when updating (file was modified since you read it)
- 422 Validation Failed: Invalid input (check branch name format, file path, etc.)
Rate Limits
The GitHub API has rate limits:
- Authenticated requests: 5,000 per hour
- Search API: 30 per minute
The skill includes automatic retry logic with exponential backoff for rate limit errors.
Check your current limits as follows:
curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/rate_limit