GitHub (gh) Skill for OpenClaw
Operate GitHub via the gh CLI (issues, PRs, repos).
Last updated : 2026-03-01
Quick Install
$
npx clawhub@latest install github
Key Features
OpenClaw GitHub Skill Overview
The GitHub (gh) skill connects OpenClaw to the GitHub platform via the official GitHub CLI (gh) . Once installed, your OpenClaw agent can interact with repositories, pull requests, issues, Actions workflows, and more — using plain English commands.
This is one of the most popular and versatile skills in the OpenClaw ecosystem. Whether you are triaging issues, opening PRs, or checking CI status, the GitHub skill turns multi-step Git workflows into simple conversations.
Typical workflow:
- Ask OpenClaw to check your open PRs.
-
The agent runs
gh pr listunder the hood. - Results are returned in a readable summary — no context-switching required.
Prerequisites for GitHub Skill
Before installing the GitHub skill, make sure you have:
- OpenClaw installed and running (v1.0+)
- GitHub CLI (gh) installed — installation guide
- A GitHub account with access to the repositories you want to manage
- clawhub CLI installed for skill management
Verify your setup:
# Check OpenClaw version openclaw --version # Check GitHub CLI version gh --version # Verify GitHub authentication gh auth status
How to Install the GitHub Skill
Install the GitHub skill with a single command:
npx clawhub@latest install github
To verify the installation:
clawhub list
You should see
github
in the list of installed skills.
GitHub Skill Configuration
The GitHub skill requires a Personal Access Token (PAT) or GitHub CLI authentication. We recommend using
gh auth login
for the simplest setup.
Token Scopes
If you prefer a PAT, create one at github.com/settings/tokens with these scopes:
| Scope | Required | Purpose |
|-------|----------|---------|
|
repo
| Yes | Full access to repositories |
|
read:org
| Recommended | Read organization membership |
|
workflow
| Optional | Manage GitHub Actions workflows |
|
read:project
| Optional | Read project boards |
|
gist
| Optional | Create and manage gists |
Environment Setup
# Option 1: Use GitHub CLI authentication (recommended) gh auth login # Option 2: Set a Personal Access Token export GITHUB_TOKEN=ghp_your_token_here
Important: Never hardcode tokens in configuration files. Use environment variables or a secret manager (such as 1Password or Bitwarden).
GitHub Skill Usage Examples
1. List and Triage Open Issues
You: "Show me the open issues on our main repo labeled
bug."
The agent runs the equivalent of
gh issue list --label bug --state open
and returns a formatted summary with issue numbers, titles, and assignees.
You: "Assign issue #42 to me and add the
priority:highlabel."
The agent executes
gh issue edit 42 --add-assignee @me --add-label priority:high
.
2. Create a Pull Request
You: "Create a PR from the
feature/authbranch tomainwith title 'Add OAuth2 login' and a summary of the changes."
The agent stages the PR using
gh pr create
, fills in the title, and generates a description based on the commit diff.
3. Review a Pull Request
You: "Summarize the changes in PR #128."
The agent fetches the diff with
gh pr diff 128
, analyzes the changes, and provides a concise summary covering:
- Files changed and lines added/removed
- Key logic changes
- Potential concerns or suggestions
4. Check CI Status
You: "What's the status of the latest Actions run on
main?"
The agent checks
gh run list --branch main --limit 1
and reports whether the run passed, failed, or is still in progress — along with a link to the full log.
Security & Best Practices
The GitHub skill can perform write operations on your repositories. Follow these guidelines to stay safe:
-
Use least privilege.
Grant only the token scopes you actually need. If you only read repos, skip the
workflowscope. -
Authenticate via
gh auth logininstead of long-lived PATs when possible. The CLI handles token refresh automatically. - Review before merging. Always confirm PR merges and destructive actions. OpenClaw will prompt for approval by default.
- Rotate tokens regularly. If you use a PAT, set an expiration date and rotate it at least every 90 days.
-
Avoid granting admin scope.
The
admin:organddelete_reposcopes are rarely needed. Do not grant them unless required. - Audit activity. Check your GitHub audit log periodically to review actions performed via the API.
Troubleshooting Common Errors
"gh: command not found"
The GitHub CLI is not installed or not in your PATH.
# macOS brew install gh # Ubuntu / Debian sudo apt install gh # Windows winget install GitHub.cli
After installing, authenticate with
gh auth login
.
"HTTP 401: Bad credentials"
Your token is missing, expired, or lacks the required scopes.
-
Run
gh auth statusto check the current authentication state. -
If expired, re-authenticate with
gh auth login. -
If using a PAT, verify it has the
reposcope at github.com/settings/tokens .
"Resource not accessible by integration"
You are trying to access a repository or organization that your token does not have permission for.
-
Check that your token includes the
read:orgscope. - Confirm your GitHub account has access to the target repository.
- For organization repos, an admin may need to approve your token under Settings → Third-party access .
FAQ
Yes, when configured properly. The skill follows OpenClaw's confirmation model — destructive actions (merges, deletions, force-pushes) require your explicit approval before execution. We recommend starting with read-only scopes and adding write permissions only as needed. Always review the agent's proposed actions before confirming.
Yes. The GitHub CLI supports Enterprise Server and GitHub Enterprise Cloud. Run `gh auth login --hostname your-enterprise-host.com` to authenticate against your Enterprise instance. The skill will automatically use the configured host for all subsequent operations.
The GitHub skill provides broad GitHub platform access — issues, PRs, Actions, repos, and more. The PR Reviewer skill is specialized for in-depth code review: it analyzes diffs line by line, checks for common patterns, and provides structured feedback. For the best experience, install both and let OpenClaw pick the right tool for each task.
Related Skills
Generate/validate Conventional Commits messages.
Automated code review for pull requests.
Advanced git workflows (rebase/cherry-pick/cleanup).