domain-exception

Define domain-specific error codes and hierarchical exceptions in Kotlin.

Updated Jan 11, 2026
One-click install
npx skills add https://github.com/gykk16/spring-skeleton --skill domain-exception
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: domain-exception
Source: https://github.com/gykk16/spring-skeleton/tree/main/.omc/skills/domain-exception
Command: npx skills add https://github.com/gykk16/spring-skeleton --skill domain-exception

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a structured and consistent way to define and manage domain-specific error codes and exceptions, improving code clarity and maintainability.

Core Features & Use Cases

  • Centralized Error Codes: Define feature-specific error codes in enums for clear identification.
  • Hierarchical Exceptions: Implement a consistent exception hierarchy for domain errors.
  • Use Case: When a user tries to create a resource that already exists, this Skill ensures a standardized AlreadyExistsException is thrown with a clear, feature-specific error message.

Quick Start

Use the domain-exception skill to define a new OrderError enum and OrderException class for the order domain.

Frequently Asked Questions about domain-exception

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

FAQPage Schema
How do I standardize domain-specific exception handling in Kotlin?▼

Standardize domain-specific exception handling in Kotlin by defining feature-specific error codes in enums and extending a base KnownException class. This creates a predictable, hierarchical structure for business errors across your application.

What is the best way to define domain error codes for a Kotlin application?▼

The best way to define domain error codes in a Kotlin application is using centralized enums. This ensures clear identification and consistent error management, allowing features to throw standardized exceptions like AlreadyExistsException with specific messages.

Can I create custom exceptions for different feature domains using this approach?▼

You can create custom exceptions for different feature domains by extending the base KnownException class. This allows predictable business errors to inherit from a standardized hierarchy, ensuring consistent error handling across your application.

When should I use a centralized exception hierarchy for domain errors?▼

Use a centralized exception hierarchy for domain errors when you need consistent business rule validation, such as preventing duplicate resource creation. It enforces clear code definitions and improves maintainability across feature-specific logic in Kotlin.

How does hierarchical exception management improve Kotlin code clarity?▼

Hierarchical exception management improves Kotlin code clarity by enforcing standardized error code definitions via enums. It replaces scattered error logic with a predictable KnownException structure, making business failures clear and maintainable across features.