This document outlines conventions and best practices for AI-assisted development in the gRPC C++ codebase.
std::optional over absl::optional#include <grpc/support/port_platform.h> is not required unless its macros are needed for compilation.include/grpc) we use <grpc/...>.#include <grpc/grpc.h>std::pair or std::tuple for return types.LOG(ERROR) from absl/log/log.h for logging errors, never use std::cerr or gpr_log.fuzztest.h header is located at fuzztest/fuzztest.h.grpc_package declaration. For libraries use grpc_cc_library, for tests grpc_cc_test.external_deps attribute.:grpc BUILD target is not allowed to depend on the C++ protobuf library, either directly or transitively.src/core/BUILD and BUILD. Do not add new BUILD files under the src/ tree without explicit instruction.test/core and test/cpp (corresponding to the src directories). These test directories contain their own BUILD files.fuzztest_main instead of gtest_main.grpc_proto_library, the name of the cc_library target is the same as the name of the grpc_proto_library rule itself, not [name]_cc_proto as one might expect from standard Bazel cc_proto_library rules. The build system error messages can be misleading in this case.upb related build rules (grpc_upb_proto_library, grpc_upb_proto_reflection_library) for protos defined anywhere in the repository must be defined in the root BUILD file. They should not be placed in the BUILD file of the subdirectory where the proto is located.test/core/end2end/BUILD using the grpc_core_end2end_test_suite macro. This macro generates multiple grpc_cc_test targets by combining a configuration file (like end2end_http2_config.cc) with individual test implementation files located in test/core/end2end/tests/. The final test target name is created by appending _test to the name attribute of the macro. For example, grpc_core_end2end_test_suite(name = "end2end_http2", ...) generates the test target //test/core/end2end:end2end_http2_test.