Use when the user asks to work with GitLab from the terminal using `glab`, including authentication, issues, merge requests, CI/CD pipelines, releases, repositories, variables, tokens, Kubernetes agent workflows, Duo, or direct REST/GraphQL API calls.
Resources
1Install
npx skillscat add data219/opencode-docker/glab Install via the SkillsCat registry.
Glab
Overview
Use glab as the default CLI for GitLab operations. Prefer native glab subcommands first, then use glab api when a capability is missing in dedicated subcommands.
Baseline Workflow
- Verify local command shape and version:
glab --version
glab --help- Verify authentication and target host:
glab auth status --all
git remote -v- Discover the exact subcommand before mutations:
glab <group> --help
glab <group> <subcommand> --helpRun read/list commands first, confirm target IDs/paths, then mutate.
If no native command exists, call the API directly:
glab api <endpoint>
glab api graphql -f query='query { currentUser { username } }'Authentication And Host Selection
Interactive login:
glab auth loginNon-interactive token login:
glab auth login --hostname <host> --stdin < token.txtCI login with job token:
glab auth login --hostname "$CI_SERVER_HOST" --job-token "$CI_JOB_TOKEN"Status checks:
glab auth status --all
glab auth status --hostname <host>Rules:
- Prefer
--hostnamefor multi-instance setups (GitLab.com + Self-Managed). - Never print tokens in user-facing output.
- For non-current repos, pass
-R/--repo <group>/<project>.
Command Families
Primary collaboration:
glab issue ...(issues, notes, board workflows)glab mr ...(create/view/update/approve/merge/rebase MRs)glab repo ...(project/repository lifecycle and metadata)
Delivery and operations:
glab ci ...,glab job ...,glab schedule ...(pipelines, jobs, schedules)glab release ...,glab changelog ...(release workflows)glab variable ...,glab token ...,glab securefile ...(automation and secrets-related project config)
Account and access:
glab auth ...,glab config ...glab ssh-key ...,glab gpg-key ...,glab deploy-key ...glab user ...,glab label ...,glab milestone ...,glab iteration ...
Advanced and platform features:
glab cluster ...(GitLab Agent for Kubernetes)glab duo ...(Duo CLI features)glab mcp ...(MCP server, experimental)glab stack ...,glab attestation ...,glab runner-controller ...(experimental domains)
Read-First Mutation Pattern
Use this sequence for any change:
# 1) Read/discover
glab <group> list ...
glab <group> view <id> ...
# 2) Mutate
glab <group> create ...
glab <group> update ...
glab <group> delete ...Examples:
glab issue list -R group/project
glab issue update 123 --title "Updated title" -R group/project
glab mr view 456 -R group/project
glab mr merge 456 -R group/projectAPI Fallback Pattern
Use glab api when subcommands do not expose needed fields or endpoints:
# REST
glab api projects/:fullpath/releases
# GraphQL
glab api graphql -f query='query { currentUser { username } }'Useful flags:
--hostnamefor explicit instance targeting.--paginatefor full result sets.--output ndjsonfor stream-friendly processing.-f/--raw-field/--fieldfor request parameters.
Output And Safety Rules
- Prefer machine-friendly output for automation (
--output json|ndjson, thenjqif needed). - When sharing results with users, include canonical GitLab URLs when available.
- Never expose secrets or raw credentials (tokens, masked variables, secure file contents).
- For destructive actions (
delete,revoke,rotate,transfer,merge), confirm scope from a preceding read/list command.