AGENT SKILL

ci-cd-and-automation

Use when setting up CI/CD pipelines, GitHub Actions workflows, automated testing in CI, or deployment automation — covers pipeline design, caching, secrets management, and release workflows

License 许可
MIT
最近更新
2026-08-20
Stars
★ 0
Forks
0

01 前言 Front Matter

name
ci-cd-and-automation
tags
[ "devops", "workflow" ]
tools
[]
version
1.0.0
agent_types
[ "planner", "worker", "reviewer" ]
description
Use when setting up CI/CD pipelines, GitHub Actions workflows, automated testing in CI, or deployment automation — covers pipeline design, caching, secrets management, and release workflows
dependencies
[]

03 SKILL.md 正文

CI/CD & Automation

Iron Laws

<EXTREMELY-IMPORTANT>

  • Honor the project's merge gate. When the project uses pull requests and required checks, those checks must pass before merge; do not invent a PR workflow for projects that do not use one.
  • Protect the project's release branch. If the project promises a deployable main/default branch, fix or revert breakage; document a different branch or release contract instead of assuming one.
  • Cache dependencies, not source. Key on lockfile. 90% of CI is install.
  • Secrets via platform store. Never in workflow YAML. Never in logs.
  • Fast feedback. 5-min CI > 30-min CI. </EXTREMELY-IMPORTANT>

When to Use

Setting up CI for a new project; adding a job (lint, typecheck, test, security, build, deploy); caching slow steps; secrets in CI; release workflow (semver, changelog, npm publish); matrix builds; deploy previews.

When NOT to Use

Manual deploys that the project intentionally keeps outside CI; one-off scripts (use Make or a focused script); long-running batch jobs (use a queue, not CI); a workflow that runs > 30 min (split it).

Pipeline Anatomy

[Trigger] → [Setup + Cache] → [declared checks: lint/typecheck/test/build] → [optional deploy]

Set budgets from the project's baseline; split jobs when measured setup or feedback time warrants it.

Caching

- uses: actions/cache@v3
  with:
    path: |
      ~/.npm
      node_modules
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-node-

Key on the lockfile hash, restore-key as fallback. Cache the install dir, not the source.

Secrets

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

secrets.* in env. Never echo the secret. Never set -x with secrets. Use ::add-mask:: if a secret might leak.

Matrix Builds

strategy:
  matrix:
    node: [18, 20, 22]
    os: [ubuntu-latest, macos-latest]

Don't test dead versions. Update when the floor moves.

Deploy Strategies

Strategy When
Rolling Default for most services
Blue/green Zero-downtime, canary-able
Canary Small % of traffic, ramp
Recreate Acceptable downtime, stateless

Release Workflow

PR merge → [CI: tests + build] → [Release: bump version] → [Publish] → [Deploy]

Use release-please or similar. Manual bumps = drift = bugs.

Common Mistakes

CI only on main (bugs caught late); no cache; secrets in logs; one giant job; "skip ci" bypass; deploy on every PR (preview instead); no artifact upload; matrix with dead versions; manual release; flaky tests not quarantined; no notifications.

Red Flags

CI only on main; no cache (5+ min install); secrets visible in logs; single big job; "skip ci" used; deploy on PR; no notifications; flaky tests pass/fail randomly; matrix with 3-year-old versions; "the CI is broken, just push to main".

Anti-Patterns

CI on main only; no cache; secrets in logs; one big job; deploy on PR; manual release; "skip ci"; no notifications.

04 同仓库更多 Skills

MinhDuyDEV
MinhDuyDEV/md-pikit

writing-skills

Use when creating new skills, editing existing skills, or verifying skills work before deployment - applies TDD to process documentation by testing with subagents before writing, iterating until bulletproof against rationalization. Includes complete pressure testing methodology.

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

verification-before-completion

Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

typescript-coding-standards

Use when writing, refactoring, or reviewing TypeScript code that needs strong domain modeling, typed errors, schema parsing, safe adapters, test seams, or maintainable module boundaries.

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

test-driven-development

Use when implementing a feature, bugfix, or behavior-changing refactor — require a failing behavior test before production code, then make the smallest change that passes.

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

source-driven-development

Use when unfamiliar libraries, dependency internals, external APIs, framework behavior, migrations, or current ecosystem guidance require official documentation, version-matched source, read the tests, and cited evidence.

★ 0
MinhDuyDEV
MinhDuyDEV/md-pikit

security-and-hardening

Use when auditing security, implementing authentication or authorization, handling secrets, or validating data across external trust boundaries.

★ 0