dto-validation-design

Design and validate API DTOs with mappings for multi-tenant Go services.

1|Updated Apr 17, 2026
One-click install
npx skills add https://github.com/PremModhaOfficial/motadata-ai-pipeline --skill dto-validation-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dto-validation-design
Source: https://github.com/PremModhaOfficial/motadata-ai-pipeline/tree/main/.claude/skills/dto-validation-design
Command: npx skills add https://github.com/PremModhaOfficial/motadata-ai-pipeline --skill dto-validation-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guides design of request/response DTOs, field-level and cross-field validation, and input sanitization for Go 1.26+ APIs in a multi-tenant platform. DTOs serve two roles: HTTP request/response types for the API Gateway's external endpoints, and NATS message payloads (MsgPack-serialized) for inter-service communication. Covers go-playground/validator struct tags (required, min, max, oneof, uuid), custom cross-field validators, DTO-to-domain model mapping functions, standard MsgPack response envelope with error codes, cursor-based pagination DTOs, CloudEvents envelope (MsgPack-serialized) for NATS JetStream messages, and XSS/HTML sanitization patterns. Produces implementation-ready Go struct definitions with validation tags and mapping functions for PostgreSQL 18 backed services.

Core Features & Use Cases

  • HTTP and NATS DTO definitions separated by clear mapping functions.
  • Validation tags for required, min, max, oneof, uuid, plus cross-field validators.
  • DTO-to-domain mapping, with tenant context and input sanitization.
  • Standard envelopes: MsgPack CloudEvents for NATS, pagination DTOs, and error handling patterns.
  • Security-ready input sanitization patterns (XSS prevention) for API inputs.

Quick Start

Define HTTP and NATS DTO structs, implement ToDomain mappings, and plug in validation and sanitization to produce production-ready Go types.

Frequently Asked Questions about dto-validation-design

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

FAQPage Schema
How do I validate DTOs in Go for both HTTP requests and NATS messages?

You map DTOs to domain models by implementing dedicated mapping functions that translate request and message payloads into domain types. This approach enforces tenant context injection and input sanitization before processing.

How do I serialize NATS JetStream messages with MsgPack in Go?

Prevent XSS in Go APIs by applying HTML sanitization patterns to API inputs during DTO processing. This strips malicious content before mapping to domain models or publishing NATS messages.

Can I use go-playground/validator for cross-field validation in Go multi-tenant services?

Implement cursor-based pagination in Go APIs by defining dedicated pagination DTOs that carry cursor tokens and page size. This enables efficient, stateless data traversal across PostgreSQL-backed services.

What is the best way to map DTOs to domain models in Go multi-tenant services?

A standard response envelope in Go APIs wraps responses with consistent error codes and metadata structures. This applies to both HTTP API Gateway endpoints and MsgPack-encoded NATS messages.