All skills
wshobson avatar

/bazel-build-optimization

@be57c0b
by Seth Hobsonwshobson/agents40k stars
4,281

Optimize Bazel builds for large-scale monorepos. Use when configuring Bazel, implementing remote execution, or optimizing build performance for enterprise codebases.

Use this Skill: https://skilld.dev/gh/wshobson/agents/bazel-build-optimization

This session only. Nothing lands on disk.

SKILL.md

β‰ˆ48 tokens always: the name and description. β‰ˆ468 when used: this file. β‰ˆ1.9k more on demand in 1 file.

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

Source: SKILL.md on GitHub

No alerts16d5 checks Β· Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides templates and best practices for optimizing Bazel build systems, including remote caching, custom rules, and multi-language support. No malicious patterns were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW Β· No issues

  • Runlayer6mo

    1 file scanned Β· No issues

  • ZeroLeaks5mo

    Score: 93/100 Β· 2 sections analyzed

Signed by skilld at be57c0b. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 4 months ago
  • bazel
  • monorepo
  • build-optimization
  • remote-caching
  • remote-execution
  • bazel-rules
  • build-performance
  • enterprise

README badge

README badge for wshobson/agents/bazel-build-optimization

Configures Bazel for large-scale monorepos with patterns for remote caching, custom rules, and build optimization. Covers workspace setup, dependency pinning, fine-grained targets, and debugging strategies for enterprise codebases.

Generated from the current SKILL.md.

Does this skill cover remote caching and execution setup?
Yes. The skill includes patterns for configuring remote caching and execution, which are core to optimizing build times in large monorepos.
What size codebase is this skill designed for?
Large-scale monorepos. The skill assumes enterprise-level codebases where build performance and reproducibility are critical concerns.
Does this skill include custom rule examples?
Yes. Writing custom Bazel rules is listed as a core use case, with detailed templates and worked examples referenced in the skill documentation.
Can I use this skill to migrate an existing project to Bazel?
Yes. Migration to Bazel is explicitly listed as a use case the skill addresses.

Generated from the current SKILL.md. These answers refresh after source changes.