setup-repo-protection
Skill1 starsChanged 19 days agoMITView on GitHub
Use when a repository has no branch protection, tag rules, secret scanning or security policy. One building block of bootstrap. Lists the protection settings and asks the owner to apply them.
In this repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apply-architectureSkill
- assess-threatsSkill
- bootstrapSkill
- chart-routeSkill
- clarify-intentSkill
- code-reviewSkill
- domain-glossarySkill
- improve-agentsSkill
- investigate-bugSkill
- learnSkill
- make-diagramSkill
- migrate-dataSkill
- model-domainSkill
- plan-workSkill
- profile-performanceSkill
- recover-workSkill
- releaseSkill
- review-blast-radiusSkill
- review-specSkill
- review-standardsSkill
- setup-dkstackSkill
- setup-editorconfigSkill
- setup-labelsSkill
- setup-quality-gatesSkill
- setup-supply-chainSkill
- setup-versioningSkill
- start-issueSkill
- tdd-loopSkill
- triageSkill
- ui-designSkill
- ui-reviewSkill
- verify-claimSkill
- write-adrSkill
- write-prSkill
- writing-checkSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 20
No force-push and no deletion of the branch.
- Distinctive: line 21
No bypass for administrators.
- Very specific: line 28
Add SECURITY.md that says how to report a vulnerability.
- Very specific: line 29
Add a CODEOWNERS entry that requires the owner's review for the CI workflow files.
- Distinctive: line 30
Check whether the owner and the agents use one code host account.
- Distinctive: line 33
Keep all other rules from step 2.
- Distinctive: line 47
Do not start subagents for this skill.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
Set up repository protection
A building block of bootstrap. Use it alone, or as a step of bootstrap. Do not weaken an existing quality gate. See coding/quality-gates.md.
These are settings of the code host. An agent does not change a protection rule or a setting without the owner's OK. See safety. Write the list of settings for the owner. The owner applies them, or gives an OK that names them.
Steps
- Read the current settings, if you can. List each setting below that is missing or weaker. If audit-settings.mjs supports the code host of the project, the owner can run it to read the settings. The tool changes nothing. It needs Node.js, the command line tool of the code host and a token with admin read rights. Run
node audit-settings.mjs <owner/repo>. If the release tags do not matchv*, add--tag-pattern <glob>. - Default branch rule:
- A pull request is required for each change.
- The required checks must pass before a merge.
- Merge with squash only, and keep a linear history.
- No force-push and no deletion of the branch.
- No bypass for administrators.
- Tag and branch rules:
- Protect release tags from update and deletion. Only the release process creates them.
- Protect release branches from force-push and deletion.
- Security settings:
- Turn on secret scanning with push protection. Push protection meets the secret scan rule in the security rules. With it on, the repository needs no secret scan in CI. See setup-quality-gates.
- Turn on private vulnerability reporting.
- Add
SECURITY.mdthat says how to report a vulnerability. - Add a
CODEOWNERSentry that requires the owner's review for the CI workflow files.
- Check whether the owner and the agents use one code host account. If they do, each pull request has that account as its author. The code host does not let the author approve their own pull request. Then:
- Set required approvals to 0. Do not require a code owner review. A required approval or a required code owner review blocks every pull request.
- The
CODEOWNERSentry from step 4 then has no effect. Do not rely on it. - Keep all other rules from step 2. The required checks and the linear history still apply.
- Each pull request still needs an independent review before the merge. See review and merge.
Record an exception in
AGENTS.md. The owner reads each CI workflow change and merges it. The owner writes the review of each CI workflow change in the pull request before the merge. The agent does not merge it. This rests on the merge rules in safety, because the settings do not enforce it. For example:- dkstack rule: setup-repo-protection, the `CODEOWNERS` entry that requires the owner's review for the CI workflow files. - Project rule: no required approval. The owner reads the diff of each CI workflow change, writes the review in the pull request and merges it. - Reason: the owner and the agents use one account. The code host does not let it approve its own pull request.
- Apply the CI workflow rules to each workflow.
- Give the list to the owner. Record in the issue what the owner applied and what stays open.
Subagents
Do not start subagents for this skill. Reason: this is one building block. bootstrap can check it in a subagent. The owner applies the settings. See the subagent guide.
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
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.

