Bazel usage
SkillDev toolsThis skill gives your AI the required instructions for building, testing, and debugging the Carbon codebase. Once added, your AI can work in the Carbon repository using Bazelisk commands the way the project expects, so builds, tests, and debugging are done correctly.
Available today. Use it from your connected AI after setup.
No other account needed.
After adding the skill, ask your AI to build, test, or debug something in the Carbon repository. It will follow the required instructions from the start.
Then ask your AI: use the Bazel usage skill
What your AI can do with it
- Build the Carbon codebase with Bazelisk
- Run tests for the Carbon codebase
- Debug problems in the Carbon codebase
- Follow the required build and test steps the project expects
What this skill tells your AI
The instructions your AI receives, as published by carbon-language/carbon-lang in .agents/skills/bazel/SKILL.md and read by ahel’s review.
This skill documents how best to use Bazel when building, testing, or manipulating the Carbon repository's Bazel in any way.
Bazel wrappers
Carbon uses Bazel for its build system. To ensure consistent versions, the project uses Bazelisk.
[!IMPORTANT] Always use
bazeliskwhenever you want to run Bazel. Never runbazeldirectly in the Carbon project. Anything you want to do withbazelcan be done with thebazeliskcommand instead.
- Bazelisk: Try to use
bazeliskin your existing$PATHif available.run_bazelisk.py: Ifbazeliskisn't available, use./scripts/run_bazelisk.pyto run bazelisk without it being installed.
Essential commands
Building
- Build all:
bazelisk build //... - Build toolchain:
bazelisk build //toolchain/... - Build specific target:
bazelisk build //toolchain:carbon
Testing
- Test all:
bazelisk test //...:all - Test toolchain:
bazelisk test //toolchain/... - Test examples:
bazelisk test //examples/...
[!TIP] Running all of the tests can be slow, so try to narrowly test the immediately relevant parts of the project first, and only expand coverage as necessary to be confident in the changes.
[!TIP] For specialized instructions on testing and developing the Carbon toolchain, consult these skills:
- Toolchain tests: For authoring, structuring, and running
file_testtests.- Toolchain development: For architecture, essential commands, and debugging the toolchain.
Running binaries built by Bazel
[!IMPORTANT] Always manually run binaries built by Bazel using the
bazelisk runcommand. Never run the binary directly frombazel-bin/.
You can run the Carbon driver or command line directly via Bazel:
bazelisk run //toolchain -- compile --phase=parse toolchain/parse/testdata/basics/empty.carbon
Advanced configurations
AddressSanitizer (ASan)
To enable ASan for local testing:
- Pass
--config=asan:bazelisk test --config=asan //...
Common pitfalls and troubleshooting
bazel clean
Changes to packages installed on your system (like changing LLVM versions or
installing libc++) may not be noticed by Bazel.
- Run
bazelisk cleanto force cached state to be rebuilt when environment changes occur.
Signals
- GitHub stars
- 34k
- Forks
- 2k
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
bazel-usage- Source
- github.com/carbon-language/carbon-lang