api-design_skill

This skill helps you design consistent API interfaces and DTOs with unified ApiResponse, camelCase fields, and validation at command boundaries.
  • Python

0

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill cacr92/wereply --skill api-design

  • SKILL.md1.8 KB

Overview

This skill guides API, DTO, and interface design for Tauri commands and backend-to-frontend contracts. It enforces a consistent response envelope, serde-compatible DTOs, naming conventions, pagination patterns, and validation rules to produce predictable, front-end-friendly APIs.

How this skill works

When invoked, the skill inspects API requirements and outputs DTO definitions, request/response shapes, pagination formats, and validation rules following the ApiResponse<T> envelope. It recommends serde and specta::Type annotations, camelCase field names, command naming patterns, and where to perform input validation versus business error handling.

When to use it

  • Designing or refactoring Tauri command interfaces that communicate with the UI
  • Creating or reviewing DTOs for backend-to-frontend serialization
  • Defining standard API responses and error handling for client consumption
  • Specifying pagination and list endpoints for tables or feeds
  • Establishing naming and validation contracts shared by frontend and backend

Best practices

  • Wrap every response in ApiResponse<T> with success, data, and error fields
  • Define DTOs with serde and specta::Type and use #[serde(rename_all = "camelCase")]
  • Use verb+noun command names (get/create/update/delete) and DTO suffixes (CreateXDto, UpdateXDto, XDto)
  • Perform input validation at the command boundary; let business layer return anyhow::Result with context
  • Keep error messages concise and user-facing; avoid leaking internal errors or raw DB messages
  • Prefer reusing existing paginated types and return fields ready for direct rendering

Example use cases

  • Designing a CreateFactory endpoint with CreateFactoryDto, validation rules, and ApiResponse<CreateFactoryDto>
  • Converting legacy list endpoints to return a MaterialsPaginatedResult ready for table rendering
  • Standardizing error responses so the UI only needs to check ApiResponse.success and display ApiResponse.error
  • Defining DTOs for front-end forms that map directly to camelCase JSON and specta type metadata
  • Adding command-level validation to prevent SQLx errors and provide clear user-facing messages

FAQ

A single envelope standardizes success, payload, and user-facing error text so clients can implement consistent handling.

Where should validation happen?

Validate at the command boundary before calling business logic; business functions should return anyhow::Result and add context on failure.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational