henricook/claude-glab-skill
Overview
This skill provides expert guidance for using the GitLab CLI (glab) to manage issues, merge requests, CI/CD pipelines, repositories, and other GitLab operations from the terminal. It focuses on practical, command-focused workflows, authentication, automation patterns, and common troubleshooting. Use it to move routine GitLab tasks into scripts or to work faster from the command line. The guidance prioritizes reproducible commands and safe practices for CI and collaboration.
How this skill works
I explain which glab commands to run for common tasks, show required flags and environment variables, and describe repository context and self-hosted usage. The guidance covers authentication, MR creation and review, issue management, pipeline monitoring and retries, repo operations, and direct API access via glab api. I also show patterns for scripting, JSON output for parsing, and pagination handling for API calls.
When to use it
- Creating, reviewing, or managing merge requests from the terminal
- Opening, listing, or linking GitLab issues and tracking assignments
- Monitoring, retrying, or inspecting CI/CD pipelines and logs
- Cloning, forking, or viewing repository details without the web UI
- Automating GitLab actions in scripts or CI jobs using glab api
Best practices
- Verify authentication before running commands: glab auth status
- Run glab <command> --help to discover flags and examples
- Link MRs to issues using 'Closes #<issue-number>' in the MR description
- Lint .gitlab-ci.yml locally with glab ci lint before pushing
- Use --output=json and jq for reliable automation and parsing
- Specify -R owner/repo when outside a local git repository or using self-hosted hosts
Example use cases
- Create a merge request after pushing a feature branch: git push -u origin feature && glab mr create --title "Add feature"
- Checkout and test a reviewer MR locally, then approve and merge: glab mr checkout 42 && glab mr approve 42 && glab mr merge 42
- List and filter assigned issues: glab issue list --assignee=@me --label=bug
- Monitor a failing pipeline and fetch logs: glab pipeline ci view && glab ci trace
- Run a custom API query with pagination and parse results: glab api --paginate "projects/:id/pipelines?per_page=100" --output=json | jq ...
FAQ
Run glab auth login --hostname gitlab.example.org or export GITLAB_TOKEN and GITLAB_HOST environment variables for non-interactive use.
How can I paginate API results with glab api?
Use the --paginate flag and include per_page in the URL query, e.g. glab api --paginate "projects/:id/jobs?per_page=100". Do not pass pagination as a glab flag.