$npx -y skills add jmxt3/gitscape.ai --skill ci-cd-and-automationAutomates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.
| 1 | # CI/CD and Automation |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Automate quality gates so that no change reaches production without passing tests, lint, type checking, and build. CI/CD is the enforcement mechanism for every other skill — it catches what humans and agents miss, and it does so consistently on every single change. |
| 6 | |
| 7 | **Shift Left:** Catch problems as early in the pipeline as possible. A bug caught in linting costs minutes; the same bug caught in production costs hours. Move checks upstream — static analysis before tests, tests before staging, staging before production. |
| 8 | |
| 9 | **Faster is Safer:** Smaller batches and more frequent releases reduce risk, not increase it. A deployment with 3 changes is easier to debug than one with 30. Frequent releases build confidence in the release process itself. |
| 10 | |
| 11 | ## When to Use |
| 12 | |
| 13 | - Setting up a new project's CI pipeline |
| 14 | - Adding or modifying automated checks |
| 15 | - Configuring deployment pipelines |
| 16 | - When a change should trigger automated verification |
| 17 | - Debugging CI failures |
| 18 | |
| 19 | ## The Quality Gate Pipeline |
| 20 | |
| 21 | Every change goes through these gates before merge: |
| 22 | |
| 23 | ``` |
| 24 | Pull Request Opened |
| 25 | │ |
| 26 | ▼ |
| 27 | ┌─────────────────┐ |
| 28 | │ LINT CHECK │ eslint, prettier |
| 29 | │ ↓ pass │ |
| 30 | │ TYPE CHECK │ tsc --noEmit |
| 31 | │ ↓ pass │ |
| 32 | │ UNIT TESTS │ jest/vitest |
| 33 | │ ↓ pass │ |
| 34 | │ BUILD │ npm run build |
| 35 | │ ↓ pass │ |
| 36 | │ INTEGRATION │ API/DB tests |
| 37 | │ ↓ pass │ |
| 38 | │ E2E (optional) │ Playwright/Cypress |
| 39 | │ ↓ pass │ |
| 40 | │ SECURITY AUDIT │ npm audit |
| 41 | │ ↓ pass │ |
| 42 | │ BUNDLE SIZE │ bundlesize check |
| 43 | └─────────────────┘ |
| 44 | │ |
| 45 | ▼ |
| 46 | Ready for review |
| 47 | ``` |
| 48 | |
| 49 | **No gate can be skipped.** If lint fails, fix lint — don't disable the rule. If a test fails, fix the code — don't skip the test. |
| 50 | |
| 51 | ## GitHub Actions Configuration |
| 52 | |
| 53 | ### Basic CI Pipeline |
| 54 | |
| 55 | ```yaml |
| 56 | # .github/workflows/ci.yml |
| 57 | name: CI |
| 58 | |
| 59 | on: |
| 60 | pull_request: |
| 61 | branches: [main] |
| 62 | push: |
| 63 | branches: [main] |
| 64 | |
| 65 | jobs: |
| 66 | quality: |
| 67 | runs-on: ubuntu-latest |
| 68 | steps: |
| 69 | - uses: actions/checkout@v4 |
| 70 | |
| 71 | - uses: actions/setup-node@v4 |
| 72 | with: |
| 73 | node-version: '22' |
| 74 | cache: 'npm' |
| 75 | |
| 76 | - name: Install dependencies |
| 77 | run: npm ci |
| 78 | |
| 79 | - name: Lint |
| 80 | run: npm run lint |
| 81 | |
| 82 | - name: Type check |
| 83 | run: npx tsc --noEmit |
| 84 | |
| 85 | - name: Test |
| 86 | run: npm test -- --coverage |
| 87 | |
| 88 | - name: Build |
| 89 | run: npm run build |
| 90 | |
| 91 | - name: Security audit |
| 92 | run: npm audit --audit-level=high |
| 93 | ``` |
| 94 | |
| 95 | ### With Database Integration Tests |
| 96 | |
| 97 | ```yaml |
| 98 | integration: |
| 99 | runs-on: ubuntu-latest |
| 100 | services: |
| 101 | postgres: |
| 102 | image: postgres:16 |
| 103 | env: |
| 104 | POSTGRES_DB: testdb |
| 105 | POSTGRES_USER: ci_user |
| 106 | POSTGRES_PASSWORD: ${{ secrets.CI_DB_PASSWORD }} |
| 107 | ports: |
| 108 | - 5432:5432 |
| 109 | options: >- |
| 110 | --health-cmd pg_isready |
| 111 | --health-interval 10s |
| 112 | --health-timeout 5s |
| 113 | --health-retries 5 |
| 114 | |
| 115 | steps: |
| 116 | - uses: actions/checkout@v4 |
| 117 | - uses: actions/setup-node@v4 |
| 118 | with: |
| 119 | node-version: '22' |
| 120 | cache: 'npm' |
| 121 | - run: npm ci |
| 122 | - name: Run migrations |
| 123 | run: npx prisma migrate deploy |
| 124 | env: |
| 125 | DATABASE_URL: postgresql://ci_user:${{ secrets.CI_DB_PASSWORD }}@localhost:5432/testdb |
| 126 | - name: Integration tests |
| 127 | run: npm run test:integration |
| 128 | env: |
| 129 | DATABASE_URL: postgresql://ci_user:${{ secrets.CI_DB_PASSWORD }}@localhost:5432/testdb |
| 130 | ``` |
| 131 | |
| 132 | > **Note:** Even for CI-only test databases, use GitHub Secrets for credentials rather than hardcoding values. This builds good habits and prevents accidental reuse of test credentials in other contexts. |
| 133 | |
| 134 | ### E2E Tests |
| 135 | |
| 136 | ```yaml |
| 137 | e2e: |
| 138 | runs-on: ubuntu-latest |
| 139 | steps: |
| 140 | - uses: actions/checkout@v4 |
| 141 | - uses: actions/setup-node@v4 |
| 142 | with: |
| 143 | node-version: '22' |
| 144 | cache: 'npm' |
| 145 | - run: npm ci |
| 146 | - name: Install Playwright |
| 147 | run: npx playwright install --with-deps chromium |
| 148 | - name: Build |
| 149 | run: npm run build |
| 150 | - name: Run E2E tests |
| 151 | run: npx playwright test |
| 152 | - uses: actions/upload-artifact@v4 |
| 153 | if: failure() |
| 154 | with: |
| 155 | name: playwright-report |
| 156 | path: playwright-report/ |
| 157 | ``` |
| 158 | |
| 159 | ## Feeding CI Failures Back to Agents |
| 160 | |
| 161 | The power of CI with AI agents is the feedback loop. When CI fails: |
| 162 | |
| 163 | ``` |
| 164 | CI fails |
| 165 | │ |
| 166 | ▼ |
| 167 | Copy the failure output |
| 168 | │ |
| 169 | ▼ |
| 170 | Feed it to the agent: |
| 171 | "The CI pipeline failed with this error: |
| 172 | [paste specific error] |
| 173 | Fix the issue and verify locally before pushing again." |
| 174 | │ |
| 175 | ▼ |
| 176 | Agent fixes → pushes → CI runs again |
| 177 | ``` |
| 178 | |
| 179 | **Key patterns:** |
| 180 | |
| 181 | ``` |
| 182 | Lint failure → Agent runs `npm run lint --fix` and commits |
| 183 | Type error → Agent reads the error location and fixes the t |