13eholder/modern-cpp-skills/m06-error-handling
Claude Code and agent skill by 13eholder/modern-cpp-skills
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Mastering C++ Error Handling. Triggers: exceptions, try-catch, noexcept, std::expected, std::optional, error codes, assert, terminate.
Install
npx vskill@latest install 13eholder/modern-cpp-skills/m06-error-handlingSKILL.md
The same SKILL.md was published earlier as 13eholder/modern-cpp-skills/m06-error-handling.
C++ Error Handling
Core Question
Is this error recoverable?
- Yes (Local):
std::expectedor return code. - Yes (Distant): Exceptions (
throw). - No (Bug):
assertorstd::terminate.
Error → Design Question
| Issue | Design Question | |
|---|---|---|
| Uncaught Exception | Did you forget to catch, or throw in noexcept? | |
| Silent Failure | Did you ignore a return code? (Use [[nodiscard]]). | |
| Destructor Throw | Never throw from destructor (std::terminate). |
Thinking Prompt
- Is absence valid?
- Yes? →
std::optional<T>.
- Does caller need details?
- Yes? →
std::expected<T, E>or Exception. - No? →
boolorstd::optional.
- Is it a Logic Error (Bug)?
- Yes? →
assert()orstd::terminate(). Do not throw for bugs in C++ (Contract Violation).
Trace Up / Down
- Trace Up:
- Issue: "Program aborted with 'terminate called recursively'."
- Cause: An exception was thrown while stack unwinding (in a destructor).
- Fix: Fix the destructor. Ensure RAII cleanup is
noexcept.
Quick Reference
| Mechanism | Cost (Happy) | Cost (Sad) | Use When | |
|---|---|---|---|---|
| `std::optional` | Branch | Branch | Return may be empty. | |
| `std::expected` | Branch | Branch | Recoverable error (Parsing). | |
| Exception | Zero | Huge | Rare IO/Resource errors. | |
| Assert | Zero (Release) | Abort | Logic bugs / Invariants. |
Security
- Security scanPassed, 100 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 repositoryCheckingm06-error-handling/SKILL.md
Popularity
- 7-day trend score
- 5
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/13eholder/modern-cpp-skills/m06-error-handling)