Proposal: Add `glab skills` command for bundled AI agent skills
## Summary Add a `glab skills` command that surfaces, describes, and installs AI agent skills bundled directly in the `glab` binary. Skills are structured prompt files (`SKILL.md` with YAML frontmatter) that AI coding assistants like Claude Code and OpenCode load to gain domain-specific knowledge about how to use `glab` correctly — covering flag gotchas, API patterns, and workflow guidance that `--help` output alone doesn't convey. ## Design decisions **Skills live in `gitlab-org/cli`.** Skills are co-located with the CLI itself, so a skill update and the CLI change that motivated it ship in the same MR — no drift, no version mismatch between a skill and the flags it describes. **Skills are bundled in the binary.** Using Go's `//go:embed`, skill files compile directly into the `glab` binary. No network call, no authentication required, works offline and in CI. The skill is always the right version for the binary you have installed. **Skills are targeted, not monolithic.** Skills are scoped to specific workflows rather than covering all of `glab` in one file. Both general domain skills (`glab-mr`) and specific workflow skills (`glab-mr-review`) are supported — an agent bootstrapping a session loads the general skill; an agent tasked with reviewing an MR loads the specific one. ## Skill structure Skills live in a `skills/` directory at the root of the repo: ``` skills/ glab-mr/SKILL.md — general merge request operations glab-mr-review/SKILL.md — focused guidance for reviewing MRs glab-issues/SKILL.md — issue management, labels, state transitions glab-ci/SKILL.md — pipeline operations, job management glab-api/SKILL.md — raw API patterns, encoding rules, GraphQL glab-repo/SKILL.md — repository operations ``` Each `SKILL.md` follows the [agentskills.io](https://agentskills.io) frontmatter format: ```yaml --- name: glab-mr-review description: Reviewing merge requests with glab — diffing, commenting, approving version: 1.0.0 --- ``` ## Proposed subcommands ### `glab skills list` Lists all skills bundled with the installed version of `glab`. ``` $ glab skills list NAME VERSION DESCRIPTION glab-api 1.0.0 Raw API patterns, encoding rules, and GraphQL glab-ci 1.0.0 Pipeline operations and job management glab-issues 1.0.0 Issue management, labels, and state transitions glab-mr 1.0.0 Merge request workflows using glab CLI glab-mr-review 1.0.0 Reviewing merge requests — diffing, commenting, approving glab-repo 1.0.0 Repository operations ``` No network call — reads from the embedded filesystem. ### `glab skills get <name>` Prints the full skill content to stdout. The most agent-native subcommand: an AI agent running in a shell can call `glab skills get glab-mr-review` to load focused, version-matched guidance mid-session without any pre-installation. ```bash glab skills get glab-mr-review glab skills get glab-api > .claude/skills/glab-api/SKILL.md ``` ### `glab skills install <name> [--agent <agent>]` Writes a skill to the appropriate location for the specified AI agent. Auto-detects the agent if `--agent` is omitted. ``` $ glab skills install glab-mr-review ✓ Detected Claude Code (found ~/.claude/) ✓ Installed glab-mr-review to ~/.claude/skills/glab-mr-review/SKILL.md Version: 1.0.0 ``` Supported targets: `claude-code` (`~/.claude/skills/`), `opencode` (`~/.config/opencode/skills/`), `local` (`./.claude/skills/` project-scoped). **Why this is simpler than tools like `vercel-labs/skills`:** That tool's complexity comes from version management for remotely-hosted skills. Because skills are embedded in the binary here, none of that is needed. `install` is just `get` piped to a file — idempotent, no version state to track. "Updating" an installed skill just means re-running `install` after updating `glab` itself. ## Implementation The command lives at `internal/commands/skills/` following the standard Cobra factory pattern. Skills are embedded at compile time: ```go //go:embed skills/**/*.md var skillsFS embed.FS ``` All three subcommands operate entirely on `skillsFS` — no GitLab API calls, no network dependency. ## Relationship to `glab mcp` `glab mcp serve` lets AI agents *act through* glab. Skills let agents *know how to use* glab. They serve different audiences: skills are for agents running `glab` as a CLI subprocess (e.g. Claude Code executing shell commands), while richer MCP tool descriptions serve agents using the MCP interface. Both tracks are worth investing in — they're complementary, not competing. A natural follow-on is exposing a `glab_skills_get` tool via MCP so agents using `glab mcp serve` can also self-load the relevant skill. Out of scope for v1. ## Help system integration A single line in the root help footer surfaces skills without cluttering subcommand help: ``` 💡 AI assistance: run 'glab skills list' to see available workflow skills for AI agents ``` ## Phased rollout - **Phase 1** — `list` and `get`. Read-only, no filesystem writes. Ships alongside the first set of domain skills. - **Phase 2** — `install`. Adds agent detection and filesystem writes. Priority targets: Claude Code and OpenCode. - **Phase 3** — Help footer. ## Deferred Project-local skill discovery (surfacing skills from `.claude/skills/` or `.opencode/skills/` in the current repo) is potentially useful but can be revisited once the core is established.
issue