agentleFS
boettiger-labboettiger-lab/agent-skills/github-rulesets/SKILL.md

github-rulesets

Skill4 starsChanged 15 days agoBSD-3-ClauseView on GitHub

Apply preferred branch-protection rulesets and squash-merge-only settings to GitHub repos. Two profiles: 'standard' (no approval required) for smaller projects and 'strict' (1 approval, dismiss stale reviews) for larger ones. TRIGGER when: setting up a new repo, applying branch protection, configuring merge settings, or the user mentions rulesets.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the shell script directly:

    line 24

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GitHub Repository Rulesets

Apply branch-protection rulesets and merge settings to repos. Two profiles available:

ProfileApprovalsDismiss stale reviewsUse for
standard0nosmaller / solo projects
strict1yeslarger / team projects

Both profiles enforce: require PR, block deletion, block force push, squash-merge-only, delete branch on merge.

How to apply

Run the shell script directly:

/home/cboettig/.claude/skills/github-rulesets/apply-ruleset.sh OWNER/REPO [standard|strict]

Or use gh one-liners directly:

Squash-merge-only + delete branch on merge

gh api -X PATCH repos/OWNER/REPO -f allow_squash_merge=true -f allow_merge_commit=false -f allow_rebase_merge=false -f delete_branch_on_merge=true --silent

Create/apply the ruleset

# standard (no approval required):
gh api -X POST repos/OWNER/REPO/rulesets --input /home/cboettig/.claude/skills/github-rulesets/ruleset-standard.json --silent

# strict (1 approval, dismiss stale):
gh api -X POST repos/OWNER/REPO/rulesets --input /home/cboettig/.claude/skills/github-rulesets/ruleset-strict.json --silent

Update an existing ruleset

# Find the ruleset ID:
gh api repos/OWNER/REPO/rulesets --jq '.[].id'

# Update it:
gh api -X PUT repos/OWNER/REPO/rulesets/RULESET_ID --input /home/cboettig/.claude/skills/github-rulesets/ruleset-standard.json --silent

What each ruleset does

The JSON payloads at ruleset-standard.json and ruleset-strict.json create a ruleset named default-branch-protection targeting ~DEFAULT_BRANCH with these rules:

  • deletion — prevents branch deletion
  • non_fast_forward — blocks force pushes
  • pull_request — requires a PR to merge (approval count and stale-review settings vary by profile)

The apply-ruleset.sh script is idempotent: it updates an existing ruleset with the same name rather than creating duplicates.

Notes

  • Rulesets require the caller to have admin access to the repo.
  • The ~DEFAULT_BRANCH ref pattern automatically targets whatever the repo's default branch is (main, master, etc.).
  • Repo-level merge settings (squash-only) are separate from rulesets and set via PATCH repos/OWNER/REPO.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.