CtrlK
BlogDocsLog inGet started
Tessl Logo

cpp-debug-audit

Load when debugging crashes, memory errors, data races, undefined behavior, or performance issues in C++ code, or when performing a systematic safety audit.

79

Quality

100%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

C++ Debug & Audit Skill

Use this skill for debugging C++ issues and performing systematic safety audits.

Debug Priority

When debugging crashes or memory issues, check in this order:

  1. Use-after-free / dangling references — sanitizers first (-fsanitize=address)
  2. Buffer overflows-fsanitize=undefined
  3. Data races-fsanitize=thread
  4. Uninitialized reads-fsanitize=memory (Clang)
  5. Double-free — check RAII ownership
  6. Stack overflow — check recursion depth, large stack allocations
  7. ABI mismatch — check linking, ODR violations

Audit Checklist

For systematic safety audit:

  • All raw pointers classified (owning vs non-owning)
  • All resources wrapped in RAII
  • No new/delete in application code
  • No mutable global state without synchronization
  • No detached threads
  • Lock ordering documented
  • Error handling strategy consistent per module
  • No throwing from destructors
  • Move semantics correct (no move-from-const)
  • string_view/span lifetime verified
  • No virtual calls in constructors/destructors

Tool Usage

# Address sanitizer
clang++ -fsanitize=address -g -O1 source.cpp

# Thread sanitizer
clang++ -fsanitize=thread -g -O1 source.cpp

# Undefined behavior sanitizer
clang++ -fsanitize=undefined -g -O1 source.cpp

# Static analysis
clang-tidy source.cpp --config-file=config/.clang-tidy -- -std=c++20

# Run with Valgrind (Linux)
valgrind --leak-check=full --track-origins=yes ./program

Output Format

Root Cause Analysis

What is the most likely cause? What evidence supports it?

Reproduction

Minimum steps to reproduce.

Fix

Precise fix with explanation of why it works.

Prevention

What rule or check would catch this class of bug in the future?

Repository
zhxc372/cpp-ai-constitution
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.