AugmentClaude

GitHub Actions Generator

Generate CI/CD workflows for GitHub Actions based on your project's tech stack.

Installation

  1. Make sure Claude is on your device and in your terminal.

    Skills load from ~/.claude/skills/ when Claude Code starts up — so you need it on your machine first. If you don't have it yet, install it once with the command below, then run claude in any terminal to verify.

    One-time setup
    npm i -g @anthropic-ai/claude-code

    Already have it? Skip ahead.

  2. Paste into Claude Code or into your terminal.

    This copies the whole skill folder into ~/.claude/skills/github-actions-gen-laolaoshiren/ — the SKILL.md plus any scripts, reference docs, or templates the skill ships with. Safe default: works for every skill.

    Faster alternative (instruction-only skills)

    Skips the clone and grabs only the SKILL.md file. Don't use this if the skill ships Python scripts, reference markdowns, or asset templates — they won't be downloaded and the skill will fail when it tries to load them.

    Quick install (SKILL.md only)
    Sign up to copy
  3. Restart Claude Code.

    Quit and reopen Claude Code (or any other agent that loads from ~/.claude/skills/). New skills are picked up on startup.

  4. Just ask Claude.

    Skills auto-activate when your request matches the skill's description — no slash command needed. Trigger phrases live in the skill's own frontmatter; you can read them in the “What this skill does” section above.

Prefer to read the source first? Open on GitHub.

When Claude uses it

GitHub Actions CI/CD 流水线生成器:根据项目技术栈自动创建 workflows

What this skill does

GitHub Actions CI/CD 生成器

触发条件

当用户要求创建 CI/CD 流水线、GitHub Actions workflow、自动化部署配置时激活。

工作流程

1. 项目分析

  • 检测项目语言和框架(package.json / requirements.txt / go.mod / Cargo.toml 等)
  • 识别现有 CI 配置(.github/workflows/)
  • 分析项目结构:单体仓库 or 单项目、monorepo 工具(nx / turborepo / lerna)
  • 检测测试框架(jest / pytest / go test / cargo test)

2. 流水线设计

根据项目类型生成对应 workflow:

通用流水线模板:

  • ci.yml — 代码检查 + 测试(push/PR 触发)
  • release.yml — 版本发布(tag 触发)
  • deploy.yml — 部署流水线(按需)

前端项目额外:

  • Node.js 版本矩阵测试
  • Lighthouse 性能检测
  • 静态资源 CDN 缓存失效

后端项目额外:

  • Docker 镜像构建 + 推送
  • 数据库 migration 检查
  • API 契约测试

3. 生成配置

  • 使用 GitHub Actions 最佳实践
  • 合理利用 cache(actions/cache)加速构建
  • 矩阵策略覆盖多版本
  • Secrets 引用安全规范(不硬编码)
  • 中文注释说明每个 step 的作用

4. 输出文件

.github/workflows/ 目录生成:

  • ci.yml — 主 CI 流水线
  • release.yml — 发布流水线(如需要)
  • README-CICD.md — 流水线使用说明

输出格式

# .github/workflows/ci.yml
name: CI

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18, 20, 22]  # 按项目调整
    steps:
      - uses: actions/checkout@v4
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'
      - run: npm ci
      - run: npm test
      - run: npm run lint

质量检查清单

  • workflow 文件语法正确(可用 actionlint 验证)
  • 使用固定版本 tag(避免 @main
  • Secrets 通过 ${{ secrets.XXX }} 引用
  • 设置适当的权限(permissions
  • 超时时间合理(timeout-minutes
  • 失败通知机制(Slack / 邮件 / 微信 webhook)

常见陷阱

  • Node.js 项目:确保 lockfile(package-lock.json / pnpm-lock.yaml)存在,否则 npm ci 会失败
  • Python 项目:注意 requirements.txt 和 pyproject.toml 的优先级
  • Docker 构建:使用 multi-stage build 减小镜像体积
  • 缓存策略:key 要包含 lockfile hash,否则缓存可能过期
  • 矩阵测试:不要过度配置,3-5 个版本足够

示例

用户输入:「帮我给这个 Next.js 项目创建 CI/CD 流水线」

输出:

  1. 分析 package.json 检测 Next.js 版本、测试框架、部署目标
  2. 生成 ci.yml(lint + test + build)
  3. 生成 deploy.yml(Vercel / Docker 部署)
  4. 生成使用说明 README-CICD.md

Related skills