Skills · Coding

Bazel Build Optimization

Unverified30/40

Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.

Originally by wshobson · MIT

Claude CodePartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
CursorPartialPlain prose you can paste in — but no Cursor rules file
CodexPartialPlain prose you can paste in — but no AGENTS.md
Gemini CLIPartialPlain prose you can paste in
CopilotPartialPlain prose you can paste in — but no Copilot instructions file
npx agentalley add bazel-build-optimization

This command does not work yet — the CLI is still being built. Until then, use Raw in the reader below to take the file.

Who is stuck, and on what

Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.

The whole source

No sign-in, no blur, nothing truncated
bazel-build-optimization/SKILL.md70 lines2.0 KBRawView on GitHub
Frontmatter — 2 properties
namebazel-build-optimization
descriptionOptimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
1---
2name: bazel-build-optimization
3description: Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
4---A5No allowed-tools declared — no way to tell what this skill may touch
5 
6# Bazel Build Optimization
7 
8Production patterns for Bazel in large-scale monorepos.
9 
10## When to Use This Skill
11 
12- Setting up Bazel for monorepos
13- Configuring remote caching/execution
14- Optimizing build times
15- Writing custom Bazel rules
16- Debugging build issues
17- Migrating to Bazel
18 
19## Core Concepts
20 
21### 1. Bazel Architecture
22 
23```
24workspace/
25├── WORKSPACE.bazel # External dependencies
26├── .bazelrc # Build configurations
27├── .bazelversion # Bazel version
28├── BUILD.bazel # Root build file
29├── apps/
30│ └── web/
31│ └── BUILD.bazel
32├── libs/
33│ └── utils/
34│ └── BUILD.bazel
35└── tools/
36 └── bazel/
37 └── rules/
38```
39 
40### 2. Key Concepts
41 
42| Concept | Description |
43| ----------- | -------------------------------------- |
44| **Target** | Buildable unit (library, binary, test) |
45| **Package** | Directory with BUILD file |
46| **Label** | Target identifier `//path/to:target` |
47| **Rule** | Defines how to build a target |
48| **Aspect** | Cross-cutting build behavior |
49 
50## Templates and detailed worked examples
51 
52Full template library and detailed worked examples live in `references/details.md`. Read that file when you need the concrete templates.
53 
54## Best Practices
55 
56### Do's
57 
58- **Use fine-grained targets** - Better caching
59- **Pin dependencies** - Reproducible builds
60- **Enable remote caching** - Share build artifacts
61- **Use visibility wisely** - Enforce architecture
62- **Write BUILD files per directory** - Standard convention
63 
64### Don'ts
65 
66- **Don't use glob for deps** - Explicit is better
67- **Don't commit bazel-\* dirs** - Add to .gitignore
68- **Don't skip WORKSPACE setup** - Foundation of build
69- **Don't ignore build warnings** - Technical debt
70 

Reviews

Installed this one?Write the first review and take the Trailblazer badge.

Reviews only open after a real install, so this is empty — and we leave it empty rather than invent one.

Alternatives

Also in Coding