Analyze code for primitive obsession and plan value object extractions around domain concepts, validation, and grouped primitive fields. Use when the user says `/value-objects`, asks for value object refactoring, or runs `/refactor:value-objects`.
Instalación
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Analyze code for primitive obsession and plan value object extractions around domain concepts, validation, and grouped primitive fields. Use when the user says `/value-objects`, asks for value object refactoring, or runs `/refactor:value-objects`.
metadata
{"legacy-name":"refactor:value-objects"}
Analyze the class provided in $ARGUMENTS for instances of primitive obsession and suggest value object extractions.
Instructions:
Examine the given class for primitive types that represent domain concepts
Identify groups of related primitives that could be encapsulated into value objects
Look for common patterns that indicate primitive obsession:
Multiple string/number parameters representing a single concept (e.g., street, city, state, zip for an address)
Validation logic scattered throughout the class for primitive values
Methods that operate on groups of related primitives
Repeated primitive type combinations across methods
Business rules applied to primitive values
Patterns to detect:
Money/Currency: Variables like price, cost, amount, fee, salary with currency
Email: String fields for email addresses lacking validation
Phone Numbers: Strings or numbers representing phone data
Addresses: Multiple fields like street, city, state, zipCode