Add a code review skill with reference files for memory safety, concurrency, correctness idioms, false positives, cppreference lookup, and report format. Move the coding conventions from AGENTS.md into the skill's project-style reference so reviews enforce them. Co-authored-by: Qwen 3.8 27B <qwen3.8_27b-q3_k_xl@lmstudio.local>
2.9 KiB
2.9 KiB
name, description
| name | description |
|---|---|
| cpp-code-review | Review C++ (and C interop) code and PRs for undefined behavior, memory/ lifetime bugs, concurrency, error handling and modern idioms. Use whenever reviewing or auditing C++ code. |
C++ Code Review
Review C++ changes for real bugs first, style last. Be concise and cite file:line.
Workflow
- Scope: identify what changed (diff, PR, or files). Check the build files
(
CMakeLists.txt, etc.) for the C++ standard (-std=/CMAKE_CXX_STANDARD) and compiler. Don't suggest features newer than the project's standard. - Tooling: if you can run commands, run what's available and fold results
in (don't re-report what they catch):
- Build with
-Wall -Wextra -Wpedantic(or/W4on MSVC) clang-tidy(withbugprone-*,cppcoreguidelines-*,modernize-*)- Tests under sanitizers:
-fsanitize=address,undefined; separately-fsanitize=threadfor threaded code
- Build with
- Review by priority: read only the reference files that apply:
| Change touches | Read |
|---|---|
Raw pointers, new/delete, buffers, casts, C APIs, references to temporaries |
references/memory-ub.md |
Threads, atomics, mutexes, std::async, coroutines |
references/concurrency.md |
| Exceptions, error codes, classes, templates, API design, integer types | references/correctness-idioms.md |
| Naming, signatures, includes, class layout, conventions | references/project-style.md |
| Unsure whether a finding is real | references/false-positives.md |
| Need to explain or verify a language/library rule | references/cppreference.md |
- Report: use
references/report-template.md.
Priorities (in order)
- Undefined behavior and memory safety (overflow, use-after-free, dangling, out-of-bounds)
- Security (untrusted input reaching buffers, format strings, integer conversions)
- Concurrency bugs (data races, deadlocks)
- Resource leaks and exception safety
- API/correctness and performance (copies, allocations)
- Modern idioms and readability
Rules
- Only flag issues you can explain concretely. No speculation.
- Don't comment on formatting (whitespace, line breaks); that is
clang-format's job. Do enforce the project's coding conventions; seereferences/project-style.md. - Suggest a fix with a short code snippet when possible.
- Before asserting a language or library rule (e.g. iterator invalidation, UB,
which header declares a type), verify it on cppreference. Link the page in the
finding instead of writing a long explanation. See
references/cppreference.mdfor how to look things up.