GitHub Repository Management

VerifiedCaution

Clone, create, fork, and manage GitHub repositories using gh, git, and curl.

Sby Skills Guide Bot
DevOpsIntermediate
8/21/2026
Claude CodeCursorWindsurfCopilotCodex
#github#git#repository-management#cli#automation

Recommended for

Automated summary

Automates GitHub repository management (clone, create, fork, sync, inspect, settings) through the gh CLI, with a git plus curl REST API fallback.

Strengths

  • Every operation ships in two flavours: gh when available, otherwise git plus the REST API with GITHUB_TOKEN
  • Spans the full lifecycle: clone, create for a user, org or template, fork, and keeping a fork in sync with upstream
  • Auto-detects the available authentication method and derives owner/repo from the origin remote, reducing manual variables
  • Copy-paste ready commands with practical edge cases such as shallow clones and pushing an existing local directory

Limitations

  • The file is truncated: the releases section promised in the description and the end of the repository settings section are missing
  • Assumes a Unix shell with sed and python3 for JSON parsing, and a GITHUB_TOKEN already injected with the right scopes; it never explains how to obtain or configure that token
  • The curl fallback is more brittle than gh: a hardcoded sleep 5 after forking, and no error or rate-limit handling
When to use it

Use it when an agent must create, clone, fork or reconfigure a GitHub repository from the command line, whether or not gh is installed.

When not to use it

Skip it for complex Git workflows (interactive rebase, conflict resolution, branching strategy) or release management, which this skill does not actually cover.

Security analysis

Caution
Quality score84/100

The skill is a straightforward GitHub CLI/API reference: it uses bash, git, curl and a scoped GITHUB_TOKEN only against github.com endpoints, with no destructive commands, no curl|sh, no obfuscated payloads and no attempt to send credentials to third-party hosts. Risk is elevated to caution because it handles a privileged token on command lines and instructs uploading private SSH key material to GitHub secrets, both of which warrant user confirmation and tighter hygiene rather than being inherently malicious. No prompt-injection or instruction-override attempts were present in the content.

Findings
  • •No allowed-tools declared, yet the skill requires shell execution, outbound network calls (api.github.com, uploads.github.com) and a privileged GITHUB_TOKEN — capability declaration does not match the instructions.
  • •Section 7 instructs reading a private key (~/.ssh/id_rsa) and uploading it as a GitHub Actions secret; legitimate DevOps practice but it moves sensitive key material off-host and should require explicit user confirmation / prefer a dedicated deploy key.
  • •GITHUB_TOKEN is interpolated into curl command lines (e.g. -H "Authorization: token ${GITHUB_TOKEN}"), so the credential can appear in shell history and process listings; examples do not recommend passing headers via stdin/env-file or scoping the token.
  • •Placeholder values such as "your-secret-value" and "your-secret-value" in the encryption example could be copied verbatim, silently creating a bogus secret.
  • •Contains a reference to environment-specific secret injection ('LaRuche's secret vault') that will not exist for other users, causing 401s.
  • •Runs bash/git/curl/gh commands that create, modify, and delete remote repositories and settings — powerful but legitimate, user-directed operations.
  • •Section 7 reads a local private key (`gh secret set SSH_KEY < ~/.ssh/id_rsa`) and encourages typing secret values on the command line (`--body "your-secret-value"`), which exposes them in shell history and process listings.
  • •Uses a `GITHUB_TOKEN` with broad scope against api.github.com; all network calls go to GitHub's own API (no third-party exfiltration), but the token is powerful and a mis-scoped token could modify org repos.
  • •Contains an API-scoped action that can toggle repository visibility to public (`gh repo edit --visibility public`), a potentially destructive exposure if misapplied.
How this analysis is made

Examples

Create and push a new repo
Create a private GitHub repo called my-project with an MIT license, then push my current directory to it
Fork and track upstream
Fork owner/repo-name, clone my fork, and add the original repo as an upstream remote so I can sync later
Inspect a repo without gh
gh isn't installed here — using curl and GITHUB_TOKEN, show me the description, star count and default branch of owner/repo-name

type: skill name: github-repo-management description: Clone, create, fork or release a GitHub repository.

GitHub Repository Management

Create, clone, fork, configure, and manage GitHub repositories. Each section shows gh first, then git + curl as fallback.

Prerequisites

GITHUB_TOKEN is injected by LaRuche's secret vault at execution. Detect available auth:

if command -v gh &>/dev/null && gh auth status &>/dev/null; then
  AUTH="gh"
  GH_USER=$(gh api user --jq '.login')
else
  AUTH="git"
  GH_USER=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
    https://api.github.com/user | python3 -c "import sys,json; print(json.load(sys.stdin)['login'])")
fi

# If inside an existing repo, extract owner/repo:
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)

1. Clone

# gh
gh repo clone owner/repo-name
gh repo clone owner/repo-name -- --depth 1

# git (works everywhere)
git clone https://github.com/owner/repo-name.git
git clone --depth 1 https://github.com/owner/repo-name.git
git clone --branch develop https://github.com/owner/repo-name.git ./my-dir
git clone git@github.com:owner/repo-name.git   # SSH

2. Create

# gh
gh repo create my-project --public --clone
gh repo create my-project --private --description "Desc" --license MIT --clone
gh repo create my-org/my-project --public --clone
gh repo create my-project --source . --public --push   # from existing local dir

# curl
curl -s -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/user/repos \
  -d '{"name":"my-project","description":"Desc","private":false,"auto_init":true,"license_template":"mit"}'

# For an org:
curl -s -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/orgs/my-org/repos \
  -d '{"name":"my-project","private":false}'

# Push existing local dir to new repo (curl path):
git init && git add . && git commit -m "Initial commit"
git remote add origin https://github.com/${GH_USER}/my-project.git
git push -u origin main

From a Template

# gh
gh repo create my-app --template owner/template-repo --public --clone

# curl
curl -s -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/owner/template-repo/generate \
  -d '{"owner":"'"${GH_USER}"'","name":"my-app","private":false}'

3. Fork

# gh (preferred - handles the wait automatically)
gh repo fork owner/repo-name --clone

# curl + git
curl -s -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/owner/repo-name/forks
sleep 5   # GitHub needs a moment
git clone https://github.com/${GH_USER}/repo-name.git
cd repo-name
git remote add upstream https://github.com/owner/repo-name.git

Keep Fork in Sync

git fetch upstream && git checkout main && git merge upstream/main && git push origin main

# gh shortcut
gh repo sync ${GH_USER}/repo-name

4. Repository Info

# gh
gh repo view owner/repo-name
gh repo list --limit 20
gh search repos "machine learning" --language python --sort stars

# curl
curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO} \
  | python3 -c "
import sys,json; r=json.load(sys.stdin)
print(r['full_name'], r['description'], 'Stars:', r['stargazers_count'], 'Branch:', r['default_branch'])"

curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
  "https://api.github.com/user/repos?per_page=20&sort=updated" \
  | python3 -c "
import sys,json
for r in json.load(sys.stdin):
    print(f\"{r['full_name']:40} {'private' if r['private'] else 'public':8} ★{r['stargazers_count']}\")"

5. Repository Settings

# gh
gh repo edit --description "Updated" --visibility public
gh repo edit --enable-wiki=false --enable-issues=true --default-branch main
gh repo edit --add-topic "machine-learning,python" --enable-auto-merge

# curl (PATCH)
curl -s -X PATCH -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO} \
  -d '{"description":"Updated","has_wiki":false,"has_issues":true,"allow_auto_merge":true}'

# Update topics
curl -s -X PUT \
  -H "Authorization: token ${GITHUB_TOKEN}" \
  -H "Accept: application/vnd.github.mercy-preview+json" \
  https://api.github.com/repos/${OWNER}/${REPO}/topics \
  -d '{"names":["machine-learning","python","automation"]}'

6. Branch Protection

# View current protection
curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/branches/main/protection

# Set protection
curl -s -X PUT -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/branches/main/protection \
  -d '{
    "required_status_checks":{"strict":true,"contexts":["ci/test","ci/lint"]},
    "enforce_admins":false,
    "required_pull_request_reviews":{"required_approving_review_count":1},
    "restrictions":null
  }'

7. Secrets (GitHub Actions)

Use gh secret set whenever possible - curl path requires NaCl encryption.

# gh
gh secret set API_KEY --body "your-secret-value"
gh secret set SSH_KEY < ~/.ssh/id_rsa
gh secret list
gh secret delete API_KEY

# curl: fetch public key, encrypt with PyNaCl, then PUT
PUB=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/actions/secrets/public-key)
KEY_ID=$(echo "$PUB" | python3 -c "import sys,json; print(json.load(sys.stdin)['key_id'])")
ENC=$(echo "$PUB" | python3 -c "
import sys,json
from base64 import b64encode
from nacl import encoding, public
d=json.load(sys.stdin)
box=public.SealedBox(public.PublicKey(d['key'].encode(), encoding.Base64Encoder))
print(b64encode(box.encrypt(b'your-secret-value')).decode())")
curl -s -X PUT -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/actions/secrets/API_KEY \
  -d "{\"encrypted_value\":\"$ENC\",\"key_id\":\"$KEY_ID\"}"

# List secrets (names only)
curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/actions/secrets \
  | python3 -c "import sys,json; [print(s['name']) for s in json.load(sys.stdin)['secrets']]"

8. Releases

# gh
gh release create v1.0.0 --title "v1.0.0" --generate-notes
gh release create v2.0.0-rc1 --draft --prerelease --generate-notes
gh release create v1.0.0 ./dist/binary --notes "Release notes"
gh release list
gh release download v1.0.0 --dir ./downloads

# curl: create release
curl -s -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/releases \
  -d '{"tag_name":"v1.0.0","name":"v1.0.0","body":"## Changelog\n- Feature A","draft":false,"prerelease":false,"generate_release_notes":true}'

# Upload asset (get RELEASE_ID from create response)
RELEASE_ID=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/releases/latest \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")

curl -s -X POST \
  -H "Authorization: token ${GITHUB_TOKEN}" \
  -H "Content-Type: application/octet-stream" \
  "https://uploads.github.com/repos/${OWNER}/${REPO}/releases/${RELEASE_ID}/assets?name=binary-amd64" \
  --data-binary @./dist/binary-amd64

9. GitHub Actions Workflows

# gh
gh workflow list
gh run list --limit 10
gh run view <RUN_ID> --log-failed
gh run rerun <RUN_ID> --failed
gh workflow run ci.yml --ref main
gh workflow run deploy.yml -f environment=staging

# curl: list workflows
curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/actions/workflows \
  | python3 -c "import sys,json; [print(w['id'],w['name'],w['state']) for w in json.load(sys.stdin)['workflows']]"

# Trigger workflow_dispatch
curl -s -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/actions/workflows/${WORKFLOW_ID}/dispatches \
  -d '{"ref":"main","inputs":{"environment":"staging"}}'

# Rerun failed jobs only
curl -s -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/repos/${OWNER}/${REPO}/actions/runs/${RUN_ID}/rerun-failed-jobs

10. Gists

# gh
gh gist create script.py --public --desc "Useful script"
gh gist list

# curl
curl -s -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
  https://api.github.com/gists \
  -d '{"description":"Useful script","public":true,"files":{"script.py":{"content":"print(\"hello\")"}}}'

Error Handling

| Symptom | Fix | |---|---| | gh: command not found | Fall back to curl path; install with brew install gh or winget install gh | | 401 Unauthorized | ${GITHUB_TOKEN} not set or expired - re-inject secret | | 422 on fork | Repo already forked - clone existing fork | | 403 on branch protection | Token needs repo scope (not fine-grained) | | Asset upload 404 | Release must exist before uploading assets |

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/github-repository-management-mt2h8ky1/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/github-repository-management-mt2h8ky1' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/github-repository-management-mt2h8ky1/download' --output '.skill-downloads/github-repository-management-mt2h8ky1/SKILL.md.part' && mv '.skill-downloads/github-repository-management-mt2h8ky1/SKILL.md.part' '.skill-downloads/github-repository-management-mt2h8ky1/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Prerequisites

GITHUB_TOKEN is injected by LaRuche's secret vault at execution. Detect available auth:

if command -v gh &>/dev/null && gh auth status &>/dev/null; then
  AUTH="gh"
  GH_USER=$(gh api user --jq '.login')
else
  AUTH="git"
  GH_USER=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
    https://api.github.com/user | python3 -c "import sys,json; print(json.load(sys.stdin)['login'])")
fi

# If inside an existing repo, extract owner/repo:
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)

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/github-repository-management-mt2h8ky1/SKILL.md' && test -s '.skill-downloads/github-repository-management-mt2h8ky1/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/github-repo-management' && cp -R '.skill-downloads/github-repository-management-mt2h8ky1' '.claude/skills/github-repo-management'

Cursor
test -f '.skill-downloads/github-repository-management-mt2h8ky1/SKILL.md' && test -s '.skill-downloads/github-repository-management-mt2h8ky1/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/github-repo-management' && cp -R '.skill-downloads/github-repository-management-mt2h8ky1' '.cursor/skills/github-repo-management'

Codex
test -f '.skill-downloads/github-repository-management-mt2h8ky1/SKILL.md' && test -s '.skill-downloads/github-repository-management-mt2h8ky1/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/github-repo-management' && cp -R '.skill-downloads/github-repository-management-mt2h8ky1' '.agents/skills/github-repo-management'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/github-repository-management-mt2h8ky1'

openskills read 'github-repository-management-mt2h8ky1'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/github-repository-management-mt2h8ky1/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills