Bazel Build Optimization
Seth HobsonCommunityCreated by Seth Hobson
- Skill
- Tool integration
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a set of guidelines, configuration templates, and best practices for managing Bazel build systems. It covers the core architecture of Bazel, including workspace setup, target management, and remote caching configurations. The content is designed to assist developers in structuring their monorepos, defining build rules for various languages, and implementing performance-oriented build settings.
What it does
- Defines patterns for structuring Bazel workspaces and packages
- Provides templates for WORKSPACE and .bazelrc configuration files
- Offers examples for defining TypeScript and Python build targets
- Outlines best practices for dependency management and build caching
- Explains core Bazel concepts like labels, rules, and aspects
When to use it
- When setting up a new Bazel workspace for a monorepo
- When configuring remote caching or remote execution for build performance
- When writing or refactoring custom Bazel build rules
- When migrating an existing codebase to use Bazel
- When debugging build issues or optimizing build times
Advantages
- Provides concrete configuration templates for immediate use
- Encourages standard conventions for build file organization
- Facilitates reproducible builds through dependency pinning
- Helps improve build efficiency via caching strategies
Usage examples
- “Show me how to configure remote caching in my .bazelrc file.”
- The agent provides the specific build flags for remote cache URLs, timeout settings, and local cache paths.
- “How should I structure a TypeScript library in a Bazel monorepo?”
- The agent provides a BUILD.bazel template using ts_project and js_library rules with appropriate dependency linking.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/wshobson/bazel-build-optimization/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip bazel-build-optimization.zip -d .agents/skills
Documentation by Seth Hobson
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
Files
- ATTRIBUTION.mdAdded by AutoGineer1012 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md2.0 KiB
- references/details.md7.5 KiB
SKILL.md
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
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Seth Hobson
- Publisher
- Seth Hobson (Community)
- Source
- wshobson/agents · plugins/developer-essentials/skills/bazel-build-optimization · commit 4bde316
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Seth Hobson or Seth Hobson.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download bazel-build-optimization.zip