model

Define and validate TypeScript domain models with Value Objects.

Updated Mar 9, 2026
One-click install
npx skills add https://github.com/paulotks/CodeLeapTest --skill model-paulotks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model
Source: https://github.com/paulotks/CodeLeapTest/tree/main/.agent/skills/model
Command: npx skills add https://github.com/paulotks/CodeLeapTest --skill model-paulotks

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the creation and validation of domain models within the CodeLeap project, ensuring consistency and adherence to established patterns.

Core Features & Use Cases

  • Model Definition: Creates TypeScript types/interfaces for domain concepts.
  • Validation: Implements validation logic using Value Objects within factory functions.
  • Domain Helpers: Provides pure functions for business rules (e.g., isOwnPost).
  • Use Case: When introducing a new feature that requires representing a "Product" with specific attributes like name, price, and description, this Skill ensures it's defined as a type with a factory function that validates these attributes before creation.

Quick Start

Use the model skill to create a new domain model for a 'User' entity with 'username' and 'email' properties.

Frequently Asked Questions about model

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

FAQPage Schema
How do I define and validate domain models in TypeScript?

Domain models are defined by creating TypeScript types for entities and implementing validation logic through Value Objects inside factory functions, ensuring attributes are validated before object creation.

What is a Value Object in domain model validation?

A Value Object in domain model validation enforces business rules within factory functions, ensuring entities like a Product have valid attributes before instantiation occurs.

How do I create a TypeScript factory function for entity validation?

To create a TypeScript factory function for entity validation, define the domain type interface and wrap object instantiation in a function that uses Value Objects to verify inputs before returning the instance.

Do I need to generate IDs and timestamps when defining domain models?

You do not need to generate IDs and timestamps when defining domain models if your frontend relies on the API for identity and creation timestamps, ensuring frontend simplicity by delegating those concerns to the backend.

How do I add pure helper functions for domain entity business logic?

To add pure helper functions for domain entity business logic, define associated functions alongside your models, such as an isOwnPost helper, to encapsulate specific business rules without mutating state.