diff --git a/.agents/skills/code_style/SKILL.md b/.agents/skills/code_style/SKILL.md index 0c36ba7505c8..081d97440ca3 100644 --- a/.agents/skills/code_style/SKILL.md +++ b/.agents/skills/code_style/SKILL.md @@ -21,18 +21,25 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ## Formatting -- **C++**: Always check `clang-format` on C++ files. +- **Bazel**: Use `pre-commit run buildifier --files ` to format + Bazel files. +- **C++**: Use `pre-commit run clang-format --files ` 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 ` to format - markdown files correctly. + markdown files. +- **Python**: Use `pre-commit run black --files ` to format Python + files. ## Style Guides -Carbon's toolchain uses LLVM-style C++ with some specific conventions. - -- **Style Guide**: Follow the +- **C++ style**: Follow the [Carbon C++ Project Style Guide](/docs/project/cpp_style_guide.md). - **Markdown style**: Follow the [Google developer documentation style guide](https://developers.google.com/style). +- **Python style**: Follow the [PEP 8](https://peps.python.org/pep-0008/) + style guide. + - Wrap code and comments to 80 columns. + - Run `pre-commit run flake8 --files ` to check Python style. diff --git a/.agents/skills/tool_usage/SKILL.md b/.agents/skills/tool_usage/SKILL.md new file mode 100644 index 000000000000..06997420ce7d --- /dev/null +++ b/.agents/skills/tool_usage/SKILL.md @@ -0,0 +1,34 @@ +--- +name: Tool usage +description: + Instructions for AI assistants on what tools to use in the carbon-lang + project. +--- + +# Tool usage + + + +## Bazelisk and Bazel + +We use `bazelisk` for build and test. + +**IMPORTANT**: AI assistants use `bazelisk` instead of `bazel`. + +## Pre-commit + +Running `pre-commit` is mandatory. To run it on all files: + +```bash +pre-commit run -a +``` + +To validate a specific list of files: + +```bash +pre-commit run --files +``` diff --git a/.agents/skills/toolchain_development/SKILL.md b/.agents/skills/toolchain_development/SKILL.md index 91d06e1c7869..c0a65ece5596 100644 --- a/.agents/skills/toolchain_development/SKILL.md +++ b/.agents/skills/toolchain_development/SKILL.md @@ -41,11 +41,6 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - **Iteration**: Prefer iterative algorithms over recursive ones to prevent stack exhaustion on complex codebases. -## Building and testing - -AI assistants should use `bazelisk` instead of `bazel` for build and test -commands, because some AI editors won't see `bazel` aliases. - ### Essential commands - **Test everything**: `bazelisk test //...` @@ -67,20 +62,6 @@ of expected output.** Use the script: ./toolchain/autoupdate_testdata.py toolchain/check/testdata/my_test.carbon ``` -### Pre-commit - -Running `pre-commit` is mandatory. To run it on all files: - -```bash -pre-commit run -a -``` - -To validate a specific list of files: - -```bash -pre-commit run --files -``` - ## Debugging and diagnostics - **Printing to stderr**: Use `llvm::errs() << "debug info\n";`. diff --git a/GEMINI.md b/GEMINI.md index a522e07eebf2..e7eda9ca3d10 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -35,6 +35,11 @@ assistant, **read this first** to avoid common pitfalls. - **[`toolchain/`](toolchain/)**: The C++ implementation of the compiler (Toolchain). +## Tool usage + +See the "Tool usage" skill for instructions on what tools to use in the +carbon-lang project. + ## Code style See the "Code style" skill for instructions on formatting, style guides, and