hbarve1/tessl-llvm/add-sanitizer
Claude Code and agent skill by hbarve1/tessl-llvm
- community
Checking that the SKILL.md file is still in the repository.
Instrument LLVM 22 IR for AddressSanitizer (ASan), UndefinedBehaviorSanitizer (UBSan), or ThreadSanitizer (TSan). Covers enabling sanitizers via TargetMachine/PassBuilder, adding manual shadow-memory checks, inserting UBSan runtime calls, and CMake setup.
Install
npx vskill@latest install hbarve1/tessl-llvm/add-sanitizerSKILL.md
The same SKILL.md was published earlier as hbarve1/tessl-llvm/add-sanitizer.
Skill: Add Sanitizer Instrumentation (LLVM 22)
Use this skill when you want to add memory-safety, undefined-behavior, or data-race detection to your language runtime or compiler output.
Step 0 — Approach options
| Approach | Use when | |
|---|---|---|
| Pass pipeline sanitizers (ASan/TSan/MSan/UBSan) | Your compiler drives the full pipeline; easiest — just enable the pass | |
| Manual IR instrumentation | You only want to check specific operations (custom UBSan-style checks) | |
| Link against sanitizer runtime | Your output must be compatible with Clang's sanitizer runtimes |
Part 1: Enable ASan/TSan/UBSan via PassBuilder (recommended)
The cleanest approach for a compiler that owns its optimization pipeline:
Then link the sanitizer runtime at link time:
Part 2: Mark functions for sanitizer control
Part 3: Manual UBSan-style runtime checks
Insert explicit checks for undefined behavior your language defines (e.g., integer overflow, null dereference, out-of-bounds):
Part 4: Use llvm.ubsantrap for UBSan-style aborts
LLVM 22 provides a dedicated UBSan trap intrinsic that carries an error kind:
CMake: link against sanitizer runtimes
Verifying instrumentation
Common mistakes
- Never apply sanitizer passes before inlining — inline first so sanitizer sees the combined code.
- Never mix sanitized and non-sanitized objects without understanding which runtime is linked.
- Always add
unreachableafterllvm.trap/llvm.ubsantrapcalls — two terminators in a block is a verifier error. - Always disable sanitizer instrumentation on your GC runtime internals and shadow-stack code — sanitizing the sanitizer causes false positives.
- Always verify the module after inserting checks (
verifyModule(*M, &errs())).
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingtiles/tessl-llvm/skills/add-sanitizer/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hbarve1/tessl-llvm/add-sanitizer)