Github operations
Skill percymcn/agent-cookbook/skills/github/github-operations
Production-ready AI agent skills, playbooks, and workflows from the pharma6 automation lab
npx -y skills add percymcn/agent-cookbook --skill github-operationsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
GitHub operations umbrella: authentication, repository setup, issues, pull requests, code review, CI, releases, and codebase inspection via gh, git, curl, and pygount. Use for any GitHub task that previously matched github-auth, github-issues, github-pr-workflow, github-code-review, github-repo-management, or codebase-inspection.
SKILL.md
4.5 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it
GitHub Operations
Use this class-level skill for GitHub work. Prefer gh when authenticated; fall back to git plus the GitHub REST API with GITHUB_TOKEN when gh is unavailable.
1. Prerequisite discovery
git --version
gh --version 2>/dev/null || echo "gh not installed"
gh auth status 2>/dev/null || echo "gh not authenticated"
Inside a repository, derive owner/repo once:
REMOTE_URL=$(git remote get-url origin)
OWNER_REPO=$(echo "$REMOTE_URL" | sed -E 's|.*github\.com[:/]||; s|\.git$||')
OWNER=$(echo "$OWNER_REPO" | cut -d/ -f1)
REPO=$(echo "$OWNER_REPO" | cut -d/ -f2)
If gh is unavailable, load GITHUB_TOKEN from the environment, ~/.hermes/.env, or ~/.git-credentials before REST calls.
2. Authentication patterns
gh auth loginfor browser login;echo "$TOKEN" | gh auth login --with-tokenfor headless hosts.- For git-only HTTPS, configure
git config --global credential.helper storeand use a GitHub PAT as the password. - For SSH, generate
ed25519, add it at GitHub Settings → SSH keys, then verify withssh -T [REDACTED-EMAIL]. - Always configure commit identity before committing:
git config --global user.nameandgit config --global user.email.
3. Repository management
Use gh repo clone/create/fork/view/edit, gh release, gh workflow, and gh secret when available. For fallback:
- Clone with plain
git clone. - Create/fork/edit repos with REST endpoints under
/user/repos,/orgs/{org}/repos,/repos/{owner}/{repo}. - Releases:
POST /repos/{owner}/{repo}/releases. - Workflows/runs:
/repos/{owner}/{repo}/actions/.... - Branch protection:
PUT /repos/{owner}/{repo}/branches/{branch}/protection.
4. Issues
Common commands:
gh issue list --state open
gh issue view 42
gh issue create --title "..." --body "..." --label bug
gh issue edit 42 --add-label priority:high --add-assignee @me
gh issue comment 42 --body "..."
gh issue close 42 --reason completed
Fallback endpoints: GET/POST/PATCH /repos/{owner}/{repo}/issues, issue comments under /issues/{n}/comments, labels under /issues/{n}/labels, assignees under /issues/{n}/assignees. Remember GitHub's issues API also returns PRs; filter entries with a pull_request key when listing actual issues.
5. Pull request lifecycle
- Start clean:
git fetch origin && git checkout main && git pull origin main. - Branch:
git checkout -b feat/short-description. - Make changes with file tools, run tests, and commit with Conventional Commits.
- Push:
git push -u origin HEAD. - Create PR:
gh pr create --title ... --body ...or RESTPOST /pulls. - Monitor CI:
gh pr checks --watch,gh run view --log-failed, or REST Actions/status endpoints. - Fix failures, commit, push, and re-check.
- Merge with
gh pr merge --squash --delete-branchwhen appropriate.
6. Code review
For local or PR review:
- Get scope:
git diff main...HEAD --statandgit log main..HEAD --oneline. - Read changed-file diffs and surrounding file context.
- Check correctness, security, code quality, testing, performance, and documentation.
- Run relevant tests/lints when feasible.
- Report findings by severity: Critical, Warnings, Suggestions, Looks Good.
For GitHub PRs use gh pr view, gh pr diff, gh pr checkout, gh pr review, and gh pr comment. For inline REST comments, use the PR head SHA and POST /repos/{owner}/{repo}/pulls/{pr}/comments or an atomic review via /pulls/{pr}/reviews.
7. CI troubleshooting loop
When CI fails:
- Identify failed workflow/job:
gh run list --branch $(git branch --show-current). - Fetch logs:
gh run view <RUN_ID> --log-failed. - Fix root cause locally.
- Commit and push.
- Re-check status; repeat up to a bounded number of attempts before escalating.
8. Codebase inspection
Use pygount for LOC/language breakdowns. Always exclude dependency and build folders:
pygount --format=summary \
--folders-to-skip=".git,node_modules,venv,.venv,__pycache__,.cache,dist,build,.next,.tox,vendor,third_party" \
.
Pitfalls: Markdown is counted as comments, JSON counts can be conservative, and missing exclusions can make pygount crawl huge dependency trees.