
Claude Code GitLab Skill:让 glab 变成 AI 助手

你用 GitLab。
你知道 glab 命令行工具很强大。
但你记不住那些复杂的命令。
claude-glab-skill 让 Claude Code 成为你的 GitLab 专家。
你用自然语言描述任务。
Claude Code 自动调用 glab 命令。
核心愿景

GitLab CLI (glab) 很强大。
但命令太多了。
glab mr create、glab mr list、glab issue list、glab ci view...
你记不住。
claude-glab-skill 的解决方案:
你不需要记住 glab 命令。
你只需要描述你想做什么。
Claude Code 会自动调用正确的 glab 命令。
示例:
# 传统方式:你需要记住命令"
glab mr create --title "Fix login bug" --assignee alice,bob
# 使用 claude-glab-skill:你只需要描述
@claude Create a merge request for my current branch with the title "Fix login bug" and assign it to reviewers alice and bob核心价值:
- 不需要记住 glab 命令
- 自然语言描述任务
- Claude Code 自动执行
- 支持所有 GitLab 操作
核心功能
1. Merge Request 管理
创建 MR:
@claude Create a merge request for my current branch with the title "Fix login bug" and assign it to reviewers alice and bob查看 MR:
@claude Show me all merge requests where I'm assigned as a reviewer审查 MR:
@claude Check out this merge request locally so I can review it价值:
- 快速创建 MR
- 自动分配审查者
- 本地代码审查
- 追踪 MR 状态
2. Issue 管理
创建 Issue:
@claude Create a bug issue titled "API timeout" with high priority label查看 Issue:
@claude List all open issues assigned to me链接 Issue 和 MR:
@claude Link this merge request to issue #123价值:
- 快速创建 Issue
- 追踪任务状态
- Issue-MR 关联
- 标签管理
3. CI/CD Pipeline 管理
查看 Pipeline 状态:
@claude Show me the status of the CI pipeline监控 Pipeline:
@claude Watch the current pipeline and let me know if it passes处理失败:
@claude Show me the failed jobs in the last pipeline价值:
- 实时监控 Pipeline
- 快速定位失败
- 自动通知
- 日志查看
4. 仓库管理
查看仓库信息:
@claude Show me the repository details管理分支:
@claude List all branches in this repository管理标签:
@claude Create a new tag v1.0.0价值:
- 仓库信息查看
- 分支管理
- 标签管理
- 版本控制
安装方式

1. 安装 glab CLI
macOS:
brew install glabLinux:
# Debian/Ubuntu
sudo apt install glab
# Fedora/RHEL
sudo dnf install glab
# Arch Linux
sudo pacman -S glabWindows:
# Using Chocolatey
choco install glab
# Using Scoop
scoop install glab从源码安装:
go install gitlab.com/gitlab-org/cli/cmd/glab@latest2. 安装 claude-glab-skill
项目级安装:
mkdir -p .claude/skills
git clone https://github.com/henricook/claude-glab-skill .claude/skills/glab全局安装:
mkdir -p ~/.claude/skills
git clone https://github.com/henricook/claude-glab-skill ~/.claude/skills/glab3. 认证 GitLab
GitLab.com:
glab auth login自托管实例:
export GITLAB_HOST=https://gitlab.example.com
glab auth login验证认证:
glab auth status使用方式

1. 自动调用
Claude Code 会自动检测何时需要 GitLab CLI 协助。
你不需要显式调用 Skill。
示例:
@claude Can you list my open merge requests?
@claude Create an issue for the bug we just found
@claude Show me the status of the CI pipeline2. 显式调用
你也可以显式调用 Skill:
@claude using the glab skill, help me create a merge request核心设计:渐进式披露

claude-glab-skill 采用渐进式披露设计原则。
核心思想:
- 快速加载核心内容
- 按需加载详细文档
- 避免上下文过载
三层结构:
1. SKILL.md frontmatter (~50 字符)
首先加载,用于 Skill 发现和调用。
2. SKILL.md body (~200 行)
Skill 调用时加载的核心内容。
包含:
- 何时使用 glab
- 认证设置
- 常见工作流模式
- 最佳实践
- 详细文档引用
3. references/ 文件夹
仅在需要时加载的详细文档。
commands-detailed.md:
- 详细的命令参考
- 所有标志和选项
- 高级命令(API、变量、调度)
- 综合命令示例
troubleshooting.md:
- 认证和连接错误
- CI/CD Pipeline 调试
- 详细的错误场景和解决方案
quick-reference.md:
- 命令速查表
- 常用标志和模式
- 快速查找
为什么这样设计?
核心内容快速加载,提供即时指导。
详细文档按需加载,避免上下文过载。
核心能力

1. 30+ glab 命令
涵盖所有 GitLab 操作:
- Merge Requests(创建、查看、审查、合并)
- Issues(创建、查看、分配、关闭)
- CI/CD Pipelines(查看、监控、调试)
- Repositories(查看、管理、分支、标签)
- API 访问
- 标签管理
- 发布管理
- Snippets
- 用户管理
- 变量管理
- SSH Keys
- 以及更多...
2. 自动上下文适应
Skill 自动适应:
- 当前仓库上下文
- 认证的 GitLab 实例
- 自托管 GitLab(通过 GITLAB_HOST 环境变量)
- 多认证配置文件
3. 智能检测
Skill 帮助 Claude Code:
- 检测何时需要认证
- 识别仓库上下文问题
- 建议适当的标志和选项
- 仅在必要时加载详细文档
4. 工具支持
Skill 配置了 allowed-tools:
- Bash - 执行 glab 命令
- Read - 读取配置和参考文件
- Grep - 搜索相关文件和模式
- Glob - 在仓库上下文中工作
使用场景

场景 1:快速创建 MR
流程:
1. 完成代码开发
↓
2. @claude Create a merge request for my current branch with the title "Fix login bug" and assign it to reviewers alice and bob
↓
3. Claude Code 自动调用 glab mr create
↓
4. MR 创建成功价值: 快速创建 MR、自动分配审查者、减少手动操作
场景 2:代码审查
流程:
1. @claude Show me all merge requests where I'm assigned as a reviewer
↓
2. Claude Code 列出所有待审查的 MR
↓
3. @claude Check out this merge request locally so I can review it
↓
4. Claude Code 自动调用 glab mr checkout
↓
5. 本地代码审查价值: 快速找到待审查的 MR、本地审查、追踪审查状态
场景 3:CI/CD 调试
流程:
1. @claude Show me the status of the CI pipeline
↓
2. Claude Code 显示 Pipeline 状态
↓
3. @claude Watch the current pipeline and let me know if it passes
↓
4. Claude Code 监控 Pipeline 并通知结果
↓
5. 如果失败,@claude Show me the failed jobs in the last pipeline
↓
6. Claude Code 显示失败的作业和日志价值: 实时监控 Pipeline、快速定位失败、自动通知
场景 4:Issue 追踪
流程:
1. 发现 Bug
↓
2. @claude Create a bug issue titled "API timeout" with high priority label
↓
3. Claude Code 自动调用 glab issue create
↓
4. Issue 创建成功
↓
5. 修复 Bug 后,@claude Link this merge request to issue #123
↓
6. Claude Code 自动关联 MR 和 Issue价值: 快速创建 Issue、Issue-MR 关联、追踪 Bug 修复
核心优势
1. 不需要记住命令
传统方式:
- 你需要记住
glab mr create --title "xxx" --assignee yyy - 你需要记住所有标志和选项
使用 claude-glab-skill:
- 你只需要描述你想做什么
- Claude Code 自动调用正确的命令
2. 自然语言交互
你用自然语言描述任务。
Claude Code 理解意图并执行。
3. 支持所有 GitLab 操作
30+ glab 命令。
涵盖所有 GitLab 操作。
4. 渐进式披露
快速加载核心内容。
按需加载详细文档。
避免上下文过载。
5. 自动上下文适应
自动检测仓库上下文。
自动适应 GitLab 实例。
自动识别认证状态。
与传统方式的对比

| 维度 | 传统方式 | claude-glab-skill |
|---|---|---|
| 命令记忆 | 需要记住所有 glab 命令 | 不需要记住命令 |
| 交互方式 | 手动输入命令 | 自然语言描述 |
| 学习曲线 | 陡峭,需要学习所有命令 | 平缓,自然语言即可 |
| 上下文感知 | 无,需要手动指定 | 自动检测仓库上下文 |
| 错误处理 | 需要自己阅读错误信息 | 自动识别并建议修复 |
| 文档查阅 | 需要查阅官方文档 | 按需加载详细文档 |
| 速度 | 慢,需要回忆命令 | 快速,自然语言描述 |
技术实现

目录结构
.claude/skills/glab/
├── SKILL.md # 核心 Skill(~200 行,Skill 调用时加载)
├── references/ # 详细文档(仅在需要时加载)
│ ├── commands-detailed.md # 详细的命令参考
│ ├── quick-reference.md # 命令速查表
│ └── troubleshooting.md # 详细的错误场景
├── README.md
├── CONTRIBUTING.md
├── CHANGELOG.md
└── LICENSE技术特点
1. 渐进式加载:
- SKILL.md frontmatter 首先加载(~50 字符)
- SKILL.md body Skill 调用时加载(~200 行)
- references/ 文件夹按需加载
2. 工具支持:
- Bash - 执行 glab 命令
- Read - 读取配置和参考文件
- Grep - 搜索相关文件和模式
- Glob - 在仓库上下文中工作
3. 智能检测:
- 检测何时需要认证
- 识别仓库上下文问题
- 建议适当的标志和选项
- 仅在必要时加载详细文档
写在最后
glab 很强大。
但你记不住那些命令。
claude-glab-skill 让 Claude Code 成为你的 GitLab 专家。
你用自然语言描述任务。
Claude Code 自动调用 glab 命令。
不需要记住命令。
不需要查阅文档。
只需要描述你想做什么。
这就是 AI 时代的命令行工具。
claude-glab-skill
让 glab 命令行变成你的 AI 助手
