Isurwars/Correlation / .agents/skills/sanitizers
sanitizers
VerifiedInstrument C++ build with LLVM/GCC sanitizers (ASan, UBSan, TSan) to trap and diagnose memory leaks, undefined behavior, and data races at runtime. Use when testing memory or thread safety.
Runtime Sanitizers (ASan / UBSan / TSan)
This skill directs runtime memory and concurrency safety checks using dedicated presets defined in CMakePresets.json. It builds instrumented binaries, runs the test suite, parses runtime reports, and guides root-cause remediation.
Execution Pipeline
Phase 1: Sanitizer Preset Execution
Use the repository's pre-configured CMake presets (asan and tsan):
- AddressSanitizer (ASan) & UndefinedBehaviorSanitizer (UBSan):
cmake --preset asan cmake --build --preset asan -j$(nproc) ctest --test-dir build-asan --output-on-failure - ThreadSanitizer (TSan):
cmake --preset tsan cmake --build --preset tsan -j$(nproc) ctest --test-dir build-tsan --output-on-failure
Note: Never modify CMakeLists.txt to inject sanitizer flags manually. Use presets.
Phase 2: Trap Capture & Diagnostic Parsing
Monitor test output for explicit sanitizer error reports:
ASan: heap-use-after-freeorstack-buffer-overflowLSan: Detected memory leaksUBSan: undefined behavior(null dereferences, integer overflow, misaligned pointer)TSan: Data race detected
Phase 3: Root-Cause Remediation & Resolution Loop
If a sanitizer report is captured, treat it as a blocking defect:
- Parse Stack Trace: Extract file path, line number, and function where violation originated.
- Apply Architectural Fixes:
- For ASan/LSan: Ensure strict RAII ownership (
std::unique_ptr), correct array indexing/span bounds. - For UBSan: Add boundary validation checks, replace C-style casts with checked conversions.
- For TSan: Eliminate uncoordinated shared mutation; use
std::atomic,std::scoped_lock, or OpenMP reduction clauses.
- For ASan/LSan: Ensure strict RAII ownership (
- Re-Validate: Re-execute the corresponding preset build and test run until all tests pass cleanly with zero sanitizer warnings.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |