agentleFS
leroyguillaumeleroyguillaume/claude/ci-conventions/SKILL.md

ci-conventions

Skill7 starsChanged 3 days agoMITView on GitHub

Platform-agnostic CI pipelines: quality gate, Trivy scans, path filters, caching, releases. TRIGGER when: creating or editing any CI definition (`.github/workflows/`, `.gitlab-ci.yml`, `.gitlab/ci/`, …); setting up CI; adding a test suite; user asks about triggers, path filters, CVE scanning, test coverage, CI caching, release automation, or committing a built binary. SKIP when: no pipeline is involved. Load `github-actions-conventions` or `gitlab-ci-conventions` alongside.

  • Pipes a download into a shell
  • Installs packages

1 other project uses 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

26 rules. About 0 are common, 12 are distinctive, and 14 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 14

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create exactly these, conditioned on what the repo contains.

    line 21
  2. Very specific:

    quality: always. It runs pre-commit run --all-files and the test suite, on every change proposal (PR/MR) and on every push to the default …

    line 24
  3. Very specific:

    coverage: when the repo has a test suite in any language but shell.

    line 32
  4. Very specific:

    build: when a Dockerfile exists. It builds the image, scans it, and

    line 35
  5. Very specific:

    security: only when the repo holds something pre-commit does not scan: a dependency lockfile, or an image it publishes.

    line 41
  6. Very specific:

    chart: when a Helm chart exists. It publishes the chart as an OCI artefact.

    line 46
  7. Very specific:

    release: when the repository publishes an application artefact (an image, a package, a binary).

    line 56
  8. Very specific:

    docs: when the repo has a documentation site.

    line 67
  9. Very specific:

    No self-authorised ignores, for any scanner: Don't add a .trivyignore entry, an inline ignore (# hadolint ignore=…, #trivy:ignore:…, # …

    line 140
  10. Distinctive:

    Every job gets the smallest token scope it needs, widened only in the job that needs more (publishing, uploading a report).

    line 213
  11. Very specific:

    No generated executable is committed: no compiled binary, .jar, .pyc, wheel, archive or minified bundle.

    line 234
  12. Distinctive:

    Only the default branch saves: Every other pipeline saves nothing, and a change proposal restores the default branch's cache.

    line 254
  13. Distinctive:

    Never drop an architecture to save time.

    line 273
  14. Distinctive:

    Never QEMU-emulate a Rust build: If no native runner exists for an architecture, say so to the user rather than falling back to emulation.

    line 274
  15. Very specific:

    When pushing, each arch job pushes by digest, and a final manifest job assembles the multi-arch manifest and applies the tags.

    line 276
  16. Distinctive:

    Never push an image or publish a chart from a change-proposal pipeline.

    line 282
  17. Distinctive:

    Never push an image, under any tag, before it has been Trivy-scanned in the same job.

    line 283
  18. Very specific:

    Never gate a vulnerability scan on anything but fixable HIGH/CRITICAL, never let a misconfiguration finding through, and never silence …

    line 285
  19. Distinctive:

    Never rely on the change-proposal scan alone.

    line 288
  20. Very specific:

    Never create a security pipeline in a repo with no lockfile and no published image: pre-commit already scans everything it holds.

    line 290
  21. Very specific:

    Never split the quality gate, and never path-filter quality or security.

    line 292
  22. Very specific:

    Never make coverage a required check without a threshold, and never set a threshold or a coverage service the user did not ask for.

    line 294
  23. Distinctive:

    Never let two runs of one pipeline overlap on a ref, and never exempt a publishing pipeline from cancellation.

    line 296
  24. Distinctive:

    Never create a release page for a pre-release tag, and never start a stable release's notes from an rc.

    line 298
  25. Distinctive:

    Never reference third-party pipeline code by a mutable ref, and never install anything unpinned.

    line 300
  26. Distinctive:

    Never commit a generated executable.

    line 302

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “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 conventions

What a pipeline does and why, whatever runs it. The how for a given platform is in github-actions-conventions or gitlab-ci-conventions.

The canonical pipeline set

Create exactly these, conditioned on what the repo contains. The platform skill says how each one maps onto files and triggers.

  • quality: always. It runs pre-commit run --all-files and the test suite, on every change proposal (PR/MR) and on every push to the default branch. The language: system hooks shell out to real binaries, so the job installs every tool the hooks need (toolchain + helm, helm-docs, hadolint, trivy, …) before running pre-commit, all through mise; when a Taskfile.yml exists, it runs task lint and task test rather than the commands behind them (mise-conventions, task-conventions). This is the single quality gate. Don't scatter fmt/lint/test across ad-hoc pipelines.
  • coverage: when the repo has a test suite in any language but shell. It measures the suite's coverage and reports it, on the same triggers as quality; it is a report, not a gate (below).
  • build: when a Dockerfile exists. It builds the image, scans it, and pushes only when asked, meaning a manual run with a push input or the release pipeline. A plain push or change proposal builds and scans without pushing (validation only). Tags and labels come from the platform's metadata (a metadata action, predefined variables). Never hand-roll tag strings in several places.
  • security: only when the repo holds something pre-commit does not scan: a dependency lockfile, or an image it publishes. It runs the Trivy vulnerability scans (below) on every change proposal, on push to the default branch, daily on a schedule, and on manual trigger. A repo of docs, configuration or skills has no security pipeline.
  • chart: when a Helm chart exists. It publishes the chart as an OCI artefact. The chart has its own release lifecycle, decoupled from the app. It triggers on the chart-X.Y.Z tag namespace, pre-release chart-X.Y.Z-rcN tags included (plus manual runs), and never on a change proposal, where helm lint inside pre-commit is the validation. The chart version comes from the tag (helm package --version <v>). appVersion stays whatever Chart.yaml pins. It runs the same drift guard as release on every chart tag: Chart.yaml always, the README's helm install --version on a stable tag. A chart tag never gets a release page. The only release pages are the app's.
  • release: when the repository publishes an application artefact (an image, a package, a binary); a chart alone is the chart pipeline's. It is the app-release orchestrator, triggered by a vX.Y.Z tag. It derives the version from the tag, refuses to run when the committed version disagrees (the drift guard in release-script-conventions), runs build with push enabled, then creates the platform's release page with generated notes. It does not publish the chart. When a documentation site exists, it also redeploys it once the release page is created. On a public repository it attests what it publishes and attaches an SBOM (release-supply-chain-conventions). A repo of docs, configuration or skills has no release pipeline.
  • docs: when the repo has a documentation site. It builds the site on every change proposal that touches it, and deploys it from the default branch only: on a push there, and on a stable release. What it builds, and why a release redeploys from the default branch rather than the tag, is in starlight-conventions.

Pre-release tags

A pre-release tag (vX.Y.Z-rcN, any tag with a -) publishes the image and stops there: no release page. An rc exists to be tested. A release page for it would carry the full generated changelog, and the final release would then repeat it (or, diffed against the rc, show almost nothing).

For a stable release, the notes start from the previous stable tag (the greatest vX.Y.Z without a hyphen below the current one, sort -V), never from an rc. With no previous stable tag, let the platform pick.

Trivy: misconfigurations in pre-commit, vulnerabilities in security

trivy config is a pre-commit hook, so it gates every commit and, through quality, every pipeline. It covers the misconfiguration checks: DS- for a Dockerfile, KSV- for a rendered chart, provider-prefixed IDs (AWS-0086, GCP-0001, …) for Terraform. The hooks are in docker-conventions, helm-conventions and terraform-conventions. A misconfiguration is deterministic, so it belongs at commit time, and it fails on every finding, whatever its severity.

The vulnerability side lives in the security pipeline, because it needs a database that changes every day and a network to fetch it. A CVE appears against code nobody touched. A repo that only scans on change proposals is scanning the day it merged, not today.

What to run:

  • trivy image on the image build just produced, in the same job, before anything is pushed, change proposals included. Build into the local store or a tarball, scan, then push that same image. Publishing a known-vulnerable image and scanning it afterwards is the wrong order, and a "staging" tag in a registry is still a published image.
  • trivy fs on the checkout, for the lockfiles (Cargo.lock, uv.lock, package-lock.json) and secrets. This is what catches a vulnerable transitive dependency the manifest never mentions.

How to run the vulnerability scans:

  • Fail on HIGH and CRITICAL, and use ignore-unfixed on that blocking gate only. This applies to CVEs alone: a misconfiguration has no upstream fix to wait for. A CVE with no upstream fix can't be actioned by the contributor in front of it. Blocking on it teaches everyone that red is normal, which is how a real finding gets waved through.
  • Report everything else where people look: the platform's code-scanning or vulnerability report, via a second, non-failing scan whose upload runs even when the gate failed. A finding that only exists in a job log is lost.
  • Pin the Trivy version (action SHA, image tag) like any other tool, and use the report templates shipped with that version. Never fetch a template from a branch URL at run time.
  • Cache the vulnerability DB. It is a large artefact pulled from a registry on every run, and the failure mode is a rate-limited registry taking the whole pipeline down. Behind a registry proxy, point --db-repository / --java-db-repository at the mirror.

The scheduled re-scan

  • Daily, at an off-hour minute (never 0). Top-of-the-hour runs are the first to be delayed or dropped under load.
  • Scan what is published, not a rebuild. A scheduled run has no fresh build, and rebuilding main would pull patched base layers and report a clean image nobody runs. It scans the image of the latest stable release, pulled by its tag. trivy fs runs on the default branch as usual. A repo with no image runs trivy fs alone.
  • Keep the gate. Nobody waits on a cron, so a red scheduled run is the notification that a new HIGH/CRITICAL CVE exists.

No self-authorised ignores, for any scanner. Don't add a .trivyignore entry, an inline ignore (# hadolint ignore=…, #trivy:ignore:…, # zizmor: ignore[…]), a zizmor.yml rule, a --skip-dirs / --skip-files, or a severity downgrade to get a green run, for a CVE and a misconfiguration finding alike. Fix at the source: bump the dependency, change the base image, harden the manifest. If an entry is genuinely unavoidable, the user decides, and it carries a comment with the finding's ID, the reason, and the condition that lifts it.

The only pre-authorised exceptions are the ones docker-conventions (DL3008), helm-conventions (KSV-0011, KSV-0110), gitlab-ci-conventions (yamllint brackets on a !reference line) and sql-conventions (RF04, RF06) list. Nothing else is.

Test coverage: measured and reported, not gated

Every test suite has its coverage measured in CI, whatever the language, except shell. Shell tests drive other programs end to end, and the shell coverage tools (kcov, bashcov) are each tied to one platform or one shell. Configuration languages are out too: terraform test and chart tests assert on a plan or a render, with no lines to count.

  • task coverage runs the suite instrumented, prints the summary and writes the detailed report; task coverage:summary prints the last run's summary again, for CI (task-conventions). The language skill gives both and names the tool (rust-build-conventions, python-conventions, frontend-conventions); a language with no skill here uses its runner's own (go test -coverprofile, node --test --experimental-test-coverage).
  • The tool is pinned like the rest: in mise.toml when it is a binary of its own, in the language's lockfile when the test runner loads it as a plugin (a pytest plugin, a Vitest provider), at the runner's version.
  • Readable without leaving the run: the summary on the run's page (the GitHub job summary, GitLab's coverage figure and diff annotations) and the HTML report as a downloadable artefact. The platform skill says how.
  • One run, on Linux. A test matrix across OSes stays in quality; coverage measures the suite once.
  • Not a required check. With no threshold, it fails only when a test fails, which quality already blocks on, or when the instrumentation breaks, which is no reason to hold a merge. Hence its own pipeline, outside quality, and never path-filtered.
  • No threshold unless the user asks for one. A number picked for them gets met with tests written for the number. When they ask, it is the tool's own fail-under option, and the job then gates: it moves into quality and is required like the rest.
  • No third-party service (Codecov, Coveralls, …) unless the user asks: it needs a token or an app with access to the repository, for a report the platform already shows.

Path filters: don't trigger for nothing

  • A pipeline triggered by a push or a change proposal only runs when a file that affects it changes. A multi-arch image build does not fire on a docs-only or chart-only change. Scope it to its real inputs (e.g. src/**, Cargo.toml, Cargo.lock, Dockerfile, .dockerignore, and its own pipeline file).
  • quality and security are never path-filtered. One is the universal gate. For the other, a new CVE lands without any file changing. Because quality always runs, a proposal is also never left without a pipeline.
  • Tag, schedule and manual triggers take no path filter.
  • Only unfiltered jobs are made required for merging. A required check that a path filter skipped can block the merge forever. The platform skill has the specific trap.

Cancel superseded runs, always

Two runs of the same pipeline never overlap on the same ref. The newer one cancels the older one, publishing pipelines included. A run for a superseded commit is dead weight. Make a partial publish safe at the registry (immutable tags, digest-addressed pushes, re-runnable tags), never by letting stale runs finish.

Least privilege and immutable references

  • Every job gets the smallest token scope it needs, widened only in the job that needs more (publishing, uploading a report).
  • Publishing credentials exist only where publishing happens: tag pipelines, or manual runs on the default branch. A change-proposal pipeline never sees them.
  • Every reference to third-party pipeline code is immutable: an action or an included template/component pinned to a full commit SHA with the version in a comment, kept fresh by the dependency bot (dependency-update-conventions). A mutable tag or branch is somebody else's deploy key into your pipeline.
  • Tool images are pinned to an exact version tag, never latest.
  • Every install a pipeline, a Dockerfile or a script it runs makes is pinned and checked: from the lockfile (npm ci, uv sync --locked, cargo install --locked --version <v>), through mise with its mise.lock (mise-conventions), or an exact release whose checksum is verified. Never curl … | sh, npm install, or pip install <name> without a version: what ran is then whatever was served that minute (Scorecard's Pinned-Dependencies).

The repository holds source, never build output

No generated executable is committed: no compiled binary, .jar, .pyc, wheel, archive or minified bundle. Nobody reviews one, nothing proves it matches the source, and it bypasses the attested build of the release pipeline (Scorecard's Binary-Artifacts). CI builds it from source; the build directories are in .gitignore. Generated source that a reviewer reads in the diff (a lockfile, generated code, a rendered README) is not build output.

Cache deliberately

Cache what is expensive to recompute, not what is cheap to re-download. Restoring a large dependency cache can be slower than a clean fetch, and a stale cache is worse than none.

  • Keep: the Docker layer cache, scoped per architecture so the arch jobs never clobber each other, and compiled-dependency caches (cargo-chef in the Dockerfile, a Rust build cache for non-Docker jobs). These cache CPU work.
  • Skip: a cache wrapped around a fast download just because you can. Measure before adding one. (The Trivy DB is the exception, see above.)
  • Only the default branch saves. Every other pipeline saves nothing, and a change proposal restores the default branch's cache. A proposal's cache serves only its own reruns, yet it shares the project's cache quota: a few dependency-bot PRs each saving gigabytes of layers evict the one cache every proposal reads, and each pays the export time for it.
  • A publishing pipeline restores no build cache: release, chart and a build that pushes start cold. Any job that ran on the default branch could write that cache, and the release would ship what it planted, signed and attested (cache poisoning). A slower release is the price. The Trivy DB cache stays: it feeds the scan, not the artefact.
  • Measure a cache that doesn't help before tuning it: hit or miss per job, what each run saved, and the quota. The usual causes are eviction (quota or inactivity), a default-branch run that never finished saving (cancelled by a newer push, so the next one saves), and a dependency change the default branch hasn't built yet, which no cache can cover.

Multi-arch builds on native runners

  • A multi-arch image is a static matrix over both architectures, amd64 and arm64, each on its own native runner, change proposals included. Never drop an architecture to save time.
  • Never QEMU-emulate a Rust build. If no native runner exists for an architecture, say so to the user rather than falling back to emulation.
  • When pushing, each arch job pushes by digest, and a final manifest job assembles the multi-arch manifest and applies the tags. That job runs only when pushing.

Never

  • Never push an image or publish a chart from a change-proposal pipeline.
  • Never push an image, under any tag, before it has been Trivy-scanned in the same job.
  • Never gate a vulnerability scan on anything but fixable HIGH/CRITICAL, never let a misconfiguration finding through, and never silence either to get a green run.
  • Never rely on the change-proposal scan alone. Without the daily re-scan of what is published, the repo only knows the CVEs that existed on merge day.
  • Never create a security pipeline in a repo with no lockfile and no published image: pre-commit already scans everything it holds.
  • Never split the quality gate, and never path-filter quality or security.
  • Never make coverage a required check without a threshold, and never set a threshold or a coverage service the user did not ask for.
  • Never let two runs of one pipeline overlap on a ref, and never exempt a publishing pipeline from cancellation.
  • Never create a release page for a pre-release tag, and never start a stable release's notes from an rc.
  • Never reference third-party pipeline code by a mutable ref, and never install anything unpinned.
  • Never commit a generated executable.

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.