---
title: "Bazel ビルドを最適化する（エージェント用スキル） | Orchestor"
description: "大規模なモノレポ向けに Bazel ビルドを最適化します。Bazel の設定、リモート実行の導入、企業向けコードベースのビルド性能改善に使います。wshobson/agents が公開している「Bazel ビルドを最適化する」の使い方を確認できます。"
canonical_url: "https://www.orchestor.io/ja/skills/wshobson/agents/bazel-build-optimization"
markdown_url: "https://www.orchestor.io/ja/skills/wshobson/agents/bazel-build-optimization.md"
---

[c96b5f6](https://github.com/wshobson/agents/commit/c96b5f6552dba32e4492307493ee613581430715)[原文を開く](https://github.com/wshobson/agents/blob/c96b5f6552dba32e4492307493ee613581430715/plugins/developer-essentials/skills/bazel-build-optimization/SKILL.md)

wshobson2026/11/24

原文 (選択中)

未翻訳

プレビュー (選択中)

69 行（空行を除く 53 行） · 2.04 KB原文

```yaml
name: bazel-build-optimization
description: Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
```

# Bazel Build Optimization

Production patterns for Bazel in large-scale monorepos.

## When to Use This Skill

* Setting up Bazel for monorepos
* Configuring remote caching/execution
* Optimizing build times
* Writing custom Bazel rules
* Debugging build issues
* Migrating to Bazel

## Core Concepts

### 1\. Bazel Architecture

```
workspace/
├── WORKSPACE.bazel       # External dependencies
├── .bazelrc              # Build configurations
├── .bazelversion         # Bazel version
├── BUILD.bazel           # Root build file
├── apps/
│   └── web/
│       └── BUILD.bazel
├── libs/
│   └── utils/
│       └── BUILD.bazel
└── tools/
    └── bazel/
        └── rules/
```

### 2\. Key Concepts

| Concept     | Description                            |
| ----------- | -------------------------------------- |
| **Target**  | Buildable unit (library, binary, test) |
| **Package** | Directory with BUILD file              |
| **Label**   | Target identifier //path/to:target     |
| **Rule**    | Defines how to build a target          |
| **Aspect**  | Cross-cutting build behavior           |

## Templates and detailed worked examples

Full template library and detailed worked examples live in details.md. Read that file when you need the concrete templates.

## Best Practices

### Do's

* **Use fine-grained targets** \- Better caching
* **Pin dependencies** \- Reproducible builds
* **Enable remote caching** \- Share build artifacts
* **Use visibility wisely** \- Enforce architecture
* **Write BUILD files per directory** \- Standard convention

### Don'ts

* **Don't use glob for deps** \- Explicit is better
* **Don't commit bazel-\* dirs** \- Add to .gitignore
* **Don't skip WORKSPACE setup** \- Foundation of build
* **Don't ignore build warnings** \- Technical debt

## Structured data

```json
[
  [
    {
      "@context": "https://schema.org",
      "@type": "Organization",
      "name": "Orchestor",
      "url": "https://www.orchestor.io",
      "sameAs": [
        "https://orchestor.io",
        "https://www.orchestor.io",
        "https://docs.orchestor.io"
      ],
      "@id": "https://www.orchestor.io/#organization",
      "alternateName": [
        "オーケスター"
      ],
      "logo": "https://www.orchestor.io/images/common/ogp/orchestor-ogp.png",
      "parentOrganization": {
        "@type": "Organization",
        "name": "ドットメディア株式会社",
        "url": "https://www.dotmedia.co.jp"
      }
    },
    {
      "@context": "https://schema.org",
      "@type": "WebSite",
      "url": "https://www.orchestor.io",
      "name": "Orchestor",
      "description": "Orchestor で画像・動画・音声を作り、参照素材を Remix できます。",
      "@id": "https://www.orchestor.io/#website",
      "alternateName": [
        "オーケスター"
      ],
      "inLanguage": "ja",
      "publisher": {
        "@id": "https://www.orchestor.io/#organization"
      }
    }
  ],
  {
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "@id": "https://www.orchestor.io/skills/wshobson/agents/bazel-build-optimization#breadcrumb",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "Orchestor",
        "item": "https://www.orchestor.io/"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "スキル",
        "item": "https://www.orchestor.io/skills"
      },
      {
        "@type": "ListItem",
        "position": 3,
        "name": "Bazel ビルドを最適化する",
        "item": "https://www.orchestor.io/skills/wshobson/agents/bazel-build-optimization"
      }
    ]
  }
]
```

---

[Documentation index](https://www.orchestor.io/llms.txt)
