/git-tools:setup-repo [branch-name] [--checks name1,name2]from git-tools
Configures GitHub repo settings (squash-only merges, auto-delete branches) and branch protection with auto-detected required CI checks from workflow files.
Ships in git-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Parse $ARGUMENTS for:
main, master)--checks <name1,name2,...>: explicitly specify required status checks (skip auto-detection)Examples:
/setup-repo → auto-detect everything/setup-repo main → protect the main branch/setup-repo --checks "Lint,Test,Notify PR" → explicit checks, skip auto-detectionRun:
gh repo view --json nameWithOwner,defaultBranchRef --jq '{repo: .nameWithOwner, branch: .defaultBranchRef.name}'
REPO (e.g. lexfrei/kuberture) and BRANCH (e.g. master)BRANCH insteadReport to the user: "Configuring {REPO}, protecting branch {BRANCH}"
Run:
gh api --method PATCH repos/{REPO} \
--field allow_squash_merge=true \
--field allow_merge_commit=false \
--field allow_rebase_merge=false \
--field delete_branch_on_merge=true
Report: "Repo settings: squash-only merges, auto-delete branches"
If --checks was provided: parse the comma-separated list and skip to Step 4.
Otherwise, auto-detect from workflow files:
Find all workflow files: .github/workflows/*.yml and .github/workflows/*.yaml
For each workflow file, read it and check if it has a pull_request trigger in the on: section. Skip workflows that only trigger on push, release, schedule, etc.
For each PR-triggered workflow, analyze the jobs: section:
job_key → { name: <display name>, needs: [<dependencies>] }name: field, use the job key as the display nameneeds: list — these are "depended-upon" jobsneeds: listname: fields of the terminal jobsPresent the detected checks to the user using AskUserQuestion:
Run:
gh api --method PUT repos/{REPO}/branches/{BRANCH}/protection \
--input - <<'PAYLOAD'
{
"required_status_checks": {
"strict": true,
"contexts": [<CHECKS_JSON_ARRAY>]
},
"enforce_admins": true,
"required_pull_request_reviews": null,
"restrictions": null
}
PAYLOAD
Where <CHECKS_JSON_ARRAY> is the JSON array of check name strings, e.g. ["Notify PR", "E2E Tests"].
Print a summary:
Repository: {REPO}
Protected branch: {BRANCH}
Merge settings:
- Squash merge: enabled
- Merge commit: disabled
- Rebase merge: disabled
- Auto-delete branches: enabled
Branch protection:
- Required checks: {comma-separated list}
- Strict status checks: enabled (branch must be up-to-date)
- Enforce for admins: enabled
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lexfrei/ccc --plugin git-tools2 skills in this plugin
Other plugins' skills for the same job