Code style

Enforce Carbon project code style across Bazel, C++, Carbon, Markdown, and Python files.

33.9k|1.7k|Updated Apr 27, 2020
One-click install
npx skills add https://github.com/carbon-language/carbon-lang --skill code-style-carbon-language
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Code style
Source: https://github.com/carbon-language/carbon-lang/tree/main/.agents/skills/code_style
Command: npx skills add https://github.com/carbon-language/carbon-lang --skill code-style-carbon-language

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Carbon projects risk inconsistent formatting across languages and tooling. This Skill codifies standard formatting rules and references to ensure uniform style and reduce code-review effort.

Core Features & Use Cases

  • Formatting guidelines for Bazel, C++, Carbon, Markdown, and Python files.
  • Centralized references to official style guides and recommended tooling.
  • Use cases include aligning new code to project standards and validating existing code via pre-commit hooks.

Quick Start

Format code in a repository to match Carbon style by applying the project’s pre-commit hooks and referencing the style guidelines.

Frequently Asked Questions about Code style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce Carbon code style guidelines across multiple languages?

To enforce Carbon code style across multiple languages, apply the project's centralized pre-commit hooks. This automatically validates Bazel, C++, Carbon, Markdown, and Python files against standard formatting rules before changes are committed.

What formatting commands are used for C++ and Python files in the Carbon toolchain?

Formatting C++ and Python files in the Carbon toolchain uses concrete commands referenced by the official style guides. These centralized commands ensure uniform formatting consistency across the repository without manual code-review effort.

Why do I need pre-commit hooks for Bazel and Markdown formatting?

Pre-commit hooks for Bazel and Markdown formatting are needed to validate existing code and align new code to project standards automatically. This ensures formatting consistency across the repository before any code is committed.

Can I use standard linting tools to meet Carbon coding standards?

Yes, you can use standard linting tools to meet Carbon coding standards. The Skill provides centralized references to official style guides and recommended tooling, ensuring your standard linting setup aligns with the project's formatting rules.

What is the best way to format code to match Carbon style guidelines?

The best way to format code to match Carbon style guidelines is by applying the project's pre-commit hooks. This approach codifies standard formatting rules for multiple languages, ensuring uniform style and reducing code-review effort.

Does the Carbon style guide cover Bazel build files?

Yes, the Carbon style guide explicitly covers Bazel build files. The Skill enforces formatting consistency by including concrete formatting commands and style references for Bazel, alongside C++, Carbon, Markdown, and Python files.