Skip to content
Back to skills

Value Objects And Dtos

ASecurity

Design Value Objects for domain concepts and DTOs for data transfer with proper immutability (readonly) and validation

  • 221 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added August 31, 2026
developmentrailsapi

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 6, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Value Objects And Dtos?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Value Objects And Dtos
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dev-toolings-value-objects-and-dtos/badge)](https://www.skillsdirectory.com/skills/dev-toolings-value-objects-and-dtos)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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`

Files in this skill

  • SKILL.md1.1 KB
  • reference.md9.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.