File contents CI/CD and Automation
Fast, reliable pipelines that catch defects early — not in production.
When to Use
Designing a new CI/CD pipeline from scratch
Adding quality gates to an existing pipeline
Diagnosing slow or flaky pipelines
Implementing Shift Left testing strategy
Automating deployment workflows (staging, production promotion)
Core Principle: Shift Left
Move quality checks as early as possible — catch defects when they are cheapest to fix.
Stage
Cost to Fix Defect
Developer's machine (pre-commit)
Lowest
CI pipeline (PR)
Low
Staging environment
Medium
Production
Highest
Rule : Every quality check that can run in CI should run in CI — not just in staging or production.
Pipeline Design
Recommended Stage Order
1. Fast Feedback (< 3 min)
└── Lint + format check
└── Unit tests (L1)
└── Type check / build
2. Integration Gates (< 10 min)
└── Integration tests (L2)
└── Security scan (SAST)
└── Dependency vulnerability check
3. Deployment Gate
└── Staging deploy
└── Smoke tests against staging
└── Performance baseline check (if applicable)
4. Promotion (manual approval or auto, based on risk)
└── Production deploy
└── Post-deploy health check
Quality Gate Rules
Each stage is a hard gate — pipeline fails and stops if any check fails:
Gate
Fail Condition
Action
Lint
Any lint error
Block merge
Unit tests
Any test failure
Block merge
Coverage
Coverage drops below threshold
Block merge
Security scan
Critical/High vulnerability found
Block merge
Staging smoke
Smoke test failure
Block production promotion
Performance Targets
Metric
Target
Alert Threshold
Total pipeline duration
< 15 min
> 20 min → investigate
Unit test suite
< 3 min
> 5 min → parallelize
Flaky test rate
< 1%
> 3% → quarantine + fix
Shift Left Implementation Checklist
Anti-Patterns
Anti-Pattern
Consequence
Fix
Tests only run on main branch
Defects merge undetected
Run on every PR
Security scan is nightly only
Vulnerabilities ship to production first
Add to PR pipeline
Flaky tests retried silently
False confidence; real failures missed
Quarantine + fix
Pipeline > 20 min
Engineers skip CI locally; defeats Shift Left
Parallelize; split stages
Manual deployment with no automation
Human error; inconsistent environments
Automate all environment promotions
Common Rationalizations
在設計和維護 CI/CD 管道時,AI 可能以下列藉口降低品質閘門標準:
常見藉口
反制說明
"CI 太慢,先跳過這次"
⛔ 跳過 CI 是技術債的加速器——每一次「只跳過這次」都讓下一次跳過更容易;正確做法是修復慢 CI,不是繞過它
"這個測試只是 flaky,重跑一次就好"
Flaky 測試不是無害雜訊——它們掩蓋真實的競態條件和環境問題;必須隔離並修復,不得無限重跑
"安全掃描在 nightly 跑就夠了,PR 上不用"
漏洞在合併後才被發現,修復成本是合併前的 10 倍——安全掃描必須在 PR 上執行,nightly 是補充不是替代
"staging 測試通過了,不用再跑 smoke test"
Staging 環境與 production 永遠存在差異——production smoke test 是確認部署本身正確,不是確認功能正確
Verification
在 CI/CD 配置完成或修改後,逐項確認:
Source: forgivesam168/ai-dev-workflow — distributed by TomeVault .
1 --- 2 name: forgivesam168-ai-dev-workflow-ci-cd-and-automation 3 description: CI/CD and Automation 4 --- 5 6 # CI/CD and Automation 7 8 Fast, reliable pipelines that catch defects early — not in production. 9 10 ## When to Use 11 12 - Designing a new CI/CD pipeline from scratch 13 - Adding quality gates to an existing pipeline 14 - Diagnosing slow or flaky pipelines 15 - Implementing Shift Left testing strategy 16 - Automating deployment workflows (staging, production promotion) 17 18 --- 19 20 ## Core Principle: Shift Left 21 22 > Move quality checks as early as possible — catch defects when they are cheapest to fix. 23 24 | Stage | Cost to Fix Defect | 25 |-------|--------------------| 26 | Developer's machine (pre-commit) | Lowest | 27 | CI pipeline (PR) | Low | 28 | Staging environment | Medium | 29 | Production | Highest | 30 31 **Rule**: Every quality check that can run in CI should run in CI — not just in staging or production. 32 33 --- 34 35 ## Pipeline Design 36 37 ### Recommended Stage Order 38 39 ``` 40 1. Fast Feedback (< 3 min) 41 └── Lint + format check 42 └── Unit tests (L1) 43 └── Type check / build 44 45 2. Integration Gates (< 10 min) 46 └── Integration tests (L2) 47 └── Security scan (SAST) 48 └── Dependency vulnerability check 49 50 3. Deployment Gate 51 └── Staging deploy 52 └── Smoke tests against staging 53 └── Performance baseline check (if applicable) 54 55 4. Promotion (manual approval or auto, based on risk) 56 └── Production deploy 57 └── Post-deploy health check 58 ``` 59 60 ### Quality Gate Rules 61 62 Each stage is a **hard gate** — pipeline fails and stops if any check fails: 63 64 | Gate | Fail Condition | Action | 65 |------|---------------|--------| 66 | Lint | Any lint error | Block merge | 67 | Unit tests | Any test failure | Block merge | 68 | Coverage | Coverage drops below threshold | Block merge | 69 | Security scan | Critical/High vulnerability found | Block merge | 70 | Staging smoke | Smoke test failure | Block production promotion | 71 72 ### Performance Targets 73 74 | Metric | Target | Alert Threshold | 75 |--------|--------|-----------------| 76 | Total pipeline duration | < 15 min | > 20 min → investigate | 77 | Unit test suite | < 3 min | > 5 min → parallelize | 78 | Flaky test rate | < 1% | > 3% → quarantine + fix | 79 80 --- 81 82 ## Shift Left Implementation Checklist 83 84 - [ ] Pre-commit hooks: lint, format, secret detection (`git-secrets`, `gitleaks`) 85 - [ ] PR pipeline: unit tests, type check, build — must complete in < 3 min 86 - [ ] Security scanning integrated in PR pipeline (not just nightly) 87 - [ ] Dependency scanning on every PR (`Dependabot`, `Snyk`, `pip-audit`) 88 - [ ] Coverage gate enforced in CI (not just reported) 89 - [ ] Flaky tests identified and quarantined (not silently retried) 90 91 --- 92 93 ## Anti-Patterns 94 95 | Anti-Pattern | Consequence | Fix | 96 |-------------|------------|-----| 97 | Tests only run on main branch | Defects merge undetected | Run on every PR | 98 | Security scan is nightly only | Vulnerabilities ship to production first | Add to PR pipeline | 99 | Flaky tests retried silently | False confidence; real failures missed | Quarantine + fix | 100 | Pipeline > 20 min | Engineers skip CI locally; defeats Shift Left | Parallelize; split stages | 101 | Manual deployment with no automation | Human error; inconsistent environments | Automate all environment promotions | 102 103 --- 104 105 ## Common Rationalizations 106 107 在設計和維護 CI/CD 管道時,AI 可能以下列藉口降低品質閘門標準: 108 109 | 常見藉口 | 反制說明 | 110 |---------|---------| 111 | "CI 太慢,先跳過這次" | ⛔ 跳過 CI 是技術債的加速器——每一次「只跳過這次」都讓下一次跳過更容易;正確做法是修復慢 CI,不是繞過它 | 112 | "這個測試只是 flaky,重跑一次就好" | Flaky 測試不是無害雜訊——它們掩蓋真實的競態條件和環境問題;必須隔離並修復,不得無限重跑 | 113 | "安全掃描在 nightly 跑就夠了,PR 上不用" | 漏洞在合併後才被發現,修復成本是合併前的 10 倍——安全掃描必須在 PR 上執行,nightly 是補充不是替代 | 114 | "staging 測試通過了,不用再跑 smoke test" | Staging 環境與 production 永遠存在差異——production smoke test 是確認部署本身正確,不是確認功能正確 | 115 116 --- 117 118 ## Verification 119 120 在 CI/CD 配置完成或修改後,逐項確認: 121 122 - [ ] `Test-Path .github/workflows/*.yml` 或 `Test-Path .gitlab-ci.yml` 至少一項回傳 True(pipeline 配置檔存在) 123 - [ ] 每個 PR 觸發 unit test + lint + build(不只是 push to main) 124 - [ ] Coverage gate 已設定且閾值 ≥80%(或符合專案標準) 125 - [ ] Security / dependency scan 已整合於 PR pipeline(非僅 nightly) 126 - [ ] 所有 stage 均為 hard gate(失敗即停止,不得 `continue-on-error: true`) 127 - [ ] Pipeline 總時長 < 15 分鐘(`Fast Feedback` stage < 3 分鐘) 128 - [ ] Flaky 測試隔離機制存在(quarantine tag 或分離 job) 129 130 --- 131 > Source: [forgivesam168/ai-dev-workflow](https://github.com/forgivesam168/ai-dev-workflow) — distributed by [TomeVault](https://tomevault.io). 132 <!-- tomevault:4.0:skill_md:2026-05-22 -->
tomevault-io/skills-registry/tree/main/forgivesam168--ai-dev-workflow--ci-cd-and-automation commit 739a68929a
Frequently asked questions How do I install the Forgivesam168 AI Dev Workflow CI CD And Automation skill? Run npx skillmds@latest add tomevault-io/forgivesam168-ai-dev-workflow-ci-cd-and-automation in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Forgivesam168 AI Dev Workflow CI CD And Automation skill do? CI/CD and Automation It is listed under DevOps & Infra on SkillMD.
Is Forgivesam168 AI Dev Workflow CI CD And Automation safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Forgivesam168 AI Dev Workflow CI CD And Automation? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Forgivesam168 AI Dev Workflow CI CD And Automation free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Forgivesam168 AI Dev Workflow CI CD And Automation? tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.