| name | glab |
| allowed-tools | Bash, Read |
| description | Expert guidance for using the GitLab CLI (glab) to manage merge requests, issues, CI/CD pipelines, repositories, and API operations from the command line. Use when the user mentions GitLab, merge requests (MRs), glab commands, CI/CD pipelines on GitLab, GitLab issues, or needs to interact with a GitLab instance — even if they don't explicitly say 'glab'. Also trigger when the user is working in a repo with a GitLab remote and wants to create MRs, check pipeline status, review code, or manage issues. Not for: bulk cross-project OSDU queries (use osdu-activity), contributor analysis (use osdu-engagement), or test reliability metrics (use osdu-quality). |
GitLab CLI (glab) — Guardrails
This skill corrects common mistakes and fills knowledge gaps when using glab. Models already knows the basics — this focuses on what it gets wrong without guidance.
Command Accuracy
These commands are frequently hallucinated or used with wrong syntax. Use exactly as shown:
glab mr note <mr-number> -m "Comment text"
glab mr view <mr-number> --comments
glab mr create --title "Fix bug" --reviewer=alice,bob --label="bug,urgent"
glab mr update <mr-number> --draft
glab mr update <mr-number> --ready
glab ci run -V KEY1=value1 -V KEY2=value2
glab mr list
glab mr list --merged
glab mr list --closed
glab mr list --all
API Pagination (Easy to Get Wrong)
Pagination parameters go in the URL as query params, NOT as CLI flags:
glab api "projects/:id/jobs?per_page=100"
glab api --paginate "projects/:id/pipelines/123/jobs?per_page=100"
The :id placeholder auto-resolves to the current project when run inside a git repo.
Self-Hosted GitLab (IMPORTANT: We Do NOT Use gitlab.com)
This project uses two self-hosted GitLab instances. NEVER default to gitlab.com:
| Instance | Purpose |
|---|
community.opengroup.org | OSDU community projects (https, public) |
gitlab.opengroup.org | OpenGroup internal projects (ssh for git, https for API) |
glab auto-detects the correct instance from the Git remote of the current repo. Before running commands, verify you're targeting the right one:
glab auth status
git remote -v
If you need to specify an instance explicitly (e.g., outside a repo):
glab mr list -R community.opengroup.org/namespace/project
glab mr list -R gitlab.opengroup.org/namespace/project
For scripts/CI, set the host explicitly:
export GITLAB_HOST=community.opengroup.org
export GITLAB_TOKEN=<your-gitlab-personal-access-token>
Common self-hosted gotchas:
- SSL errors (
x509: certificate signed by unknown authority): custom CA — use git config --global http.sslCAInfo /path/to/cert.pem
- 401 after auth: token needs
api scope at minimum
- 404 on valid project: check the full namespace path (groups can be nested)
- Wrong instance: if commands return unexpected results, check
git remote -v — the remote URL determines which instance glab talks to
Workflow: Ship a Feature
When a user needs the end-to-end flow, present it in this order:
git push -u origin <branch> — push first
glab mr create --title "..." --description "Closes #N" --reviewer=x,y — link issues with "Closes #N" so GitLab auto-closes them on merge
glab ci status — check pipeline
glab ci trace / glab ci retry — debug failures
glab mr merge <N> --remove-source-branch — merge and clean up
Scripting Patterns
For JSON output in scripts:
glab mr list --output=json
glab mr list --output=json | jq '.[] | {iid: .iid, title: .title}'
glab api --paginate "projects/:id/merge_requests?state=opened&per_page=100" \
| jq '.[] | {iid: .iid, title: .title, pipeline: .head_pipeline.status}'
Notes
- Most commands support
--web / -w to open in browser
- Use
-R owner/repo when running outside a git repository
glab <command> --help for any command's full options