data-transformation-layer
Installation
SKILL.md
Data Transformation Layer
Covers the non-obvious parts of transformation: where mappers live, what they must never do, how to handle nested relations and optional fields safely, and how to keep frontend UI models separate from raw API shapes without over-engineering. Skips ORM setup — assumes data is fetched, focus is on shaping it.
Discovery
Before writing anything, answer:
- How many layers are needed? DB → API only (backend-rendered), or DB → API → UI model (fullstack with a frontend)?
- Sensitive fields: Which DB fields must never reach the client (
password,internalScore,stripeCustomerId)? - Derived fields: Does the UI need computed values not in the DB (e.g.,
displayName,isExpired,formattedDate)? - Nested relations: Does the API response include related objects (author, tags, permissions) that also need transforming?
- Nullability: Does the DB schema allow nulls that the API or UI must normalize to defaults or omit?