Generated banner for Bazel Build Optimization
Generated logo for Bazel Build Optimization

Bazel Build Optimization

Seth HobsonCommunityCreated by Seth Hobson

  • Skill
  • Tool integration
  • Software development
  • MIT
  • No issues found

From the author

Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.
— the description by Seth Hobson

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a set of guidelines, configuration templates, and best practices for managing Bazel build systems. It covers the core architecture of Bazel, including workspace setup, target management, and remote caching configurations. The content is designed to assist developers in structuring their monorepos, defining build rules for various languages, and implementing performance-oriented build settings.

What it does

  • Defines patterns for structuring Bazel workspaces and packages
  • Provides templates for WORKSPACE and .bazelrc configuration files
  • Offers examples for defining TypeScript and Python build targets
  • Outlines best practices for dependency management and build caching
  • Explains core Bazel concepts like labels, rules, and aspects

When to use it

  • When setting up a new Bazel workspace for a monorepo
  • When configuring remote caching or remote execution for build performance
  • When writing or refactoring custom Bazel build rules
  • When migrating an existing codebase to use Bazel
  • When debugging build issues or optimizing build times

Advantages

  • Provides concrete configuration templates for immediate use
  • Encourages standard conventions for build file organization
  • Facilitates reproducible builds through dependency pinning
  • Helps improve build efficiency via caching strategies

Usage examples

“Show me how to configure remote caching in my .bazelrc file.”
The agent provides the specific build flags for remote cache URLs, timeout settings, and local cache paths.
“How should I structure a TypeScript library in a Bazel monorepo?”
The agent provides a BUILD.bazel template using ts_project and js_library rules with appropriate dependency linking.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/wshobson/bazel-build-optimization/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip bazel-build-optimization.zip -d .agents/skills

Documentation by Seth Hobson

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

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

Files

SKILL.md

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

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

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Seth Hobson
Publisher
Seth Hobson (Community)
Source
wshobson/agents · plugins/developer-essentials/skills/bazel-build-optimization · commit 4bde316
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Seth Hobson or Seth Hobson.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download bazel-build-optimization.zip