本文へ移動
cccskills
無料GitHub で公開日本語紹介

Code style

Carbonツールチェーンのコードを書く際に、言語ごとの整形方法やコメント、命名、ドキュメント、コミットメッセージの基準を確認できます。

原文原文の説明を見る

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

carbon-language/carbon-langスター 33,929(GitHub 33,929 + cccskills 0)

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • Carbonコードの書式を整えたいとき
  • コメントやドキュメントを見直したいとき
  • コードの名前が意味に合うか確認したいとき
  • 変更内容に沿ったコミット説明を書きたいとき

日本語での紹介

できること

Carbonツールチェーンのコードや文書を整える際の基準を確認できます。Bazel、C++、Markdown、Pythonでは、それぞれ指定されたフォーマッターやチェック方法を使います。Carbonコードは現状のformatコマンドがうまく動かないため、既存のCarbonコードやC++のスタイルを参考にします。コメントは現在のコードの動作や理由を説明し、説明文は要点から書く、といった方針のほか、名前を実際の役割や意味に合わせる考え方も含まれます。ドキュメントを変更後のコードと一致させること、設計でデータモデルを出力調整のために歪めないこと、コミット説明で成果を具体的に記すことも扱います。

こんなときに便利

Carbonツールチェーンのコードを新しく書いたり、既存部分を変更したりするときに役立ちます。コメントや名前、ドキュメント、コミット説明がプロジェクトの方針に沿っているか見直したい場合にも使えます。

使い方の例

  • 「このC++ファイルに適した整形方法を教えて」
  • 「このコメントと変数名が方針に合っているか確認して」
  • 「変更内容が伝わるコミット説明に整えて」

注意点

対象ごとに使うツールが異なります。C++はCarbon C++ Project Style Guide、MarkdownはGoogle developer documentation style guide、PythonはPEP 8を参照します。Carbonコード用のformatコマンドは現状うまく動かないとされています。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

資料チェック

SKILL.md の記述から、注意が要る操作と導入の前提を AI が確認しました。点数は実際に動かした結果(実行検証)だけで付けています。

安全面送信・削除・コマンド実行などの扱いが明示されているか
A良好整形・確認の指示が中心で、外部送信や削除などの操作はない。
導入のしやすさ必要なツールや API キーが少ないか、書かれているか
B一部不足`pre-commit`や各種フォーマッターを使うが、導入手順はない。

点数には入れていません。 2026年10月26日 時点で AI(OpenAI Codex)が判定しました。目安なので、入れる前に原文も確認してください。

評価が違うと思ったら、見直しを依頼する

どの項目が、なぜ違うと思うかを書いてください。ログインは不要です。内容を SKILL.md と照らし合わせて評価を作り直し、この欄に反映します。

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

含まれるファイル(1)

  • SKILL.md6.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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.

Comments

  • Describe the code that is there. A comment should explain what the current code does or why it is the way it is, not narrate what the code used to be. Do not add a comment to justify a deletion or explain that something is no longer necessary; a reader of the new code has no idea what is being contrasted against, and the comment rots as soon as the old shape is forgotten. Put that reasoning in the commit message instead.
  • Do not introduce a local variable just to host a comment. If a call argument reads clearly on its own, inline it rather than naming it so that a comment has somewhere to attach.
  • Lead with a plain summary. Start a doc comment with a direct statement of what the function does or returns, such as "Returns true if the InstKind is a singleton." Put nuance in a following sentence rather than qualifying the summary into something harder to read.
  • Re-read a comment before updating it. When a symbol is renamed or changes meaning, a comment that mentions it is not automatically stale. Work out what the comment actually asserts first: it may be describing what the code uses, which is still true, and rewriting it loses information.

Documentation

This covers standalone prose: /docs, README.md files, and the skill files under .agents/skills.

  • Be true of the tree it lands in. Documentation shipping in the same commit as the code it describes should name that code freely. Documentation that lands separately must not: a reader who greps for an identifier from an unlanded change finds nothing, and a claim that only holds after that change is false until it lands. This is easy to get wrong when writing up a lesson while the change that taught it is still in flight.
  • Use placeholders for illustrations. When an example only needs to show a shape, name it Foo rather than reaching for a real symbol. Save real identifiers for documenting that identifier, where going stale is at least detectable.
  • Make each point stand alone. A reader has none of the discussion that produced it. State the rule, and enough of the reason to apply it, without assuming knowledge of the change that motivated it.

Naming

  • A name is a claim, so keep it true. When a change invalidates the invariant a name describes, rename it in the same change. A factory called MakeSingletonFooId has to be renamed once Foo is no longer a singleton, even though nothing forces you to.
  • Types in a signature are part of the claim. A function returning the id of a namespace should return InstId, not TypeInstId, because a namespace is not a type. Do not let a convenient wider or narrower id type imply something false.
  • Delete a predicate whose name stops distinguishing anything. If a change widens a test so that it no longer says what its name implies, remove it and let callers use the underlying test, rather than keeping a wrapper that sounds meaningful. What callers actually want is often the inverse, and is worth adding under its own name.
  • Name a variable for its role, not its representation. If the role a value plays is unchanged, keep its name even when a change means it is now held or spelled differently.

Commit descriptions

  • Say what the change is, not how you made it. Describe the resulting code. Only describe process when the process is more interesting than the change, as with a large mechanical transformation.
  • Do not narrate your own work. Statements like "each such site was audited" or "we investigated every caller" describe effort, not the change.
  • Omit routine mechanical steps. Do not mention running the testdata autoupdater or the formatter. Every change is expected to include those.
  • Do not enumerate each edit. Describe the change as a whole rather than listing every function or file touched; the diff already lists them.
  • Use the project's terms precisely. Reach for the term of art the codebase uses. Calling something a "type alias" or a "namespace" when it is a named scope misleads, and is worse than a vaguer but accurate word.
  • Scope claims to what changed. Say the specific thing that is now true, rather than a broader statement that happens to contain it.

Design

  • Do not distort the data model to improve output. If printed or golden output is undesirable, change the printer, not the data structures that feed it.

Style Guides

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Accessing GitHub issues

無料概要あり

コマンドラインからGitHub issueの本文やコメントを読み取り専用で確認し、URLや番号から対象リポジトリを指定する手順を案内します。

  • issueの本文とコメントを読みたいとき
  • URLからissueの内容を確認したいとき
  • 別リポジトリのissueを参照したいとき
carbon-language/carbon-lang3.4万2026年10月26日 更新

Agent tools

無料概要あり

AIアシスタントがCarbonのコードベースを扱う際に、専用ツールでファイルを閲覧・検索・編集し、一時ファイルを管理するためのルールを示します。

  • Carbonのファイルを規則に沿って検索したいとき
  • 専用ツールを使ったファイル編集を確認したいとき
  • 一時ファイルの置き場所と削除ルールを確認したいとき
carbon-language/carbon-lang3.4万2026年10月26日 更新

Bazel usage

無料概要あり

Bazeliskを使ったCarbonプロジェクトのビルド、テスト、実行、デバッグの基本手順を確認し、対象を絞った検証やASanの利用方法も把握できます。

  • Carbonのコードをビルドしたいとき
  • 変更箇所に関係するテストを実行したいとき
  • Bazelで作ったバイナリを起動したいとき
carbon-language/carbon-lang3.4万2026年10月26日 更新

Builtin functions

無料概要あり

Carbonコンパイラに組み込み関数を追加する際の登録、型シグネチャ検証、定数評価、LLVMコード生成、テスト方法を案内します。

  • 組み込み関数を登録したいとき
  • 定数評価の処理を実装したいとき
  • LLVM IRへの変換を追加したいとき
carbon-language/carbon-lang3.4万2026年10月26日 更新

Diagnostics

無料概要あり

Carbonコンパイラのエラーや警告を定義し、書式やソース位置のラベルを整え、テストで網羅性を確かめる方法を案内します。

  • 診断メッセージを追加したいとき
  • エラー位置にラベルを付けたいとき
  • 診断文の表記を統一したいとき
carbon-language/carbon-lang3.4万2026年10月26日 更新

GitHub CLI usage

無料概要あり

`gh`でGitHubのIssue、プルリクエスト、リポジトリを読み取り専用で検索・確認し、必要な情報を絞り込む方法を案内します。

  • Issueの内容や状態を確認したいとき
  • PRの差分やチェック状況を見たいとき
  • GitHub上のコードやリポジトリを検索したいとき
carbon-language/carbon-lang3.4万2026年10月26日 更新

carbon-language のスキルをすべて見る

このスキルの問題を報告する