value-object-pattern-applied

Identify and implement Domain-Driven Design Value Objects using Java records.

10|2|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/pwyczes/ddd-ai-skills-applied --skill value-object-pattern-applied
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: value-object-pattern-applied
Source: https://github.com/pwyczes/ddd-ai-skills-applied/tree/main/value-object-pattern-applied
Command: npx skills add https://github.com/pwyczes/ddd-ai-skills-applied --skill value-object-pattern-applied

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you identify and implement Value Objects, a core Domain-Driven Design pattern, to encapsulate domain concepts, reduce primitive obsession, and improve code clarity and robustness.

Core Features & Use Cases

  • Identify Opportunities: Detects situations ripe for Value Object implementation, such as primitive clusters, scattered validation, or hidden domain concepts.
  • Guided Implementation: Provides a structured workflow for designing and implementing Value Objects, emphasizing intention-revealing interfaces and side-effect-free behavior.
  • Use Case: Refactor a Java codebase where String isbn and String edition are used inconsistently, into a BookIdentifier Value Object with built-in validation and clear domain meaning.

Quick Start

Apply the value-object-pattern-applied skill to refactor primitive parameters in the estimateShippingCost method into an Address Value Object.

Frequently Asked Questions about value-object-pattern-applied

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

FAQPage Schema
How do I refactor primitive obsession in Java using Value Objects?

Refactor primitive obsession by identifying scattered primitive parameters and clusters, encapsulating them into Java Value Objects with built-in validation and clear domain meaning. This reduces inconsistency and improves code clarity within a single Bounded Context.

What is a Value Object in Domain-Driven Design?

A Value Object in Domain-Driven Design is an immutable construct that encapsulates related domain concepts, enforces value-based equality, and performs side-effect-free operations. It replaces primitive data types to represent domain attributes accurately.

How do I implement immutability and value-based equality in Java records?

Implement immutability and value-based equality in Java records by designing intention-revealing interfaces and side-effect-free behavior. Java records natively enforce these constraints, allowing you to encapsulate domain values securely within a Bounded Context.

When should I use Value Objects instead of primitive types?

Use Value Objects instead of primitives when you detect hidden domain concepts, scattered validation logic, or parameter clusters. Encapsulating these primitives ensures consistent validation and enforces immutability across the domain model.

What's the best way to group parameter clusters in a Java domain model?

The best way to group parameter clusters is encapsulating them into a Value Object using Java records. This enforces side-effect-free operations and value-based equality, replacing ambiguous primitive clusters with intention-revealing domain concepts.