Skip to main content
skill CX Codex

gitlab-ci-validator — Claude Code skill: what it does, how to install

Validates syntax and security rules in .gitlab-ci.yml. Useful before opening a merge request to catch broken pipelines locally.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add akin-ozer/cc-devops-skills --skill gitlab-ci-validator -a claude-code
Open on GitHub

What gitlab-ci-validator does

The skill analyzes .gitlab-ci.yml files using a collection of Python and Bash scripts. It splits checks into distinct gates: syntax and schema parsing, along with security audits for exposed credentials or curl | bash commands. It also checks caching practices and job dependencies. Passing --strict turns best-practice warnings into failures to stop flawed pipelines at the review gate.

Running the checks requires python3. The helper script python_wrapper.sh automatically creates a virtual environment to install pyyaml, though restricted offline environments require installing it beforehand. The tool evaluates configuration and static patterns only, without executing actual GitLab runners. Local pipeline testing with --test-only demands gitlab-ci-local and Docker.

What it helps with

  • catch syntax errors and undefined job stages in .gitlab-ci.yml
  • audit pipelines for hardcoded secrets and unverified remote includes
  • verify cache keys and artifact expiration settings
  • run local pipeline structure tests before opening merge requests

Example prompts for the agent

  • Validate this .gitlab-ci.yml before merge
  • Run a security review for our GitLab CI configuration
  • Why is this GitLab pipeline failing?

How to install gitlab-ci-validator

1Skills CLI (Vercel)

npx skills add akin-ozer/cc-devops-skills --skill gitlab-ci-validator -a claude-code

2Manually: put the files in place

~/.claude/skills/gitlab-ci-validator/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/gitlab-ci-validator/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about gitlab-ci-validator

How do I install gitlab-ci-validator in Claude Code?

Run npx skills add akin-ozer/cc-devops-skills --skill gitlab-ci-validator -a claude-code.

What does gitlab-ci-validator check?

It statically inspects .gitlab-ci.yml files. The validator covers YAML schema, undefined stages, hardcoded secrets, and pipeline caching practices.

Does the skill run actual GitLab CI jobs?

No, it performs static analysis rather than executing production pipelines. To run local structural tests with --test-only, you must install Docker and gitlab-ci-local.

Source text

SKILL.md · Apache-2.0
---
name: gitlab-ci-validator
description: Validate, lint, audit, or fix .gitlab-ci.yml pipelines, stages, and jobs.
---

# GitLab CI/CD Validator

Comprehensive toolkit for validating, linting, testing, and securing `.gitlab-ci.yml` configurations.

## Trigger Phrases

Use this skill when requests include intent like:

- "Validate this `.gitlab-ci.yml`"
- "Why is this GitLab pipeline failing?"
- "Run a security review for our GitLab CI"
- "Check pipeline best practices"
- "Lint GitLab CI config before merge"

## Setup And Prerequisites (Run First)

All commands below assume repository root as current working directory.

```bash
# Ensure validator scripts are executable
chmod +x devops-skills-plugin/skills/gitlab-ci-validator/scripts/*.sh \
  devops-skills-plugin/skills/gitlab-ci-validator/scripts/*.py

# Required runtime
python3 --version
```

Use one canonical command path for orchestration:

```bash
VALIDATOR="bash devops-skills-plugin/skills/gitlab-ci-validator/scripts/validate_gitlab_ci.sh"
```

Optional local execution tooling (for `--test-only`):

```bash
bash devops-skills-plugin/skills/gitlab-ci-validator/scripts/install_tools.sh
```

## Quick Start Commands

```bash
# 1) Full validation (syntax + best practices + security)
$VALIDATOR .gitlab-ci.yml

# 2) Syntax and schema only (required first gate)
$VALIDATOR .gitlab-ci.yml --syntax-only

# 3) Best-practices only (recommended)
$VALIDATOR .gitlab-ci.yml --best-practices

# 4) Security only (required before merge)
$VALIDATOR .gitlab-ci.yml --security-only

# 5) Optional local pipeline structure test (needs gitlab-ci-local + Docker)
$VALIDATOR .gitlab-ci.yml --test-only

# 6) Strict mode (treat best-practice warnings as failure)
$VALIDATOR .gitlab-ci.yml --strict
```

## Deterministic Validation Workflow

Follow these gates in order:

1. Run Quick Start command `2` (`--syntax-only`).
2. If syntax fails, stop and fix errors before continuing.
3. Run Quick Start command `3` (`--best-practices`) and apply relevant improvements.
4. Run Quick Start command `4` (`--security-only`) and fix all `critical`/`high` findings before merge.
5. Optionally run Quick Start command `5` (`--test-only`) for local execution checks.
6. Run Quick Start command `6` (`--strict`) for final merge gate.

Required gates: syntax + security.
Recommended gate: best practices.
Optional gate: local execution test.

## Rule Severity Rationale And Documentation Links

### Severity Model

- `critical`: Direct credential/secret exposure or high-confidence compromise path. Block merge.
- `high`: Exploitable unsafe behavior or strong security regression. Fix before merge.
- `medium`: Security hardening gap with realistic risk. Track and fix soon.
- `low`/`suggestion`: Optimization or maintainability improvement.

### Rule Classes And Why They Matter

- Syntax rules (`yaml-syntax`, `job-stage-undefined`, `dependencies-undefined-job`): prevent pipeline parse and dependency failures.
- Best-practice rules (`cache-missing`, `artifact-no-expiration`, `dag-optimization`): reduce runtime cost and improve pipeline throughput.
- Security rules (`hardcoded-password`, `curl-pipe-bash`, `include-remote-unverified`): reduce credential leaks and supply-chain risk.

### References

- Local syntax reference: `devops-skills-plugin/skills/gitlab-ci-validator/docs/gitlab-ci-reference.md`
- Local best practices: `devops-skills-plugin/skills/gitlab-ci-validator/docs/best-practices.md`
- Local common issues: `devops-skills-plugin/skills/gitlab-ci-validator/docs/common-issues.md`
- GitLab CI YAML reference: https://docs.gitlab.com/ee/ci/yaml/
- GitLab CI/CD components: https://docs.gitlab.com/ee/ci/components/
- GitLab pipeline security guidance: https://docs.gitlab.com/ee/ci/pipelines/settings.html

## Fallbacks For Tool Or Environment Constraints

- Missing `python3`:
  - Behavior: validator cannot run.
  - Fallback: install Python 3 and rerun.
- Missing `PyYAML`:
  - Behavior: `python_wrapper.sh` auto-creates `.venv` and installs `pyyaml` when possible.
  - Fallback in restricted/offline environments: pre-install `pyyaml` from an internal mirror, then rerun.
- Missing `gitlab-ci-local`, `node`, or `docker`:
  - Behavior: `--test-only` reports warning/failure.
  - Fallback: skip local execution testing and continue with syntax/best-practice/security gates.
- No execute permission on scripts:
  - Behavior: shell permission errors.
  - Fallback: rerun the setup `chmod` command from the Setup section.

## Examples

### Example 1: New Pipeline Validation

```bash
$VALIDATOR examples/basic-pipeline.gitlab-ci.yml --syntax-only
$VALIDATOR examples/basic-pipeline.gitlab-ci.yml --security-only
```

### Example 2: Pre-Merge Hard Gate

```bash
$VALIDATOR .gitlab-ci.yml --strict
```

### Example 3: CI Integration

```yaml
stages:
  - validate

validate_gitlab_ci:
  stage: validate
  script:
    - chmod +x devops-skills-plugin/skills/gitlab-ci-validator/scripts/*.sh devops-skills-plugin/skills/gitlab-ci-validator/scripts/*.py
    - bash devops-skills-plugin/skills/gitlab-ci-validator/scripts/validate_gitlab_ci.sh .gitlab-ci.yml --strict
```

## Individual Validators (Advanced)

```bash
# Syntax validator (via wrapper for PyYAML fallback)
bash devops-skills-plugin/skills/gitlab-ci-validator/scripts/python_wrapper.sh \
  devops-skills-plugin/skills/gitlab-ci-validator/scripts/validate_syntax.py .gitlab-ci.yml

# Best-practices validator
bash devops-skills-plugin/skills/gitlab-ci-validator/scripts/python_wrapper.sh \
  devops-skills-plugin/skills/gitlab-ci-validator/scripts/check_best_practices.py .gitlab-ci.yml

# Security validator
bash devops-skills-plugin/skills/gitlab-ci-validator/scripts/python_wrapper.sh \
  devops-skills-plugin/skills/gitlab-ci-validator/scripts/check_security.py .gitlab-ci.yml
```

## Done Criteria

- Frontmatter `name` and `description` unchanged.
- One canonical orchestrator path is used consistently.
- Setup and `chmod` prerequisites appear before workflow/use examples.
- Quick-start and workflow are non-duplicative (workflow references quick-start gates).
- Severity rationale and rule-to-doc references are explicit.
- Fallback behavior is documented for missing tools and constrained environments.
- Examples are executable from repository root.

## Notes

- This skill validates configuration and static patterns; it does not execute production pipelines.
- Use `gitlab-ci-local` or GitLab CI Lint for runtime behavior confirmation.

© akin-ozer · Apache-2.0 · akin-ozer/cc-devops-skills

Similar skills

Everything for DevOps and infrastructure →

From the same set28

k8s-debug Walks through pod failures, stuck rollouts, DNS and storage problems with kubectl. Useful when a cluster misbehaves right after a deploy. CX Codex +1 819installs jenkinsfile-generator Generates declarative and scripted Jenkinsfiles, Kubernetes pod templates, and Jenkins Shared Library scaffolds. Useful when creating CI/CD pipelines with parallel stages or security checks. CX Codex +1 803installs dockerfile-validator Validates Dockerfiles for syntax, security flaws, and build practices using a structured validation script. Useful for hardening images before CI/CD merges. CX Codex +1 740installs dockerfile-generator A skill that writes production-ready Dockerfiles and .dockerignore, validates them, then fixes what the validator flags. Handy when you need to containerize a service without hand-tuning layers. CX Codex +1 699installs bash-script-validator A skill that runs bash and POSIX scripts through syntax checks, ShellCheck and its own security and portability rules. Handy before CI. CX Codex +1 679installs k8s-yaml-validator This skill runs Kubernetes manifests through a linter, schema validation and dry-run, then reports errors with line references. Handy before kubectl apply. CX Codex +1 672installs helm-validator Runs a Helm chart through ten stages: structure, lint, template rendering, YAML, schemas, CRDs and security. You get a severity report and proposed patches. CX Codex +1 671installs bash-script-generator A skill that turns a task into a working bash script: captures requirements, writes the code, then validates it. CX Codex +1 670installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor