bazel-build-optimization — Claude Code skill
This skill helps configure Bazel for monorepos, remote execution, and build caching. Use it when build setup or debugging needs a clear Bazel workflow.
/plugin marketplace add wshobson/agents
/plugin install developer-essentials@claude-code-workflowsWhat bazel-build-optimization does
bazel-build-optimization covers Bazel setup for large monorepos. It explains how to arrange WORKSPACE.bazel, .bazelrc, .bazelversion, and BUILD.bazel, then work with packages, targets, labels, rules, and aspects. The skill also addresses Bazel migration, custom rules, build warnings, and build failures.
Its guidance favors fine-grained targets for better caching, pinned dependencies for reproducible builds, remote caching, and deliberate visibility settings. Worked templates and detailed examples are stored in references/details.md; read that file when you need concrete patterns. The project needs Bazel and its standard configuration files.
Install it when you are configuring or migrating a Bazel monorepo. It has little to add to a project that does not use Bazel.
What it helps with
- set up Bazel for a monorepo
- enable remote caching and execution
- trace a slow Bazel build
- write a custom Bazel rule
- debug a build failure
Example prompts for the agent
- Set up Bazel for this monorepo and inspect `WORKSPACE.bazel`.
- Find the cause of the slow build and suggest finer-grained targets for caching.
- Create a custom Bazel rule using the templates in `references/details.md`.
How to install bazel-build-optimization
1Plugin marketplace
/plugin marketplace add wshobson/agents/plugin install developer-essentials@claude-code-workflowsThis installs the whole developer-essentials plugin with all its skills
2Skills CLI (Vercel)
npx skills add wshobson/agents --skill bazel-build-optimization -a claude-code3Manually: put the files in place
~/.claude/skills/bazel-build-optimization/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/bazel-build-optimization/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill bazel-build-optimization -a codex2Manually: put the files in place
.agents/skills/bazel-build-optimization/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshobson/agents --skill bazel-build-optimization -a cursor2Manually: put the files in place
.cursor/skills/bazel-build-optimization/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshobson/agents bazel-build-optimization2Manually: put the files in place
.github/skills/bazel-build-optimization/SKILL.mdPlatform CLI
gemini skills install https://github.com/wshobson/agents --path plugins/developer-essentials/skills/bazel-build-optimizationManually: put the files in place
.devin/skills/bazel-build-optimization/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set213
The whole set →Similar
Questions about bazel-build-optimization
How do I install bazel-build-optimization in Claude Code?
Run npx skills add wshobson/agents --skill bazel-build-optimization -a claude-code. The skill file is placed at ~/.claude/skills/bazel-build-optimization/SKILL.md.
What does bazel-build-optimization do?
It guides Bazel configuration, remote caching and execution, build debugging, monorepo migration, and custom rule authoring.
Which Bazel files does it cover?
It covers the roles of WORKSPACE.bazel, .bazelrc, .bazelversion, and BUILD.bazel, including per-directory BUILD files.
Source text
SKILL.md · MIT
---
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 `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
© Seth Hobson · MIT · wshobson/agents