AgentSkillsCN

gitlab

通过 glab CLI 进行 GitLab 操作。当用户提及“MR”、“合并请求”、“GitLab 问题”、“流水线”、“CI 状态”、“glab”,或当 `git remote` 显示 `gitlab.com` 或自建 GitLab 时,可使用此方法。

SKILL.md
--- frontmatter
name: gitlab
description: GitLab operations via glab CLI. Use when user mentions: MR, merge request, gitlab issue, pipeline, CI status, glab, or when git remote shows gitlab.com or self-hosted GitLab.

GitLab CLI (glab)

When to Use This Skill

Use glab for GitLab repositories. To detect GitLab:

bash
git remote -v | grep -i gitlab

If the remote contains gitlab.com or a known GitLab instance, use this skill.

Before Any Operation

Always verify authentication first:

bash
glab auth status

If not authenticated, guide the user to run glab auth login.

Behavioral Guidelines

  1. Creating MRs: Always check for uncommitted changes first with git status
  2. Viewing MRs/Issues: Prefer --comments flag when user wants full context
  3. CI Operations: Check glab ci status before suggesting glab ci run
  4. Use --web: When the user might benefit from the browser UI

Command Reference

Merge Requests

ActionCommand
Createglab mr create --title "Title" --description "Desc"
Create draftglab mr create --draft --title "Title"
Listglab mr list
Viewglab mr view <id>
View with commentsglab mr view <id> --comments
Checkoutglab mr checkout <id>
Mergeglab mr merge <id>
Approveglab mr approve <id>

Issues

ActionCommand
Createglab issue create --title "Title" --description "Desc"
Listglab issue list
List mineglab issue list --assignee=@me
Viewglab issue view <id>
Closeglab issue close <id>
Commentglab issue note <id> --message "Comment"

CI/CD Pipelines

ActionCommand
Statusglab ci status
Listglab ci list
View logsglab ci trace
Run newglab ci run
Retry failedglab ci retry

Repository

ActionCommand
View infoglab repo view
Cloneglab repo clone <repo>
Open in browserglab repo view --web