Comprehensive toolkit for validating, linting, testing, and securing GitLab CI/CD pipeline configurations. Use this skill when working with GitLab CI/CD pipelines, validating pipeline syntax, debugging configuration issues, or implementing best practices.
80
100%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Validates, lints, tests, and secures GitLab CI/CD pipeline configurations (.gitlab-ci.yml files) across three layers: syntax/schema validation, best practices analysis, and security scanning.
bash scripts/validate_gitlab_ci.sh --syntax-only .gitlab-ci.ymlChecks: YAML structure, GitLab CI schema compliance, job definitions, stage references, dependency graphs (needs/dependencies/extends), include configurations (component, project, remote, local, template), circular dependency detection, and GitLab limits (500 jobs max, 255-char job names, 50 max needs, 100 max components).
Action: Fix all syntax errors before proceeding.
bash scripts/validate_gitlab_ci.sh --best-practices .gitlab-ci.ymlChecks: Cache usage for dependency installation, artifact expiration settings, DAG optimization with needs, parallel execution opportunities, Docker image version pinning, deprecated only/except → rules migration, missing timeouts and retries, resource group usage.
Action: Review suggestions and apply relevant optimizations.
bash scripts/validate_gitlab_ci.sh --security-only .gitlab-ci.ymlChecks: Hardcoded secrets and credentials, component security (version pinning, trusted sources), remote include integrity, insecure script patterns (curl | bash, eval), SSL/TLS verification bypasses, dangerous file permissions (chmod 777), overly broad artifact paths, variable masking, path traversal in local includes.
Action: Fix all critical and high-severity issues immediately.
# Install gitlab-ci-local first (requires Docker and Node.js)
bash scripts/install_tools.sh
# Test pipeline locally
gitlab-ci-local
# Or via the validator script
bash scripts/validate_gitlab_ci.sh --test-only .gitlab-ci.ymlSimulates local pipeline execution to test job ordering, dependencies, and environment setup. Requires Docker and gitlab-ci-local.
# Full validation (all three layers)
bash scripts/validate_gitlab_ci.sh .gitlab-ci.yml
# Strict mode (fail on warnings)
bash scripts/validate_gitlab_ci.sh .gitlab-ci.yml --strictbash scripts/validate_gitlab_ci.sh .gitlab-ci.yml --syntax-only
bash scripts/validate_gitlab_ci.sh .gitlab-ci.yml --best-practices
bash scripts/validate_gitlab_ci.sh .gitlab-ci.yml --security-only
bash scripts/validate_gitlab_ci.sh .gitlab-ci.yml --no-best-practices
bash scripts/validate_gitlab_ci.sh .gitlab-ci.yml --no-security
bash scripts/validate_gitlab_ci.sh .gitlab-ci.yml --strictpython3 scripts/validate_syntax.py .gitlab-ci.yml
python3 scripts/check_best_practices.py .gitlab-ci.yml
python3 scripts/check_security.py .gitlab-ci.yml════════════════════════════════════════════════════════════════════════════════
Validation Summary
════════════════════════════════════════════════════════════════════════════════
Syntax Validation: PASSED
Best Practices: WARNINGS
Security Scan: PASSED
✓ All validation checks passedstages:
- validate
validate_pipeline:
stage: validate
script:
- pip3 install PyYAML
- bash .claude/skills/gitlab-ci-validator/scripts/validate_gitlab_ci.sh .gitlab-ci.yml --strictAdd custom rules directly to the relevant script:
# In check_best_practices.py
def _check_custom_rule(self):
"""Check for custom organization rule"""
for job_name, job in self.config.items():
if not self._is_job(job_name):
continue
if 'tags' not in job:
self.issues.append(BestPracticeIssue(
'warning',
self._get_line(job_name),
f"Job '{job_name}' should specify runner tags",
'custom-missing-tags',
"Add 'tags' to select appropriate runners"
))scripts/validate_syntax.pyscripts/check_best_practices.pyscripts/check_security.pypip3 install PyYAMLdocs/gitlab-ci-reference.md — Complete GitLab CI/CD YAML syntax referencedocs/best-practices.md — Detailed best practices guidedocs/common-issues.md — Common issues and solutionsdocs/RULES.md — Full validation rules catalog (syntax, best practice, security)examples/basic-pipeline.gitlab-ci.yml — Simple three-stage pipelineexamples/docker-build.gitlab-ci.yml — Docker build and push workflowexamples/multi-stage.gitlab-ci.yml — Multi-stage pipeline with DAGexamples/complex-workflow.gitlab-ci.yml — Advanced workflow with all featuresexamples/component-pipeline.gitlab-ci.yml — GitLab 17.0+ pipeline using CI/CD components# Test with examples
bash scripts/validate_gitlab_ci.sh examples/basic-pipeline.gitlab-ci.yml
bash scripts/validate_gitlab_ci.sh examples/component-pipeline.gitlab-ci.ymlWhen encountering custom GitLab features or version-specific requirements, this skill can:
Note: This skill validates GitLab CI/CD configurations but does not execute pipelines. Use GitLab's CI Lint tool or gitlab-ci-local for testing actual pipeline execution.