wshobson avatar

Bazel Build Optimization

For teams running multi-language monorepos at scale, this handles the gnarly parts of Bazel configuration that usually take weeks to figure out. It covers remote caching setup, proper .bazelrc tuning for CI/CD, and cross-language dependency management between TypeScript, Python, and other ecosystems. The custom rule templates and query examples are especially useful when you're debugging why builds are slow or writing your own tooling. Most teams underestimate Bazel's complexity until they hit performance walls, and this gives you the production patterns that Google-scale companies actually use rather than basic tutorials.

skills.sh installs
10.6K
GitHub stars
42.4K
last updated
Aug 21, 2026

Install

$ npx -y skills add wshobson/agents --skill bazel-build-optimization --agent claude-code

Installs into .claude/skills of the current project.

Files

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

ConceptDescription
TargetBuildable unit (library, binary, test)
PackageDirectory with BUILD file
LabelTarget identifier //path/to:target
RuleDefines how to build a target
AspectCross-cutting build behavior

Templates and detailed worked examples

Sponsors

Details

Repository
github.com/wshobson/agents
Categories
DevOps & CI/CD, Debugging

More from wshobson/agents

All 174
1rorkai avatarasc-build-lifecyclerorkai/app-store-connect-cli-skillsTrack build processing, find latest builds, and clean up old builds with asc. Use when managing build retention or waiting on processing.7.6Kskills.sh installs
2anthropics avatarbuild-mcpbanthropics/claude-plugins-officialThis skill should be used when the user wants to "package an MCP server", "bundle an MCP", "make an MCPB", "ship a local MCP server", "distribute a local MCP", 6.9Kskills.sh installs
3inferen-sh avatarai-content-pipelineinferen-sh/skills6.3Kskills.sh installs
4inferen-sh avatarai-rag-pipelineinferen-sh/skills6.3Kskills.sh installs
5anthropics avatarincident-responseanthropics/knowledge-work-pluginsRun an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs sev6Kskills.sh installs
6affaan-m avatarorch-pipelineaffaan-m/eccShared orchestration engine for the orch-* skill family. Defines the gated Research-Plan-TDD-Review-Commit pipeline, the size classifier, the agent map, and the4.8Kskills.sh installs