with one click
ci-cd-assistant
[UDS] 引導 CI/CD 管線設計、配置和優化
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
[UDS] 引導 CI/CD 管線設計、配置和優化
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
| name | ci-cd-assistant |
| source | ../../../../skills/ci-cd-assistant/SKILL.md |
| source_version | 1.0.0 |
| translation_version | 1.0.0 |
| last_synced | "2026-03-24T00:00:00.000Z" |
| status | current |
| description | [UDS] 引導 CI/CD 管線設計、配置和優化 |
語言: English | 繁體中文
引導 CI/CD 管線設計,遵循業界最佳實踐與 DORA 指標。
BUILD ──► TEST ──► ANALYZE ──► DEPLOY ──► VERIFY
建置 測試 分析 部署 驗證
| 階段 | 用途 | 關鍵活動 |
|---|---|---|
| Build | 編譯與打包 | 安裝相依、編譯、產出成品 |
| Test | 品質驗證 | 單元、整合、端對端測試 |
| Analyze | 程式碼品質 | 程式碼檢查、安全掃描、覆蓋率 |
| Deploy | 發布到環境 | 預備環境 → 正式環境部署 |
| Verify | 部署後驗證 | 冒煙測試、健康檢查、監控 |
| 指標 | 菁英 | 高 | 中 | 低 |
|---|---|---|---|---|
| 部署頻率 | 隨需(每日多次) | 每週至每月 | 每月至半年 | > 6 個月 |
| 變更前置時間 | < 1 小時 | 1 天至 1 週 | 1 至 6 個月 | > 6 個月 |
| MTTR | < 1 小時 | < 1 天 | 1 天至 1 週 | > 6 個月 |
| 變更失敗率 | 0–15% | 16–30% | 16–30% | > 30% |
node_modules、.m2、pip cache| 平台 | 快取 | 平行化 | 密鑰 | 備註 |
|---|---|---|---|---|
| GitHub Actions | actions/cache | matrix 策略 | secrets.* | 使用 reusable workflows |
| GitLab CI | cache: 關鍵字 | parallel: 關鍵字 | CI/CD Variables | 使用 include: 模組化 |
| Jenkins | Stash/unstash | parallel {} 區塊 | Credentials plugin | 使用 shared libraries |
反覆出現的 CI 作業編排模式(UDS #126)。每條原則平台無關;對照欄顯示各平台的寫法。
將重型慢速套件(完整 E2E)以觸發條件與每次變更的輕量檢查分離,使 runner 成本隨風險而非每次 push 成長。
| 需求 | GitHub Actions | GitLab CI | Jenkins |
|---|---|---|---|
| 重型套件排程觸發 | on: schedule: | rules: if $CI_PIPELINE_SOURCE == "schedule" | cron 觸發 |
| 輕量檢查每次變更 | on: pull_request | rules: if $CI_PIPELINE_SOURCE == "merge_request_event" | SCM webhook |
⚠️ 反模式:每次 push 跑完整 E2E。
當多個作業觸及同一個有狀態共享資源(單一測試環境 / runner / 部署目標)時,序列化以防並發污染。
| 需求 | GitHub Actions | GitLab CI | Jenkins |
|---|---|---|---|
| 互斥 | concurrency: { group: … } | resource_group: | lock(resource: …) |
⚠️ 反模式:兩作業並行寫同一 DB/環境。
當某範圍的 HEAD 自上次成功未變(或變更只觸及範圍外路徑)時,跳過 deploy/test 以節省 runner。明確定義「未變」(上次成功 SHA 或路徑過濾)。
| 需求 | GitHub Actions | GitLab CI | Jenkins |
|---|---|---|---|
| 範圍未變則跳過 | paths: / dorny/paths-filter | rules: changes: / SHA 比對 | changeset 條件 |
⚠️ 反模式:文件-only commit 跑完整部署。
明確宣告每個作業是 advisory(回報但不擋合併)或 gating(擋合併)。混淆會在雜訊上卡關、或漏掉該擋的。(安全閘門是 Block/Warn/Log 特例——見 pipeline-security-gates。)
| 需求 | GitHub Actions | GitLab CI | Jenkins |
|---|---|---|---|
| Advisory(不擋) | continue-on-error: true | allow_failure: true | catchError → unstable |
| Gating(擋合併) | required status check | 預設(無 allow_failure) | hard fail |
⚠️ 反模式:把雜訊 lint 設硬閘,或把關鍵套件設 advisory。
npm ci EUSAGEnpm ci 需要 committed lockfile。若 package-lock.json 被 gitignore,CI 會以 EUSAGE 失敗。修法:commit lockfile,或 CI-only 安裝用 npm install --no-audit --no-fund --ignore-scripts(跳過 CI 不需要的 prepare/husky hook)。
/ci-cd - 顯示完整管線指引/ci-cd github-actions - GitHub Actions 專屬提示/ci-cd --optimize - 管線優化建議/ci-cd build - 建置階段最佳實踐/ci-cd 完成後,AI 助手應建議:
管線指引已提供。建議下一步:
- 執行
/deploy設定部署策略- 執行
/security檢查管線安全- 執行
/testing設計測試策略- 執行
/commit建立規範化提交
Guide CI/CD pipeline design, configuration, and optimization. Use when: setting up pipelines, optimizing build times, configuring deployment stages. Keywords: CI/CD, pipeline, GitHub Actions, deployment, build.
在编写规格前进行结构化 AI 辅助头脑风暴。 使用时机:功能规划、创意发想、问题定义。 关键字:brainstorm, persona, multi-critic, HMW, SCAMPER, 头脑风暴, 发想。
[UDS] 在撰寫規格前進行結構化 AI 輔助腦力激盪
[UDS] Structured AI-assisted brainstorming before spec creation
[UDS] 从规格衍生 BDD 场景、TDD 骨架或 ATDD 表格
[UDS] 引導驗收測試驅動開發(ATDD)流程,用於定義和驗證使用者故事