Value objects

From SDiamante13/dotfiles · View interactive version

Value objects is an AI agent skill from the GitHub repository SDiamante13/dotfiles. 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`.

How to use this skill

Skill file

Analyze the class provided in $ARGUMENTS for instances of primitive obsession and suggest value object extractions.

Instructions:

  1. Examine the given class for primitive types that represent domain concepts
  2. Identify groups of related primitives that could be encapsulated into value objects
  3. Look for common patterns that indicate primitive obsession:

Patterns to detect:

Output format:

  1. List each identified primitive obsession case
  2. Suggest a value object name and structure
  3. Provide a brief implementation example with:
  1. Show how to refactor the original class to use the value object
  2. Explain the benefits of each extraction

Focus on improving code expressiveness, encapsulation, and type safety while reducing duplication and scattering of domain logic.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.