Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计提醒

ci-cd光盘

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

4,516

周安装

194

GitHub Stars

137

下载量

1,583
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ci-cd(光盘)
来源仓库:https://github.com/ahmedasmar/devops-claude-skills
仓库路径:skills/ci-cd
安装命令:
npx skills add https://github.com/ahmedasmar/devops-claude-skills --skill ci-cd
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/ahmedasmar/devops-claude-skills --skill ci-cd

简介

提供跨平台的 CI/CD 流水线设计和优化指南,支持 GitHub Actions 和 GitLab CI。

  • 按技术栈(Node.js、Python、Go、Docker)提供标准化模板和部署流程。
  • 涵盖安全扫描、依赖检查、构建缓存和自动化测试集成方案。
  • 适用于新建项目初始化或现有流水线重构时的参考依据。
  • ci-cd 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

CI/CD Pipelines

Comprehensive guide for CI/CD pipeline design, optimization, security, and troubleshooting across GitHub Actions, GitLab CI, and other platforms.

Core Workflows

1. Creating a New Pipeline

Decision tree:

What are you building?
├── Node.js/Frontend → GitHub: templates/github-actions/node-ci.yml | GitLab: templates/gitlab-ci/node-ci.yml
├── Python → GitHub: templates/github-actions/python-ci.yml | GitLab: templates/gitlab-ci/python-ci.yml
├── Go → GitHub: templates/github-actions/go-ci.yml | GitLab: templates/gitlab-ci/go-ci.yml
├── Docker Image → GitHub: templates/github-actions/docker-build.yml | GitLab: templates/gitlab-ci/docker-build.yml
├── Other → Follow the pipeline design pattern below

Basic pipeline structure:

# 1. Fast feedback (lint, format) - <1 min
# 2. Unit tests - 1-5 min
# 3. Integration tests - 5-15 min
# 4. Build artifacts
# 5. E2E tests (optional, main branch only) - 15-30 min
# 6. Deploy (with approval gates)

Key principles (from references/best_practices.md):

  • Fail fast: Run cheap validation first
  • Parallelize: Remove unnecessary job dependencies
  • Cache dependencies: Use actions/cache or GitLab cache (references/optimization.md for strategies)
  • Use artifacts: Build once, deploy many times
  • Add security scanning early: See references/devsecops.md for SAST/DAST/SCA integration

2. Optimizing Pipeline Performance

Quick wins checklist:

  • Add dependency caching (50-90% faster builds)
  • Remove unnecessary needs dependencies
  • Add path filters to skip unnecessary runs
  • Use npm ci instead of npm install
  • Add job timeouts to prevent hung builds
  • Enable concurrency cancellation for duplicate runs

Analyze existing pipeline:

# Use the pipeline analyzer script
python3 scripts/pipeline_analyzer.py --platform github --workflow .github/workflows/ci.yml

Common optimizations (detailed in references/optimization.md):

  • Slow tests: Shard tests with matrix builds
  • Repeated dependency installs: Add caching
  • Sequential jobs: Parallelize with proper needs
  • Full test suite on every PR: Use path filters or test impact analysis

See optimization.md for detailed caching strategies, parallelization techniques, and performance tuning.

3. Securing Your Pipeline

Essential security checklist:

  • Use OIDC instead of static credentials
  • Pin actions/includes to commit SHAs
  • Use minimal permissions
  • Enable secret scanning
  • Add vulnerability scanning (dependencies, containers)
  • Implement branch protection
  • Separate test from deploy workflows

Quick setup - OIDC authentication:

GitHub Actions → AWS:

permissions:
  id-token: write
  contents: read

steps:
  - uses: aws-actions/configure-aws-credentials@v4
    with:
      role-to-assume: arn:aws:iam::123456789:role/GitHubActionsRole
      aws-region: us-east-1

Secrets management:

  • Store in platform secret stores (GitHub Secrets, GitLab CI/CD Variables)
  • Mark as "masked" in GitLab
  • Use environment-specific secrets
  • Rotate regularly (every 90 days)
  • Never log secrets

See security.md for comprehensive security patterns, supply chain security, and secrets management.

4. Troubleshooting Pipeline Failures

Systematic approach:

Step 1: Check pipeline health

gh run list --limit 20    # Recent runs with status (success/failure rates)
gh run view <run-id>      # Detailed run info and failure logs
gh workflow list           # All configured workflows

Step 2: Identify the failure type

Error PatternCommon CauseQuick Fix
"Module not found"Missing dependency or cache issueClear cache, run npm ci
"Timeout"Job taking too longAdd caching, increase timeout
"Permission denied"Missing permissionsAdd to permissions: block
"Cannot connect to Docker daemon"Docker not availableUse correct runner or DinD
Intermittent failuresFlaky tests or race conditionsAdd retries, fix timing issues

Step 3: Enable debug logging

GitHub Actions:

# Add repository secrets:
# ACTIONS_RUNNER_DEBUG = true
# ACTIONS_STEP_DEBUG = true

GitLab CI:

variables:
  CI_DEBUG_TRACE: "true"

Step 4: Reproduce locally

# GitHub Actions - use act
act -j build

# Or Docker
docker run -it ubuntu:latest bash
# Then manually run the failing steps

See troubleshooting.md for comprehensive issue diagnosis, platform-specific problems, and solutions.

5. Implementing Deployment Workflows

Deployment pattern selection:

PatternUse CaseComplexityRisk
DirectSimple apps, low trafficLowMedium
Blue-GreenZero downtime requiredMediumLow
CanaryGradual rollout, monitoringHighVery Low
RollingKubernetes, containersMediumLow

Basic deployment structure:

deploy:
  needs: [build, test]
  if: github.ref == 'refs/heads/main'
  environment:
    name: production
    url: https://example.com
  steps:
    - name: Download artifacts
    - name: Deploy
    - name: Health check
    - name: Rollback on failure

Multi-environment setup:

  • Development: Auto-deploy on develop branch
  • Staging: Auto-deploy on main, requires passing tests
  • Production: Manual approval required, smoke tests mandatory

See best_practices.md for detailed deployment patterns and environment management.

6. Implementing DevSecOps Security Scanning

Security scanning types:

Scan TypePurposeWhen to RunSpeedTools
Secret ScanningFind exposed credentialsEvery commitFast (<1 min)TruffleHog, Gitleaks
SASTFind code vulnerabilitiesEvery commitMedium (5-15 min)CodeQL, Semgrep, Bandit, Gosec
SCAFind dependency vulnerabilitiesEvery commitFast (1-5 min)npm audit, pip-audit, Snyk
Container ScanningFind image vulnerabilitiesAfter buildMedium (5-10 min)Trivy, Grype
DASTFind runtime vulnerabilitiesScheduled/main onlySlow (15-60 min)OWASP ZAP

Quick setup - Add security to existing pipeline:

GitHub Actions:

jobs:
  # Add before build job
  secret-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: trufflesecurity/trufflehog@main
      - uses: gitleaks/gitleaks-action@v2

  sast:
    runs-on: ubuntu-latest
    permissions:
      security-events: write
    steps:
      - uses: actions/checkout@v4
      - uses: github/codeql-action/init@v3
        with:
          languages: javascript  # or python, go
      - uses: github/codeql-action/analyze@v3

  build:
    needs: [secret-scan, sast]  # Add dependencies

GitLab CI:

stages:
  - security  # Add before other stages
  - build
  - test

# Secret scanning
secret-scan:
  stage: security
  image: trufflesecurity/trufflehog:latest
  script:
    - trufflehog filesystem . --json --fail

# SAST
sast:semgrep:
  stage: security
  image: returntocorp/semgrep
  script:
    - semgrep scan --config=auto .

# Use GitLab templates
include:
  - template: Security/SAST.gitlab-ci.yml
  - template: Security/Dependency-Scanning.gitlab-ci.yml

Comprehensive security pipeline templates:

  • GitHub Actions: templates/github-actions/security-scan.yml - Complete DevSecOps pipeline with all scanning stages
  • GitLab CI: templates/gitlab-ci/security-scan.yml - Complete DevSecOps pipeline with GitLab security templates

Security gate pattern:

Add a security gate job that evaluates all security scan results and fails the pipeline if critical issues are found:

security-gate:
  needs: [secret-scan, sast, sca, container-scan]
  script:
    # Check for critical vulnerabilities
    # Parse JSON reports and evaluate thresholds
    # Fail if critical issues found

Language-specific security tools:

  • Node.js: CodeQL, Semgrep, npm audit, eslint-plugin-security
  • Python: CodeQL, Semgrep, Bandit, pip-audit, Safety
  • Go: CodeQL, Semgrep, Gosec, govulncheck

All language-specific templates now include security scanning stages. See:

  • templates/github-actions/node-ci.yml
  • templates/github-actions/python-ci.yml
  • templates/github-actions/go-ci.yml
  • templates/gitlab-ci/node-ci.yml
  • templates/gitlab-ci/python-ci.yml
  • templates/gitlab-ci/go-ci.yml

See devsecops.md for comprehensive DevSecOps guide covering all security scanning types, tool comparisons, and implementation patterns.

Quick Reference Commands

GitHub Actions

# List workflows
gh workflow list

# View recent runs
gh run list --limit 20

# View specific run
gh run view <run-id>

# Re-run failed jobs
gh run rerun <run-id> --failed

# Download logs
gh run view <run-id> --log > logs.txt

# Trigger workflow manually
gh workflow run ci.yml

# Check workflow status
gh run watch

GitLab CI

# View pipelines
gl project-pipelines list

# Pipeline status
gl project-pipeline get <pipeline-id>

# Retry failed jobs
gl project-pipeline retry <pipeline-id>

# Cancel pipeline
gl project-pipeline cancel <pipeline-id>

# Download artifacts
gl project-job artifacts <job-id>

Platform-Specific Patterns

GitHub Actions

Reusable workflows:

# .github/workflows/reusable-test.yml
on:
  workflow_call:
    inputs:
      node-version:
        required: true
        type: string

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ inputs.node-version }}

Call from another workflow:

jobs:
  test:
    uses: ./.github/workflows/reusable-test.yml
    with:
      node-version: '20'

GitLab CI

Templates with extends:

.test_template:
  image: node:20
  before_script:
    - npm ci

unit-test:
  extends: .test_template
  script:
    - npm run test:unit

integration-test:
  extends: .test_template
  script:
    - npm run test:integration

DAG pipelines with needs:

build:
  stage: build

test:unit:
  stage: test
  needs: [build]

test:integration:
  stage: test
  needs: [build]

deploy:
  stage: deploy
  needs: [test:unit, test:integration]

Diagnostic Scripts

ScriptPurposeUsage
pipeline_analyzer.pyFind optimization opportunities (caching, parallelization, outdated actions)python3 scripts/pipeline_analyzer.py --platform github --workflow <path>

For pipeline health checks (success/failure rates, failure patterns), use gh CLI: gh run list --limit 20, gh run view <run-id>, gh workflow list.

Reference Documentation

  • references/best_practices.md — Pipeline design, testing, deployment patterns, artifact handling
  • references/security.md — Secrets management, OIDC, supply chain security, secure pipeline patterns
  • references/devsecops.md — SAST/DAST/SCA tooling (CodeQL, Semgrep, Trivy, Snyk), security gates
  • references/optimization.md — Caching strategies, parallelization, test splitting, build optimization
  • references/troubleshooting.md — Common issues, Docker problems, authentication, platform debugging

Templates

Starter templates in assets/templates/ for both GitHub Actions and GitLab CI:

Language/TypeGitHub ActionsGitLab CI
Node.jsgithub-actions/node-ci.ymlgitlab-ci/node-ci.yml
Pythongithub-actions/python-ci.ymlgitlab-ci/python-ci.yml
Gogithub-actions/go-ci.ymlgitlab-ci/go-ci.yml
Dockergithub-actions/docker-build.ymlgitlab-ci/docker-build.yml
Securitygithub-actions/security-scan.ymlgitlab-ci/security-scan.yml

All templates include security scanning, caching, and multi-environment deployment.

Common Patterns

Caching Dependencies

GitHub Actions:

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

GitLab CI:

cache:
  key:
    files:
      - package-lock.json
  paths:
    - node_modules/

Matrix Builds

GitHub Actions:

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

GitLab CI:

test:
  parallel:
    matrix:
      - NODE_VERSION: ['18', '20', '22']

Conditional Execution

GitHub Actions:

- name: Deploy
  if: github.ref == 'refs/heads/main' && github.event_name == 'push'

GitLab CI:

deploy:
  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: manual

Getting Started

  1. New pipeline: Start with a template from assets/templates/
  2. Add security scanning: Use DevSecOps templates or add security stages to existing pipelines (see workflow 6 above)
  3. Optimize existing: Run scripts/pipeline_analyzer.py
  4. Debug issues: Check references/troubleshooting.md
  5. Improve security: Review references/security.md and references/devsecops.md checklists
  6. Speed up builds: See references/optimization.md

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.12%
按下载量换算445

OpenCode

23.73%
按下载量换算376

Antigravity

15.18%
按下载量换算240

Gemini CLI

13.42%
按下载量换算212

Cursor

6.7%
按下载量换算106

github-copilot

3.06%
按下载量换算48

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills