Automated summary
Sets up a headless Claude Code agent inside the Gramax GitLab CI "ai" job: workspace layout, glab/gh usage, merge request review, failed pipeline job diagnosis, and review context persisted across runs.
Strengths
- Gives a precise map of the CI environment (cwd, sibling repos, GitLab host, ics/doc-reader project) and available image tools.
- Includes concrete glab api commands for listing failed jobs and reading their traces to isolate the root cause.
- Defines clear review behavior: inline comments on exact lines, focus on correctness and security bugs, skip style nits.
- Documents cross-run review persistence through AI_CONTEXT_DIR, AI_REVIEW_MODE, and review-state.md.
Limitations
- Tightly bound to one environment: gitlab.ics-it.ru host, ics/doc-reader project, and the gramax/docs/board workspace layout.
- Assumes glab and gh are pre-authenticated and that the agent runs non-interactively with no prompts or questions.
- The document is cut off mid-sentence while describing review-state.md, so the state file fields are only partially specified.
Use it when an agent runs headless in the Gramax GitLab CI "ai" job and must review a merge request or diagnose a failed pipeline.
Avoid it outside that specific CI setup, such as local development or interactive reviews on other GitLab projects.
Security analysis
CautionThe skill is a narrowly scoped CI operating guide: it uses git, glab, gh, bun, rg for reviewing MRs and diagnosing failed jobs. It references token env vars by name but never sends them anywhere, and it contains no curl|sh, rm -rf, obfuscated payloads, or safety-disabling instructions. The main risk is legitimate but powerful autonomous tooling (network API access, ability to commit to a branch), so it rates caution rather than safe.
- •Skill runs fully autonomously in CI ('no prompts, no questions. Decide and act') and may commit small fixes directly to the MR source branch — legitimate but unsupervised write access to a repo.
- •Relies on pre-authenticated credentials (GITLAB_TOKEN, GITLAB_CLAUDE_ACCESS_TOKEN) and uses glab/gh against a private GitLab host; powers network/git operations for legitimate review purposes. No credential exfiltration, no encoded payloads, no destructive commands.
- •Instructs persistence of a review-state file in a CI cache dir across runs, which is benign but means state carries between pipeline executions.
- •Autonomously performs write actions on GitLab (posting MR notes/comments as bot, updating review state) and may commit fixes to the repo without human confirmation ("non-interactive... decide and act").
- •References credential env vars (GITLAB_TOKEN, GITLAB_CLAUDE_ACCESS_TOKEN) but does not expose values; token handling itself is legitimate.
- •Network access to gitlab.ics-it.ru / GitHub mirror via glab and gh for reading diffs, logs, and posting comments.
Examples
You're running in CI. Find which jobs failed in this pipeline, read their traces, and tell me the exact file:line fix for each root cause.Review the current merge request headlessly: verify the description and task link, then post inline comments only on correctness or security issues.This is a continue run — read $AI_CONTEXT_DIR/review-state.md and review only what changed since $AI_LAST_REVIEWED_SHA.name: ci
description: Use when running headless inside a GitLab CI job in the Gramax repo (the ai job). Establishes environment — repo checked out, glab/gh authenticated, what tools exist, how to read/post on GitLab, how to diagnose failed pipeline jobs. Triggers on "ci", "running in CI", "headless CI job", "ты в CI", "запущен в пайплайне".
Claude Code running headless in GitLab CI job for Gramax.
Environment
- Cwd = team workspace root (cloned fresh by
init.sh). Layout:gramax/— product repo, on MR source branch.cd gramaxfor code.docs/,board/— sibling repos (shallow)..claude/— workspace config + skills.
- GitLab host:
gitlab.ics-it.ru, projectics/doc-reader(id155). glabalready authed (GITLAB_HOST+GITLAB_TOKENset). Use for every GitLab op — read MRs, diffs, job logs, post notes.ghfor GitHub mirror (gram-ax/gramax, issues only).- Non-interactive: no prompts, no questions. Decide and act.
Tools in image
claude, glab, gh, git, bun, rg, fd, jq, uv/python3, openssh-client.
bun for JS/TS (bun run lint, bun run test <file>), rg/fd for search.
Current context
CI vars say where you are:
CI_MERGE_REQUEST_IID— MR (on MR pipeline).CI_MERGE_REQUEST_SOURCE_BRANCH_NAME/CI_MERGE_REQUEST_TARGET_BRANCH_NAME.CI_PIPELINE_ID— current pipeline.CI_PROJECT_ID(155),CI_PROJECT_PATH(ics/doc-reader),CI_SERVER_HOST.
CI vars omit MR body — pull live title/desc/diff with glab. Run from gramax/, or target -R ics/doc-reader:
glab mr view "$CI_MERGE_REQUEST_IID" -R ics/doc-reader
glab mr diff "$CI_MERGE_REQUEST_IID" -R ics/doc-reader
Diagnose failed pipeline jobs
Part of helping the dev: find which jobs failed and why, so you can propose a fix.
- List pipeline jobs, spot failed ones:
glab api "projects/155/pipelines/$CI_PIPELINE_ID/jobs?per_page=100" | jq -r '.[] | select(.status=="failed") | "\(.id)\t\(.name)\t\(.stage)"' - Read each failed job's log, find root cause (tail = error):
Quote shortest decisive error line. Map to source file/line in the diff.glab api "projects/155/jobs/<job-id>/trace" - Diagnose: lint break, test fail, type error, build error. Tie to the MR change that caused it.
- Tell dev concrete fix — file:line + what to change. If fix is small + safe, may commit it (attribution below).
Acting
- Reviews follow
merge-requestskill. Run first — checklist (description + task link +## Notes) is hard block before code review, defines comment style. - Prefer inline comments on exact lines (
merge-request→ REFERENCE.md → Inline comments), one thread = one finding, no status emoji. Summary MR note only for cross-file points not mapping to a line. Don't dump whole review in one note. - Output GitLab-flavored markdown. Reference files by path. Terse.
- Review: focus correctness bugs, security, clear simplifications. Skip style nits (Biome handles). Nothing material wrong → say so in one line.
- Comment replies = bot. Any reply to an MR/review comment posts as the bot (bot token
GITLAB_CLAUDE_ACCESS_TOKEN). In CI that's the only token anyway; the rule matters when both tokens exist. - Conventions in
gramax/CLAUDE.md+ workspaceCLAUDE.md(cwd). Follow.
Persistent review context across runs
ai job persists context dir between runs on same MR (GitLab cache keyed by MR IID). CI script restores before start, saves after, exports:
AI_CONTEXT_DIR— abs path to persisted dir (always exists). Read/write state here.AI_REVIEW_MODE—fresh(first review) orcontinue(reviewed before).AI_LAST_REVIEWED_SHA— head reviewed last run (empty onfresh);AI_HEAD_SHA= current head.
State file: $AI_CONTEXT_DIR/review-state.md. Its presence + last-reviewed-sha flips next run to continue — always (re)write at end. Keep compact:
- Current head SHA + one-line MR summary.
- Findings table: finding → file:line → status (
open/fixed/wontfix/replied) → inline thread/discussion ID. - Open questions to author, waiting on.
- Latest MR note timestamp seen (detect new comments next run).
fresh mode
Full review. Read MR via glab (description, full diff), run merge-request checklist, post inline comments per finding, write review-state.md from scratch.
continue mode — resume, don't restart
- Read
$AI_CONTEXT_DIR/review-state.md— memory of prior review. - Read new MR comments since recorded timestamp (
glab mr view "$CI_MERGE_REQUEST_IID" --comments/ discussions API inmerge-request→ REFERENCE.md). Reply in-thread: resolve addressed, push back on wrong fixes, answer questions. - Review only new commits. Diff range, not whole MR:
git -C gramax diff "$AI_LAST_REVIEWED_SHA".."$AI_HEAD_SHA"(--statfirst to scope).AI_LAST_REVIEWED_SHA==AI_HEAD_SHA→ no new code, only process comments. Don't re-review unchanged code or re-post known findings. - Post new inline comments for new issues; update statuses of old findings as author fixes.
- Rewrite
review-state.md: bump head SHA + timestamp, merge new findings, update statuses.
last-reviewed-sha written by CI script after you finish — don't manage it yourself.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/headless-gitlab-ci-skill-gramax-mvvwbpao/download' --output '.skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao/SKILL.md.part' && mv '.skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao/SKILL.md.part' '.skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao/SKILL.md' && test -s '.skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/ci' && cp -R '.skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao' '.claude/skills/ci'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao'openskills read 'headless-gitlab-ci-skill-gramax-mvvwbpao'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/headless-gitlab-ci-skill-gramax-mvvwbpao/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Configure a Chat Channel with SecretRefs
DevOps
Set up chat channels using non-interactive commands, with secrets only as SecretRefs. Covers gather, mutate, repair, and prove steps for reliable delivery.
Investigate ClickHouse CI Failures
DevOps
Investigate a ClickHouse CI failure end-to-end from a PR or S3 report URL. Fetches failed tests, classifies flaky vs real regression, and checks for existing issues/fixes.
Ansible PR Review
DevOps
Reviews an Ansible PR following the project's standardized process, including changelog checks, test coverage validation, and feedback tracking.