-
Notifications
You must be signed in to change notification settings - Fork 0
Add GitHub integration skill for cloud AI coding agents #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1d384df
595692e
4481a69
ba36602
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,200 @@ | ||||||||||||||||||
| --- | ||||||||||||||||||
| name: github-integration | ||||||||||||||||||
| description: > | ||||||||||||||||||
| 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. | ||||||||||||||||||
| metadata: | ||||||||||||||||||
| author: Codervisor | ||||||||||||||||||
| version: 0.2.0 | ||||||||||||||||||
| homepage: https://github.com/codervisor/forge | ||||||||||||||||||
| --- | ||||||||||||||||||
|
|
||||||||||||||||||
| # 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`: | ||||||||||||||||||
|
Comment on lines
+123
to
+126
|
||||||||||||||||||
| 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`: | |
| Copilot coding agents use a workflow at `.github/workflows/copilot-setup-steps.yml`. The `gh` CLI | |
| is pre-installed; you just need to authenticate it. | |
| Add this file at `.github/workflows/copilot-setup-steps.yml`: |
Copilot
AI
Mar 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “Pitfalls” row “HTTP 403 on push → Token lacks repo scope” is misleading in the context of this skill: in Claude Code cloud, git push is mediated by the sandbox proxy and is often blocked due to branch restrictions (as described in references/cloud-auth.md), not because GH_TOKEN/PAT scopes are wrong. Consider rewording this symptom to be explicitly about gh API calls returning 403 (scope issue), and add a separate row for git push failures pointing to the branch/proxy restriction.
| | `HTTP 403` on push | Token lacks `repo` scope | Regenerate PAT with `repo` scope | | |
| | `HTTP 403` from \`gh\` API calls | `GH_TOKEN`/PAT lacks required scopes (e.g. \`repo\`) | Regenerate token with needed scopes; see \`references/cloud-auth.md\` | | |
| | `git push` returns `403` / "protected branch" | Sandbox proxy / branch protection blocks direct pushes in Claude Code cloud | Push to an allowed branch or use PR-based flow; see \`references/cloud-auth.md\` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this catalog entry, “Requirements” says
ghis “pre-installed in cloud sessions”, butreferences/cloud-auth.mdin this same skill explicitly statesghis not pre-installed in Claude Code cloud (it must be installed via setup script). Please adjust the requirement wording to distinguish between Copilot/Actions (pre-installed) vs Claude Code cloud (manual install).