skills/ci-cd/gitlab-ci/generator/SKILL.md
Creates .gitlab-ci.yml files, configures pipeline stages, defines CI jobs and runners, sets up deployment workflows, and generates reusable GitLab CI/CD templates following current best practices and security standards. Use when users ask to create or build a GitLab CI/CD pipeline, CI config, build pipeline, deploy pipeline, GitLab YAML, CI jobs, or any .gitlab-ci.yml configuration from scratch or for a new project.
npx skillsauth add pantheon-org/tekhne gitlab-ci-generatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate production-ready GitLab CI/CD pipeline configurations following current best practices, security standards, and naming conventions. All generated resources are validated using the devops-skills:gitlab-ci-validator skill before delivery.
CRITICAL: Before generating ANY pipeline, complete these steps in order:
Use the Read tool to load all four reference files plus the relevant template:
1. references/best-practices.md — Security, performance, and naming patterns
2. references/common-patterns.md — Standard pipeline patterns as foundation
3. references/gitlab-ci-reference.md — Syntax reference and keyword details
4. references/security-guidelines.md — Security-sensitive configurations
Template selection:
assets/templates/docker-build.ymlassets/templates/kubernetes-deploy.ymlassets/templates/multi-project.ymlassets/templates/basic-pipeline.ymlAfter reading references, output this confirmation before proceeding:
## Reference Analysis Complete
**Pipeline Pattern Identified:** [Pattern name] from common-patterns.md
- [Why this pattern fits]
**Best Practices to Apply:**
- [3–5 key best practices relevant to this pipeline]
**Security Guidelines:**
- [Security measures to implement]
**Template Foundation:** [Template file name]
- [What will be customized]
Generate complete .gitlab-ci.yml files with proper structure, security best practices, and efficient CI/CD patterns. Use assets/templates/basic-pipeline.yml as structural foundation, referencing references/best-practices.md and references/common-patterns.md.
Apply these principles:
:latest)expire_in always set)needs keyword for DAG optimizationrules instead of deprecated only/excepttimeout on ALL jobs (10–30 minutes typically)retry for flaky operations (network, external APIs)resource_group for deployment jobsValidate per the Validation Workflow section.
Minimal example:
stages: [build, test, deploy]
variables:
NODE_VERSION: "20"
default:
image: node:20-alpine
timeout: 20 minutes
cache:
key: ${CI_COMMIT_REF_SLUG}
paths: [node_modules/]
interruptible: true
build-application:
stage: build
timeout: 15 minutes
script: [npm ci, npm run build]
artifacts:
paths: [dist/]
expire_in: 1 hour
test-unit:
stage: test
needs: [build-application]
script: [npm run test:unit]
artifacts:
reports:
junit: junit.xml
deploy-production:
stage: deploy
needs: [build-application, test-unit]
script: [npm run deploy:production]
environment:
name: production
url: https://example.com
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: manual
resource_group: production
timeout: 15 minutes
Create pipelines for building, scanning, and pushing Docker images to container registries. Use assets/templates/docker-build.yml as foundation with Docker-in-Docker or Kaniko, registry authentication via predefined variables, image tagging strategy ($CI_COMMIT_SHORT_SHA), and container security scanning (Trivy or GitLab template). Validate per the Validation Workflow section.
Minimal example:
variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE
IMAGE_TAG: $CI_COMMIT_SHORT_SHA
docker-build:
stage: build
image: docker:24-dind
timeout: 20 minutes
services: [docker:24-dind]
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build --cache-from $IMAGE_NAME:latest --tag $IMAGE_NAME:$IMAGE_TAG .
- docker push $IMAGE_NAME:$IMAGE_TAG
retry:
max: 2
when: [runner_system_failure]
Create pipelines deploying to Kubernetes clusters via kubectl, Helm, or Kustomize. Use assets/templates/kubernetes-deploy.yml as foundation with cluster authentication via $KUBE_CONTEXT, environment management, and rollback capabilities. Validate per the Validation Workflow section.
Minimal example:
deploy-k8s:
stage: deploy
image: bitnami/kubectl:1.29
timeout: 10 minutes
before_script: [kubectl config use-context $KUBE_CONTEXT]
script:
- kubectl set image deployment/myapp myapp=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA -n $KUBE_NAMESPACE
- kubectl rollout status deployment/myapp -n $KUBE_NAMESPACE --timeout=5m
environment:
name: production
url: https://example.com
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: manual
resource_group: k8s-production
Create pipelines that trigger other projects or use parent-child patterns for monorepos and microservices. Use assets/templates/multi-project.yml or parent-child templates with artifact passing between pipelines and parallel execution where appropriate. Validate per the Validation Workflow section.
Create modular, DRY configurations using extends, YAML anchors, and include. Extract common patterns into hidden jobs (.template-name), use extends for inheritance (preferred over YAML anchors), organize into separate files with include, and include explicit timeout in all templates. Validate per the Validation Workflow section.
Minimal example:
.node-template:
image: node:20-alpine
timeout: 15 minutes
cache:
key: ${CI_COMMIT_REF_SLUG}
paths: [node_modules/]
before_script: [npm ci]
interruptible: true
build:
extends: .node-template
stage: build
script: [npm run build]
When the user requests specific GitLab features (Auto DevOps, SAST, dependency scanning, etc.):
"GitLab CI/CD [feature] documentation 2025"mcp__context7__resolve-library-id then mcp__context7__get-library-docsdocs.gitlab.comWhen using GitLab include templates:
include:
- template: Jobs/SAST.gitlab-ci.yml
- template: Jobs/Dependency-Scanning.gitlab-ci.yml
variables:
SAST_EXCLUDED_PATHS: "spec, test, tests, tmp"
Note: Customize included template jobs via global
variablesrather than partial job overrides. GitLab merges at runtime, but local validators only see your file—partial overrides will fail validation.
Every complete pipeline MUST be validated before presenting to the user.
devops-skills:gitlab-ci-validatorSee references/validation-presentation.md for detailed requirements on presenting validation results, including status tables, issue explanations, and usage instructions.
See references/best-practices.md for the full set of security, performance, reliability, naming, and organization guidelines that all generated pipelines must follow.
only: [master] or only: [main]only/except are deprecated in GitLab 15+; rules is the current approach and offers more expressive conditions.only: - mainrules: - if: '$CI_COMMIT_BRANCH == "main"'environment: key.environment: name: production url: https://example.com combined with when: manual for production jobs.tags: [kubernetes, production] on lint and unit test jobs.before_script blocks in every jobbefore_script creates maintenance debt; use YAML anchors or extends to share setup.before_script: [npm ci] in every job..node_setup hidden job with before_script: [npm ci] and use extends: .node_setup in dependent jobs.expire_in on artifactsartifacts: paths: [dist/] with no expire_in.artifacts: paths: [dist/] expire_in: 7 daysreferences/best-practices.md — Security, performance, pipeline design, anti-patternsreferences/common-patterns.md — Standard patterns (basic CI, Docker, K8s, multi-project)references/gitlab-ci-reference.md — Full keyword and syntax referencereferences/security-guidelines.md — Secrets, image, script, and artifact securityreferences/validation-presentation.md — Validation results presentation formatassets/templates/basic-pipeline.yml — Basic pipeline templateassets/templates/docker-build.yml — Docker build pipeline templateassets/templates/kubernetes-deploy.yml — Kubernetes deployment templateassets/templates/multi-project.yml — Multi-project orchestration templateTemplate usage: Copy structure → replace [PLACEHOLDERS] → customize logic → remove unused sections → validate.
tools
Generates Jenkinsfiles with stages, agents, parallel builds, post-build actions, and security scanning for Declarative and Scripted pipeline syntaxes. Use when creating a Jenkins pipeline script, Groovy pipeline, or build configuration; implementing CI/CD workflows, continuous integration, or build automation; adding Docker/Kubernetes deployments, matrix builds, parameterized pipelines, or DevSecOps security scanning to a Jenkins setup.
tools
Comprehensive toolkit for validating, linting, testing, and analyzing Helm charts and their rendered Kubernetes resources. Use this skill when working with Helm charts, validating templates, debugging chart issues, working with Custom Resource Definitions (CRDs) that require documentation lookup, or checking Helm best practices.
tools
Comprehensive toolkit for generating best practice Helm charts and resources following current standards and conventions. Use this skill when creating new Helm charts, implementing Helm templates, scaffolding Chart.yaml and values.yaml, defining deployment templates, service definitions, ingress configurations, .tpl helpers, or building Helm projects from scratch. Trigger phrases include "create", "generate", "build", "scaffold" alongside terms like "kubernetes helm", "k8s charts", "helm package", "chart dependencies", "values.yaml", or "helm install".
development
Validates .gitlab-ci.yml syntax, detects security misconfigurations in job definitions, checks for deprecated keywords, ensures proper stage ordering, and audits pipeline configurations for best practices. Use when working with .gitlab-ci.yml files, validating GitLab CI/CD pipeline syntax, debugging configuration errors, checking for hardcoded secrets or credentials in pipeline jobs, optimizing pipeline performance with DAG or cache, or performing security audits on GitLab CI/CD configurations.