generate-code

Generate Go client, server, and type code from an OpenAPI specification.

5|5|Updated Nov 9, 2025
One-click install
npx skills add https://github.com/erraggy/oastools --skill generate-code-erraggy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: generate-code
Source: https://github.com/erraggy/oastools/tree/main/plugin/skills/generate-code
Command: npx skills add https://github.com/erraggy/oastools --skill generate-code-erraggy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go teams often spend significant time writing boilerplate to translate OpenAPI definitions into usable clients, servers, and data types. This Skill automates that work by generating idiomatic Go code directly from a spec, ensuring consistency and reducing manual errors.

Core Features & Use Cases

  • Types generation: Go type definitions for all schemas in the OpenAPI spec.
  • Client generation: HTTP client with methods for each operation (including parameter and response types).
  • Server generation: Server interfaces and handler stubs (with integrated types) for rapid API implementation.
  • Use Case: Quickly bootstrap a Go service from a spec to accelerate development and testing.

Quick Start

Run the generate-code tool with your OpenAPI spec file and an output directory to produce Go code ready for integration.

Frequently Asked Questions about generate-code

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

FAQPage Schema
How do I generate Go code from an OpenAPI spec?

Generating Go code from an OpenAPI spec requires providing a valid spec file and an output directory, optionally specifying a Go package name. The tool then produces idiomatic Go client, server, and type definitions ready for integration.

What types of Go code can I generate from an OpenAPI definition?

You can generate Go type definitions for all schemas, HTTP clients with methods for each operation, and server interfaces with handler stubs. This covers strongly-typed interfaces for both consuming and exposing APIs across Go-based services.

Do I need a valid OpenAPI spec file to generate Go client and server code?

Yes, you need a valid OpenAPI spec file and an output directory to generate Go client and server code. The specification file is the source of truth used to automate boilerplate translation and ensure consistency across your strongly-typed interfaces.

What is the best way to bootstrap a Go service from an OpenAPI spec?

The best way to bootstrap a Go service from an OpenAPI spec is to automate code generation for server interfaces and handler stubs. This accelerates API development and testing by ensuring consistency and reducing manual boilerplate errors.

Can I specify a Go package name when generating types from an OpenAPI spec?

Yes, you can optionally specify a Go package name to organize the generated code when generating types from an OpenAPI spec. Along with a spec file and output directory, this helps structure the generated client, server, and type code.

Why generate Go client and server code from an OpenAPI spec instead of writing it manually?

Generating Go client and server code from an OpenAPI spec eliminates significant time spent writing boilerplate to translate API definitions into usable code. It ensures consistency, reduces manual errors, and provides strongly-typed interfaces across API versions.