bazel

star 0

Bazel build system — MODULE.bazel (bzlmod), custom rules, test targets, Starlark scripting, CI integration, and remote caching. USE WHEN bazel, bazel build, MODULE.bazel, bzlmod, bazel rule, starlark, BUILD file, bazel test, bazel CI, bazel remote cache, bazel query, bazel run, bazel error, custom rule, bazel workspace, bazel dependency.

larsboes By larsboes schedule Updated 5/13/2026

name: Bazel description: "Bazel build system — MODULE.bazel (bzlmod), custom rules, test targets, Starlark scripting, CI integration, and remote caching. USE WHEN bazel, bazel build, MODULE.bazel, bzlmod, bazel rule, starlark, BUILD file, bazel test, bazel CI, bazel remote cache, bazel query, bazel run, bazel error, custom rule, bazel workspace, bazel dependency."

Bazel

Hermetic build system with caching, reproducibility, and custom rules via Starlark.

Quick Reference

  • Module file: MODULE.bazel — declares deps (WORKSPACE removed in Bazel 9)
  • Build files: BUILD.bazel — targets per package
  • Rules: Starlark (Python-like, deterministic, no I/O in analysis)
  • Tests: Rule produces script, exit 0 = pass, non-zero = fail
  • Caching: Same inputs = instant skip. Remote cache shares across CI jobs.
  • Formatter: buildifier -r . — mandatory for clean .bzl files
  • Query: bazel query "deps(//target)" — explore the dependency graph

References

Need File
MODULE.bazel, BCR, deps, .bazelversion references/bzlmod.md
Writing custom test rules (Starlark) references/custom-rules.md
GitLab CI, remote cache, Docker tests references/ci-integration.md
Bazel 7/8/9 changes, style guide, queries, perf references/modern-principles.md

Scripts

Script Purpose
scripts/bazel-debug.sh Query deps, rdeps, changed targets, profile builds
scripts/bazel-init.sh Bootstrap a new project with MODULE.bazel + .bazelrc

External References

Install via CLI
npx skills add https://github.com/larsboes/PAI --skill bazel
Repository Details
star Stars 0
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator