$npx -y skills add Svenja-dev/claude-code-skills --skill code-quality-gateEnforces automated quality checks before every deploy. Prevents production failures through a 5-stage Quality Gate System (Pre-Commit, PR-Check, Preview, E2E, Production). Activate on code changes, deployments, PR reviews, build failures.
| 1 | # Code Quality Gate |
| 2 | |
| 3 | This skill prevents production failures through a 5-stage Quality Gate System. |
| 4 | |
| 5 | ## The 5 Quality Gates |
| 6 | |
| 7 | 1. **Pre-Commit (local):** TypeScript, Lint, Format - blocks commit on errors |
| 8 | 2. **PR-Check (GitHub Actions):** Unit Tests, Build - blocks merge on errors |
| 9 | 3. **Preview Deploy:** Vercel/Netlify Preview URL for visual review |
| 10 | 4. **E2E Tests:** Playwright against Preview, Lighthouse performance audit |
| 11 | 5. **Production Deploy:** Only when ALL gates pass |
| 12 | |
| 13 | ## Critical Rules |
| 14 | |
| 15 | - **CRITICAL:** NEVER use `continue-on-error: true` for TypeScript checks in GitHub Actions! |
| 16 | - Husky Setup: `npm install -D husky lint-staged && npx husky init` |
| 17 | - Rollback: `vercel rollback` |
| 18 | |
| 19 | ## Example: Pre-Commit Hook (.husky/pre-commit) |
| 20 | |
| 21 | ```bash |
| 22 | #!/bin/sh |
| 23 | npx lint-staged |
| 24 | npx tsc --noEmit |
| 25 | ``` |
| 26 | |
| 27 | ## Example: lint-staged.config.js |
| 28 | |
| 29 | ```javascript |
| 30 | module.exports = { |
| 31 | '*.{ts,tsx}': ['eslint --fix', 'prettier --write'], |
| 32 | '*.{json,md}': ['prettier --write'], |
| 33 | }; |
| 34 | ``` |
| 35 | |
| 36 | ## Example: GitHub Actions Workflow |
| 37 | |
| 38 | ```yaml |
| 39 | name: Quality Gate |
| 40 | on: [push, pull_request] |
| 41 | |
| 42 | jobs: |
| 43 | quality: |
| 44 | runs-on: ubuntu-latest |
| 45 | steps: |
| 46 | - uses: actions/checkout@v4 |
| 47 | - uses: actions/setup-node@v4 |
| 48 | with: |
| 49 | node-version: '20' |
| 50 | cache: 'npm' |
| 51 | |
| 52 | - run: npm ci |
| 53 | |
| 54 | # Gate 1: TypeScript (NEVER skip!) |
| 55 | - name: TypeScript Check |
| 56 | run: npx tsc --noEmit |
| 57 | |
| 58 | # Gate 2: Linting |
| 59 | - name: ESLint |
| 60 | run: npm run lint |
| 61 | |
| 62 | # Gate 3: Unit Tests |
| 63 | - name: Unit Tests |
| 64 | run: npm run test |
| 65 | |
| 66 | # Gate 4: Build |
| 67 | - name: Build |
| 68 | run: npm run build |
| 69 | ``` |
| 70 | |
| 71 | ## When to Activate |
| 72 | |
| 73 | - Code changes that touch production code |
| 74 | - Deployment requests |
| 75 | - PR reviews |
| 76 | - Build failures (for debugging) |
| 77 | |
| 78 | ## Real-World Impact |
| 79 | |
| 80 | At [fabrikIQ.com](https://www.fabrikiq.com), this quality gate system caught: |
| 81 | - 2 TypeScript errors that would have caused runtime crashes |
| 82 | - 1 missing environment variable in the deploy |
| 83 | - 3 performance regressions before they hit production |