mcpField
B
bazel-build-optimization

bazel-build-optimization

github.com/wshobsonDevelopment41.9k10.4k installsUpdated 2w ago
Repository

About bazel-build-optimization

A skill for applying production-oriented Bazel patterns in large monorepos. It helps engineers configure builds, improve build times, write rules, debug issues, and migrate to Bazel.

Key features

  1. 01Monorepo Bazel setup guidance
  2. 02Remote cache and execution configuration
  3. 03Build-time optimization patterns
  4. 04Custom rule and build debugging guidance
  5. 05Migration guidance and detailed templates

Use cases

  1. 01Setting up Bazel in a monorepo
  2. 02Sharing artifacts through remote caching
  3. 03Investigating slow or failing builds
  4. 04Migrating a project to Bazel

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/wshobson/agents --skill bazel-build-optimization

After installing, type/bazel-build-optimizationin Claude Code to confirm it loaded.

Bundled filesreferences/details.md

Details

From the project README

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

Comments

Markdown supported