Skip to content
cccskills
FreePublished on GitHubEnglish overview

Bazel usage

Follow the Carbon project's Bazel workflow through Bazelisk, a version-managing launcher. Learn commands for building targets, running tests and binaries, enabling AddressSanitizer, and refreshing cached state after system dependency changes.

OriginalShow the original description

Instructions that **MUST** be followed when using Bazel or Bazelisk to build, test, and debug in the Carbon repository.

carbon-language/carbon-lang33,929 stars(GitHub 33,929 + cccskills 0)

Run score Not tested

See how to install

Good for

  • Building a Carbon target
  • Running focused project tests
  • Launching a Bazel-built binary
  • Testing with AddressSanitizer

Overview

What it does

This skill explains how to build, test, and run software in the Carbon project with Bazel. The project uses bazelisk to keep Bazel versions consistent, so commands should use bazelisk rather than calling bazel directly. It provides commands for building or testing the whole project and for focusing on targets such as the toolchain or examples. It also explains how to start binaries with bazelisk run, enable AddressSanitizer (ASan) for tests, and rebuild cached state after changes to system dependencies.

When it helps

Use it when you have changed Carbon code and want to check it with a build or tests. It can also help when you are unsure which command to use, or need to rebuild after changing system dependencies.

Example requests

  • “Run the tests related to this toolchain change.”
  • “Launch the Carbon driver through Bazel.”
  • “Show me the command to run tests with ASan enabled.”

Notes

Use bazelisk in the Carbon project. If it is not installed, ./scripts/run_bazelisk.py is available. The skill does not describe special procedures for Jujutsu.

This overview was written by AI (OpenAI Codex) from the public SKILL.md. Check the original below for the exact behavior.

Document check

AI checked the SKILL.md for operations that need care and for setup requirements. The score comes only from actually running the skill (hands-on test).

SafetyAre sending data, deleting files, and running commands disclosed?
AGoodBuild and test commands are scoped; no destructive operations are instructed.
Easy setupDoes it need few tools or API keys, and are they documented?
BPartly lackingBazelisk is required; the document only names a fallback script if absent.

Not counted in the score. Rated by AI (OpenAI Codex) as of Oct 26, 2026. Treat it as a guide and read the original before installing.

Disagree? Request a re-evaluation

Tell us which point is wrong and why. No login needed. We will check it against the SKILL.md, redo the evaluation, and show the result here.

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

Files included (1)

  • SKILL.md2.8 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Bazel usage

<!-- Part of the Carbon Language project, under the Apache License v2.0 with LLVM Exceptions. See /LICENSE for license information. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->

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 bazelisk whenever you want to run Bazel. Never run bazel directly in the Carbon project. Anything you want to do with bazel can be done with the bazelisk command instead.

  • Bazelisk: Try to use bazelisk in your existing $PATH if available.
    • run_bazelisk.py: If bazelisk isn't available, use ./scripts/run_bazelisk.py to 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:

Running binaries built by Bazel

[!IMPORTANT] Always manually run binaries built by Bazel using the bazelisk run command. Never run the binary directly from bazel-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 clean to force cached state to be rebuilt when environment changes occur.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Use this skill to read GitHub issue details and comments from the command line with `gh`. It covers issues referenced by number or URL, including issues in other repositories, and keeps access read-only so issue state is not changed.

  • Reading an issue and its full comment history
  • Opening an issue referenced by URL
  • Viewing an issue from another repository
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Agent tools

FreeSummary

Use this skill to guide an AI assistant working in the Carbon repository on viewing, searching, and editing files with specialized environment tools. It also sets rules for temporary files and when custom programs may be used.

  • Choosing approved tools to view, search, or edit files
  • Checking where temporary analysis and test files belong
  • Deciding when a custom transformation program is allowed
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Use this skill to implement builtin functions in the Carbon compiler, from registering a function name and checking its signature to evaluating constant calls and generating LLVM IR for runtime calls. It also covers prelude bindings and focused tests.

  • Registering a new Carbon builtin function
  • Adding compile-time evaluation behavior
  • Lowering runtime builtins to LLVM IR
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Code style

FreeSummary

Apply Carbon toolchain conventions for formatting Bazel, C++, Carbon, Markdown, and Python files. The skill also covers clear comments and documentation, accurate names, design choices, and concise commit descriptions.

  • Formatting a changed source file
  • Writing or revising code comments
  • Choosing names that match their meaning
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

Diagnostics

FreeSummary

Use this skill to add or revise diagnostics in the Carbon toolchain. It explains how to register message kinds, format typed arguments, attach source labels and context, and verify that diagnostics follow the project’s wording and test coverage rules.

  • Adding an error or warning to the Carbon compiler
  • Attaching source locations and explanatory labels
  • Checking diagnostic wording and formatting conventions
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

GitHub CLI usage

FreeSummary

Use `gh`, the GitHub command-line tool, to list, inspect, and search issues, pull requests, repositories, and code. The skill also explains read-only REST and GraphQL queries, pagination, and ways to filter or format returned data.

  • Checking an issue or pull request
  • Searching issues, code, or repositories
  • Querying GitHub data with the API
carbon-language/carbon-lang33.9KUpdated Oct 26, 2026

See all skills by carbon-language

Report a problem with this skill