skillfed

api-design

api-design guides you through building robust command interfaces for Tauri applications using type-safe data structures and proven patterns. It covers DTO design, validation at API boundaries, error handling strategies, and documentation practices to ensure your backend contracts are clear and maintainable.

api-design helps you build type-safe Tauri command APIs with structured DTOs and validation patterns.

AI-generated summary based on this skill's SKILL.md

4 3 MIT updated by cacr92

Install

cacr92/WeReply/api-design · repository language: Python

CLI (skillfed)coming soon
git clone https://github.com/cacr92/WeReply
cp -r WeReply/.claude/skills/api-design ~/.claude/skills/api-design

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How to design Tauri API commands with type safety?

api-design teaches you to structure Tauri command interfaces using type-safe data transfer objects (DTOs) and validation patterns. Define request and response types in Rust, leverage the type system to catch errors at compile time, and use tools like Specta to auto-generate TypeScript bindings. This ensures your frontend and backend stay synchronized and eliminates runtime type mismatches.

What are best practices for Tauri command structure?

api-design covers Tauri command structure best practices including clear separation of concerns between commands, consistent naming conventions, and layered validation. Use dedicated DTO types for inputs and outputs, apply validation at API boundaries before business logic runs, and organize commands into logical modules. This approach makes your codebase maintainable and your contracts explicit.

How do I create DTOs and validate data in Rust APIs?

api-design guides you through creating data transfer objects (DTOs) in Rust with field-level validation rules. Use serde for serialization, derive macros for common patterns, and validation libraries to enforce constraints at API boundaries. Structure your DTOs to mirror your API contracts, validate early in the request pipeline, and return structured errors when validation fails.

How should I handle errors in API responses?

api-design shows you how to implement structured error types for APIs that provide clear, actionable feedback. Define custom error enums that map to HTTP-like status codes, include error codes and messages in responses, and ensure all API endpoints return consistent error formats. This lets clients handle failures predictably and improves debugging.

How do I document API endpoints and contracts?

api-design emphasizes documenting API contracts through type definitions and generated bindings. Use Specta to auto-generate TypeScript types from your Rust command signatures, add doc comments to DTOs and commands, and maintain a clear mapping between frontend requests and backend handlers. Generated documentation stays in sync with your code and reduces manual effort.

What patterns work for pagination and CRUD operations?

api-design covers pagination, versioning, and CRUD patterns for scalable APIs. Implement paginated responses with offset/limit or cursor-based approaches, structure CRUD commands consistently (create, read, update, delete), and version your API contracts to support evolution. These patterns keep your API predictable as your application grows.

SKILL.md

rendered from the published skill — quoted content, verbatim

API Design Skill

Expert guidance for designing robust, type-safe APIs and data structures in Tauri applications.

Overview

This skill provides guidance for: - Designing Tauri command APIs - Creating type-safe DTOs (Data Transfer Objects) - API documentation and contracts - Request/response patterns - Error handling in APIs - API versioning and evolution

When This Skill Applies

This skill activates when: - Creating new Tauri commands - Designing request/response DTOs - Planning API structure - Documenting API contracts - Refactoring existing APIs - Handling API versioning

API Design Principles

1. Type Safety First

✓ Good: Explicit, typed structures

```rust use serde::{Deserialize, Serialize}; use specta::Type;

[derive(Serialize, Deserialize, Type, Clone)]

[specta(inline)]

pub struct CreateFormulaDto { /// Formula name (2-100 characters) #[serde(alias = "formulaName")] pub name: String,

/// Species code (e.g., "pig",

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 2 files
.claude/skills/api-design/SKILL.md
.claude/skills/api-design/skill.json

Related skills

Tags

contract-first-design backend-architecture type-generation request-validation response-wrapping error-standardization pagination-patterns schema-versioning