agentleFS
Greg-KleinGreg-Klein/implementation-harness/skills/glab-gitlab-api/SKILL.md

glab-gitlab-api

Skill1 starsChanged 2 months agoMITView on GitHub

Recipes and traps for the `glab` CLI and the GitLab API at Synapse Medicine - linking a ticket to an epic, passing a long description from a file, assigning an issue reliably, reading and writing a work item's native status. Use whenever a glab command fails silently or returns an unexpected error (404 on --epic, assignee_ids ignored, description filled with the literal text "@file.md", status absent from the REST API).

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not go through glab api projects/:id/issues -f "assignee_ids[]=<userid>" (POST or PUT): the assignment is silently ignored (assignees …

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

glab / GitLab API - recipes and traps (Synapse Medicine)

Linking a ticket to an epic

The --epic <iid> flag of glab issue create returns a 404 Not Found (tested on synapse-medicine&629). Do not rely on it.

The workflow that works, in three steps:

# 1. Create the ticket without --epic
glab issue create -R <group/project> -t "..." -d "..." -l ... -a ... -y

# 2. Fetch the ticket's INTERNAL id (not its displayed iid)
glab api "projects/<group%2Fproject>/issues/<iid>"   # the `id` field

# 3. Link it to the epic through the internal id
glab api --method POST "groups/<group>/epics/<epic_iid>/issues/<internal_id>"

Real example: ticket material#5854 (internal id 196700862) linked to epic synapse-medicine&629: glab api --method POST "groups/synapse-medicine/epics/629/issues/196700862".

Group trap: an epic's iid is scoped to its group, not global. synapse-medicine&6 and synapse-medicine/app&6 are two completely different epics that share the iid 6 by coincidence. Always reuse the EXACT group path written in the ticket ("Épique : synapse-medicine/app&6"), never assume the root group applies. Check with glab api "groups/<url-encoded-group-path>/epics/<iid>" and compare the title before linking.

MedGPT epics live in the root group synapse-medicine (id 3049991), not synapse-medicine/app.

Passing a long description from a file

For a multi-line markdown description with glab api: --field "description=@file.md". The @ prefix is only interpreted with --field.

  • --raw-field "description=@file.md" sends the literal string @file.md (no interpretation).
  • --input file.json returns HTTP 400 (wrong Content-Type for the GitLab API).

Epic creation example: glab api "groups/<gid>/epics" -X POST --field "title=..." --field "description=@desc.md".

Trap with glab issue create (not glab api): its -d / --description flag does NOT support the @file prefix. -d "@file.md" literally fills the description with the text @file.md. The correct workflow for a long description at creation time:

glab issue create -t "..." -d "placeholder" -l ... -a ...
glab api --method PUT "projects/<path>/issues/<iid>" --field "description=@file.md"

Assigning an issue

Use glab issue update <iid> --assignee <username> -R <project>.

Do not go through glab api projects/:id/issues -f "assignee_ids[]=<userid>" (POST or PUT): the assignment is silently ignored (assignees stays empty) with no error. The dedicated glab issue update command works reliably with the username.

Work item status

For native status reads and authorized updates, read work-item-status.md. The caller chooses the transition; lifecycle names are project-specific.

Merge request delivery

For an authorized MR creation or consolidated review publication, read merge-request.md. Do not publish merely because a report or URL is supplied. The caller provides the branch, target, exact content, reviewer policy and whether delivery is ready or draft.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.