{"id":"bazel-build-optimization","name":"bazel-build-optimization","summary":"大規模なモノレポ向けにBazelビルドを最適化しましょう。Bazelの設定、リモート実行の実装、エンタープライズコードベースのビルドパフォーマンス最適化時に利用してください。","body":"# Bazel Build Optimization\n\nProduction patterns for Bazel in large-scale monorepos.\n\n## When to Use This Skill\n\n- Setting up Bazel for monorepos\n- Configuring remote caching/execution\n- Optimizing build times\n- Writing custom Bazel rules\n- Debugging build issues\n- Migrating to Bazel\n\n## Core Concepts\n\n### 1. Bazel Architecture\n\n```\nworkspace/\n├── WORKSPACE.bazel       # External dependencies\n├── .bazelrc              # Build configurations\n├── .bazelversion         # Bazel version\n├── BUILD.bazel           # Root build file\n├── apps/\n│   └── web/\n│       └── BUILD.bazel\n├── libs/\n│   └── utils/\n│       └── BUILD.bazel\n└── tools/\n    └── bazel/\n        └── rules/\n```\n\n### 2. Key Concepts\n\n| Concept     | Description                            |\n| ----------- | -------------------------------------- |\n| **Target**  | Buildable unit (library, binary, test) |\n| **Package** | Directory with BUILD file              |\n| **Label**   | Target identifier `//path/to:target`   |\n| **Rule**    | Defines how to build a target          |\n| **Aspect**  | Cross-cutting build behavior           |\n\n## Templates and detailed worked examples\n\nFull template library and detailed worked examples live in `references/details.md`. Read that file when you need the concrete templates.\n\n## Best Practices\n\n### Do's\n\n- **Use fine-grained targets** - Better caching\n- **Pin dependencies** - Reproducible builds\n- **Enable remote caching** - Share build artifacts\n- **Use visibility wisely** - Enforce architecture\n- **Write BUILD files per directory** - Standard convention\n\n### Don'ts\n\n- **Don't use glob for deps** - Explicit is better\n- **Don't commit bazel-\\* dirs** - Add to .gitignore\n- **Don't skip WORKSPACE setup** - Foundation of build\n- **Don't ignore build warnings** - Technical debt","author":"@wshobson","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/wshobson/agents/tree/main/plugins/developer-essentials/skills/bazel-build-optimization","license":"MIT","category":"writing","lang":"en","tokens":442,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"references/details.md","size":7672,"sha256":"08a4c12a5c4dc9132e4ad9222e0cfe69ae363e5a74294ba4510eec39dceee133"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":["results.example.com"]}}