dto-implementation

Enforce safe DTO patterns with JPQL queries for HMIS Java backends.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/withmartian-sandbox/ghrc-x-a78d77e2f0a84f43b4d486d418566b5b --skill dto-implementation-withmartian-sandbox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dto-implementation
Source: https://github.com/withmartian-sandbox/ghrc-x-a78d77e2f0a84f43b4d486d418566b5b/tree/main/.claude/skills/dto-implementation
Command: npx skills add https://github.com/withmartian-sandbox/ghrc-x-a78d77e2f0a84f43b4d486d418566b5b --skill dto-implementation-withmartian-sandbox

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

DTO implementation guidelines prevent unsafe DTO patterns and ensure consistent data transfer in HMIS backend by standardizing constructor usage, query patterns, and navigation strategies.

Core Features & Use Cases

  • Never modify existing constructors; only add new ones to preserve backward compatibility.
  • Use direct DTO queries (e.g., selecting new DTOs in JPQL) to avoid entity-to-DTO mapping loops.
  • Enforce JPQL persisted fields only; avoid derived properties in queries.
  • Use navigation by IDs and names for reliable relationships; handle nulls with LEFT JOINs and COALESCE.
  • Enforce wrapper types for null safety and provide explicit guidance on common non-persisted properties.
  • Apply these patterns when creating DTOs for reports, service layers, and API responses in HMIS.

Quick Start

Review existing HMIS DTO usage and implement at least one new constructor and a direct DTO query example to validate the guidelines.

Frequently Asked Questions about dto-implementation

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

FAQPage Schema
How do I implement safe DTO patterns in Java backend modules?

Safe DTO patterns in Java backends are implemented by enforcing wrapper types for null safety, using direct DTO JPQL queries, and adding new constructors without modifying existing ones to preserve backward compatibility.

What is the best way to write JPQL queries for DTO projection?

The best way to write JPQL DTO projection queries is selecting new DTOs directly in the query, avoiding entity-to-DTO mapping loops, and enforcing JPQL persisted fields only while avoiding derived properties.

Why does my JPQL DTO query fail when using derived properties?

JPQL DTO queries fail with derived properties because direct DTO projection requires JPQL persisted fields only. You must exclude non-persisted properties and handle common derived attributes through explicit guidance outside the query.

How do I handle null values in JPQL DTO navigation queries?

Handle null values in JPQL DTO navigation by using LEFT JOINs and COALESCE, and navigate by IDs and names for reliable relationships to ensure safe data transfer across relationship boundaries.

Can I modify existing constructors when adding DTO projection?

No, you must never modify existing constructors when adding DTO projection. Only add new constructors to preserve backward compatibility and standardize constructor usage across the backend service layers.

When do I need wrapper types for DTO data transfer?

You need wrapper types for DTO data transfer whenever null safety is required. Enforcing wrapper types prevents null pointer exceptions and provides explicit guidance on common non-persisted properties.