Skip to content
Agentmart
Submit a tool

setup-repo

Configure GitHub repo settings and branch protection with auto-detected required CI checks from workflow files

Skill by lexfrei

IndexedBSD-3-Clause★ 11
Write a review

Chalk Labs

Need help deploying setup-repo?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/lexfrei-setup-repo

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Configure GitHub repo settings and branch protection with auto-detected required CI checks from workflow files

Use cases: devops, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/setup-repo

What's inside

Skill name
setup-repo
Description
Configure GitHub repo settings and branch protection with auto-detected required CI checks from workflow files
License
BSD-3-Clause
Instructions
105 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

## Arguments

Parse $ARGUMENTS for:

- Positional argument: default branch name override (e.g. `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-detection

## Step 1: Identify repo and default branch

Run:

```bash
gh repo view --json nameWithOwner,defaultBranchRef --jq '{repo: .nameWithOwner, branch: .defaultBranchRef.name}'
```

- Extract `REPO` (e.g. `lexfrei/kuberture`) and `BRANCH` (e.g. `master`)
- If a positional argument was provided, use it as `BRANCH` instead

Report to the user: "Configuring {REPO}, protecting branch {BRANCH}"

## Step 2: Configure repo merge settings

Run:

```bash
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"

## Step 3: Detect required status checks

**If `--checks` was provided**: parse the comma-separated list and skip to Step 4.

**Otherwise, auto-detect from workflow files**:

1. Find all workflow files: `.github/workflows/*.yml` and `.github/workflows/*.yaml`

2. 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.

3. For each PR-triggered workflow, analyze the `jobs:` section:
   - Build a map of `job_key → { name: <display name>, needs: [<dependencies>] }`
   - If a job has no `name:` field, use the job key as the display name
   - Collect all job keys that appear in ANY other job's `needs:` list — these are "depended-upon" jobs
   - "Terminal jobs" are jobs whose key does NOT appear in any other job's `needs:` list
   - The required check names are the `name:` fields of the terminal jobs

4. Present the detected checks to the user using AskUserQuestion:
   - Show the list of detected terminal jobs and their display names
   - Ask: "These terminal CI jobs were detected. Use them as required status checks?"
   - Options: "Yes, apply these" / "Let me customize"
   - If the user wants to customize, ask them to provide the check names

## Step 4: Set branch protection

Run:

```bash
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"]`.

## Step 5: Summary

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
```

From lexfrei/ccc, BSD-3-Clause.

More from lexfrei/ccc

Signals

Stars
11
Forks
3
Open issues
2
Last commit (this folder)
Mar 12, 2026 (7 months ago)
Last release
Oct 4, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
BSD-3-Clause
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from lexfrei

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get setup-repo running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying setup-repo?

CallGet help
Cite this page

setup-repo skill. Agent Mart. https://agentmart.dev/skills/lexfrei-setup-repo (last updated 2026-10-24)