agentleFS
jars-demojars-demo/jars-skills/skills/ci-cd/SKILL.md

ci-cd

Skill0 starsChanged 32 days agoMITView on GitHub

Write, review, and fix CI/CD pipeline configurations for GitHub Actions, GitLab CI, and similar platforms. Use when the user asks to add a CI pipeline, set up GitHub Actions, write a workflow file, fix a failing pipeline, add a deploy step, set up staging or production deploys, wire up secrets, add branch protection, or speed up a slow pipeline.

  • Reads credentials
  • Installs packages

38 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use observability, shell-scripting and 2 more.

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 13 projects that use this

  • mylee04Skill

    shell-scripting

    Shell scripting best practices for cross-platform CLI tools

    Also in 3 projects that use this

  • MicrosoftSkill

    authentication

    Wire this in whenever the app uses or connects to data — records, a database, entities, per-user data, row-level security — or when the user wants sign-in, accounts, login, or protected pages. Rayfin data is always accessed as an authenticated user, so **data implies auth**; only a static page over public data skips it. The starter ships as a no-auth "hello world" that previews with no backend, and the full Fabric auth scaffolding is already in the project — this skill wires it in: AuthProvider + bootstrapAuth in main.tsx, the route guard in App.tsx, the sign-in page, sign-out, and the env/deploy requirement. Triggers: auth, authentication, sign in, sign-in, login, log in, sign out, logout, account, user, identity, protect route, require login, gated page, data, database, records, per-user, row-level security, who is the current user, Fabric auth, Entra.

    Also in 4 projects that use this

  • mijunriSkill

    database

    数据库脚本与操作规范。脚本放在 db_scripts 目录,遵循查询优化、事务、安全等实践。

    Also in 4 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 12 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 25 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write and fix pipeline configurations that build on every commit, test before merging, and deploy only when things are green.

    line 8
  2. Distinctive:

    Read the project before touching the pipeline: Check the runtime, package manager, build command, test command, and deploy target.

    line 14
  3. Distinctive:

    Never put secrets in pipeline files: Use the platform's secret store and reference secrets by name.

    line 19
  4. Distinctive:

    Respect the repo's existing pipeline setup: If a workflow file already exists, read it before suggesting changes.

    line 21
  5. Distinctive:

    Always pin actions to a specific version tag.

    line 197
  6. Very specific:

    Never use @main or @master — third-party action code can change under you.

    line 209
  7. Distinctive:

    Don't guess from the job name alone.

    line 280
  8. Distinctive:

    Run the exact commands the CI job runs, in the same order:

    line 285
  9. Distinctive:

    If it passes locally but fails in CI, the cause is usually one of:

    line 293
  10. Distinctive:

    If the pipeline was green and a recent commit broke it:

    line 313
  11. Distinctive:

    If the cache key is too broad (e.g., keyed on the branch name), it misses on most runs.

    line 326
  12. Distinctive:

    Parallelize independent jobs: Test and lint don't need each other — run them in parallel jobs in the same stage.

    line 328
  13. Very specific:

    Split slow test suites: Use matrix builds or test-splitting tools (jest --shard, pytest-split, go test -run) to distribute across parallel …

    line 331
  14. Very specific:

    Don't reinstall what you don't need: If a deploy job only needs the built artifact, pass it via artifacts (GitLab) or …

    line 336
  15. Distinctive:

    Skip CI for non-code changes: Add path filters to avoid running the full pipeline on doc-only commits:

    line 340

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

Write and fix pipeline configurations that build on every commit, test before merging, and deploy only when things are green. Start from what the project already does, not from a template you copied elsewhere.

Ground rules

  • Read the project before touching the pipeline. Check the runtime, package manager, build command, test command, and deploy target. A Node app and a Python app need different setup steps and caches.
  • Never push, deploy, or publish without being asked. Pipelines should be written and committed locally. The user decides when to push.
  • Never put secrets in pipeline files. Use the platform's secret store and reference secrets by name. Flag any hardcoded credential you find and tell the user to rotate it.
  • Respect the repo's existing pipeline setup. If a workflow file already exists, read it before suggesting changes.
  • If the pipeline was passing and now it isn't, find the root cause. Don't comment out steps or widen conditions to make a failing check go green.

Step 0: Read the project first

# Runtime and tooling
cat .nvmrc || cat .node-version || cat .python-version || cat .tool-versions

# Build and test commands
cat package.json | grep -A 10 '"scripts"'    # Node
cat pyproject.toml | grep -A 5 '\[tool\.'    # Python
cat Makefile | head -40

# Existing CI config
ls .github/workflows/
ls .gitlab-ci.yml
ls Jenkinsfile
ls .circleci/config.yml

# Are there Docker or Compose files that the pipeline needs to know about?
ls Dockerfile* docker-compose*

Identify: the runtime version, install command, build command, test command, and whether there is a deploy target and what environment it deploys to.


GitHub Actions

Minimal CI workflow (build + test on every push and PR)

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

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

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version-file: .nvmrc     # or: node-version: "22"
          cache: npm

      - name: Install dependencies
        run: npm ci

      - name: Build
        run: npm run build

      - name: Test
        run: npm test

Adapt setup-node to setup-python, setup-go, setup-java, etc., depending on the stack. Always use node-version-file (or the equivalent) when the project pins a version.

Caching dependencies

Cache the package manager's store, not node_modules, so the cache works across OS updates:

# Node (npm) — already handled by cache: npm in setup-node
# Node (pnpm)
- uses: pnpm/action-setup@v4
  with:
    version: 9
- uses: actions/setup-node@v4
  with:
    node-version-file: .nvmrc
    cache: pnpm

# Python (pip)
- uses: actions/setup-python@v5
  with:
    python-version-file: .python-version
    cache: pip

# Python (uv)
- name: Install uv
  uses: astral-sh/setup-uv@v5
  with:
    enable-cache: true

Matrix builds (test across multiple versions)

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: ["20", "22"]
      fail-fast: false       # don't cancel all jobs when one version fails

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: npm
      - run: npm ci
      - run: npm test

Adding a deploy step

Deploy only from main, only after tests pass, and only when the user has set up the required secrets.

jobs:
  test:
    # ... (the CI job above)

  deploy:
    needs: test                  # only runs when test passes
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
    environment: production      # enables environment protection rules in GitHub

    steps:
      - uses: actions/checkout@v4

      - name: Deploy
        env:
          DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
        run: ./scripts/deploy.sh

Key points:

  • needs: test — never deploy if tests fail.
  • if: github.ref == 'refs/heads/main' — only deploy from the main branch.
  • environment: production — links to a GitHub Environment so you can add required reviewers and environment-specific secrets.
  • The secret is referenced as ${{ secrets.SECRET_NAME }}, never hardcoded.

Using secrets safely

# Reference secrets from the GitHub secret store
- name: Authenticate
  env:
    API_KEY: ${{ secrets.API_KEY }}
  run: ./scripts/authenticate.sh

# For Docker Hub, AWS, GCP, etc., use the official actions
- name: Log in to Docker Hub
  uses: docker/login-action@v3
  with:
    username: ${{ secrets.DOCKERHUB_USERNAME }}
    password: ${{ secrets.DOCKERHUB_TOKEN }}

Tell the user which secret names the workflow expects so they can add them under Settings → Secrets and variables → Actions.

Pinning action versions

Always pin actions to a specific version tag. For security-sensitive actions (checkout, login, deploy), pin to a commit SHA:

# Version tag (acceptable for most actions)
- uses: actions/checkout@v4
- uses: actions/setup-node@v4

# Commit SHA (recommended for actions with write access or secret exposure)
- uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502

Never use @main or @master — third-party action code can change under you.


GitLab CI

Minimal pipeline

# .gitlab-ci.yml
stages:
  - build
  - test
  - deploy

default:
  image: node:22-bookworm-slim
  cache:
    key:
      files:
        - package-lock.json
    paths:
      - node_modules/

build:
  stage: build
  script:
    - npm ci
    - npm run build
  artifacts:
    paths:
      - dist/
    expire_in: 1 hour

test:
  stage: test
  script:
    - npm ci
    - npm test

deploy:
  stage: deploy
  script:
    - ./scripts/deploy.sh
  environment:
    name: production
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  variables:
    DEPLOY_TOKEN: $DEPLOY_TOKEN   # set in GitLab CI/CD settings → Variables

GitLab secret variables

Secrets go in Settings → CI/CD → Variables. Reference them with $VARIABLE_NAME. Mark sensitive variables as "Masked" and "Protected" (protected = only available on protected branches/tags).


Diagnosing a failing pipeline

1. Read the actual failure

# GitHub Actions: open the failing job in the Actions tab
# Look for the red step — expand it to see the full error

# GitLab CI: open the failing job in the pipeline view

Don't guess from the job name alone. The error message is almost always in the last 20 lines of the failing step's log.

2. Reproduce locally

Run the exact commands the CI job runs, in the same order:

npm ci          # not npm install — CI uses the lockfile
npm run build
npm test

If it passes locally but fails in CI, the cause is usually one of:

  • A dependency that's in devDependencies but assumed in CI
  • An environment variable or secret that's not set
  • A file that's .gitignored and not present in CI
  • A platform difference (macOS vs Linux, different Node version)

3. Common failure patterns

SymptomLikely causeFix
Cannot find moduleDependency not installed or in wrong dep groupMove to dependencies, check npm ci ran
Tests pass locally, fail in CIMissing env varAdd to repo secrets or CI variables
Cache hit but stale depsCache key doesn't include lockfileUse key: files: [package-lock.json]
Timeout on installNo cache, or cache miss on every runFix the cache key
Permission denied on scriptScript not executable in repogit update-index --chmod=+x scripts/deploy.sh
Deploy runs on every branchMissing branch conditionAdd if: github.ref == 'refs/heads/main'
Old action version brokenUpstream action API changedPin to a newer version tag

4. Checking the diff

If the pipeline was green and a recent commit broke it:

git log --oneline -10        # find the commit that broke it
git show <sha>               # what changed
git bisect start             # if the culprit isn't obvious

Speeding up a slow pipeline

  1. Cache the right things. Cache the package manager's store keyed on the lockfile. If the cache key is too broad (e.g., keyed on the branch name), it misses on most runs.
  2. Parallelize independent jobs. Test and lint don't need each other — run them in parallel jobs in the same stage.
  3. Split slow test suites. Use matrix builds or test-splitting tools (jest --shard, pytest-split, go test -run) to distribute across parallel runners.
  4. Use npm ci not npm install. npm ci is faster and deterministic.
  5. Don't reinstall what you don't need. If a deploy job only needs the built artifact, pass it via artifacts (GitLab) or actions/upload-artifact / actions/download-artifact (GitHub) instead of reinstalling all deps.
  6. Skip CI for non-code changes. Add path filters to avoid running the full pipeline on doc-only commits:

    # GitHub Actions
    on:
      push:
        paths-ignore:
          - "**.md"
          - "docs/**"

Checklist before finishing

  • Pipeline triggers are correct (push, PR, tag — not all three unless needed)
  • Runtime version is pinned (.nvmrc, node-version-file, etc.)
  • Dependencies are installed with the lockfile command (npm ci, pip install -r requirements.txt)
  • Cache key includes the lockfile so it invalidates when deps change
  • Tests must pass before deploy runs (needs: test / stage ordering)
  • Deploy only runs from the intended branch
  • No secrets hardcoded in the workflow file
  • Secret names are documented for the user to add to the secret store
  • Action versions are pinned (not @main)
  • Pipeline runs green locally (simulate with act for GitHub Actions if needed)

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.