jpskill.com
🛠️ 開発・MCP コミュニティ

infra-ci-cd-github-actions

GitHub Actionsを活用し、ソフトウェア開発におけるパイプライン構築やデプロイメントを効率化することで、開発プロセス全体の自動化と迅速化を実現するSkill。

📜 元の英語説明(参考)

GitHub Actions, pipelines, deployment

🇯🇵 日本人クリエイター向け解説

一言でいうと

GitHub Actionsを活用し、ソフトウェア開発におけるパイプライン構築やデプロイメントを効率化することで、開発プロセス全体の自動化と迅速化を実現するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o infra-ci-cd-github-actions.zip https://jpskill.com/download/10253.zip && unzip -o infra-ci-cd-github-actions.zip && rm infra-ci-cd-github-actions.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10253.zip -OutFile "$d\infra-ci-cd-github-actions.zip"; Expand-Archive "$d\infra-ci-cd-github-actions.zip" -DestinationPath $d -Force; ri "$d\infra-ci-cd-github-actions.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して infra-ci-cd-github-actions.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → infra-ci-cd-github-actions フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

CI/CD パイプライン

クイックガイド: CI/CD のための GitHub Actions。モノレポ最適化のための影響検出 (例: Turborepo --affected または --filter=...[origin/main])。高速な CI のための依存関係とビルド出力のキャッシュ。必要なステータスチェックとしての品質ゲート: lint + type-check + test + build + coverage。ビルドプロモーションによるマルチ環境デプロイメント。クラウドプロバイダーのための OIDC 認証。すべてのアクションとランタイムのバージョンを固定。


<critical_requirements>

重要: この Skill を使用する前に

すべてのコードは CLAUDE.md のプロジェクト規約に従う必要があります (kebab-case、名前付きエクスポート、インポート順序、import type、名前付き定数)

(PR ビルドには、影響/変更されたパッケージの検出を必ず使用してください - PR で完全なテストスイートを実行しないでください)

(パッケージマネージャーの依存関係とビルド出力を必ずキャッシュしてください - キャッシュなしの CI はランタイムの 70% を無駄にします)

(アクションのバージョンを必ず固定してください (actions/checkout@v6oven-sh/setup-bun@v2actions/cache@v5) - @main またはバージョンなしは絶対に使用しないでください)

(品質ゲート (lint + type-check + test + build) を必須のステータスチェックとして実装してください - 失敗時にマージをブロックします)

(サポートされている場合は、クラウドプロバイダー認証に OIDC を必ず使用してください - 静的な長期的な認証情報を絶対に使用しないでください)

</critical_requirements>


詳細なリソース:


自動検出: GitHub Actions、CI/CD パイプライン、.github/workflows、Turborepo 影響検出、リモートキャッシュ、デプロイメント自動化、品質ゲート、OIDC 認証、シークレットローテーション、アーティファクトアテステーション、SLSA プロベナンス、再利用可能なワークフロー、コンポジットアクション、マトリックスビルド、workflow_call

使用する場合:

  • モノレポ用の GitHub Actions ワークフローをセットアップする場合
  • より高速な PR ビルドのために影響検出を実装する場合
  • 共有ビルドアーティファクトのためにリモートキャッシュを設定する場合
  • 品質ゲートとブランチ保護ルールを設定する場合
  • クラウドデプロイメントのために OIDC 認証を実装する場合
  • サプライチェーンセキュリティのためにアーティファクトアテステーションを追加する場合

使用しない場合:

  • GitHub を使用していないプロジェクト (CI プロバイダーのネイティブドキュメントを使用してください)
  • 自動テストまたはビルドステップが必要ない場合

カバーする主要なパターン:

  • 並列ジョブと依存関係キャッシュによるパイプライン構成
  • 影響検出 (Turborepo --affected フラグまたは --filter=...[origin/main])
  • 品質ゲート (lint、type-check、test、build を依存関係を持つ並列ジョブとして)
  • OIDC 認証 (クラウドプロバイダー用の静的な認証情報なし)
  • 再利用可能なワークフロー (workflow_call、合計 10 レベルまで)
  • コンポジットアクション (using: composite、共有セットアップロジック)
  • マトリックスビルド (include/exclude、fail-fast、動的マトリックス)
  • アーティファクトアテステーション (SLSA v1.0 Build Level 2 プロベナンス)
  • ビルドプロモーションによるマルチ環境デプロイメント

<philosophy>

哲学

CI/CD パイプラインは、テスト、ビルド、デプロイメントを自動化します。モノレポでは、コードベースの成長に合わせて高速な CI を維持するために、インテリジェントなキャッシュと影響検出が重要です。

コア原則:

  • 迅速なフィードバック: PR ビルドは、影響検出とキャッシュによって 5 分以内に完了する必要があります
  • 一度ビルドし、どこにでもプロモート: プレビュー/ステージング/本番環境を通じてデプロイされる単一のビルドアーティファクト
  • 静的な認証情報なし: クラウドプロバイダーには OIDC、ローテーション認証情報にはシークレットマネージャー
  • 品質ゲートがマージをブロック: マージする前に、Lint、type-check、test、build のすべてが合格する必要があります

</philosophy>


<patterns>

コアパターン

パターン 1: パイプライン構成

インストール、並列品質チェック、そしてビルドを分離します。

# 推奨されるワークフロー構造:
# ci.yml      - lint, test, type-check, build (PR + main)
# deploy.yml  - production deployment from main
# preview.yml - preview deployments for PRs

重要な決定事項:

  • ランタイムとアクションのバージョンを固定します (決して latest を使用しないでください)
  • キャッシュされた依存関係を持つ個別のインストールジョブを作成し、並列の lint/test/type-check に分岐します
  • すべての品質ゲートが合格した後にのみビルドします
  • リソースの無駄を避けるために、concurrencycancel-in-progress: true で使用します

完全なワークフローの例については、examples/core.md を参照してください。


パターン 2: 影響検出

モノレポで変更されたパッケージのみをテストおよびビルドします。

Turborepo の例 (2 つのアプローチ、いずれかを選択):

# Modern: --affected フラグ (CI 環境を自動検出)
turbo run test --affected

# Manual: git 比較による --filter
turbo run test --filter=...[origin/main]

重要な原則: PR は、迅速なフィードバックのために影響検出を使用します (5 分未満)。メインブランチは完全なスイートを実行します。

注意点: 新しいパッケージには git の履歴がなく、影響検出によってスキップされます。常に新しい package.json ファイルを確認し、完全なスイートにフォールバックしてください。

PR とメインブランチのワークフローの例については、examples/testing.md を参照してください。


パターン 3: 品質ゲート

マージする前に合格する必要がある自動チェック。

品質ゲートの順序:

  1. リンティング (コードスタイルと静的解析)
  2. 型チェック (TypeScript エラー)
  3. カバレッジ付きのテスト (機能検証)
  4. ビルド検証 (本番ビルドが成功する)
  5. バンドルサイズチェック (パフォーマンスの低下防止)
  6. セキュリティ監査 (依存関係の脆弱性)

ブランチ保護で必須のステータスチェックとして構成します。マージ前にブランチを最新の状態にする必要がある場合は、strict: true を使用します。

包括的な品質ゲートワークフローについては、examples/testing.md を参照してください。


パターン 4: OIDC 認証

静的な認証情報を排除します

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

CI/CD Pipelines

Quick Guide: GitHub Actions for CI/CD. Affected detection for monorepo optimization (e.g., Turborepo --affected or --filter=...[origin/main]). Dependency and build output caching for fast CI. Quality gates: lint + type-check + test + build + coverage as required status checks. Multi-environment deployments with build promotion. OIDC authentication for cloud providers. Pin all action and runtime versions.


<critical_requirements>

CRITICAL: Before Using This Skill

All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering, import type, named constants)

(You MUST use affected/changed-package detection for PR builds - NEVER run full test suite on PRs)

(You MUST cache package manager dependencies and build outputs - CI without caching wastes 70% of runtime)

(You MUST pin action versions (actions/checkout@v6, oven-sh/setup-bun@v2, actions/cache@v5) - NEVER use @main or unversioned)

(You MUST implement quality gates (lint + type-check + test + build) as required status checks - block merge on failures)

(You MUST use OIDC for cloud provider auth where supported - NEVER use static long-lived credentials)

</critical_requirements>


Detailed Resources:


Auto-detection: GitHub Actions, CI/CD pipelines, .github/workflows, Turborepo affected detection, remote cache, deployment automation, quality gates, OIDC authentication, secret rotation, artifact attestations, SLSA provenance, reusable workflows, composite actions, matrix builds, workflow_call

When to use:

  • Setting up GitHub Actions workflows for monorepos
  • Implementing affected detection for faster PR builds
  • Configuring remote cache for shared build artifacts
  • Setting up quality gates and branch protection rules
  • Implementing OIDC authentication for cloud deployments
  • Adding artifact attestations for supply chain security

When NOT to use:

  • Projects not using GitHub (use your CI provider's native docs)
  • No automated testing or build step needed

Key patterns covered:

  • Pipeline configuration with parallel jobs and dependency caching
  • Affected detection (Turborepo --affected flag or --filter=...[origin/main])
  • Quality gates (lint, type-check, test, build as parallel jobs with dependencies)
  • OIDC authentication (no static credentials for cloud providers)
  • Reusable workflows (workflow_call, up to 10 levels total)
  • Composite actions (using: composite, shared setup logic)
  • Matrix builds (include/exclude, fail-fast, dynamic matrices)
  • Artifact attestations (SLSA v1.0 Build Level 2 provenance)
  • Multi-environment deployment with build promotion

<philosophy>

Philosophy

CI/CD pipelines automate testing, building, and deployment. In a monorepo, intelligent caching and affected detection are critical for maintaining fast CI as the codebase grows.

Core principles:

  • Fast feedback: PR builds should complete in < 5 minutes via affected detection and caching
  • Build once, promote everywhere: Single build artifact deployed through preview/staging/production
  • No static credentials: OIDC for cloud providers, secrets managers for rotating credentials
  • Quality gates block merge: Lint, type-check, test, and build must all pass before merge

</philosophy>


<patterns>

Core Patterns

Pattern 1: Pipeline Configuration

Separate install, parallel quality checks, then build.

# Recommended workflow structure:
# ci.yml      - lint, test, type-check, build (PR + main)
# deploy.yml  - production deployment from main
# preview.yml - preview deployments for PRs

Key decisions:

  • Pin runtime and action versions (never use latest)
  • Separate install job with cached dependencies, then fan out to parallel lint/test/type-check
  • Build only after all quality gates pass
  • Use concurrency with cancel-in-progress: true to avoid wasting resources

See examples/core.md for complete workflow examples.


Pattern 2: Affected Detection

Only test and build changed packages in monorepos.

Turborepo example (two approaches, choose one):

# Modern: --affected flag (auto-detects CI environment)
turbo run test --affected

# Manual: --filter with git comparison
turbo run test --filter=...[origin/main]

Key principle: PRs use affected detection for fast feedback (< 5 min). Main branch runs full suite.

Gotcha: New packages have no git history and get skipped by affected detection. Always check for new package.json files and fall back to full suite.

See examples/testing.md for PR vs main branch workflow examples.


Pattern 3: Quality Gates

Automated checks that must pass before merge.

Quality gate order:

  1. Linting (code style and static analysis)
  2. Type checking (TypeScript errors)
  3. Tests with coverage (functionality validation)
  4. Build verification (production build succeeds)
  5. Bundle size check (performance regression prevention)
  6. Security audit (dependency vulnerabilities)

Configure as required status checks in branch protection. Use strict: true to require branches be up-to-date before merge.

See examples/testing.md for comprehensive quality gate workflow.


Pattern 4: OIDC Authentication

Eliminate static credentials for cloud deployments.

# Key requirement for OIDC:
permissions:
  id-token: write # Required for OIDC token generation
  contents: read

OIDC eliminates: manual key rotation, permanent security risk from leaked keys, and untraceable deployments. Temporary credentials auto-expire (typically 1 hour).

See examples/security.md for AWS OIDC and token-based authentication examples.


Pattern 5: Reusable Workflows vs Composite Actions

Centralize CI/CD logic across repositories.

Feature Reusable Workflow Composite Action
Scope Multiple jobs Steps within a job
Secrets Native secrets context Must pass via inputs
Nesting Up to 10 levels total (caller + 9 nested), 50 unique per run N/A
Use for Full pipeline templates Shared setup/teardown

See examples/core.md for implementation examples.

</patterns>


<performance>

Performance Optimization

Goal: CI runtime < 5 minutes for PR builds

Parallelization techniques:

  • Separate install job, parallel lint/test/type-check jobs (saves 40% time)
  • Matrix builds for multiple OS/versions (only on main, not PRs)
  • Split test suites (unit, integration, e2e as parallel jobs)
  • Use concurrency with cancel-in-progress: true to cancel outdated runs

Monitoring targets:

  • CI runtime: < 5 min (PR), < 10 min (main)
  • Cache hit rate: > 80% (remote cache)
  • Failure rate: < 5% (excluding flaky tests)
  • Time to deploy: < 10 min (commit to production)

</performance>


<red_flags>

RED FLAGS

High Priority:

  • Running full test suite on every PR - Use affected detection or CI takes 10+ minutes
  • No caching configured - Reinstalling dependencies every run wastes 2-3 minutes
  • Using latest for runtime versions - Non-deterministic builds break reproducibility
  • Static cloud credentials in secrets - Use OIDC authentication, never store long-lived access keys
  • Committing secrets to repository - Use GitHub Secrets, never hardcode credentials in YAML
  • No quality gates on main branch - Missing lint/test/type-check allows broken code to merge

Medium Priority:

  • Sequential jobs instead of parallel - Lint/test/type-check should fan out after install
  • No concurrency limits - Multiple CI runs on same PR waste resources
  • Rebuilding for each environment - Build once, promote artifact through environments
  • No monitoring of CI performance - Cannot identify bottlenecks without tracking duration and cache hit rate
  • Magic numbers in workflows - Hardcoded timeouts and thresholds with no documentation of intent

Common Mistakes:

  • Not using fetch-depth: 0 for affected detection (git diff fails without history)
  • Using needs: [all, previous, jobs] on every job (creates sequential execution)
  • Not handling new packages in affected detection (they get skipped)

Gotchas & Edge Cases:

  • fetch-depth: 0 required for affected detection (shallow clone breaks git diff)
  • New packages have no git history so affected detection skips them
  • actions/cache default limit is 10GB per repo (configurable up to 10TB, additional storage billed at $0.07/GiB/month)
  • OIDC requires id-token: write permission or token generation fails silently
  • Environment secrets override repository secrets with the same name
  • Artifact attestations require attestations: write AND id-token: write AND contents: read
  • Reusable workflows support 10 levels total (caller + 9 nested, increased from 4) and 50 unique per run
  • actions/create-release is deprecated - use softprops/action-gh-release@v2 instead
  • workflow_dispatch now supports 25 inputs (increased from 10)

</red_flags>


<critical_reminders>

CRITICAL REMINDERS

All code must follow project conventions in CLAUDE.md

(You MUST use affected/changed-package detection for PR builds - NEVER run full test suite on PRs)

(You MUST cache package manager dependencies and build outputs - CI without caching wastes 70% of runtime)

(You MUST pin action versions (actions/checkout@v6, oven-sh/setup-bun@v2, actions/cache@v5) - NEVER use @main or unversioned)

(You MUST implement quality gates (lint + type-check + test + build) as required status checks - block merge on failures)

(You MUST use OIDC for cloud provider auth where supported - NEVER use static long-lived credentials)

Failure to follow these rules will result in slow CI (10+ min), security vulnerabilities (leaked credentials), and broken builds (missing quality gates).

</critical_reminders>