agentleFS
nisarthnisarth/claude-skills-store/skills/engineering/ci-cd-pipeline/SKILL.md

ci-cd-pipeline

Skill1 starsChanged 7 months agoMITView on GitHub

Design and troubleshoot CI/CD pipelines. GitHub Actions, GitLab CI, Jenkins, CircleCI. Build optimization, caching strategies, parallelization, and deployment automation. Trigger with "set up CI/CD", "fix the build", "GitHub Actions workflow", "speed up the pipeline", "deploy to production", or when the user needs help with continuous integration, continuous deployment, or build automation.

9 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. 0 are common, 18 are distinctive, and 10 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 18

    Distinctive

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Detect platform: Look for .github/workflows/, .gitlab-ci.yml, Jenkinsfile, .circleci/config.yml.

    line 35
  2. Very specific:

    Identify stack: Check package.json, requirements.txt, go.mod, Cargo.toml, pom.xml, Gemfile for language and dependency info.

    line 36
  3. Distinctive:

    Review existing config: If a pipeline exists, read it fully to understand current stages, jobs, and pain points.

    line 37
  4. Distinctive:

    Check build times: If debugging performance, look at recent run logs or timing annotations.

    line 38
  5. Distinctive:

    Review secrets: Check for references to secrets/environment variables that need configuration.

    line 39
  6. Distinctive:

    Use lock file hashes as cache keys for deterministic invalidation.

    line 175
  7. Distinctive:

    Run lint, type-check, and unit tests in parallel (no dependencies between them).

    line 179
  8. Distinctive:

    Use matrix builds for multi-version testing.

    line 180
  9. Very specific:

    Use concurrency groups to cancel in-progress runs on the same PR.

    line 184
  10. Very specific:

    Use actions/cache with proper cache keys to avoid re-downloading dependencies.

    line 186
  11. Very specific:

    Use tools like turborepo, nx, or bazel for incremental/affected-only builds in monorepos.

    line 190
  12. Distinctive:

    When a pipeline is failing:

    line 195
  13. Very specific:

    Check for flaky tests: Look for tests that pass on retry (use --retry flags or rerun).

    line 198
  14. Distinctive:

    Resource limits: Check for OOM kills, disk space issues, or timeout limits.

    line 200
  15. Distinctive:

    Secret availability: Verify secrets are configured for the branch/environment.

    line 201
  16. Distinctive:

    Dependency issues: Check for version mismatches, network failures during install.

    line 202
  17. Distinctive:

    Permission issues: Verify the CI runner has access to required resources.

    line 203
  18. Very specific:

    Add --frozen-lockfile (pnpm) or --immutable (yarn) to prevent lockfile changes.

    line 208
  19. Very specific:

    Action: Read package.json, detect test/lint/build scripts, create a complete workflow YAML with caching, matrix testing, and deployment.

    line 249
  20. Distinctive:

    Action: Read the workflow config and recent run logs, identify environment differences, suggest fixes.

    line 252
  21. Distinctive:

    Action: Read the Jenkinsfile, map stages to GitHub Actions jobs, translate Groovy DSL to YAML, handle secret migration.

    line 258
  22. Very specific:

    Use concurrency groups to cancel stale runs and save CI minutes.

    line 263
  23. Very specific:

    Add timeout-minutes to every job to prevent hung builds from consuming resources.

    line 264
  24. Distinctive:

    Use environment protection rules for production deployments (require approval).

    line 266
  25. Distinctive:

    Add status badges to the README so build health is visible.

    line 267
  26. Distinctive:

    Keep pipelines DRY with reusable workflows (GitHub Actions) or YAML anchors (GitLab CI).

    line 269
  27. Distinctive:

    Run security scans (dependency audit, SAST) on every PR, not just main.

    line 270
  28. Distinctive:

    Use artifact uploads to pass build outputs between jobs instead of rebuilding.

    line 271

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

CI/CD Pipeline

Design, debug, and optimize CI/CD pipelines across major platforms. Covers workflow creation, build optimization, caching, parallelization, secret management, and deployment strategies.

Workflow

Step 1: Assess the Project

Gather context about the project and its CI/CD needs:

  • Detect platform: Look for .github/workflows/, .gitlab-ci.yml, Jenkinsfile, .circleci/config.yml.
  • Identify stack: Check package.json, requirements.txt, go.mod, Cargo.toml, pom.xml, Gemfile for language and dependency info.
  • Review existing config: If a pipeline exists, read it fully to understand current stages, jobs, and pain points.
  • Check build times: If debugging performance, look at recent run logs or timing annotations.
  • Review secrets: Check for references to secrets/environment variables that need configuration.

Step 2: Pipeline Design

Design or restructure the pipeline with these stages:

Standard Pipeline Stages:

  1. Lint & Format — Fast feedback on code style (eslint, prettier, black, gofmt)
  2. Type Check — Static analysis (TypeScript, mypy, flow)
  3. Unit Tests — Fast, isolated tests
  4. Build — Compile, bundle, or package
  5. Integration Tests — Tests requiring databases, APIs, or services
  6. Security Scan — Dependency audit, SAST, secret scanning
  7. Deploy to Staging — Automated deploy to preview environment
  8. E2E Tests — Full end-to-end tests against staging
  9. Deploy to Production — Gated production deployment

GitHub Actions Structure:

name: CI/CD
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

concurrency:
  group: ${{ 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:
    runs-on: ubuntu-latest
    needs: lint
    strategy:
      matrix:
        node-version: [18, 20, 22]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'
      - run: npm ci
      - run: npm test -- --coverage
      - uses: actions/upload-artifact@v4
        with:
          name: coverage-${{ matrix.node-version }}
          path: coverage/

  build:
    runs-on: ubuntu-latest
    needs: test
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: 'npm'
      - run: npm ci
      - run: npm run build
      - uses: actions/upload-artifact@v4
        with:
          name: build
          path: dist/

  deploy:
    runs-on: ubuntu-latest
    needs: build
    if: github.ref == 'refs/heads/main'
    environment: production
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: build
          path: dist/
      - name: Deploy
        run: echo "Deploy to production"

GitLab CI Structure:

stages:
  - lint
  - test
  - build
  - deploy

variables:
  NODE_VERSION: "20"

.node-setup:
  image: node:${NODE_VERSION}
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
      - node_modules/

lint:
  extends: .node-setup
  stage: lint
  script:
    - npm ci
    - npm run lint

test:
  extends: .node-setup
  stage: test
  script:
    - npm ci
    - npm test -- --coverage
  coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
  artifacts:
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage/cobertura-coverage.xml

Step 3: Build Optimization

Apply these optimization techniques:

Caching strategies:

  • Cache dependency directories (node_modules/, .venv/, ~/.m2/, ~/.cache/go-build/).
  • Use lock file hashes as cache keys for deterministic invalidation.
  • Layer caches: dependencies first (changes rarely), then build artifacts.

Parallelization:

  • Run lint, type-check, and unit tests in parallel (no dependencies between them).
  • Use matrix builds for multi-version testing.
  • Split large test suites across parallel runners with test splitting tools.

Reducing redundant work:

  • Use concurrency groups to cancel in-progress runs on the same PR.
  • Skip jobs when only docs or non-code files changed using path filters.
  • Use actions/cache with proper cache keys to avoid re-downloading dependencies.
  • Build Docker images with multi-stage builds and layer caching.

Incremental builds:

  • Use tools like turborepo, nx, or bazel for incremental/affected-only builds in monorepos.
  • Cache build outputs between runs when possible.

Step 4: Debugging Failures

When a pipeline is failing:

  1. Read the error output: Identify the exact command and error message.
  2. Check for flaky tests: Look for tests that pass on retry (use --retry flags or rerun).
  3. Environment differences: Compare CI environment with local (OS, Node version, env vars).
  4. Resource limits: Check for OOM kills, disk space issues, or timeout limits.
  5. Secret availability: Verify secrets are configured for the branch/environment.
  6. Dependency issues: Check for version mismatches, network failures during install.
  7. Permission issues: Verify the CI runner has access to required resources.

Common fixes:

  • npm ci instead of npm install for reproducible installs.
  • Pin action versions to full SHA hashes for security and reproducibility.
  • Add --frozen-lockfile (pnpm) or --immutable (yarn) to prevent lockfile changes.
  • Set timeout-minutes on jobs to prevent hung builds.

Step 5: Deployment Strategies

Blue-Green Deployment: Two identical environments; switch traffic after verification. Canary Deployment: Route a percentage of traffic to the new version, monitor, then promote. Rolling Deployment: Gradually replace instances with the new version. Feature Flags: Deploy code behind flags, enable incrementally.

Output Format

## CI/CD Pipeline Configuration

### Platform: <platform>
### Stack: <language/framework>

### Pipeline Architecture
<stage diagram or description>

### Configuration
<full YAML/Groovy pipeline config>

### Optimization Notes
- Estimated build time: <duration>
- Caching: <what is cached and expected hit rate>
- Parallelization: <which jobs run in parallel>

### Secrets Required
| Secret Name | Purpose | Where to Configure |
|-------------|---------|-------------------|
| <name> | <purpose> | <location> |

### Deployment Strategy
<strategy with rollback procedure>

Examples

User: "Set up GitHub Actions for my Node.js project" Action: Read package.json, detect test/lint/build scripts, create a complete workflow YAML with caching, matrix testing, and deployment.

User: "The build is failing on CI but works locally" Action: Read the workflow config and recent run logs, identify environment differences, suggest fixes.

User: "Our pipeline takes 20 minutes, can we speed it up?" Action: Analyze the current workflow, identify sequential jobs that can be parallelized, add caching, suggest path filters for skip conditions.

User: "Migrate from Jenkins to GitHub Actions" Action: Read the Jenkinsfile, map stages to GitHub Actions jobs, translate Groovy DSL to YAML, handle secret migration.

Best Practices

  • Pin all action versions to full commit SHAs, not tags (prevents supply chain attacks).
  • Use concurrency groups to cancel stale runs and save CI minutes.
  • Add timeout-minutes to every job to prevent hung builds from consuming resources.
  • Store secrets in the platform's secret manager, never in the repo or pipeline config.
  • Use environment protection rules for production deployments (require approval).
  • Add status badges to the README so build health is visible.
  • Set up notifications (Slack, email) for failed builds on the main branch only.
  • Keep pipelines DRY with reusable workflows (GitHub Actions) or YAML anchors (GitLab CI).
  • Run security scans (dependency audit, SAST) on every PR, not just main.
  • Use artifact uploads to pass build outputs between jobs instead of rebuilding.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.