Skip to main content
skill CX Codex

value-objects-and-dtos — Claude Code skill: what it does

This skill guides Symfony work with immutable Value Objects and DTOs, covering constructor validation, value equality, and data crossing application boundaries.

MIT ★ 234 updated 2026-10-05

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dev-toolings/superpowers-symfony --skill value-objects-and-dtos -a claude-code
Open on GitHub

What value-objects-and-dtos does

Use a Value Object for a domain concept with its own rules, and a DTO when data crosses an application boundary. The skill calls for readonly classes that validate in their constructors, compare Value Objects by value, and return new instances from operations. Setters are out.

For Doctrine, it prescribes embeddables. Input DTOs carry validation constraints; output DTOs use serializer attributes. The guidance also says to keep entities out of direct API input and output, and to represent money as an integer in minor units rather than a float. That integer representation is a constraint to preserve in the implementation. The expected result includes DTOs, mappings to and from entities, and unit tests for invariants.

Install it in Claude Code with npx skills add dev-toolings/superpowers-symfony --skill value-objects-and-dtos -a claude-code. The installed skill file is at ~/.claude/skills/value-objects-and-dtos/SKILL.md; reference.md provides further implementation detail.

What it helps with

  • model a domain concept as a Value Object with enforced invariants
  • transfer request or API data through DTOs
  • validate class invariants during construction
  • embed a value object in a Doctrine entity
  • map input and output DTOs to entities

Example prompts for the agent

  • Create an immutable Value Object for an address, validate it in the constructor, and test its invariants.
  • Split this API's input and output DTOs, then map them to and from the entities.
  • Model money as a Value Object and store its amount as an integer in minor units.

How to install value-objects-and-dtos

1Skills CLI (Vercel)

npx skills add dev-toolings/superpowers-symfony --skill value-objects-and-dtos -a claude-code

2Manually: put the files in place

~/.claude/skills/value-objects-and-dtos/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/value-objects-and-dtos/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about value-objects-and-dtos

How do I install value-objects-and-dtos in Claude Code?

Run npx skills add dev-toolings/superpowers-symfony --skill value-objects-and-dtos -a claude-code. The skill file is at ~/.claude/skills/value-objects-and-dtos/SKILL.md.

What does value-objects-and-dtos do?

It guides Symfony implementations of immutable Value Objects and DTOs, including validation and the separation of incoming and outgoing data.

How should money be represented with this skill?

Use an integer count of minor units, not a float.

Source text

SKILL.md · MIT
---
name: value-objects-and-dtos
description: Design Value Objects for domain concepts and DTOs for data transfer with proper immutability (readonly) and validation
capabilities: [read, search]
tags: [architecture]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep
---

# Value Objects And Dtos (Symfony)

## Use when
- A domain concept with rules of its own (money, email, address) travels as raw scalars.
- Data crosses a boundary: request input, API output, message payload.
- Storing a value object inside a Doctrine entity.

## Default workflow
1. Decide: a value object for a domain concept with invariants, a DTO for data crossing a boundary.
2. Make it `readonly`, validate in the constructor, and fail fast.
3. Give value objects equality by value and operations that return new instances.
4. Persist value objects as Doctrine embeddables.
5. Keep input DTOs (validation constraints) apart from output DTOs (serializer attributes).

## Guardrails
- No setters and no mutation: a change returns a new instance.
- DTOs carry data only, with no behavior.
- Never expose entities directly as API input or output.
- Store money as an integer in minor units, never as a float.

## Progressive disclosure
- Use this file for execution posture and risk controls.
- Open references when deep implementation details are needed.

## Output contract
- Value objects with their invariants and equality.
- Input and output DTOs, and their mapping to and from entities.
- Unit tests for each invariant.

## References
- `reference.md`

© dev-toolings · MIT · dev-toolings/superpowers-symfony

Similar skills

All skills for Backend and APIs →

From the same set51

The whole set →
symfony-voters The symfony-voters skill guides Symfony Voter authorization work, from mapping access decisions to testing denied cases. Use it to keep permission checks out of duplicated controller logic. CX Codex +1 ★ 234repo stars quality-checks Runs PHP-CS-Fixer for code style, PHPStan for static analysis, and type checking. Use before committing or when CI quality checks fail. CX Codex +1 ★ 234repo stars writing-plans writing-plans generates structured implementation plans for Symfony features with clear steps, acceptance criteria, and risk mitigations. CX Codex +1 ★ 234repo stars effective-context effective-context is a Claude Code skill that teaches an agent to gather context for Symfony development: versions, error-path files, stack traces, and project constraints. CX Codex +1 ★ 234repo stars strategy-pattern Implements the Strategy pattern in Symfony using tagged services. Helps clean up branching logic when algorithms or providers vary at runtime. CX Codex +1 ★ 234repo stars executing-plans The executing-plans skill guides Claude Code through an approved implementation plan, with test-first steps and a separate commit for each one. Use it for multi-step work or to resume after an interruption. CX Codex +1 ★ 234repo stars twig-components twig-components turns repeated Twig markup into Symfony UX components with props, slots and CVA variants. Handy once the same template chunk starts getting copied around. CX Codex +1 ★ 234repo stars cqrs-and-handlers cqrs-and-handlers implements CQRS in Symfony projects using separate Messenger buses for commands and queries. CX Codex +1 ★ 234repo stars

Project sponsors

Companies that keep this analytics open