error-handling

Standardizes Solidity custom errors and revert patterns for gas efficiency and debuggability.

120|12|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ccashwell/evm-cortex --skill error-handling-ccashwell
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/ccashwell/evm-cortex/tree/main/skills/error-handling
Command: npx skills add https://github.com/ccashwell/evm-cortex --skill error-handling-ccashwell

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Solidity error handling historically uses require with string messages, which increases gas costs and complicates off-chain decoding. This skill standardizes custom errors and revert patterns to create cheaper, more expressive error surfaces and easier auditing.

Core Features & Use Cases

  • Define and reuse custom errors with structured parameters to convey context without bloating bytecode.
  • Establish error hierarchies and propagate errors across modules for safer upgradeability and clearer debugging.
  • Provide NatSpec documentation guidelines to make error semantics clear for developers and tooling.

Quick Start

Define a centralized set of custom errors and begin using revert patterns with NatSpec in all contracts.

Frequently Asked Questions about error-handling

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

FAQPage Schema
How do I reduce gas costs when using revert patterns in Solidity?

Custom errors in Solidity define structured revert parameters without storing string messages in bytecode. They convey execution failure context across contract modules more efficiently than require statements, reducing gas costs and simplifying off-chain decoding.

How do I document custom errors for off-chain tooling and auditing?

Document custom errors using NatSpec guidelines to make error semantics clear for developers and tooling. This standardizes revert patterns across contract modules, ensuring structured error propagation is verifiable during design and auditing.

Does Solidity try-catch work with custom errors across upgradeable contract modules?

Yes, try-catch usage in Solidity integrates with custom errors to enforce consistent error semantics across upgradeable contract modules. This structured error propagation ensures safer upgradeability and clearer debugging across decentralized applications.

What's the best way to structure error hierarchies for consistent error propagation in Solidity?

The best way to structure Solidity error hierarchies is to define a centralized set of custom errors with structured parameters. This enforces consistent error propagation across modules, improving debuggability and gas efficiency during contract deployment.

When should I not use string messages in Solidity require statements?

Avoid string messages in Solidity require statements when optimizing for gas efficiency and off-chain debuggability. Replacing them with standardized custom errors creates cheaper, more expressive error surfaces by eliminating expensive string storage from bytecode.