gitlab-protected-branch

gitlab-protected-branch is a skill for Claude Code from grandcamel/GitLab-Assistant-Skills. It costs 60 tokens per session (2,503 once invoked), scanned A, original, MIT.

GitLab protected-branch management for controlling who may push to or merge into important branches such as main or release branches.

In plain words
What is it for?
Viewing branch protection rules, protecting or unprotecting branches, setting push and merge access, and configuring code-owner approval requirements.
Why use it?
It helps prevent unreviewed or unauthorized changes to branches that contain production or release code.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the gitlab-assistant-skills plugin — 19 skills, 3 commands shipped together

Good fit Viewing branch protection rules, protecting or unprotecting branches, setting push and merge access, and configuring code-owner approval requirements.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/grandcamel/gitlab-assistant-skills/gitlab-protected-branch
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add grandcamel/GitLab-Assistant-Skills --skill gitlab-protected-branch
Clone the repo
git clone --depth 1 https://github.com/grandcamel/GitLab-Assistant-Skills

Made for: Claude Code.

Or install gitlab-assistant-skills, the plugin that ships this one along with the rest of its 19 skills, 3 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gitlab-protected-branch

README.md
[![agentmods](https://agentmods.dev/badge/skills/grandcamel/gitlab-assistant-skills/gitlab-protected-branch.svg)](https://agentmods.dev/skills/grandcamel/gitlab-assistant-skills/gitlab-protected-branch)
Your own site
<a href="https://agentmods.dev/skills/grandcamel/gitlab-assistant-skills/gitlab-protected-branch"><img src="https://agentmods.dev/badge/skills/grandcamel/gitlab-assistant-skills/gitlab-protected-branch.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,503 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.02503
Opus 5 $0.00030 $0.01252
Sonnet 5 $0.00012 $0.00501
Haiku 4.5 $0.00006 $0.00250

Measured 8d ago against content hash 2f49a51093ef, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

gitlab-protected-branch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/gitlab-protected-branch/SKILL.md · 304 lines

How it starts

The opening of the file, as written. The whole thing — 304 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Protected Branch Skill

Branch protection management for GitLab using glab api raw endpoint calls.

Quick Reference

Operation Command Pattern Risk
List protected glab api projects/:id/protected_branches -
Get protection glab api projects/:id/protected_branches/:name -
Protect branch glab api projects/:id/protected_branches -X POST -f ... ⚠️
Update protection glab api projects/:id/protected_branches/:name -X PATCH -f ... ⚠️
Unprotect branch glab api projects/:id/protected_branches/:name -X DELETE ⚠️⚠️

Risk Legend: - Safe | ⚠️ Caution | ⚠️⚠️ Warning | ⚠️⚠️⚠️ Danger

When to Use This Skill

ALWAYS use when:

  • User mentions "protect branch", "branch protection", "protected branches"
  • User wants to restrict who can push/merge to a branch
  • User mentions "force push", "code owners", "merge access"
  • User wants to configure main/release branch security

NEVER use when:

  • User wants to create/delete branches (use git or gitlab-repo)
  • User wants to manage merge request approvals (different API)
  • User wants to configure CI/CD for branches (use gitlab-ci)

API Prerequisites

Required Token Scopes: api

Permissions:

  • View protected branches: Developer+
  • Manage protected branches: Maintainer+

Premium Features:

  • Code owner approval: GitLab Premium
  • Multiple access levels: GitLab Premium

Access Levels

Level Value Description
No access 0 Nobody can perform action
Developer 30 Developers and above
Maintainer 40 Maintainers and above
Admin 60 Instance admins only

Available Commands

List Protected Branches

# List all protected branches
glab api projects/123/protected_branches --method GET

# With pagination
glab api projects/123/protected_branches --paginate

# Using project path
glab api "projects/$(echo 'mygroup/myproject' | jq -Rr @uri)/protected_branches"

Read the full file on GitHub · 304 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 304 lines · 60 tokens per session scan A 2f49a51093ef

Subscribe to this mod's changes

gitlab-protected-branch is a skill published in the GitHub repository grandcamel/GitLab-Assistant-Skills (4 stars, last pushed 7mo ago), licensed MIT. It adds 60 tokens to every session and 2,503 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.