agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/tools/gitlab/SKILL.md

gitlab

Skill15 starsChanged 42 days agoMITView on GitHub

Expert GitLab platform assistance covering Merge Requests, issue boards, package registry, releases, and glab CLI. Use when managing enterprise source control and DevOps workflows on GitLab.

  • Sends data out

14 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

GitLab (Tool)

GitLab's CLI (glab) allows interaction with the GitLab instance (Cloud or Self-Managed) directly from the terminal.

When to Use

  • Complete DevOps Lifecycle Platform: Single unified platform for Git hosting, CI/CD, issue tracking, and container registry.
  • Self-Managed Private Cloud Deployments: Running enterprise Git infrastructure with GitLab Dedicated or Omnibus.
  • Merge Request Approval Rules & Compliance: Enforcing security approval gates, license compliance, and code coverage minimums.
  • GitLab REST API & Webhooks: Automating repository provisioning, member access, and pipeline triggering.

Quick Start

# Create Merge Request using GitLab CLI (glab)
glab mr create \
  --title "feat: implement caching layer" \
  --description "Improves read performance with Redis." \
  --target-branch main \
  --remove-source-branch

Core Concepts

Managing Merge Requests via GitLab REST API v4

Querying and creating merge requests programmatically:

# Create a Merge Request with automated labels and assignee
curl -s -X POST \
  -H "PRIVATE-TOKEN: $GITLAB_PERSONAL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "source_branch": "feature/rate-limiting",
    "target_branch": "main",
    "title": "feat: add token bucket rate limiter",
    "remove_source_branch": true,
    "squash": true
  }' \
  "https://gitlab.example.com/api/v4/projects/12345/merge_requests" | jq .

Project Badges & Pipeline Status Tracking

Configuring pipeline status, test coverage, and release version badges:

<!-- README.md badges linked to GitLab CI -->

[![pipeline status](https://gitlab.example.com/org/project/badges/main/pipeline.svg)](https://gitlab.example.com/org/project/-/commits/main)
[![coverage report](https://gitlab.example.com/org/project/badges/main/coverage.svg)](https://gitlab.example.com/org/project/-/commits/main)
[![Latest Release](https://gitlab.example.com/org/project/-/badges/release.svg)](https://gitlab.example.com/org/project/-/releases)

Security Approval Policies & Protected Branches

Restricting production branch access:

  1. Navigate to Settings -> Repository -> Protected Branches.
  2. Set Allowed to push: No one (forces all changes through Merge Requests).
  3. Set Allowed to merge: Maintainers.
  4. Enable Require approval from Code Owners and Require all conversations to be resolved.

Common Patterns

Generic Package Registry Upload via CI/CD

Problem: Distributing versioned build binaries without external artifact repositories.

Solution: Publish binaries directly to GitLab Package Registry in .gitlab-ci.yml:

upload_binary:
  stage: deploy
  script:
    - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file bin/app.tar.gz "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my-app/${CI_COMMIT_TAG}/app.tar.gz"'
  rules:
    - if: $CI_COMMIT_TAG

Best Practices

Do:

  • Protect default branches (main) by allowing merges only through reviewed Merge Requests.
  • Leverage GitLab Container Registry and Dependency Proxy to speed up container caching in pipelines.
  • Configure Merge Request approval rules requiring Security and QA approval on sensitive repositories.
  • Rotate Personal Access Tokens (PATs) regularly or use short-lived Project Access Tokens.

Don't:

  • Allow force pushes to protected branches.
  • Store unmasked secrets in CI/CD variables; mark variables as Protected and Masked.
  • Allow unreviewed commits to bypass CI pipelines.

Troubleshooting

ErrorCauseSolution
GitLab: You are not allowed to push code to protected branchesDirect push attempted on branch protected by repository policy.Create a feature branch and submit a Merge Request.
glab: 401 UnauthorizedInvalid GITLAB_TOKEN personal access token.Run glab auth login to refresh access credentials.
MR cannot be merged: Merge conflictTarget branch diverged with overlapping changes.Rebase locally: git pull --rebase origin main and resolve conflicts.

References

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.