OpenParable
Skip to content
← Back to skills

Code style

Development

Code style is an Agent Skill for development published in the carbon-language/carbon-lang repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Instructions for code formatting and style guidelines in the Carbon toolchain.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/carbon-language/carbon-lang/blob/HEAD/.agents/skills/code_style/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/code-style, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Code style

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