agentleFS
thettwethettwe/nyann/skills/gh-protect/SKILL.md

gh-protect

Skill6 starsChanged 3 months agoMITView on GitHub

Audit or apply GitHub branch protection, tag rulesets, repo security settings, and signing requirements based on the active profile. TRIGGER when the user says "check branch protection", "audit GitHub protection", "apply branch protection", "enforce branch protection", "set up branch protection", "configure branch rules", "check tag protection", "audit repo security", "apply GitHub settings", "enable branch protection", "protection audit", "are my branches protected", "/nyann:gh-protect". Do NOT trigger on "is this repo healthy" — that's `doctor` (which includes a protection check among many other signals). Do NOT trigger on "bootstrap this project" — bootstrap applies protection as one step of the full pipeline.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If either fails, tell the user gh is required for this skill and stop.

    line 31
  2. Distinctive:

    If the user names a specific profile, use that instead.

    line 40
  3. Distinctive:

    Run the read-only check regardless of whether the user asked to audit or apply — the delta informs what apply would change:

    line 44
  4. Very specific:

    If everything is ok, report "protection matches profile" and stop (no apply needed).

    line 63
  5. Very specific:

    If any drift exists at critical or warn level, ask:

    line 68
  6. Distinctive:

    After audit-only or audit+apply, end with:

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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

gh-protect

Standalone GitHub protection management. Wraps bin/gh-integration.sh in two modes: --check (read-only audit) and apply (write). Lets users manage branch protection, tag rulesets, signing requirements, and repo-level merge settings independently of bootstrap or doctor.

1. Pre-flight

Guard on gh:

command -v gh && gh auth status

If either fails, tell the user gh is required for this skill and stop. Unlike other skills that soft-skip, protection management has no useful fallback without gh.

2. Resolve profile

Load the active profile via bin/load-profile.sh <name> (resolves preferences → CLAUDE.md markers → "default" fallback).

If the user names a specific profile, use that instead.

3. Audit first (always)

Run the read-only check regardless of whether the user asked to audit or apply — the delta informs what apply would change:

bin/gh-integration.sh --target <cwd> --profile <name> --check

Output conforms to schemas/protection-audit.schema.json. Show the user a summary table:

AreaExpectedActualDrift
Branch protection (branches[])from profilefrom GitHub APIcritical / warn / ok
Tag rulesets.github.tag_protection_patternGitHub Rulesets APIcritical / warn / ok
CODEOWNERS gate.github.require_code_owner_reviewsbranch protectioncritical / warn / ok
Signing.github.require_signed_commits/tagsbranch protection + local git configcritical / warn / ok
Repo settings.github.allow_*_merge, delete_branch_on_mergerepo APIwarn / ok
Security signalsDependabot, secret scanning, push protection, code scanningrepo APIinfo

If everything is ok, report "protection matches profile" and stop (no apply needed).

4. Offer to apply (if drift found)

If any drift exists at critical or warn level, ask:

"Apply protection rules to match the profile? This will update branch protection via the GitHub API."

On confirmation:

bin/gh-integration.sh --target <cwd> --profile <name>

The apply mode never downgrades stricter remote rules — it only tightens. Relay this constraint so the user understands that loosening protection requires manual GitHub UI changes.

Output is a GhIntegrationResult JSON (schemas/gh-integration-result.schema.json). Report:

  • applied[] — rules that were created or updated.
  • noop[] — rules already at or above the expected level.
  • errors[] — rules that failed to apply (permission issues, etc.).

5. Report

After audit-only or audit+apply, end with:

  • Protection status per branch (protected / unprotected / partial).
  • Tag ruleset status.
  • Any errors[] that need manual attention.

When to hand off

  • "Check overall repo health" → doctor skill (includes protection as one signal among many).
  • "Set up this repo from scratch" → bootstrap-project skill (applies protection as part of the full pipeline).
  • "I changed my profile's GitHub settings" → re-run this skill to apply the updated expectations.
  • "Loosen a protection rule" → explain that gh-integration.sh never downgrades; the user must change the rule via the GitHub UI or API directly.

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.