cpp-sanitizers

Instrument C/C++ builds with ASan, UBSan, and TSan to detect runtime bugs.

14|Updated May 28, 2026
One-click install
npx skills add https://github.com/Redtropig/harness-anchor --skill cpp-sanitizers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-sanitizers
Source: https://github.com/Redtropig/harness-anchor/tree/main/skills/cpp-sanitizers
Command: npx skills add https://github.com/Redtropig/harness-anchor --skill cpp-sanitizers

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers catch runtime bugs in C/C++ projects using sanitizers (ASan, UBSan, TSan) to supplement compile-time checks.

Core Features & Use Cases

  • Instrument builds with ASan, UBSan, and TSan to detect memory errors, null dereferences, and data races.
  • Interpret sanitizer reports to pinpoint bug sources and verify fixes across Linux and macOS environments.
  • Use dedicated sanitizer build directories to separate instrumentation from production builds and to maintain reproducible results.

Quick Start

Run the sanitizer workflow against your C/C++ project to identify runtime errors such as UAF, leaks, and data races.

Frequently Asked Questions about cpp-sanitizers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I catch memory leaks and data races in a C++ project?

To catch memory leaks and data races in a C++ project, compile your code with ASan and TSan instrumentation. This skill configures sanitizer builds to detect runtime errors like use-after-free and threading issues across Linux and macOS.

What is the best way to debug undefined behavior in C++?

The best way to debug undefined behavior in C++ is applying UBSan instrumentation during your build process. This skill helps identify null dereferences and undefined behavior by analyzing sanitizer reports generated by Clang or GCC.

Do I need a separate build directory when using sanitizers like ASan?

Yes, you need a separate sanitizer build directory to avoid contaminating normal production builds. This skill requires this setup to maintain reproducible results and isolate sanitizer instrumentation from your standard C++ compilation workflow.

Can I use sanitizers to detect use-after-free errors on macOS?

Yes, you can use ASan to detect use-after-free errors on macOS and Linux. This skill applies sanitizer instrumentation using Clang or GCC to identify memory management bugs and analyze runtime reports in native codebases.

How do I interpret sanitizer reports to find the source of a bug?

To interpret sanitizer reports, this skill analyzes the generated output to pinpoint exact bug sources. It helps you read ASan, UBSan, and TSan logs to verify fixes for detected memory errors and data races.

When should I use TSan versus ASan for debugging?

Use TSan to detect data races in multi-threaded C++ code and ASan for memory errors like use-after-free. This skill applies the appropriate sanitizer instrumentation based on whether you face threading or memory management issues.