ci-cd-and-automation
できること
コードをチェックする作業の準備を自動化する仕組みです。まずすべてをテストすることで、品質の高いコードだけが最終的な製品に届くようにします。
使う場面
- ✓新しいプロジェクトを始めて、チェックの仕組みを設定するとき。
- ✓自動テストを追加または変更したいとき。
- ✓コードを利用者に公開する方法を設定するとき。
スキルのリンク
https://github.com/addyosmani/agent-skills/blob/main/skills/ci-cd-and-automation/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“プロジェクトの自動テストのパイプラインを設定してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
コードのチェック、機能のテスト、セキュリティのテストなど、一連のチェックを定義します。コードはこれらすべてに合格して初めて、準備完了とみなされます。失敗した場合は、システムが修正を促す通知を出します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
CI/CD and Automation
Overview
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.
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.
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.
When to Use
- Setting up a new project's CI pipeline
- Adding or modifying automated checks
- Configuring deployment pipelines
- When a change should trigger automated verification
- Debugging CI failures
The Quality Gate Pipeline
Every change goes through these gates before merge:
Pull Request Opened
│
▼
┌─────────────────┐
│ LINT CHECK │ eslint, prettier
│ ↓ pass │
│ TYPE CHECK │ tsc --noEmit
│ ↓ pass │
│ UNIT TESTS │ jest/vitest
│ ↓ pass │
│ BUILD │ npm run build
│ ↓ pass │
│ INTEGRATION │ API/DB tests
│ ↓ pass │
│ E2E (optional) │ Playwright/Cypress
│ ↓ pass │
│ SECURITY AUDIT │ npm audit
│ ↓ pass │
│ BUNDLE SIZE │ bundlesize check
└─────────────────┘
│
▼
Ready for review
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.
GitHub Actions Configuration
Basic CI Pipeline
# .github/workflows/ci.yml
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Type check
run: npx tsc --noEmit
- name: Test
run: npm test -- --coverage
- name: Build
run: npm run build
- name: Security audit
run: npm audit --audit-level=high
With Database Integration Tests
integration:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: testdb
POSTGRES_USER: ci_user
POSTGRES_PASSWORD: ${{ secrets.CI_DB_PASSWORD }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- run: npm ci
- name: Run migrations
run: npx prisma migrate deploy
env:
DATABASE_URL: postgresql://ci_user:${{ secrets.CI_DB_PASSWORD }}@localhost:5432/testdb
- name: Integration tests
run: npm run test:integration
env:
DATABASE_URL: postgresql://ci_user:${{ secrets.CI_DB_PASSWORD }}@localhost:5432/testdb
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.
E2E Tests
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- run: npm ci
- name: Install Playwright
run: npx playwright install --with-deps chromium
- name: Build
run: npm run build
- name: Run E2E tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: playwright-report/
Feeding CI Failures Back to Agents
The power of CI with AI agents is the feedback loop. When CI fails:
CI fails
│
▼
Copy the failure output
│
▼
Feed it to the agent:
"The CI pipeline failed with this error:
[paste specific error]
…
よくある質問
「品質ゲート」とは何ですか?
品質の関門のことです。各「ゲート」は、次の工程に進むためにコードが通過しなければならないチェックです。たとえば、コードのテストや機能のテストなどがあります。
なぜ「速いほど安全」なのですか?
小さな変更を頻繁にリリースするほうが安全だからです。大きな更新よりも小さな更新のほうが、問題を見つけて直しやすく、リスクを減らせます。
「Shift Left」とは何ですか?
問題をできるだけ早い段階で見つけることを意味します。製品が完成してから、または利用中にエラーを直すより、早い段階で直すほうが時間と手間を抑えられます。
詳細
作者による元の説明
Automates 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.
repo: addyosmani/agent-skills
人気
- GitHubのスター
- 107k
- ランキング
- #763
- ライセンス
- MIT
- 更新日
- 2026/10/13
コメント
- …
このリポジトリの他のスキル
api-and-interface-design
107k明確に定義されたAPIやインターフェースの作成を支援します。ソフトウェアの異なる部分がどのように通信するかを設計する際に役立ちます。
browser-testing-with-devtools
107k実際のブラウザでコードを直接テストできるよう支援します。実際の利用環境での動作を確認し、エラーやパフォーマンスの問題を見つけるのに役立ちます。
code-review-and-quality
107k複数の観点から詳細なコードレビューを行います。新しい変更をマージする前に、品質を確保し、将来の問題を防ぐのに役立ちます。
code-simplification
107kコードを単純化して、理解しやすく保守しやすくします。コードは動くものの複雑すぎる場合に、わかりやすさの向上に役立ちます。