Optimize Bazel builds for large-scale monorepos
Bazel build optimization

Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
--- 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
Overview
Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.
Manual install (npx, ZIP)
Claude Code
npx skills add wshobson/agents --skill bazel-build-optimization -g -a claude-codeClaude Code (manual)
mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \
| tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/developer-essentials/skills/bazel-build-optimizationWindows (PowerShell)
New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/33229c94e993191f3cd1/bazel-build-optimization.zip" -OutFile "$env:TEMP\bazel-build-optimization.zip"; Expand-Archive "$env:TEMP\bazel-build-optimization.zip" -DestinationPath "$HOME\.claude\skills" -ForceClaude.ai / desktop
Codex, Cursor, other agents
Connects with Agent Alley MCP · agentalley.io/mcp
Files included
SKILL.md2.0 KBreferences/1 file · 7.5 KB
Read the files here
SKILL.md
Show the full text70 lines
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
| 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 |
Details
- Updated
- Sep 21, 2026
- License
- MIT
- Stars on the repo
- ★ 39,857
- Checked
- Source
- wshobson/agents ↗
- Creator
- wshobson · 179 listings
Similar skills
See all →
SkillExtract text, tables, metadataXberg Document Extraction
SkillMove code from one implementation to another functionCode migration
SkillManages Ahrefs API usage in Python using ahrefs-python
MCPDocx LLM translatoradeu
SkillCreate an Amazon-compliant white-background main imageAmazon White-Background Main Image · 亚马逊白底主图
MCPOfficial monorepo of SDKs, CLISendmux sdkMore from wshobson
SkillMaster C/.NET backend development patterns for building
SkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliance
SkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Design
SkillMigrate from AngularJS to Angular using hybrid modeAngular migration
SkillUnderstand anti-reversing, obfuscationAnti reversing techniques
SkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patterns