crud-dto

Standardize CRUD DTO definitions and validation for PowerX HTTP transport handlers.

357|65|Updated Jul 29, 2022
One-click install
npx skills add https://github.com/ArtisanCloud/PowerX --skill crud-dto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: crud-dto
Source: https://github.com/ArtisanCloud/PowerX/tree/main/.codex/skills/crud/dto
Command: npx skills add https://github.com/ArtisanCloud/PowerX --skill crud-dto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill codifies PowerX CRUD DTO conventions to prevent database model leakage into the transport layer, enforce consistent request/response shapes, and mandate pagination and validation rules for HTTP endpoints.

Core Features & Use Cases

  • Separation of concerns: DTOs are decoupled from models and must not include ORM or gorm tags.
  • Validation and binding: Handlers are required to use centralized binding/validation helpers and DTO fields must include json and validation tags.
  • Unified pagination and responses: Standard PaginationRequest and PaginationResponse types and ResponseList envelopes for list endpoints.
  • Use Case: When implementing a new CRUD HTTP handler, apply these templates to create Create/Update/Get/List DTOs, add validation tags, and ensure the handler uses the prescribed validate-and-bind helpers.

Quick Start

Create or validate DTO files under internal/transport/http following the provided templates and binding rules so handlers can call ValidateRequestWithContext or ValidateAndBindWithContext.

Frequently Asked Questions about crud-dto

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

FAQPage Schema
How do I separate HTTP DTOs from database models in Go services?

Separate HTTP DTOs by defining them in the transport layer without ORM or gorm tags, ensuring request and response shapes remain decoupled from database structures.

How do I standardize pagination requests and responses for Go HTTP endpoints?

Standardize pagination for Go HTTP endpoints by defining unified PaginationRequest and PaginationResponse types, using a ResponseList envelope for list handlers to ensure consistent API contracts.

What is the best way to validate API requests and bind DTOs in Go?

Validate API requests and bind DTOs by including validation tags on struct fields and calling centralized validation helpers like ValidateRequestWithContext or ValidateAndBindWithContext in your HTTP handlers.

Do I need to include validation tags on DTO fields for Go CRUD operations?

Yes, you need validation tags on DTO fields for Go CRUD operations. DTOs must include both json and validation tags to enforce API contracts and enable centralized binding helpers to function correctly.

Why are my gorm tags leaking into the HTTP transport layer DTOs?

Gorm tags leak into HTTP transport layer DTOs when database models are reused directly for API responses. To prevent this, define separate CRUD DTOs that exclude ORM tags and include only json and validation tags.