api-contract

Convert Swagger/OpenAPI or page-spec JSON into TypeScript types and API request functions.

1.0k|71|Updated Apr 1, 2025
One-click install
npx skills add https://github.com/ChenyCHENYU/Robot_Admin --skill api-contract-chenychenyu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-contract
Source: https://github.com/ChenyCHENYU/Robot_Admin/tree/main/.github/skills/api-contract
Command: npx skills add https://github.com/ChenyCHENYU/Robot_Admin --skill api-contract-chenychenyu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill automates the creation of TypeScript API types and request functions from page specifications or API documentation, reducing manual coding efforts.

Core Features & Use Cases

  • Type Generation: Converts API schemas or page-spec JSON into comprehensive TypeScript type definitions.
  • Request Function Automation: Generates ready-to-use API request functions adhering to project conventions.
  • Use Case: A developer wants to quickly implement front-end API calls based on Swagger or page schemas, ensuring type safety and consistency with backend services.

Quick Start

Use the api-contract skill to generate types and API functions from your Swagger or page-spec JSON file.

Frequently Asked Questions about api-contract

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

FAQPage Schema
How do I generate TypeScript types from Swagger or OpenAPI documents?

To generate TypeScript types from Swagger or OpenAPI documents, you can use an automated code generation process that parses the API schemas and outputs comprehensive type definitions. This approach reduces manual coding efforts and ensures type safety.

Can I automate API request function creation from page-spec JSON?

Yes, you can automate API request function creation from page-spec JSON. The process converts JSON specifications into ready-to-use API request functions that adhere to project conventions, facilitating rapid front-end API integration.

What's the best way to ensure type safety when integrating front-end API calls?

The best way to ensure type safety when integrating front-end API calls is to generate TypeScript type definitions directly from API documentation. This guarantees consistency with backend services and reduces manual coding errors.

Do I need configuration files to generate TypeScript API code from specifications?

Yes, you need configuration files to generate TypeScript API code from specifications. These files are required to customize the code structure according to specific project conventions and to adhere to strict safety and modularity standards.

How does code generation from OpenAPI specifications customize code structure for my project?

Code generation from OpenAPI specifications customizes code structure by reading project conventions through required configuration files. This ensures the generated TypeScript types and request functions match your existing architecture and modularity standards.