VibeRune
Commands/cicd

/cicd:optimize

CI/CD Pipeline Optimization

/cicd:optimize

Claude Code

Agent: devops-engineer Skills: cicd-automation

/cicd:optimize - CI/CD Pipeline Optimization

Analyze and optimize GitHub Actions workflows for speed and cost.

Usage

/cicd:optimize [workflow]
/cicd:optimize                   - Analyze all workflows
/cicd:optimize ci.yml            - Optimize specific workflow
/cicd:optimize --report          - Generate detailed report only

Execution Steps

1. Gather Metrics

# List workflows
gh workflow list

# Get recent run timings
gh run list --workflow=ci.yml --limit 10 --json databaseId,timing

# Analyze step durations
gh run view <run-id> --json jobs

2. Identify Bottlenecks

Time Analysis:

  • Which steps take longest?
  • Which jobs could run in parallel?
  • Are there redundant steps?

Common Bottlenecks:

IssueSymptomSolution
No cachingnpm install >2minAdd cache action
Sequential jobsTotal time = sum of jobsUse needs for parallelism
Large artifactsUpload/download slowReduce artifact size
Checkout depthgit checkout slowUse fetch-depth: 1
Heavy imagesContainer pull slowUse lighter base images

3. Generate Recommendations

## Pipeline Optimization Report

### Current State
- **Average Duration**: {time}
- **P95 Duration**: {time}
- **Success Rate**: {percentage}
- **Monthly Minutes**: {minutes}

### Bottleneck Analysis

#### Slowest Steps
| Step | Avg Duration | % of Total |
|------|--------------|------------|
| npm install | 3m 45s | 35% |
| npm test | 4m 20s | 40% |
| npm build | 2m 15s | 25% |

### Recommendations

#### 1. Add Dependency Caching (Est. -2min)
```yaml
- uses: actions/cache@v4
  with:
    path: ~/.npm
    key: npm-$\{\{ hashFiles('package-lock.json') \}\}

2. Parallelize Test Suites (Est. -3min)

jobs:
  test-unit:
    ...
  test-integration:
    ...
  test-e2e:
    ...

3. Use Shallow Clone (Est. -30s)

- uses: actions/checkout@v4
  with:
    fetch-depth: 1

Projected Improvements

OptimizationTime SavedCost Saved/Month
Caching2min$X
Parallelization3min$X
Shallow clone30s$X
Total5.5min$X

## Agent Configuration

```yaml
agent: devops-engineer
skills:
  - cicd-automation
confirmation: none  # Analysis only

Optimization Templates

Caching Node.js

- uses: actions/setup-node@v4
  with:
    node-version: '20'
    cache: 'npm'

Caching Docker Layers

- uses: docker/build-push-action@v5
  with:
    cache-from: type=gha
    cache-to: type=gha,mode=max

Matrix Strategy

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

Concurrency Control

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

On this page