3.5 KiB
3.5 KiB
AGENTS.md - Instructions for Junie
Project Overview
This project is a high-performance modern C++ application featuring an advanced backend architecture. Junie must follow modern standards, clean code principles, and efficient resource management.
Modern C++ Standards (C++20/C++23)
- Language Standard: Write code strictly targeting C++20 or later. Do not use legacy pre-C++11 or C++11/14 patterns.
- Ranges & Views: Prefer
std::rangesandstd::views(using pipe syntax|) for filtering, transforming, and iterating through standard containers instead of writing rawforloops or explicitbegin/enditerators. - Concepts: Use
conceptsandrequiresclauses to constrain templates. Avoid old SFINAE (std::enable_if) techniques. - Initialization: Use direct initialization or designated initializers for aggregate types to maximize readability.
Memory Management & Performance (Strict RAII)
- Raw Pointers: Absolute ban on raw
newanddelete. Manual memory management is strongly discouraged. - Exclusive Ownership: Prefer
std::unique_ptrby default, instantiated viastd::make_unique. - Argument Passing:
- Pass heavy, non-modifiable objects by constant reference (
const T&). - Pass by value (
T) only if the function intends to take ownership or make a copy, utilizingstd::move.
- Pass heavy, non-modifiable objects by constant reference (
- Move Semantics: Implement move constructors and move assignment operators (
&&) for resource-heavy components. Ensure strict adherence to the Rule of Five.
Concurrency & Multithreading
- Modern Primitives: Always prefer
std::jthreadoverstd::thread, as it automatically manages its own RAII lifecycle and signals cooperative cancellation on destruction. - Thread Safety: Use
std::unique_lock,std::lock_guard, orstd::scoped_lock(when handling multiple mutexes) to protect critical sections. - Lock-free Basics: Prefer atomic operations (
std::atomic) for simple shared primitive types.
Compile-Time Safety & Robustness
- Compile-Time Validation: Use
static_assertwherever possible to enforce architectural assumptions and constraints during the build phase. - Constexpr: Mark functions and variables as
constexpr(orconsteval) to force computation at compile-time whenever feasible. - Type Safety & Errors: Use
std::optionalto express the absence of a value. Usestd::variantor custom error/result structures for structured error handling. Do not return magic error numbers (e.g.,-1) or null pointers for error states.
Structural & Project Constraints
- Header Guards: Always use
#pragma onceat the top of header files instead of old-fashioned#ifndefinclude guards. - Architecture Style: If introducing lightweight internal utilities, prefer a clean, modular Header-Only structure (with
inlinefunctions/variables) to keep dependencies streamlined, unless compilation times dictate otherwise. - Code Formatting: All generated code must comply with the
.clang-formatspecification present in the repository root.
Strict Guardrails & Bans
- NO PYTHON: Under no circumstances should you generate, modify, or suggest Python scripts, Python bindings, or Python-based automation tools. The tooling and automation landscape of this environment must remain purely native (C++, Shell, or CMake).
- Public API Modifications: Do not change public function signatures or break backward compatibility in core interface headers without explicit confirmation in your plan.