Bazel Build Optimization

SkillAI & models

Bazel build optimization is a skill that guides an AI agent through configuring Bazel for large monorepos. It covers workspace setup, remote caching and execution, custom rules, and build performance tuning. The agent uses its patterns and reference examples to help you set up and speed up Bazel builds in enterprise codebases.

Use Bazel Build Optimization in Claude, ChatGPT or Ahel Desktop

Free. Sign in, add Bazel Build Optimization and connect your AI. About a minute.

Also: Claude Code · Cursor · Codex

Then ask your AI: use the Bazel Build Optimization skill

Details

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Have a Bazel project or monorepo that you want to configure or speed up.

Bazel Build OptimizationStart free

What your AI can do with it

  • Set up Bazel workspaces for monorepos
  • Configure remote caching and remote execution
  • Write custom Bazel rules
  • Optimize build times with fine-grained targets
  • Debug Bazel build issues
  • Migrate an existing build to Bazel

Getting started

  1. Have a Bazel project or monorepo that you want to configure or speed up.
  2. Add the skill to your agent so it can read the Bazel patterns and reference file.
  3. Ask the agent to review your WORKSPACE.bazel, .bazelrc, and BUILD files.
  4. Have the agent apply the templates and best practices to your build configuration.
  5. Run your Bazel build and check that caching and target setup work as intended.

What this skill tells your AI

The instructions your AI receives, as published by wshobson/agents in plugins/developer-essentials/skills/bazel-build-optimization/SKILL.md and read by ahel’s review.

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

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

Signals

GitHub stars
40k
Forks
4k
Last commit
Sep 2026

Questions

When should I use this skill?
Use it when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
Does it support remote caching and execution?
Yes. The skill includes patterns for configuring remote caching and remote execution in large monorepos.
Can it help write custom Bazel rules?
Yes. It provides patterns and worked examples for writing custom Bazel rules.
Where are the templates and worked examples?
They live in a reference file called references/details.md, which the agent reads when concrete templates are needed.
Advanced
Item type
skill
Key
bazel-build-optimization-wshobson
Source
github.com/wshobson/agents