一键导入
setup-repo
Configure GitHub repo settings and branch protection with auto-detected required CI checks from workflow files
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Configure GitHub repo settings and branch protection with auto-detected required CI checks from workflow files
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run the full local cleanup pipeline — stale git worktrees, dead personal forks, Docker prune, Go caches, and Homebrew — in one pass, each stage report → confirm → execute, then a combined reclaimed-space summary. TRIGGER when the user wants a broad disk cleanup ("free up disk space", "почисти всё", "run the cleanup pipeline"). DO NOT trigger when the user clearly wants only one specific cleaner — invoke that skill instead.
Reclaim Docker disk by pruning unused images, containers, networks, build cache, optionally volumes, and the build cache of non-default buildx builders; on VM-backed daemons (Colima/Lima) also offers a guest fstrim so the host-side sparse disk image actually shrinks. Shows reclaimable size first, then prunes the user-chosen scope after approval. TRIGGER when the user wants to free Docker space ("docker prune", "почисти docker", "reclaim image cache"). DO NOT trigger for removing specific named containers/images.
Generate plain-text TLDR for PRs (for Slack, copied to clipboard). Each entry includes change scope (+N/-M lines, K files), a 1-5 star review-effort rating (time to review) and a 1-5 star outcome rating whose axis depends on the change — Pain relieved for fixes, Joy for features, Impact for internal work — so the reader can both budget time and prioritise before opening the PR.
Draft a GitHub PR review with inline comments. Opens with a readiness gate (stops on merge conflicts or red code-related CI with a fix-it note, no verdict), then runs the five-frame substance pass (problem real & root cause in-repo / approach optimal & worth its permanent cost / tradeoffs & scope / docs sync / code quality), cascades /branch-review, performs sequential Claude+Codex dual-model analysis on the PR diff, cross-validates every finding with explicit evidence, and presents the draft for approval. A value/design gate can block a PR even when the code is flawless — root cause upstream, permanent maintenance cost disproportionate to niche value, wrong layer, or scope over-reach. Publishing the review to GitHub is opt-in via `--publish`; without it the draft is the deliverable. Reviews open with an LGTM or NOT LGTM verdict (matching the /branch-review convention); the only no-verdict path is the readiness gate's fix-CI / fix-conflicts note. TRIGGER: invoke proactively whenever the user asks to review, a
Review current branch changes in isolation. Output starts with LGTM verdict — if no LGTM, the code is not ready to merge. IMPORTANT — always pass all flags you already know from context (target branch, project type, ticket, etc.). Do not rely on auto-detection when the answer is known. Pass --target to set which branch the changes are going INTO. Pass --ticket with a URL or ID to validate against requirements.
Reclaim Homebrew disk by removing old formula/cask versions, pruning the download cache, and uninstalling orphaned dependencies (brew autoremove). Shows a dry-run estimate first, then runs the user-chosen scope after approval. TRIGGER when the user wants to free Homebrew space ("brew cleanup", "почисти brew", "remove orphaned brew packages"). DO NOT trigger for uninstalling a specific named formula.
| name | setup-repo |
| description | Configure GitHub repo settings and branch protection with auto-detected required CI checks from workflow files |
| disable-model-invocation | true |
| argument-hint | [branch-name] [--checks name1,name2] |
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