agentleFS
SID-SURANGESID-SURANGE/cursor-team-ops/skills/community/ci-cd-pipeline/SKILL.md

ci-cd-pipeline

Skill0 starsChanged 4 months agoMITView on GitHub

Set up or fix a CI/CD pipeline with quality gates — lint, type check, tests, build, security audit, and deployment. Triggered by "set up CI", "fix the pipeline", "add GitHub Actions", "ci-cd-pipeline", "automate deployment", "set up quality gates".

  • Reads credentials

7 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use observability and api-design.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 10 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every change passes these gates before merge — in order, no skipping:

    line 34
  2. Distinctive:

    Before writing any pipeline config:

    line 57
  3. Very specific:

    Check if a CI config already exists (.github/workflows/, .gitlab-ci.yml, Jenkinsfile)

    line 60
  4. Distinctive:

    If one exists, read it fully before modifying

    line 61
  5. Distinctive:

    After the workflow is live, enforce it via branch protection rules:

    line 137
  6. Distinctive:

    When CI fails, copy the full failure output and pass it back:

    line 150
  7. Distinctive:

    Never share secrets between CI and production.

    line 214
  8. Distinctive:

    Never disable a failing check to make CI green — fix the code or fix the check.

    line 250
  9. Distinctive:

    Never store secrets in workflow files — use the secrets manager.

    line 251
  10. Distinctive:

    Never set up CI for only one branch and call it done — protect main with branch rules too.

    line 252
  11. Distinctive:

    If the project already has CI, read it fully before modifying — don't add duplicate jobs.

    line 253

“Common” is measured: kept by at least 6 in 10 of the 6 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

🚦 Skill: ci-cd-pipeline

Purpose

CI/CD is the enforcement mechanism for every other team standard — it catches what humans and agents miss, consistently, on every change. Setting it up once protects the entire team permanently. This skill establishes a quality gate pipeline, feeds failures back into the development loop, and documents deployment strategy.

Trigger phrases

  • "set up CI"
  • "add GitHub Actions"
  • "fix the pipeline"
  • "ci-cd-pipeline"
  • "automate deployment"
  • "set up quality gates"
  • "why is CI failing"
  • "add a quality gate"

The quality gate pipeline

Every change passes these gates before merge — in order, no skipping:

PR opened
    │
    ▼
 Lint  →  Type check  →  Unit tests  →  Build  →  Security audit
    │
    ▼ (all pass)
 Integration tests  →  E2E (if applicable)
    │
    ▼ (all pass)
 Ready for review  →  Merge  →  Deploy to staging  →  Deploy to production

Shift left: a bug caught in lint costs minutes; the same bug caught in production costs hours. Move checks as early as possible.


Steps

1. Read the project first

Before writing any pipeline config:

  • Identify the package manager (npm, pnpm, yarn, pip, cargo, etc.)
  • Find the test command, lint command, build command from package.json / Makefile / pyproject.toml
  • Check if a CI config already exists (.github/workflows/, .gitlab-ci.yml, Jenkinsfile)
  • If one exists, read it fully before modifying

2. Create the CI workflow

GitHub Actions — Node.js (adapt language as needed)

# .github/workflows/ci.yml
name: CI

on:
  pull_request:
    branches: [main]
  push:
    branches: [main]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: 'npm'
      - run: npm ci
      - run: npm run lint

  typecheck:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: 'npm'
      - run: npm ci
      - run: npx tsc --noEmit

  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: 'npm'
      - run: npm ci
      - run: npm test -- --coverage

  build:
    runs-on: ubuntu-latest
    needs: [lint, typecheck, test]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: 'npm'
      - run: npm ci
      - run: npm run build

  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: 'npm'
      - run: npm ci
      - run: npm audit --audit-level=high

3. Configure branch protection

After the workflow is live, enforce it via branch protection rules:

Settings → Branches → main → Branch protection rule:
  ✅ Require status checks to pass before merging
       Add: lint, typecheck, test, build, security
  ✅ Require branches to be up to date before merging
  ✅ Do not allow force pushes
  ✅ Require at least 1 approving review

4. Feeding CI failures back to the agent

When CI fails, copy the full failure output and pass it back:

"The CI pipeline failed with this error:
[paste full error output — do not truncate]
Fix the issue and verify locally before pushing."
Failure typeWhat the agent should do
Lint errorRun npm run lint --fix, review unfixable errors, commit
Type errorRead the error location, fix the type, do not use any
Test failureFollow systematic-debugging skill
Build errorCheck config, dependencies, and env vars
Audit findingnpm audit fix; for manual fixes, read the advisory first

5. Deployment strategy

Choose based on project risk:

Low-risk (internal tools, early stage):

merge to main → auto-deploy to production → monitor for 15 min

Standard (most projects):

merge to main → auto-deploy to staging → manual promotion to production

High-risk (regulated, high traffic):

merge to main → staging → canary (5% traffic) → full production

Rollback workflow:

# .github/workflows/rollback.yml
name: Rollback
on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version/SHA to roll back to'
        required: true
jobs:
  rollback:
    runs-on: ubuntu-latest
    steps:
      - name: Rollback
        run: echo "Deploy version ${{ inputs.version }} here"
        # Replace with your actual deployment command

6. Environment and secrets hygiene

.env.example     → committed (template, no real values)
.env             → NOT committed (local dev only, in .gitignore)
.env.test        → committed (test config, no real secrets)
CI secrets       → stored in GitHub Secrets (Settings → Secrets)
Production       → stored in deployment platform vault

Never share secrets between CI and production. Use separate values.


Pipeline optimisation (when CI exceeds 10 min)

Apply in this order:

FixImpact
Cache dependencies (actions/cache or setup-node cache)High
Run lint, typecheck, test in parallel jobsHigh
Use path filters — skip E2E for docs-only PRsMedium
Shard test suite across matrix runnersMedium
Move slow tests to a nightly scheduleLow

Common rationalisations and rebuttals

RationalisationReality
"CI is too slow to run on every PR"Optimise the pipeline — don't remove the gate. A 5-min pipeline prevents hours of debugging.
"This change is trivial, CI will pass"Trivial changes cause broken builds. The pipeline is fast for trivial changes.
"The test is flaky, just re-run it"Flaky tests mask real bugs. Fix the flakiness — don't re-run and hope.
"We'll add CI after launch"Projects without CI accumulate broken states that get harder to fix under pressure. Set it up on day one.
"I disabled the failing check temporarily"Temporarily disabled checks become permanently ignored. Fix the check or fix the code.

Output

A working .github/workflows/ci.yml (or equivalent for your CI platform) with all quality gates active, plus branch protection settings documented. Deployment strategy documented in AGENTS.md or docs/deployment.md.

Guardrails

  • Never disable a failing check to make CI green — fix the code or fix the check.
  • Never store secrets in workflow files — use the secrets manager.
  • Never set up CI for only one branch and call it done — protect main with branch rules too.
  • If the project already has CI, read it fully before modifying — don't add duplicate jobs.

Gotchas

  • The sample workflow above is a Node.js template — pasting it unmodified into a Python, Go, or Ruby repo passes the checkout step and then fails every job on a missing package.json. Always substitute the package manager, install command, and test/lint/build commands actually detected in Step 1.
  • Branch protection settings (Settings → Branches) aren't configurable via a committed YAML file — they require repo admin access through the GitHub UI or API. Don't imply the workflow file alone enforces them; call out the manual step explicitly.
  • A pipeline that passes locally but was never actually triggered (wrong on: branch filter, typo'd branch name) reports as "set up" while doing nothing — verify a real PR actually triggers the new checks before calling the setup done.

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.