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

build-engineer

モノレポツールやCI/CDパイプライン、バンドラー最適化に関する専門知識を活かし、開発効率を最大化するSkill。

📜 元の英語説明(参考)

Expert in monorepo tooling (Turborepo, Nx, Bazel), CI/CD pipelines, and bundler optimization (Webpack/Vite/Rspack).

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

一言でいうと

モノレポツールやCI/CDパイプライン、バンドラー最適化に関する専門知識を活かし、開発効率を最大化するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して build-engineer.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → build-engineer フォルダができる
  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-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

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

ビルドエンジニア

目的

モノレポツール(Turborepo、Nx、Bazel)、バンドラー最適化(Webpack/Vite/Rspack)、インクリメンタルビルドに特化したビルドシステムとCI/CD最適化の専門知識を提供します。キャッシュ、並列化、ビルドパフォーマンスを通じて開発速度を最適化することに重点を置いています。

使用するタイミング

  • モノレポのセットアップ(pnpm workspaces + Turborepo/Nx)
  • 遅いCIビルドの最適化(リモートキャッシュ、シャーディング)
  • パフォーマンス向上のためのWebpackからVite/Rspackへの移行
  • 高度なBazelビルドルール(Starlark)の設定
  • 複雑な依存関係グラフや循環依存関係のデバッグ
  • 「Affected」ビルドの実装(変更されたもののみをテスト)


2. 意思決定フレームワーク

モノレポツールの選択

ツール 最適な用途 利点 欠点
Turborepo JS/TSエコシステム 設定不要、シンプル、Vercelネイティブ。 JSのみ(ほとんど)、Bazelよりも粒度が低い。
Nx エンタープライズJS/TS 強力なプラグイン、コード生成、グラフ可視化。 設定が重い、意見が分かれる。
Bazel ポリグロット(Go/Java/JS) 密閉型ビルド、無限スケール(Googleスタイル)。 習得曲線が非常に長い、複雑なセットアップ。
Pnpm Workspaces シンプルなプロジェクト Node.jsネイティブ、高速インストール。 タスクオーケストレーションなし(Turbo/Nxが必要)。

バンドラーの選択

優先順位は何ですか?
│
├─ **開発速度 (HMR)**
│  ├─ Webアプリですか? → **Vite** (ESModulesベース、即時起動)
│  └─ レガシーアプリですか? → **Rspack** (Webpack互換、Rustの速度)
│
├─ **本番環境の最適化**
│  ├─ 最大圧縮ですか? → **Webpack** (成熟したプラグインエコシステム)
│  └─ 速度ですか? → **Rspack / Esbuild**
│
└─ **ライブラリ作成**
   └─ Dual Emit (CJS/ESM)ですか? → **Rollup** (ツリーシェイキングの標準)

危険信号 → devops-engineer にエスカレートしてください:

  • CIパイプラインが20分以上かかる
  • node_modules のサイズが1GBを超える(ファントム依存関係)
  • 「私のマシンでは動作する」がCIでは失敗する(環境のずれ)
  • ビルド成果物(ソースマップ)に秘密鍵が見つかる


4. コアワークフロー

ワークフロー 1: Turborepoのセットアップ(リモートキャッシュ)

目標: キャッシュ成果物を再利用することでCI時間を80%削減する。

手順:

  1. 設定 (turbo.json)

    {
      "$schema": "https://turbo.build/schema.json",
      "pipeline": {
        "build": {
          "dependsOn": ["^build"],
          "outputs": ["dist/**", ".next/**"]
        },
        "test": {
          "dependsOn": ["build"],
          "inputs": ["src/**/*.tsx", "test/**/*.ts"]
        },
        "lint": {}
      }
    }
  2. リモートキャッシュ

    • Vercelリモートキャッシュへのリンク: npx turbo link
    • CI(GitHub Actions)の場合:
      env:
        TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
        TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
  3. 実行

    • turbo run build test lint
    • 初回実行: 5分。2回目実行: 100ms (FULL TURBO)。


ワークフロー 3: Nx Affected Commands

目標: モノレポ内で変更されたプロジェクトのみテストを実行する。

手順:

  1. グラフの分析

    • nx graph(依存関係を視覚化: アプリAはライブラリBに依存)。
  2. CIパイプライン

    # PRによって影響を受けるプロジェクトのみをテスト
    npx nx affected -t test --base=origin/main --head=HEAD
    
    # 影響を受けるもののみをlint
    npx nx affected -t lint --base=origin/main


ワークフロー 5: JS開発者向けBazelの概念

目標: BUILD ファイルと package.json の違いを理解する。

マッピング:

NPMの概念 Bazelの概念
package.json WORKSPACE / MODULE.bazel
script: build js_library(name = "build")
dependencies deps = ["//libs/utils"]
node_modules npm_link_all_packages

コード例 (BUILD.bazel):

load("@aspect_rules_js//js:defs.bzl", "js_library")

js_library(
    name = "pkg",
    srcs = ["index.js"],
    deps = [
        "//:node_modules/lodash",
        "//libs/utils"
    ],
)


5. アンチパターンと落とし穴

❌ アンチパターン 1: ファントム依存関係

どのようなものか:

  • import foo from 'foo' はローカルでは動作するが、CIでは失敗する。

なぜ失敗するのか:

  • 'foo' はパッケージマネージャーによってホイストされるが、package.json にはリストされていないためです。

正しいアプローチ:

  • pnpm(厳格モード)を使用してください。シンボリックリンクを介して未宣言の依存関係にアクセスすることを防ぎます。

❌ アンチパターン 2: 循環依存関係

どのようなものか:

  • ライブラリAがライブラリBをインポートし、ライブラリBがライブラリAをインポートする。
  • ビルドが「Maximum call stack exceeded」または「Undefined symbol」で失敗する。

なぜ失敗するのか:

  • アーキテクチャにおけるロジックエラーです。

正しいアプローチ:

  • 共有コードの抽出: 共通ロジックをライブラリCに移動します。
  • A → C、B → C。
  • madge ツールを使用して循環依存関係を検出します: npx madge --circular .

❌ アンチパターン 3: node_modules のコミット

どのようなものか:

  • Gitリポジトリのサイズが2GB。

なぜ失敗するのか:

  • クローンが遅い。プラットフォーム固有のバイナリが壊れる。

正しいアプローチ:

  • .gitignorenode_modules/dist/.turbo/.next/ を含める必要があります。


7. 品質チェックリスト

パフォーマンス:

  • [ ] キャッシュ: リモートキャッシュが有効で検証済み(ヒット率 > 80%)。
  • [ ] 並列処理: 可能であればタスクが並列で実行される(トポロジー認識)。
  • [ ] サイズ: 本番環境の成果物がミニファイされ、ツリーシェイクされている。

信頼性:

  • [ ] ロックファイル: pnpm-lock.yaml / package-lock.json が一貫している。
  • [ ] CI: クリーンなランナーでビルドがパスする(キャッシュなし)。
  • [ ] 決定論: 同じ入力 = 同じハッシュ。

保守性:

  • [ ] スクリプト: package.json のスクリプトが標準化されている(devbuildtestlint)。
  • [ ] グラフ: 依存関係グラフが非巡回である(DAG)。
  • [ ] 足場: 新しいライブラリ/アプリケーション用のジェネレーターがセットアップされている。

例 1: エンタープライズモノレポ移行

シナリオ: 4つのReactアプリケーションと15の共有ライブラリを持つ500人規模の開発会社が、コード共有とCI効率を向上させるために、個別のリポジトリからモノレポへの移行を希望しています。

移行アプローチ:

  1. ツール選択
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Build Engineer

Purpose

Provides build systems and CI/CD optimization expertise specializing in monorepo tooling (Turborepo, Nx, Bazel), bundler optimization (Webpack/Vite/Rspack), and incremental builds. Focuses on optimizing development velocity through caching, parallelization, and build performance.

When to Use

  • Setting up a Monorepo (pnpm workspaces + Turborepo/Nx)
  • Optimizing slow CI builds (Remote Caching, Sharding)
  • Migrating from Webpack to Vite/Rspack for performance
  • Configuring advanced Bazel build rules (Starlark)
  • Debugging complex dependency graphs or circular dependencies
  • Implementing "Affected" builds (only test what changed)


2. Decision Framework

Monorepo Tool Selection

Tool Best For Pros Cons
Turborepo JS/TS Ecosystem Zero config, simple, Vercel native. JS only (mostly), less granular than Bazel.
Nx Enterprise JS/TS Powerful plugins, code generation, graph visualization. heavier configuration, opinionated.
Bazel Polyglot (Go/Java/JS) Hermetic builds, infinite scale (Google style). Massive learning curve, complex setup.
Pnpm Workspaces Simple Projects Native to Node.js, fast installation. No task orchestration (needs Turbo/Nx).

Bundler Selection

What is the priority?
│
├─ **Development Speed (HMR)**
│  ├─ Web App? → **Vite** (ESModules based, instant start)
│  └─ Legacy App? → **Rspack** (Webpack compatible, Rust speed)
│
├─ **Production Optimization**
│  ├─ Max Compression? → **Webpack** (Mature ecosystem of plugins)
│  └─ Speed? → **Rspack / Esbuild**
│
└─ **Library Authoring**
   └─ Dual Emit (CJS/ESM)? → **Rollup** (Tree-shaking standard)

Red Flags → Escalate to devops-engineer:

  • CI Pipeline takes > 20 minutes
  • node_modules size > 1GB (Phantom dependencies)
  • "It works on my machine" but fails in CI (Environment drift)
  • Secret keys found in build artifacts (Source maps)


4. Core Workflows

Workflow 1: Turborepo Setup (Remote Caching)

Goal: Reduce CI time by 80% by reusing cache artifacts.

Steps:

  1. Configuration (turbo.json)

    {
      "$schema": "https://turbo.build/schema.json",
      "pipeline": {
        "build": {
          "dependsOn": ["^build"],
          "outputs": ["dist/**", ".next/**"]
        },
        "test": {
          "dependsOn": ["build"],
          "inputs": ["src/**/*.tsx", "test/**/*.ts"]
        },
        "lint": {}
      }
    }
  2. Remote Cache

    • Link to Vercel Remote Cache: npx turbo link.
    • In CI (GitHub Actions):
      env:
        TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
        TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
  3. Execution

    • turbo run build test lint
    • First run: 5 mins. Second run: 100ms (FULL TURBO).


Workflow 3: Nx Affected Commands

Goal: Only run tests for changed projects in a monorepo.

Steps:

  1. Analyze Graph

    • nx graph (Visualizes dependencies: App A depends on Lib B).
  2. CI Pipeline

    # Only test projects affected by PR
    npx nx affected -t test --base=origin/main --head=HEAD
    
    # Only lint affected
    npx nx affected -t lint --base=origin/main


Workflow 5: Bazel Concepts for JS Developers

Goal: Understand BUILD files vs package.json.

Mapping:

NPM Concept Bazel Concept
package.json WORKSPACE / MODULE.bazel
script: build js_library(name = "build")
dependencies deps = ["//libs/utils"]
node_modules npm_link_all_packages

Code Example (BUILD.bazel):

load("@aspect_rules_js//js:defs.bzl", "js_library")

js_library(
    name = "pkg",
    srcs = ["index.js"],
    deps = [
        "//:node_modules/lodash",
        "//libs/utils"
    ],
)


5. Anti-Patterns & Gotchas

❌ Anti-Pattern 1: Phantom Dependencies

What it looks like:

  • import foo from 'foo' works locally but fails in CI.

Why it fails:

  • 'foo' is hoisted by the package manager but not listed in package.json.

Correct approach:

  • Use pnpm (Strict mode). It prevents accessing undeclared dependencies via symlinks.

❌ Anti-Pattern 2: Circular Dependencies

What it looks like:

  • Lib A imports Lib B. Lib B imports Lib A.
  • Build fails with "Maximum call stack exceeded" or "Undefined symbol".

Why it fails:

  • Logic error in architecture.

Correct approach:

  • Extract Shared Code: Move common logic to Lib C.
  • A → C, B → C.
  • Use madge tool to detect circular deps: npx madge --circular .

❌ Anti-Pattern 3: Committing node_modules

What it looks like:

  • Git repo size is 2GB.

Why it fails:

  • Slow clones. Platform specific binaries break.

Correct approach:

  • .gitignore must include node_modules/, dist/, .turbo/, .next/.


7. Quality Checklist

Performance:

  • [ ] Cache: Remote caching enabled and verified (Hit rate > 80%).
  • [ ] Parallelism: Tasks run in parallel where possible (Topology aware).
  • [ ] Size: Production artifacts minified and tree-shaken.

Reliability:

  • [ ] Lockfile: pnpm-lock.yaml / package-lock.json is consistent.
  • [ ] CI: Builds pass on clean runner (no cache).
  • [ ] Determinism: Same inputs = Same hash.

Maintainability:

  • [ ] Scripts: package.json scripts standardized (dev, build, test, lint).
  • [ ] Graph: Dependency graph is acyclic (DAG).
  • [ ] Scaffolding: Generators set up for new libraries/apps.

Examples

Example 1: Enterprise Monorepo Migration

Scenario: A 500-developer company with 4 React applications and 15 shared libraries wants to migrate from separate repos to a monorepo to improve code sharing and CI efficiency.

Migration Approach:

  1. Tool Selection: Chose Nx for enterprise features and graph visualization
  2. Dependency Mapping: Used madge to visualize current dependencies between projects
  3. Module Boundaries: Defined clear layers (ui, utils, data-access, features)
  4. Build Optimization: Configured remote caching with Nx Cloud

Migration Results:

  • CI build time reduced from 45 minutes to 8 minutes (82% improvement)
  • Code duplication reduced by 60% through shared libraries
  • Affected builds only test changed projects (often under 1 minute)
  • Clear architectural boundaries enforced by Nx project inference

Example 2: Webpack to Rspack Migration

Scenario: A large e-commerce platform has slow production builds (12 minutes) due to complex Webpack configuration and wants to improve developer experience.

Migration Strategy:

  1. Incremental Migration: Started with development builds, kept Webpack for production temporarily
  2. Config Translation: Mapped Webpack loaders to Rspack equivalents
  3. Plugin Compatibility: Used rspack-plugins for webpack-compatible plugins
  4. Verification: Ran parallel builds to verify output equivalence

Performance Comparison: | Metric | Webpack | Rspack | Improvement | |--------|---------|--------|-------------| | Dev server start | 45s | 2s | 96% | | HMR update | 8s | 0.5s | 94% | | Production build | 12m | 2m | 83% | | Bundle size | 2.4MB | 2.3MB | 4% |

Example 3: Distributed CI Pipeline with Sharding

Scenario: A gaming company with 5,000 E2E tests needs to reduce CI time from 90 minutes to under 15 minutes for fast feedback.

Pipeline Design:

  1. Test Analysis: Categorized tests by duration and parallelism potential
  2. Shard Strategy: Split tests into 20 shards, each running ~250 tests
  3. Smart Scheduling: Used Nx affected to only run tests for changed features
  4. Resource Optimization: Configured auto-scaling runners for parallel execution

CI Pipeline Configuration:

# GitHub Actions with Playwright sharding
- name: Run E2E Tests
  run: |
    npx playwright test --shard=${{ matrix.shard }}/${{ matrix.total }} \
      --config=playwright.config.ts
  strategy:
    matrix:
      shard: [1, 2, ..., 20]
    max-parallel: 10

Results:

  • E2E test time: 90m → 12m (87% improvement)
  • Developer feedback loop under 15 minutes
  • Reduced cloud CI costs by 30% through better parallelism

Best Practices

Monorepo Architecture

  • Define Clear Boundaries: Establish and enforce project boundaries from day one
  • Use Strict Dependency Rules: Prevent circular dependencies and enforce directionality
  • Automate Project Creation: Use generators for consistent new project setup
  • Version Packages Together: Use Changesets or Lerna for coordinated releases
  • Document Dependencies: Maintain architecture decision records for changes

Build Performance

  • Profile Before Optimizing: Use tools like speed-measure-webpack-plugin to identify bottlenecks
  • Incremental Builds: Configure build tools to only rebuild what's necessary
  • Parallel Execution: Use available CPU cores for parallel task execution
  • Caching Strategies: Implement aggressive caching at every layer
  • Dependency Optimization: Prune unused dependencies regularly (bundlephobia)

CI/CD Excellence

  • Fail Fast: Order tests to run fast tests first, catch failures quickly
  • Sharding Strategy: Distribute tests across multiple runners intelligently
  • Cache Everything: Dependencies, build outputs, test results
  • Conditional Execution: Only run jobs that are affected by the change
  • Pipeline as Code: Version control CI configuration alongside code

Tool Selection

  • Match Tool to Ecosystem: Don't force tools that don't fit your stack
  • Evaluate Migration Cost: Consider total cost, not just performance gains
  • Community Health: Choose tools with active maintenance and community support
  • Plugin Ecosystem: Ensure required integrations are available
  • Team Familiarity: Consider learning curve and team adoption

Security and Compliance

  • Secret Scanning: Never commit secrets; use automated scanning
  • Dependency Auditing: Regular vulnerability scans with automated fixes
  • Access Control: Limit CI credentials to minimum required permissions
  • Build Reproducibility: Ensure builds can be reproduced from source
  • Audit Logging: Maintain logs of all build and deployment activities