api-generation

Generate typed TypeScript API clients from Go Swagger comments.

2|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/atilladeniz/next-go-pg --skill api-generation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-generation
Source: https://github.com/atilladeniz/next-go-pg/tree/main/.claude/skills/api-generation
Command: npx skills add https://github.com/atilladeniz/next-go-pg --skill api-generation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the tedious and error-prone manual process of writing and maintaining frontend API clients. It automates the generation of type-safe TypeScript React Query hooks directly from your Go backend's Swagger comments, ensuring your frontend is always perfectly in sync with your backend API, saving countless hours of debugging and manual updates.

Core Features & Use Cases

  • One-Command Generation: Use make api to automatically generate swagger.json from Go comments and then TypeScript hooks via Orval.
  • Type-Safe Frontend Client: Provides strongly typed API requests and responses, reducing runtime errors and improving developer experience.
  • Clear Workflow for New Endpoints: Guides you through adding Swagger comments to Go handlers and regenerating the client.
  • Use Case: After adding a new /products endpoint to your Go backend, use make api to automatically generate the corresponding useGetProducts and usePostProducts React Query hooks for the frontend, ensuring immediate and type-safe consumption.

Quick Start

Explain the steps to add a new API endpoint in the Go backend, including Swagger comments, and then generate the updated TypeScript client for the frontend using the make api command.

Frequently Asked Questions about api-generation

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

FAQPage Schema
How do I keep my TypeScript frontend API client in sync with my Go backend?

Generate a typed TypeScript API client directly from your Go Swagger comments using `make api`, which runs swag init to produce swagger.json and Orval to generate React Query hooks. This ensures your frontend client automatically reflects backend API changes without manual updates.

Can I generate TypeScript React Query hooks automatically from Go Swagger comments?

Yes. Add Swagger comments to your Go handlers, then run `make api` to automatically generate type-safe React Query hooks via Orval. The generated files are written to frontend/src/shared/api and should not be manually edited.

What's the workflow for adding a new API endpoint and updating the frontend client?

Add Swagger comments to your new Go endpoint, run `make api` to regenerate swagger.json and TypeScript hooks, then use the generated typed hooks in your React components. This end-to-end process eliminates manual API client maintenance.

Why use Orval for API client generation instead of writing TypeScript types manually?

Orval generates strongly typed API requests and responses from Swagger specifications, eliminating runtime errors and reducing debugging time. Manual TypeScript types become outdated when backend APIs change; generated clients stay in sync automatically.

Do I need to manually edit generated TypeScript API client files?

No. Generated files under frontend/src/shared/api are managed by `make api` and should never be manually edited. Any backend changes are incorporated by regenerating with the make command.

What happens if I add a new Go endpoint but forget to regenerate the TypeScript client?

Your React frontend won't have the corresponding typed hooks available, forcing manual API calls or type definitions. Running `make api` after any backend endpoint changes ensures the frontend client stays current and type-safe.