Back to Carbon Lang

Code style

.agents/skills/code_style/SKILL.md

0.0.0-0.nightly.2026.05.061.4 KB
Original Source

Code style

<!-- 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 -->

License

Formatting

  • Bazel: Use pre-commit run buildifier --files <file.bzl> to format Bazel files.
  • C++: Use pre-commit run clang-format --files <file.cpp> to format C++ files.
  • Carbon: The toolchain's format command doesn't work well right now. Instead, try to format Carbon code based on other Carbon files and the C++ style.
  • Markdown: Use pre-commit run prettier --files <file.md> to format markdown files.
  • Python: Use pre-commit run black --files <file.py> to format Python files.

Style Guides