Skip to content

Commit 0084e38

Browse files
committed
Enhance guidelines for AI bot usage
1 parent 14ba827 commit 0084e38

File tree

2 files changed

+37
-33
lines changed

2 files changed

+37
-33
lines changed

AI_GUIDELINES.md

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ The project has three primary test targets, each with specific purposes:
9090

9191
The project also supports fuzz testing for code that handles external inputs, located in `/fuzz_test`.
9292

93+
94+
* ALWAYS prefer test-driven development
95+
* ALWAYS write tests for new code
96+
* NEVER filter tests when running test binaries - you need to know if the feature broke other tests!
97+
9398
### 5. Code Coverage
9499

95100
The project supports code coverage reporting using gcovr. When working with this project:
@@ -161,11 +166,14 @@ Remember, the project's guardrails exist for a reason. Help the user install and
161166

162167
### Modern C++ Coding Guidelines
163168

164-
1. **Format Strings**: Use `std::format` and `std::print` instead of iostream or printf
169+
1. **Format Strings**:
170+
- Use `std::format` and `std::print` instead of iostream or printf
171+
- NEVER use printf (this will not pass static analysis)
165172
2. **Memory Management**:
166173
- No raw `new`/`delete` operations
167174
- Prefer stack allocation, then std::vector/array
168175
- Use smart pointers if heap allocation is necessary
176+
- ALWAYS prefer unique_ptr over shared_ptr
169177
3. **Algorithms over Loops**:
170178
- Use standard algorithms and ranges instead of raw loops when possible
171179
- Use ranged-for with `auto` when algorithms aren't suitable
@@ -193,6 +201,7 @@ Remember, the project's guardrails exist for a reason. Help the user install and
193201
- Set `<project_name>_PACKAGING_MAINTAINER_MODE=OFF`
194202
- Enable coverage with `-D<project_name>_ENABLE_COVERAGE=ON`
195203
- Example: `cmake -DCMAKE_BUILD_TYPE=Debug -Dmyproject_PACKAGING_MAINTAINER_MODE=OFF -Dmyproject_ENABLE_COVERAGE=ON ..`
204+
6. ALWAYS commit changes after significant change has been made AND tests pass
196205

197206
## Technical Implementation Details
198207

@@ -232,37 +241,6 @@ cmake --build build --target lizard_html
232241
cmake --build build --target lizard_xml
233242
```
234243

235-
### Binary Size Analysis with Bloaty McBloatface
236-
237-
The project includes optional support for Bloaty McBloatface, a binary size analyzer. This tool helps identify what's contributing to executable size, which is valuable for embedded systems and performance optimization.
238-
239-
Note: Bloaty is disabled by default as it may not be installed on all systems. Enable with `-D<project_name>_ENABLE_BLOATY=ON`.
240-
241-
When Bloaty is enabled, it provides several analysis targets for each executable:
242-
243-
```bash
244-
# Basic size analysis for a specific target (e.g., "intro")
245-
cmake --build build --target bloaty_intro
246-
247-
# Generate CSV report
248-
cmake --build build --target bloaty_intro_csv
249-
250-
# Store current binary as a baseline for comparisons
251-
cmake --build build --target bloaty_intro_store
252-
253-
# Analyze template usage (particularly useful for C++ binary bloat)
254-
cmake --build build --target bloaty_intro_templates
255-
256-
# Run analysis on all executable targets
257-
cmake --build build --target bloaty_all
258-
```
259-
260-
When addressing binary size issues:
261-
1. Look for excessive template instantiations
262-
2. Check for large static data or string literals
263-
3. Consider enabling Link Time Optimization (LTO)
264-
4. Evaluate if all included functionality is necessary
265-
266244
### Compiler Warning Configuration
267245

268246
Each supported compiler (GCC, Clang, MSVC) has specific warning flags enabled:
@@ -328,4 +306,4 @@ This workflow helps the user quickly test your suggestions and allows you, as an
328306

329307
1. Use conditional compilation sparingly and only when necessary
330308
2. Consider implications of your changes on all supported platforms
331-
3. Use the provided abstractions for platform-specific code
309+
3. Use the provided abstractions for platform-specific code

CLAUDE.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Claude AI Assistant Guidelines
2+
3+
## IMPORTANT NOTICE
4+
5+
CLAUDE, NEVER modify this file
6+
7+
This file contains instructions specifically for Claude AI. For all general AI assistant guidelines, please refer to and modify the `AI_GUIDELINES.md` file instead.
8+
9+
## Claude-Specific Instructions
10+
11+
1. Always review `AI_GUIDELINES.md` for project standards and best practices.
12+
13+
2. When running commands, always check for and use:
14+
- `clang-format -i path/to/changed/files/*.cpp path/to/changed/files/*.hpp`
15+
- Build commands: `cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -Dmyproject_PACKAGING_MAINTAINER_MODE=OFF -Dmyproject_ENABLE_COVERAGE=ON ..`
16+
- Test commands: `ninja tests relaxed_constexpr_tests && ctest -R "unittests|relaxed_constexpr" --output-on-failure`
17+
18+
3. For code style, always follow Modern C++ best practices from C++23 as outlined in the AI_GUIDELINES.md file.
19+
20+
4. Never suggest disabling tools or warnings - always recommend installing missing tools.
21+
22+
5. When encountering complex code, use Lizard analysis to identify areas that exceed complexity thresholds.
23+
24+
6. Use proper CMake practices as outlined in project documentation.
25+
26+
7. Follow the project's testing workflow by prioritizing relaxed_constexpr_tests first.

0 commit comments

Comments
 (0)