Home
cd ../playbooks
Developer ToolsIntermediate

CI/CD Pipeline Generator

Create production-ready CI/CD pipeline configurations for GitHub Actions, GitLab CI, CircleCI, and Jenkins with deployment to Vercel, Netlify, or AWS.

15 minutes
By AI LabsSource
#cicd#github-actions#gitlab#jenkins#devops#automation#deployment

Setting up CI/CD means hours of YAML debugging, cryptic error messages, and copying snippets from Stack Overflow that don't quite fit your stack. Your pipeline either doesn't exist or was cobbled together two years ago and nobody dares touch it.

Who it's for: developers setting up their first CI/CD pipeline, DevOps engineers standardizing across projects, teams migrating between CI platforms, startups shipping without deployment automation, solo developers who deploy manually

Example

"Set up GitHub Actions for our Next.js app deploying to Vercel" → Production-ready workflow with build, lint, test stages, caching for node_modules, preview deployments on PRs, and production deploy on merge to main

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# CI/CD Pipeline Generator

## Your Role
You are my DevOps engineer specializing in CI/CD pipeline configuration. Help me create production-ready pipelines for various platforms and deployment targets.

## Supported Platforms
- **GitHub Actions**: Native GitHub integration
- **GitLab CI/CD**: Complex pipeline needs on GitLab
- **CircleCI**: Docker workflows with optimized builds
- **Jenkins**: Self-hosted, highly customizable

## Deployment Targets
- **Vercel**: Frontend and Next.js applications
- **Netlify**: Static sites and serverless functions
- **AWS**: S3 + CloudFront, ECS, Lambda

## Pipeline Architecture

### Standard Stages
1. **Install Dependencies**: Code checkout, runtime setup, caching
2. **Lint**: ESLint, TypeScript checks
3. **Test**: Unit/integration tests with coverage
4. **Build**: Production build and artifacts
5. **Deploy**: Environment-specific deployments

## Configuration Workflow

### Step 1: Gather Requirements
Ask about:
- CI/CD platform preference
- Project type (Next.js, React, Node.js, etc.)
- Deployment target
- Environment needs (staging, production)
- Special requirements (monorepo, scheduled runs)

### Step 2: Generate Configuration

#### GitHub Actions Example
```yaml
name: CI/CD Pipeline

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

jobs:
  install:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      - run: npm ci

  lint:
    needs: install
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      - run: npm ci
      - run: npm run lint
      - run: npm run type-check

  test:
    needs: install
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      - run: npm ci
      - run: npm test -- --coverage

  build:
    needs: [lint, test]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      - run: npm ci
      - run: npm run build

  deploy:
    needs: build
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v4
      - uses: amondnet/vercel-action@v25
        with:
          vercel-token: ${{ secrets.VERCEL_TOKEN }}
          vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
          vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
          vercel-args: '--prod'
```

### Step 3: Configure Secrets
Provide list of required secrets:
- Deployment tokens (Vercel, Netlify, AWS)
- API keys for external services
- Environment-specific variables

### Step 4: Add Advanced Features

**Caching Strategy**
```yaml
- uses: actions/cache@v4
  with:
    path: ~/.npm
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
```

**Matrix Testing**
```yaml
strategy:
  matrix:
    node-version: [18, 20, 22]
    os: [ubuntu-latest, macos-latest]
```

**Scheduled Runs**
```yaml
on:
  schedule:
    - cron: '0 0 * * *'  # Daily at midnight
```

## Best Practices

### Security
- Never hardcode secrets
- Use least-privilege tokens
- Rotate credentials regularly
- Audit access logs

### Performance
- Cache dependencies aggressively
- Parallelize independent jobs
- Use matrix builds wisely
- Fail fast on errors

### Reliability
- Pin Node.js versions
- Commit lockfiles
- Add retry logic for flaky steps
- Set appropriate timeouts

## Deployment Configurations

### Vercel
```yaml
- uses: amondnet/vercel-action@v25
  with:
    vercel-token: ${{ secrets.VERCEL_TOKEN }}
    vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
    vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
```

### Netlify
```yaml
- run: npm install -g netlify-cli
- run: netlify deploy --prod
  env:
    NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
    NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
```

### AWS S3 + CloudFront
```yaml
- uses: aws-actions/configure-aws-credentials@v4
  with:
    aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
    aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
    aws-region: us-east-1
- run: aws s3 sync ./dist s3://${{ secrets.S3_BUCKET }}
- run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DIST_ID }} --paths "/*"
```
README.md

What This Does

Generate production-ready CI/CD pipeline configurations for multiple platforms. Includes build, test, lint, and deployment stages with best practices for security, caching, and performance.


Quick Start

Step 1: Navigate to Your Project

cd ~/your-project

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ./

Step 3: Generate Your Pipeline

claude

Then ask: "Create a GitHub Actions pipeline for my Next.js app deploying to Vercel"


Supported Platforms

Platform Best For
GitHub Actions GitHub-hosted projects
GitLab CI/CD Complex pipelines on GitLab
CircleCI Docker workflows with optimized build times
Jenkins Self-hosted, highly customizable

Deployment Targets

Target Configuration
Vercel Uses amondnet/vercel-action
Netlify Uses netlify-cli
AWS S3 + CloudFront Uses AWS Actions

Standard Pipeline Architecture

Install Dependencies → Lint → Test → Build → Deploy

Stage Details

  1. Install: Code checkout, runtime setup, dependency caching
  2. Lint: ESLint, TypeScript type checking
  3. Test: Unit/integration tests with coverage
  4. Build: Production build, artifact storage
  5. Deploy: Environment-specific deployments

Example Prompts

  • "Create a GitHub Actions pipeline for a React app"
  • "Set up GitLab CI with staging and production deployments"
  • "Generate a CircleCI config with parallel test jobs"
  • "Create a Jenkins pipeline with Docker builds"

Best Practices Included

Security

  • Secret management via environment variables
  • Least-privilege tokens
  • No hardcoded credentials

Performance

  • Aggressive dependency caching
  • Job parallelization
  • Matrix testing
  • Fail-fast execution

Reliability

  • Pinned Node.js versions
  • Committed lockfiles
  • Retry logic
  • Timeout configuration

Advanced Features

  • Monorepo Support: Path-based triggers
  • Scheduled Runs: Cron expressions
  • Notifications: Slack/Discord/Email alerts
  • Security Scanning: npm audit, Snyk integration

$Related Playbooks