Draft: feat: generate SKILLS.md file
Description
Adds a new skill command to add a SKILLS.md to agentic tools that instructs correct usage of glab.
glab skill will write the content to stdout glab skill > ./glab/SKILL.md
glab skill add <path> will write the file to provided location
The SKILL.md file contains a (generated) reference to all commands, as well as some general tips and guidance for agents to successfully work with glab. Some inspiration taken from @dgruzd via https://gitlab.com/-/snippets/4930796
< 300 lines (https://agentskills.io recommends skills are < 500 lines) which should be ~5k tokens when the skill is fully read (frontmatter alone is ~70 tokens)
SKILL.md
---
name: glab
description: Work with GitLab from the command line using glab. Use when creating, viewing, or managing GitLab issues, epics, work-items, merge requests, CI/CD pipelines, releases, and repositories. Enables automation of GitLab workflows without leaving the terminal.
---
# glab
glab is the official GitLab CLI tool for working with issues, merge requests, pipelines, and more from the terminal.
## Context Detection
glab automatically detects the GitLab project from the current Git repository's remote URL. Most commands work without specifying a project when run inside a Git repo.
To target a different project, use the `-R` or `--repo` flag:
```bash
glab issue list -R gitlab-org/gitlab
glab mr view 123 -R owner/project
```
## Authentication
The user should already be logged in to glab. On authentication errors, STOP and ask the user to check their login status with `glab auth status` or log in with `glab auth login`.
## Commands
glab has many commands. Run `glab <command> --help` for detailed usage. Available commands:
- `glab alias` - Create, list, and delete aliases.
- `glab alias delete` - Delete an alias.
- `glab alias list` - List the available aliases.
- `glab alias set` - Set an alias for a longer command.
- `glab api` - Make an authenticated request to the GitLab API.
- `glab attestation` - Manage software attestations. (EXPERIMENTAL)
- `glab attestation verify` - Verify the provenance of a specific artifact or file. (EXPERIMENTAL)
- `glab auth` - Manage glab's authentication state.
- `glab auth configure-docker` - Register glab as a Docker credential helper
- `glab auth docker-helper` - A Docker credential helper for GitLab container registries
- `glab auth dpop-gen` - Generates a DPoP (demonstrating-proof-of-possession) proof JWT. (EXPERIMENTAL)
- `glab auth login` - Authenticate with a GitLab instance.
- `glab auth logout` - Logout from a GitLab instance.
- `glab auth status` - View authentication status.
- `glab changelog` - Interact with the changelog API.
- `glab changelog generate` - Generate a changelog for the repository or project.
- `glab check-update` - Check for latest glab releases.
- `glab ci` - Work with GitLab CI/CD pipelines and jobs.
- `glab ci cancel` - Cancel a running pipeline or job.
- `glab ci config` - Work with GitLab CI/CD configuration.
- `glab ci delete` - Delete CI/CD pipelines.
- `glab ci get` - Get JSON of a running CI/CD pipeline on the current or other specified branch.
- `glab ci lint` - Checks if your `.gitlab-ci.yml` file is valid.
- `glab ci list` - Get the list of CI/CD pipelines.
- `glab ci retry` - Retry a CI/CD job.
- `glab ci run` - Create or run a new CI/CD pipeline.
- `glab ci run-trig` - Run a CI/CD pipeline trigger.
- `glab ci status` - View a running CI/CD pipeline on current or other branch specified.
- `glab ci trace` - Trace a CI/CD job log in real time.
- `glab ci trigger` - Trigger a manual CI/CD job.
- `glab ci view` - View, run, trace, log, and cancel CI/CD job's current pipeline.
- `glab cluster` - Manage GitLab Agents for Kubernetes and their clusters.
- `glab cluster agent` - Manage GitLab Agents for Kubernetes.
- `glab cluster graph` - Queries the Kubernetes object graph, using the GitLab Agent for Kubernetes. (EXPERIMENTAL)
- `glab completion` - Generate shell completion scripts.
- `glab config` - Manage glab settings.
- `glab config edit` - Opens the glab configuration file.
- `glab config get` - Prints the value of a given configuration key.
- `glab config set` - Updates configuration with the value of a given key.
- `glab deploy-key` - Manage deploy keys.
- `glab deploy-key add` - Add a deploy key to a GitLab project.
- `glab deploy-key delete` - Deletes a single deploy key specified by the ID.
- `glab deploy-key get` - Returns a single deploy key specified by the ID.
- `glab deploy-key list` - Get a list of deploy keys for the current project.
- `glab duo` - Work with GitLab Duo
- `glab duo ask` - Generate Git commands from natural language.
- `glab gpg-key` - Manage GPG keys registered with your GitLab account.
- `glab gpg-key add` - Add a GPG key to your GitLab account.
- `glab gpg-key delete` - Deletes a single GPG key specified by the ID.
- `glab gpg-key get` - Returns a single GPG key specified by the ID.
- `glab gpg-key list` - Get a list of GPG keys for the currently authenticated user.
- `glab incident` - Work with GitLab incidents.
- `glab incident close` - Close an incident.
- `glab incident list` - List project incidents.
- `glab incident note` - Comment on an incident in GitLab.
- `glab incident reopen` - Reopen a resolved incident.
- `glab incident subscribe` - Subscribe to an incident.
- `glab incident unsubscribe` - Unsubscribe from an incident.
- `glab incident view` - Display the title, body, and other information about an incident.
- `glab issue` - Work with GitLab issues.
- `glab issue board` - Work with GitLab issue boards in the given project.
- `glab issue close` - Close an issue.
- `glab issue create` - Create an issue.
- `glab issue delete` - Delete an issue.
- `glab issue list` - List project issues.
- `glab issue note` - Comment on an issue in GitLab.
- `glab issue reopen` - Reopen a closed issue.
- `glab issue subscribe` - Subscribe to an issue.
- `glab issue unsubscribe` - Unsubscribe from an issue.
- `glab issue update` - Update issue
- `glab issue view` - Display the title, body, and other information about an issue.
- `glab iteration` - Retrieve iteration information.
- `glab iteration list` - List project iterations
- `glab job` - Work with GitLab CI/CD jobs.
- `glab job artifact` - Download all artifacts from the last pipeline.
- `glab label` - Manage labels on remote.
- `glab label create` - Create labels for a repository or project.
- `glab label delete` - Delete labels for a repository or project.
- `glab label edit` - Edit group or project label.
- `glab label get` - Returns a single label specified by the ID.
- `glab label list` - List labels in the repository.
- `glab mcp` - Work with a Model Context Protocol (MCP) server. (EXPERIMENTAL)
- `glab mcp serve` - Start a MCP server with stdio transport. (EXPERIMENTAL)
- `glab milestone` - Manage group or project milestones.
- `glab milestone create` - Create a group or project milestone.
- `glab milestone delete` - Delete a group or project milestone.
- `glab milestone edit` - Edit a group or project milestone.
- `glab milestone get` - Get a milestones via an ID for a project or group.
- `glab milestone list` - Get a list of milestones for a project or group.
- `glab mr` - Create, view, and manage merge requests.
- `glab mr approve` - Approve merge requests.
- `glab mr approvers` - List eligible approvers for merge requests in any state.
- `glab mr checkout` - Check out an open merge request.
- `glab mr close` - Close a merge request.
- `glab mr create` - Create a new merge request.
- `glab mr delete` - Delete a merge request.
- `glab mr diff` - View changes in a merge request.
- `glab mr issues` - Get issues related to a particular merge request.
- `glab mr list` - List merge requests.
- `glab mr merge` - Merge or accept a merge request.
- `glab mr note` - Add a comment or note to a merge request.
- `glab mr rebase` - Rebase the source branch of a merge request against its target branch.
- `glab mr reopen` - Reopen a merge request.
- `glab mr revoke` - Revoke approval on a merge request.
- `glab mr subscribe` - Subscribe to a merge request.
- `glab mr todo` - Add a to-do item to merge request.
- `glab mr unsubscribe` - Unsubscribe from a merge request.
- `glab mr update` - Update a merge request.
- `glab mr view` - Display the title, body, and other information about a merge request.
- `glab opentofu` - Work with the OpenTofu or Terraform integration.
- `glab opentofu init` - Initialize OpenTofu or Terraform.
- `glab opentofu state` - Work with the OpenTofu or Terraform states.
- `glab release` - Manage GitLab releases.
- `glab release create` - Create a new GitLab release, or update an existing one.
- `glab release delete` - Delete a GitLab release.
- `glab release download` - Download asset files from a GitLab release.
- `glab release list` - List releases in a repository.
- `glab release upload` - Upload release asset files or links to a GitLab release.
- `glab release view` - View information about a GitLab release.
- `glab repo` - Work with GitLab repositories and projects.
- `glab repo archive` - Get an archive of the repository.
- `glab repo clone` - Clone a GitLab repository or project.
- `glab repo contributors` - Get repository contributors list.
- `glab repo create` - Create a new GitLab project/repository.
- `glab repo delete` - Delete an existing project on GitLab.
- `glab repo fork` - Fork a GitLab repository.
- `glab repo list` - Get list of repositories.
- `glab repo members` - Manage project members.
- `glab repo mirror` - Configure mirroring on an existing project to sync with a remote repository.
- `glab repo publish` - Publishes resources in the project.
- `glab repo search` - Search for GitLab repositories and projects by name.
- `glab repo transfer` - Transfer a repository to a new namespace.
- `glab repo update` - Update an existing GitLab project or repository.
- `glab repo view` - View a project or repository.
- `glab schedule` - Work with GitLab CI/CD schedules.
- `glab schedule create` - Schedule a new pipeline.
- `glab schedule delete` - Delete the schedule with the specified ID.
- `glab schedule list` - Get the list of schedules.
- `glab schedule run` - Run the specified scheduled pipeline.
- `glab schedule update` - Update a pipeline schedule.
- `glab securefile` - Manage secure files for a project.
- `glab securefile create` - Create a new project secure file.
- `glab securefile download` - Download a secure file for a project.
- `glab securefile get` - Get details of a project secure file. (GitLab 18.0 and later)
- `glab securefile list` - List secure files for a project.
- `glab securefile remove` - Remove a secure file.
- `glab skill` - Manage the glab Agent Skill for AI coding agents
- `glab skill add` - Write the skill file to the specified path
- `glab snippet` - Create, view and manage snippets.
- `glab snippet create` - Create a new snippet.
- `glab ssh-key` - Manage SSH keys registered with your GitLab account.
- `glab ssh-key add` - Add an SSH key to your GitLab account.
- `glab ssh-key delete` - Deletes a single SSH key specified by the ID.
- `glab ssh-key get` - Returns a single SSH key specified by the ID.
- `glab ssh-key list` - Get a list of SSH keys for the currently authenticated user.
- `glab stack` - Create, manage, and work with stacked diffs. (EXPERIMENTAL)
- `glab stack amend` - Save more changes to a stacked diff. (EXPERIMENTAL)
- `glab stack create` - Create a new stacked diff. (EXPERIMENTAL)
- `glab stack first` - Moves to the first diff in the stack. (EXPERIMENTAL)
- `glab stack last` - Moves to the last diff in the stack. (EXPERIMENTAL)
- `glab stack list` - Lists all entries in the stack. (EXPERIMENTAL)
- `glab stack move` - Moves to any selected entry in the stack. (EXPERIMENTAL)
- `glab stack next` - Moves to the next diff in the stack. (EXPERIMENTAL)
- `glab stack prev` - Moves to the previous diff in the stack. (EXPERIMENTAL)
- `glab stack reorder` - Reorder a stack of merge requests. (EXPERIMENTAL)
- `glab stack save` - Save your progress within a stacked diff. (EXPERIMENTAL)
- `glab stack switch` - Switch between stacks. (EXPERIMENTAL)
- `glab stack sync` - Sync and submit progress on a stacked diff. (EXPERIMENTAL)
- `glab token` - Manage personal, project, or group tokens
- `glab token create` - Creates user, group, or project access tokens.
- `glab token list` - List user, group, or project access tokens.
- `glab token revoke` - Revoke user, group or project access tokens
- `glab token rotate` - Rotate user, group, or project access tokens
- `glab user` - Interact with a GitLab user account.
- `glab user events` - View user events.
- `glab variable` - Manage variables for a GitLab project or group.
- `glab variable delete` - Delete a variable for a project or group.
- `glab variable export` - Export variables from a project or group.
- `glab variable get` - Get a variable for a project or group.
- `glab variable list` - List variables for a project or group.
- `glab variable set` - Create a new variable for a project or group.
- `glab variable update` - Update an existing variable for a project or group.
- `glab version` - Show version information for glab.
## Example Workflows
### Understanding an issue before implementation
Fetch issue details to understand requirements before starting work:
```bash
glab issue view 456
glab issue view 456 --comments # Include discussion thread
glab issue --help # Full issue command reference
```
### Fixing a failed pipeline
When a pipeline fails, diagnose the issue:
```bash
glab ci status # Quick status of current branch
glab ci view # See all jobs and their status
glab ci trace # Stream logs from the failed job
glab ci --help # Full ci command reference
```
### Creating an MR from the current branch
After committing changes, create a merge request:
```bash
glab mr create --fill # Auto-fill title/description from commits
glab mr create --fill --draft # Create as draft if not ready for review
glab mr create --fill --web # Create and open in browser
glab mr create --help # Full MR creation command reference
```
For longer descriptions, write to a file first to avoid shell escaping issues:
```bash
glab mr create --title "feat: add feature" --description "$(cat /tmp/mr-description.md)"
```
### Checking assigned work
List issues and MRs assigned to the user:
```bash
glab issue list --assignee=@me # Issues assigned to the user
glab mr list --reviewer=@me # MRs awaiting the user's review
glab mr list --author=@me # The user's open MRs
```
## GitLab References
GitLab uses special syntax for cross-referencing items:
- `#123` - References issue 123
- `!456` - References merge request 456
- `Closes #123` - In MR description or commit, auto-closes issue when merged
- `Related to #123` - Creates a link without auto-closing
## Tips
- **Get help**: `glab <command> --help` for detailed options
- **JSON output**: `--output json` for machine-readable output (where supported)
- **Filtering**: Use `--label`, `--state`, `--assignee`, `--author` to filter lists
- **Templates**: Check `.gitlab/merge_request_templates/` and `.gitlab/issue_templates/` for project-specific templates when creating MRs or issues
Related Issues
Resolves #[issue_number]