github-integration
Enable the GitHub CLI (`gh`) in Claude Code cloud sessions and GitHub Copilot coding agent environments. Use this skill when: (1) setting up a project so cloud AI agents can use `gh` for PRs, issues, and releases, (2) configuring setup scripts or SessionStart hooks for `gh` installation, (3) adding `copilot-setup-steps.yml` for GitHub Copilot agents, (4) troubleshooting `gh` auth failures in cloud sessions, or (5) configuring `GH_TOKEN` for headless environments. Triggers on: "enable gh", "github integration", "Claude Code cloud setup", "copilot setup steps", "gh auth in cloud", "gh not working in cloud", "setup script", or any request involving GitHub CLI access from cloud-based AI coding agents.
Best use case
github-integration is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Enable the GitHub CLI (`gh`) in Claude Code cloud sessions and GitHub Copilot coding agent environments. Use this skill when: (1) setting up a project so cloud AI agents can use `gh` for PRs, issues, and releases, (2) configuring setup scripts or SessionStart hooks for `gh` installation, (3) adding `copilot-setup-steps.yml` for GitHub Copilot agents, (4) troubleshooting `gh` auth failures in cloud sessions, or (5) configuring `GH_TOKEN` for headless environments. Triggers on: "enable gh", "github integration", "Claude Code cloud setup", "copilot setup steps", "gh auth in cloud", "gh not working in cloud", "setup script", or any request involving GitHub CLI access from cloud-based AI coding agents.
Teams using github-integration should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/github-integration/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How github-integration Compares
| Feature / Agent | github-integration | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Enable the GitHub CLI (`gh`) in Claude Code cloud sessions and GitHub Copilot coding agent environments. Use this skill when: (1) setting up a project so cloud AI agents can use `gh` for PRs, issues, and releases, (2) configuring setup scripts or SessionStart hooks for `gh` installation, (3) adding `copilot-setup-steps.yml` for GitHub Copilot agents, (4) troubleshooting `gh` auth failures in cloud sessions, or (5) configuring `GH_TOKEN` for headless environments. Triggers on: "enable gh", "github integration", "Claude Code cloud setup", "copilot setup steps", "gh auth in cloud", "gh not working in cloud", "setup script", or any request involving GitHub CLI access from cloud-based AI coding agents.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# GitHub Integration
Enable `gh` CLI access in Claude Code cloud and GitHub Copilot coding agent
environments so agents can create PRs, manage issues, and interact with
GitHub APIs.
## When to Use This Skill
Activate when:
- User wants cloud AI agents to use `gh` (PRs, issues, releases, API calls)
- User needs to install `gh` in Claude Code cloud sessions
- User wants to add `copilot-setup-steps.yml` for GitHub Copilot agents
- `gh` commands fail with auth or "not found" errors in a cloud session
- User wants to enable GitHub integration for any cloud-based AI coding agent
## Decision Tree
```
Which cloud environment?
Claude Code cloud (claude.ai/code)?
→ gh is NOT pre-installed in the default image
→ Install via setup script: apt update && apt install -y gh
→ Set GH_TOKEN as environment variable in environment settings
→ For repo-portable setup, use SessionStart hook instead
→ Use -R owner/repo flag with gh due to sandbox proxy
GitHub Copilot coding agent?
→ Add .github/copilot-setup-steps.yml to the repo
→ gh IS pre-installed; just configure GH_TOKEN
→ Commit and push — agent sessions pick it up automatically
gh commands failing?
→ "command not found" → gh not installed; add to setup script
→ HTTP 401 → GH_TOKEN not set; add to environment variables
→ HTTP 403 → Token lacks required scope; check permissions
→ "could not determine repo" → Use -R owner/repo flag
→ See references/cloud-auth.md for more
Need gh in local dev too?
→ Run: gh auth login (interactive, browser-based)
→ Or set GH_TOKEN env var for headless/CI use
```
## Two Environments, Two Approaches
### Claude Code Cloud (claude.ai/code)
Claude Code cloud runs sessions in Anthropic-managed VMs. The `gh` CLI
is **not pre-installed**. You need two things:
1. **Setup script** — installs `gh` when the session starts
2. **`GH_TOKEN` env var** — authenticates `gh` with your GitHub PAT
#### Quick Start: Setup Script
In the Claude Code web UI: Environment Settings → Setup script:
```bash
#!/bin/bash
apt update && apt install -y gh
```
Then add `GH_TOKEN` as an environment variable with your GitHub Personal
Access Token (needs `repo` scope).
#### Alternative: SessionStart Hook (repo-portable)
Add to `.claude/settings.json` in your repo:
```json
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "if [ \"$CLAUDE_CODE_REMOTE\" = \"true\" ]; then apt update && apt install -y gh; fi",
"timeout": 120
}
]
}
]
}
}
```
The `CLAUDE_CODE_REMOTE` check ensures it only runs in cloud sessions.
#### Important: The `-R` Flag
Due to the sandbox proxy, `gh` may not auto-detect the repo. Use the
`-R owner/repo` flag:
```bash
gh pr create -R codervisor/myrepo --title "..." --body "..."
gh issue list -R codervisor/myrepo
```
### GitHub Copilot Coding Agent
Copilot coding agents use `.github/copilot-setup-steps.yml`. The `gh` CLI
is pre-installed; you just need to authenticate it.
Add this file at `.github/copilot-setup-steps.yml`:
```yaml
name: "Copilot Setup Steps"
on: repository_dispatch
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Authenticate gh CLI
run: gh auth status
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
See `templates/copilot-setup-steps.yml` for a full template with
dependency installation.
## Setup Scripts vs SessionStart Hooks vs copilot-setup-steps
| | Setup scripts | SessionStart hooks | copilot-setup-steps.yml |
|------------------|--------------------------|---------------------------------|----------------------------------|
| **Platform** | Claude Code cloud only | Claude Code (local + cloud) | GitHub Copilot agents only |
| **Configured in**| Environment settings UI | `.claude/settings.json` in repo | `.github/copilot-setup-steps.yml`|
| **Runs** | Before Claude launches | After Claude launches | Before Copilot agent launches |
| **Runs on resume**| No (new sessions only) | Yes (every session) | Yes |
| **Network** | Needs registry access | Needs registry access | Full GitHub Actions network |
## Common gh Commands for Agents
```bash
# PRs (use -R in Claude Code cloud)
gh pr create -R owner/repo --title "..." --body "..."
gh pr list -R owner/repo
gh pr view -R owner/repo
gh pr merge -R owner/repo --squash --delete-branch
# Issues
gh issue list -R owner/repo
gh issue view 42 -R owner/repo
gh issue create -R owner/repo --title "..." --body "..."
# API (for anything not covered by subcommands)
gh api repos/owner/repo/actions/runs
```
## Pitfalls
| Symptom | Cause | Fix |
|---------|-------|-----|
| `gh: command not found` | Not installed (Claude Code cloud) | Add `apt install -y gh` to setup script |
| `HTTP 401` / auth error | `GH_TOKEN` not set | Add to environment variables in settings UI |
| `HTTP 403` on push | Token lacks `repo` scope | Regenerate PAT with `repo` scope |
| `could not determine repo` | Sandbox proxy hides git remote | Use `-R owner/repo` flag |
| `gh pr create` fails | No upstream branch | Push with `git push -u origin <branch>` first |
| Setup script fails | No network access | Set network to "Limited" (default) or "Full" |
## References
- `references/cloud-auth.md` — Token auth, scopes, proxy details, troubleshooting
- `references/copilot-setup-steps.md` — Full guide to customizing the Copilot setup workflow
## Setup & Activation
```bash
npx skills add codervisor/forge@github-integration -g -y
```
Auto-activates when: user mentions "gh in cloud", "github integration",
"setup script", "copilot setup steps", or `gh` auth failures in cloud
environments.Related Skills
leanspec
The spec-coding methodology for AI-assisted development. Use when planning features, creating/refining/implementing/verifying specs, or organising a project. Works with whatever spec backend your team already uses — local markdown, GitHub Issues, Azure DevOps, Jira — by delegating platform-specific details to a LeanSpec adapter.
watch-ci
Watch GitHub Actions CI status for the current commit until completion. Use after pushing changes to monitor build results.
parallel-worktrees
Run multiple AI coding agent sessions in parallel using git worktrees — each agent isolated in its own worktree, working on a separate branch. Use this skill whenever the user wants to: run two or more AI agents simultaneously on different features or bugs, set up isolated agent workspaces in the same repo, push parallel branches to GitHub and open/update PRs, coordinate between concurrent agent sessions, or clean up after merging. Triggers on: "parallel agents", "multiple agent sessions", "git worktree", "run agents in parallel", "work on two things at once", "isolated agent workspace", "spin up another agent", or any request involving simultaneous AI-assisted development streams.
leanspec-development
Development workflows, commands, publishing, CI/CD, changelog management, and contribution guidelines for LeanSpec. Use when contributing code, fixing bugs, setting up dev environment, running tests or linting, working with the monorepo structure, looking up build/dev/test/publish/format/lint commands, preparing releases, publishing to npm, bumping versions, syncing package versions, testing dev builds, troubleshooting npm distribution, updating changelogs, triggering CI/CD workflows, monitoring build status, debugging failed runs, managing artifacts, checking CI before releases, or researching AI agent runners. Triggers include any development, scripting, publishing, CI/CD, changelog, or runner research task in this project.
agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
hubspot-integration
Expert patterns for HubSpot CRM integration including OAuth authentication, CRM objects, associations, batch operations, webhooks, and custom objects. Covers Node.js and Python SDKs.
gemini-api-integration
Use when integrating Google Gemini API into projects. Covers model selection, multimodal inputs, streaming, function calling, and production best practices.
clickhouse-github-forensics
Query GitHub event data via ClickHouse for supply chain investigations, actor profiling, and anomaly detection. Use when investigating GitHub-based attacks, tracking repository activity, analyzing actor behavior patterns, detecting tag/release tampering, or reconstructing incident timelines from public GitHub data. Triggers on GitHub supply chain attacks, repo compromise investigations, actor attribution, tag poisoning, or "query github events".
github-tools
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
vercel-github-actions-deploy
Set up GitHub Actions to deploy any Vercel project using the Git Author Override method, enabling teammates to deploy on the free Hobby plan. Use when the user asks about Vercel deployment via GitHub Actions, CI/CD for Vercel, letting teammates deploy on Vercel free plan, bypassing Vercel's Hobby plan deploy restrictions, or automating Vercel production deploys. Covers workflow setup, GitHub Secrets configuration, and package manager variants (bun, npm, pnpm).
jira-integration
Use this skill when retrieving Jira tickets, analyzing requirements, updating ticket status, adding comments, or transitioning issues. Provides Jira API patterns via MCP or direct REST calls.
github-ops
GitHub repository operations, automation, and management. Issue triage, PR management, CI/CD operations, release management, and security monitoring using the gh CLI. Use when the user wants to manage GitHub issues, PRs, CI status, releases, contributors, stale items, or any GitHub operational task beyond simple git commands.