Bazel Build Optimization

Bazel Build Optimization

Guides an agent through configuring and speeding up Bazel builds in large monorepos, including remote caching, remote execution and custom rules.

Skill files2 files

references/

SKILL.md70 lines
1
---
2
name: bazel-build-optimization
3
description: Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
4
---
5
6
# Bazel Build Optimization
7
8
Production 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
```
24
workspace/
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
52
Full 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

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 11,632 prompts

More by @OpenSourceBuffGuy

See all
Anime streetwear couple in polos and retro sneakers prompt image

Anime streetwear couple in polos and retro sneakers

Draws a stylish anime couple in polos and retro sneakers from a low angle, with outfit, lighting and negative prompt sections.

image-prompt, anime, couple, fashion, footwear, man, woman, character-design, cinematic, low-angle, full-body, dramatic-lighting, editorial, luxury, digital-art, illustration, negative-prompt, vertical-format, fashion-shoot, nano-banana, for-artists

Cinematic Street Photography Portrait prompt image

Cinematic Street Photography Portrait

Makes a cinematic street portrait of you holding a poster board with a single pencil sketch of yourself, keeping your face from a reference photo.

image-prompt, reference-image, face-reference, gpt-image, photorealistic, cinematic, street-photography, portrait, man, sketch, bokeh, natural-light, vertical-format, placeholders, editorial, for-content-creators, for-photographers, full-body, guardrails, cityscape

Team Communication Protocols prompt image

Team Communication Protocols

Defines messaging protocols for agent teams: choosing direct message versus broadcast, plan approval, graceful shutdown and anti-patterns that break coordination.

agent-skill, multi-agent, orchestrator, ai-agents, human-in-the-loop, json-output, best-practices, troubleshooting, communication, teamwork, claude-code, for-developers, for-prompt-engineers, long-form, advanced, guardrails, conditional-logic, structured-output, tool-use, context-engineering

Reviews

Loading reviews…

Discussion

Loading comments…