generate-code

A code generator that creates Go types, HTTP clients, or server interfaces from an OpenAPI specification. OpenAPI is a machine-readable description of an HTTP API, including its endpoints and data shapes.

In plain words
What is it for?
Use it to generate Go models, client methods, or server handler stubs from an OpenAPI file.
Why use it?
It removes the need to manually write repetitive Go code and keeps generated interfaces aligned with the API description.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/erraggy/oastools/generate-code
Any agent
npx skills add erraggy/oastools --skill generate-code
Clone the repo
git clone --depth 1 https://github.com/erraggy/oastools

Made for: Claude Code, Codex.

Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 526 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00017 $0.00526
Opus 5 $0.00009 $0.00263
Sonnet 5 $0.00003 $0.00105
Haiku 4.5 $0.00002 $0.00053

Measured yesterday against content hash 7eee37363ee0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

generate-code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugin/skills/generate-code/SKILL.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Generate Code from an OpenAPI Specification

Step 1: Understand the spec

Call parse to get an overview of the API:

{"spec": {"file": "<path>"}}

Report the API title, version, number of operations and schemas. This helps set expectations for what will be generated.

Step 2: Determine what to generate

Ask the user what they need. The generate tool supports three output modes:

Option What it generates
types Go type definitions for all schemas
client HTTP client with methods for each operation (includes types)
server Server interface and handler stubs (includes types)

Also determine:

  • output_dir (required) -- Where to write the generated files
  • package_name (optional, default: api) -- Go package name for the generated code

Step 3: Generate the code

Call the generate tool:

{
  "spec": {"file": "<path>"},
  "client": true,
  "output_dir": "./generated",
  "package_name": "petstore"
}

Step 4: Review the output

The tool returns a manifest of generated files with names and sizes. Review:

  • File list -- Confirm all expected files were created
  • Generated types count -- Matches the schema count from Step 1
  • Generated operations count -- Matches the operation count from Step 1
  • Warnings -- Any issues encountered during generation (unsupported features, naming conflicts)
  • Critical errors -- If success is false, explain what went wrong

Read the generated files and provide a summary of the key types and functions.

Step 5: Suggest integration steps

Based on what was generated, suggest next steps:

For types only:

  • Import the package and use the types in existing code
  • Note any custom types that may need manual adjustment (e.g., interface{} fields)

For client:

  • Show how to initialize the client with a base URL
  • Demonstrate calling one or two key endpoints
  • Note authentication setup if the spec has security schemes

Read the full file on GitHub · 78 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 78 lines · 17 tokens per session scan A 7eee37363ee0

Subscribe to this mod's changes

generate-code is a skill published in the GitHub repository erraggy/oastools (5 stars, last pushed 3d ago), licensed MIT. It adds 17 tokens to every session and 526 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.