Bazel Build Optimization skill for Claude
Optimize Bazel builds for large-scale monorepos.
When Claude uses it
Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
Bazel Build Optimization SKILL.md
The full skill file from wshobson/agents (MIT).
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 references/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
How to install Bazel Build Optimization
Claude Code
Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):
npx degit wshobson/agents/plugins/developer-essentials/skills/bazel-build-optimization#main ~/.claude/skills/bazel-build-optimizationCodex
npx degit wshobson/agents/plugins/developer-essentials/skills/bazel-build-optimization#main ~/.codex/skills/bazel-build-optimizationClaude.ai and Claude Desktop
Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.
Frequently asked questions
+What does the Bazel Build Optimization skill do?
Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
+How do I install Bazel Build Optimization in Claude Code?
Copy the skill folder into ~/.claude/skills/bazel-build-optimization, for example with "npx degit wshobson/agents/plugins/developer-essentials/skills/bazel-build-optimization#main ~/.claude/skills/bazel-build-optimization". Claude Code loads it automatically and uses it when a task matches.
+Does Bazel Build Optimization work with ChatGPT or Codex?
Yes. Bazel Build Optimization uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/bazel-build-optimization. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.
+Is Bazel Build Optimization free?
Bazel Build Optimization is published on GitHub by wshobson under the MIT license, which allows free use.