/devops-skills:ci-cd-pipeline-designfrom devops-skills
Designs and troubleshoots CI/CD pipelines across platforms, covering stage layout, caching, parallelization, quality gates, and secrets handling.
Ships in devops-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A CI/CD pipeline is the mechanism that turns a code change into a verified, deployable artifact and, eventually, a running system — reliably, repeatably, and fast enough that engineers trust it over manual steps. Badly designed pipelines either fail to catch real regressions (weak gates, flaky tests suppressed rather than fixed) or become so slow and brittle that engineers route around them (manual deploys, skipped checks). This skill covers designing pipeline stages, gates, caching, and parallelization so that CI/CD is both trustworthy and fast enough to stay in the critical path of every change.
.gitlab-ci.yml support; GitLab 15+ recommended for modern
rules:/workflow: syntax (older only:/except: still works but is
deprecated in favor of rules:).Define the stage model before writing YAML. A typical pipeline has:
lint/static-analysis → build → unit test → package/containerize
→ integration test → publish artifact → deploy (per environment).
Keep fast, cheap checks (lint, unit tests) first so failures surface in
seconds/minutes, not after a 20-minute build.
Trigger scoping. Run the full pipeline on pushes to the default branch and on pull requests; run only relevant subsets on other branches. For monorepos, use path filters so a docs-only change doesn't trigger a full backend build.
GitHub Actions:
name: ci
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- run: npm run lint
test:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- run: npm test -- --shard=${{ matrix.shard }}/4
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t myapp:${{ github.sha }} .
GitLab CI equivalent (.gitlab-ci.yml):
stages: [lint, test, build]
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == "main"'
lint:
stage: lint
script:
- npm ci
- npm run lint
test:
stage: test
parallel: 4
script:
- npm ci
- npm test -- --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
build:
stage: build
needs: ["test"]
script:
- docker build -t myapp:$CI_COMMIT_SHORT_SHA .
Cache dependencies, not build output you can't trust. Cache package
manager directories (~/.npm, ~/.m2, ~/.cache/pip) keyed by a lock
file hash. Avoid caching compiled artifacts across unrelated commits —
stale caches cause "works in CI, fails locally" (or the reverse) bugs.
Add required quality gates as required status checks, not just as jobs that "happen to run." In GitHub: Settings → Branches → branch protection rule → "Require status checks to pass" and select the exact job names. A job that runs but isn't marked required can fail silently and still allow merge.
Add a manual approval gate before production deploy using GitHub
Actions environment: protection rules or GitLab's when: manual with
environment:, rather than trusting a human to remember to "deploy
only after checking."
deploy-prod:
needs: build
runs-on: ubuntu-latest
environment:
name: production
url: https://app.example.com
steps:
- run: ./deploy.sh prod ${{ github.sha }}
Configure production as a protected GitHub environment requiring
reviewer approval under Settings → Environments.
Fail fast and make failures actionable. Surface test reports, not just exit codes (JUnit XML upload, annotations on the PR diff). A red pipeline with no indication of what failed drives engineers to rerun blindly instead of fixing the root cause.
Measure and budget pipeline duration. Track p50/p95 pipeline duration over time; if it creeps past your team's tolerance (commonly cited target: keep PR feedback under ~10-15 minutes), invest in test sharding, dependency caching, or splitting slow integration suites into a separate, less-blocking pipeline.
actions/checkout@v4, not @main) to
avoid supply-chain surprises from upstream changes; update deliberately
via Dependabot/Renovate rather than floating on latest.concurrency/pipeline cancellation so superseded runs on the same
branch don't waste runner minutes.retry: 2 band-aid that runs forever hides real
instability.set -x around commands
that interpolate secret env vars, and use the platform's masked/secret
variable feature rather than plain CI variables.Symptom: Pipeline is green but a bug reaches production anyway. Fix: Audit whether the job that "should have" caught it is actually a required status check, not just a job that runs — non-required jobs can fail without blocking merge.
Symptom: CI takes 40+ minutes and engineers start merging with
--no-verify or bypassing checks.
Fix: Profile the pipeline (per-step timing), parallelize the test
suite via sharding, cache dependencies keyed on lockfile hash, and move
slow end-to-end suites to a separate, non-blocking nightly pipeline.
Symptom: Same test fails ~5% of the time with no code change ("flaky test"), and the team adds automatic retries to make it pass. Fix: Quarantine the flaky test (mark it non-blocking, file a ticket), fix the root cause (shared state, timing assumption, unseeded randomness), then re-enable it as blocking — indefinite silent retries erode trust in the whole pipeline signal.
Symptom: A secret leaks in build logs (e.g., printed via env or an
-x shell trace).
Fix: Store secrets only in the platform's secret store, reference
them as ${{ secrets.NAME }} / ${SECRET_NAME} masked CI/CD variables,
and audit logs for accidental echo/env/printenv dumps of the
environment.
Symptom: Self-hosted runner has stale tooling and pipeline behavior differs from GitHub-hosted runners used elsewhere. Fix: Pin the runner image/tooling versions explicitly in the workflow (language runtime, Docker version) rather than relying on whatever happens to be installed on the runner host.
Scenario: A Node.js service repo needs CI on every PR (lint, unit test,
build, container image) and CD to a staging environment automatically on
merge to main, with a manual gate to production.
.github/workflows/ci-cd.yml:
name: ci-cd
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "20", cache: "npm" }
- run: npm ci
- run: npm run lint
- run: npm test -- --coverage
- name: Upload coverage
uses: actions/upload-artifact@v4
with: { name: coverage, path: coverage/ }
build-image:
needs: verify
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions: { contents: read, packages: write }
steps:
- uses: actions/checkout@v4
- run: |
docker build -t ghcr.io/${{ github.repository }}:${{ github.sha }} .
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push ghcr.io/${{ github.repository }}:${{ github.sha }}
deploy-staging:
needs: build-image
runs-on: ubuntu-latest
environment: { name: staging }
steps:
- run: ./deploy.sh staging ${{ github.sha }}
deploy-prod:
needs: deploy-staging
runs-on: ubuntu-latest
environment: { name: production } # protected: requires reviewer approval
steps:
- run: ./deploy.sh prod ${{ github.sha }}
With branch protection on main requiring the verify job's checks
(lint, test) and the production environment configured with a
required reviewer, a bad change cannot reach production without a passing
pipeline and a human sign-off — while staging still deploys automatically
for fast feedback.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin devops-skills16 skills in this plugin
/artifact-and-dependency-managementManages build artifacts and third-party dependencies through a private registry/proxy with lockfiles, version pinning, retention policies, and automated update workflows. Use when the user asks to "set up an artifact repository," "configure a package registry proxy/mirror," "pin/lock dependency versions," "clean up old artifacts," "handle a dependency update / Dependabot-Renovate PR," or "avoid a left-pad-style supply-chain incident."
/blue-green-canary-deploymentsDesigns and executes progressive delivery strategies — blue-green cutover, canary rollout, and traffic-shifted releases — with automated health checks and rollback triggers, typically on Kubernetes. Use when the user asks to "reduce deployment risk," "set up canary/blue-green deployments," "do a zero-downtime release," "gradually shift traffic to a new version," or "automatically roll back a bad deploy."
/ci-access-and-credential-lifecycle-managementManages the lifecycle of one-off/temporary repo and environment access grants and CI service-account credentials — granting time-boxed access for a specific task, revoking it reliably when the task ends, and rotating CI service-account tokens/keys before they expire or become stale. Use when the user asks to "give a contractor temporary repo access," "grant one-off access to the production environment," "rotate our CI service account token/API key," "find and revoke stale CI credentials," or "our CI token is about to expire, what do we do."
/container-build-and-releaseBuilds, tags, scans, and publishes container images with reproducible, minimal, multi-stage Dockerfiles and a defensible tagging/release scheme. Use when the user asks to "write a Dockerfile," "reduce image size," "set up multi-arch builds," "tag and push a container image," "add image scanning to the pipeline," or "publish a release image to a registry."
/devops-delivery-metrics-and-dora-analysisMeasures and interprets the DORA four keys — deployment frequency, lead time for changes, mean time to restore (MTTR), and change failure rate — including how to compute each one correctly, common measurement pitfalls (vanity metrics, gaming the numbers, misclassifying a rollback), and how to use the results to drive process improvement rather than individual blame. Use when the user asks to "set up DORA metrics," "measure our deployment frequency/lead time," "what's our change failure rate," "are we an elite/high/medium/low performer," or "use delivery metrics to improve, not to blame the team."
/emergency-hotfix-deployment-procedureDefines the out-of-cadence process for shipping a production hotfix outside the normal release train — which checks are genuinely safe to bypass versus never, the minimum required verification before an emergency deploy, required sign-off, and the rollback plan that must exist before the hotfix goes out. Use when the user asks to "ship an emergency hotfix," "deploy outside the normal release process," "bypass the release train for a critical fix," "what's the minimum we can skip for a production emergency," or "we need to patch prod right now."
Other plugins' skills for the same job