| name | domain-logic |
| description | Standards for handling business logic, data validation, and 3-level validation architecture. |
| trigger | when implementing new business rules, data validation, or core processing logic. |
Domain and Business Logic
Defines the business rules for processing application-specific data, ensuring consistency and integrity through a multi-layered validation approach.
When to use this skill
- When modifying core business services.
- When designing algorithms or data processing pipelines.
- When implementing new validation rules.
Degree of Freedom
- Strict: 3-level validation rules and core-UI decoupling are mandatory.
Workflow
- Modeling: Define entities using Dataclasses and strict types.
- Validation: Implement the 3 levels (Type, Schema, Business).
- Abstraction: Ensure core logic is independent of UI or specialized framework elements.
- Testing: Create unit tests for all domain logic.
Instructions and Rules
3-Level Validation
- Level 1 (Type): Basic data types and allowed ranges.
- Level 2 (Schema): Consistency between fields in a single DTO.
- Level 3 (Business): External consistency and cross-module rules.
Decoupling Rules
- Pure Core: Core services MUST NEVER depend on UI libraries or specific framework graphics components.
- DTOs: Operate with clean Data Transfer Objects; convert to specialized framework objects only at the boundaries.
- Mocks: Use mocks for all external dependencies in local unit tests.
Quality Checklist