API Contracts Generator
CommunitySync frontend & backend, ensure flawless API communication.
AuthorRomualdP
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill eliminates common frontend-backend communication errors by generating consistent API contracts, ensuring synchronized types, standardized validation, and uniform error handling across Next.js and NestJS applications.
Core Features & Use Cases
- Backend DTOs (NestJS): Defines Request and Response DTOs using
class-validatorand@nestjs/swaggerfor robust validation and automatic API documentation. - Frontend Types (Next.js): Guides on generating or manually synchronizing TypeScript types for frontend consumption, ensuring type safety.
- Standardized Error Handling: Implements a consistent error response format across the API, making it easier for the frontend to parse and display errors.
- Use Case: When creating a new API endpoint for club creation, define a
CreateClubDtoin NestJS with validation rules. Then, create a corresponding TypeScript type on the frontend to ensure the data sent by the UI matches the backend's expectations, preventing runtime errors.
Quick Start
To define a new API contract, create a CreateXDto in your backend's presentation/dtos/ folder using class-validator and @ApiProperty decorators. Ensure the frontend uses a corresponding TypeScript type for the request body.
Dependency Matrix
Required Modules
class-validator@nestjs/swaggerzod
Components
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: API Contracts Generator Download link: https://github.com/RomualdP/hoki/archive/main.zip#api-contracts-generator Please download this .zip file, extract it, and install it in the .claude/skills/ directory.