cicd-pipeline-author
Skill9 starsChanged 5 months agoApache-2.0View on GitHub
Designs and hardens CI/CD pipelines across GitHub Actions, GitLab CI, Jenkins, and CircleCI — caching, matrix builds, least-privilege tokens, pinned actions, and OIDC instead of long-lived secrets. Triggers when writing or fixing a pipeline/workflow file, speeding up CI, or securing a build.
In this repository147 other files it gives its agents.
- second-brain/AGENTS.mdAGENTS.md
- second-brain/CLAUDE.mdCLAUDE.md
- agent-tool-mcp-builderSkill
- api-design-reviewSkill
- async-concurrency-correctnessSkill
- audit-accessibility-wcagSkill
- audit-license-complianceSkill
- audit-technical-seoSkill
- auth-jwt-sessionSkill
- author-codemodSkill
- brainstorm-designSkill
- build-audit-loggingSkill
- build-cdc-streaming-pipelineSkill
- build-cli-toolSkill
- build-data-tableSkill
- build-etl-pipelineSkill
- build-form-validationSkill
- build-native-mobile-uiSkill
- build-office-docsSkill
- build-offline-first-syncSkill
- build-react-componentSkill
- build-realtime-channelSkill
- build-spreadsheetSkill
- build-vector-searchSkill
- caching-strategySkill
- cloud-cost-optimizeSkill
- code-commentsSkill
- code-reviewSkill
- compose-local-dev-stackSkill
- configure-bundler-buildSkill
- configure-dns-tlsSkill
- configure-reverse-proxy-lbSkill
- configure-security-headers-cspSkill
- contract-testingSkill
- datetime-timezone-correctnessSkill
- db-migration-safetySkill
- debug-ci-pipeline-failureSkill
- debug-flaky-testsSkill
- debug-frontend-browserSkill
- debug-root-causeSkill
- defend-llm-prompt-injectionSkill
- deliver-webhooksSkill
- dependency-upgradeSkill
- deploy-releaseSkill
- design-api-paginationSkill
- design-authorization-modelSkill
- design-backup-dr-recoverySkill
- design-event-sourcing-cqrsSkill
- design-multi-tenancySkill
- design-protobuf-grpc-serviceSkill
- design-relational-schemaSkill
- design-search-index-infraSkill
- design-state-machineSkill
- design-token-systemSkill
- diff-table-paritySkill
- distributed-locks-leasesSkill
- dockerfile-optimizeSkill
- encrypt-sensitive-dataSkill
- error-messageSkill
- estimate-workSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Use this skill when the task touches a pipeline definition file or its performance/security:
- Distinctive: line 28
Never cache build artifacts that change every commit — that just thrashes the cache.
- Very specific: line 36
Replace static cloud secrets with OIDC: Stop storing long-lived AWS_*/GCP_*/AZURE_* keys.
- Distinctive: line 39
Use the provider's official auth action to exchange the OIDC token for temporary credentials.
- Very specific: line 62
Dry run where supported: run the workflow locally (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
When to Use
Use this skill when the task touches a pipeline definition file or its performance/security:
- Authoring or editing
.github/workflows/*.yml,.gitlab-ci.yml,Jenkinsfile, or.circleci/config.yml. - CI is slow or expensive — reduce wall-clock time and runner minutes.
- Hardening a build: removing long-lived secrets, pinning third-party actions, scoping token permissions.
- Migrating cloud auth from static keys to OIDC (federated identity).
- Splitting a monolithic pipeline into reusable workflows/templates.
Skip if the change is a one-line tweak whose diff you can state in a sentence (bump a runner image tag, fix a typo in a step name) — just make it.
Steps
- Detect platform and read the existing pipeline first. Match the file:
.github/workflows/*→ Actions,.gitlab-ci.yml→ GitLab,Jenkinsfile→ Jenkins,.circleci/config.yml→ CircleCI. Never rewrite blind — read the current file, note language/build tool, where secrets are consumed, and which steps dominate runtime. - Lay out stages as a DAG, not a straight line. Target order:
lint+typecheck→build→test→security-scan→deploy(gated). Run independent stages in parallel; only serialize on real data dependencies. In Actions useneeds:; in GitLabstage:+needs:for out-of-order DAG; in CircleCIrequires:under workflows. - Cache the dependency layer, key it on the lockfile. Cache key = hash of the lockfile, with a restore-key fallback for partial hits. Cache the package dir, not
node_modules-style install output that must stay in sync with the runner.- Actions:
actions/cachewithkey: deps-${{ runner.os }}-${{ hashFiles('**/lock*') }}andrestore-keys: deps-${{ runner.os }}-. For common ecosystems prefer the built-in cache (e.g.setup-*withcache:input) which keys the lockfile for you. - GitLab:
cache: { key: { files: [lockfile] }, paths: [...], policy: pull-push }; setpolicy: pullon jobs that only read. - Never cache build artifacts that change every commit — that just thrashes the cache. Pass those between stages as artifacts instead.
- Actions:
- Add a matrix only where it earns parallelism. Fan out across versions/OS that you actually support. Set
fail-fast: falsewhen you need the full failure map (e.g. compatibility testing); leave ittrue(default) to abort early and save minutes on normal PR runs. Shard a large test suite across N parallel jobs and merge results. - Pin third-party actions/images by full commit SHA, not a tag. Tags (
@v4) are mutable and a supply-chain hole. Pinuses: owner/action@<40-char-sha> # v4.1.2and keep the version in a trailing comment so a bot can bump it. Pin container/runner images by digest where the platform allows. First-partyactions/*may use a major tag if your policy permits, but SHA is the safe default. - Scope token permissions to least privilege. In Actions, set top-level
permissions: { contents: read }(default-deny everything else) and widen per-job only for what that job needs (e.g.id-token: writefor OIDC,packages: writeto publish). In GitLab, prefer job tokens with limited scope over project access tokens. Never give a test job write access. - Replace static cloud secrets with OIDC. Stop storing long-lived
AWS_*/GCP_*/AZURE_*keys. Have the pipeline mint a short-lived token via the provider's federated identity:- Job needs
permissions: id-token: write(Actions) or the platform's OIDC equivalent. - Configure a trust policy on the cloud side scoped to this repo + this branch/environment + this workflow (don't trust
repo:*). - Use the provider's official auth action to exchange the OIDC token for temporary credentials. Remove the old secrets after the OIDC path is verified — not before.
- Job needs
- Factor shared logic into reusable workflows/templates. Actions: reusable workflow called via
uses: ./.github/workflows/x.ymlor a composite action. GitLab:include:+extends:+!reference. CircleCI: orbs/commands. Jenkins: shared library. One source of truth beats copy-pasted YAML across services. - Make failures fast and required. Put cheap checks (lint, typecheck) before expensive ones so a bad PR fails in seconds. Add
timeout-minutesto every job so a hung step can't burn an hour. Wire the gating jobs into branch protection / required status checks so deploy literally cannot run on a red build. Gate deploy on a protected environment with manual approval for prod. - Validate locally and report the diff. Lint the file, dry-run if possible (see Verify), then report before/after wall-clock and estimated runner-minutes, plus the security delta (secrets removed, permissions narrowed, actions pinned). A pipeline change without a measured result is unfinished.
Common Errors
permissionsblock at top level silently kills the whole-workflow grant. The moment you add anypermissions:key, every unlisted scope becomesnone. A push/comment step that worked before will now 403. Add back exactly what each job needs at job level.- Cache restored but the install step still runs full. Usually the cache path is wrong, or the key changes every run (you hashed a file that mutates). Verify with the cache-hit output, and cache the package manager's store dir, not the project-local install dir.
- OIDC
Error: Not authorized to perform sts:AssumeRoleWithWebIdentity/ audience mismatch. The cloud-side trust condition doesn't match the token'ssub/aud. Check the exact subject string format (it differs for branch vs tag vs environment vs pull_request) and that the audience matches what the auth step requests. - Pinned SHA points at a tag that was force-moved → action runs different code than reviewed. Always re-verify the SHA belongs to the version in your comment; don't copy a SHA from an untrusted PR.
fail-fastcancels sibling matrix jobs and you lose the failure you needed. For compatibility/flake debugging setfail-fast: false; for normal PRs keep it on to save minutes — they're opposite goals, pick deliberately.- Secrets passed into a reusable workflow vanish. Reusable workflows don't inherit secrets implicitly — pass them with
secrets: inheritor map each one explicitly. pull_requestfrom a fork can't read secrets / OIDC. That's by design (untrusted code). Don't "fix" it by switching topull_request_targetwith checkout of the PR head — that's a known privilege-escalation footgun. Run untrusted PR builds without secrets.- No
timeout-minutes→ a hung network call burns the full default timeout (often 6h) of paid minutes. Set an explicit per-job timeout always. - Caching across untrusted PRs can poison the cache. Scope/segregate caches so a fork PR can't write a cache a trusted branch later reads.
Verify
- Syntax/lint: Actions →
actionlint(catches expression and context errors a YAML linter misses). GitLab → CI Lint API/UI. CircleCI →circleci config validate. Jenkins →jenkins-cli declarative-linter. Any platform → a plain YAML linter as a floor. - Dry run where supported: run the workflow locally (e.g.
actfor Actions) for fast iterate-on-failure before pushing; if the job has external/cloud deps that can't run locally, push to a throwaway branch and read the live run. - Security checklist passes: no
secrets.*for cloud creds remaining (OIDC instead); top-levelpermissionsis read-only with per-job widening; every third-party action pinned to a full SHA; every job hastimeout-minutes; deploy gated by required checks + protected environment. - Performance proven: capture wall-clock and runner-minutes before vs after on a real run; confirm the cache reports a hit on the second run and parallel jobs actually overlap. Report the numbers — "should be faster" is not verification.
- Branch protection enforced: confirm the gating jobs are listed as required status checks so a red build blocks merge/deploy.
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
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.

