Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

import-openapi-microservice

БесплатноБез исполняемых скриптовНе проверен

TRIGGER when the user asks to delegate to or integrate an external/third-party REST API, import an OpenAPI/Swagger document, or generate a microservice from…

microbus-ioот microbus-io★ 173 звезды на GitHub

Об этом скилле

CRITICAL: This skill does NOT define the shape of generated code. It delegates every feature to the add-microservice, add-function, add-web, and add-config skills, the single source of truth for code shape. This skill only scaffolds the microservice, produces the specs file, picks endpoints, and fills the one-line delegation body.

CRITICAL: The microservice is a faithful one-for-one delegator. Do NOT reshape the remote API: never split a request body into separate arguments, rename routes, or collapse status codes. Body-bearing operations use the magic HTTP arguments so the microservice is byte-transparent to its callers.

CRITICAL: openapispecs.json lives in the microservice's directory and is tracked in source control (never git-ignored). It is the durable record of the remote API. Re-running this skill imports more endpoints from the present specs without re-fetching, and skips endpoints already scaffolded.

Workflow

Copy this checklist and track your progress:

- [ ] Step 1: Locate or scaffold the microservice
- [ ] Step 2: Acquire the OpenAPI document
- [ ] Step 3: Generate openapispecs.json
- [ ] Step 4: Add the base-URL and credential configs
- [ ] Step 5: Add the shared request helpers (once)
- [ ] Step 6: Select which endpoints to import
- [ ] Step 7: Generate the complex types
- [ ] Step 8: Declare the endpoints in definition.go
- [ ] Step 9: Generate the boilerplate
- [ ] Step 10: Implement the handler bodies
- [ ] Step 11: Wire the HTTP egress proxy into the app
- [ ] Step 12: Housekeeping

The placeholders myservice, MyService, myserviceapi stand for the microservice being generated.

Step 1: Locate or Scaffold the Microservice

If a delegator for this API already exists, its openapispecs.json and local CLAUDE.md record what is already imported. If the user only wants more endpoints, skip to Step 6 (the specs are already present; do not re-fetch unless the user wants a newer version of the document).

Otherwise follow the add-microservice skill. Name the microservice after the remote API itself (petstore, not petstorewrap/petstoreproxy/petstoreclient): in the mesh this microservice is that API's representation, and a suffix leaks an implementation detail into a hostname every caller sees. "Delegator" describes what it does, never what it is named. Give it a one-line description (MyService delegates to the Petstore API.); Step 3 appends the API's own overview.

Step 2: Acquire the OpenAPI Document

Place the document in the microservice directory as myservice/openapi.src:

  • By URL: curl -fsSL '<url>' -o myservice/openapi.src. Remember the URL for Step 3.
  • Pasted: write the pasted content verbatim to myservice/openapi.src.

Do not hand-edit it. JSON and YAML are both accepted.

Step 3: Generate openapispecs.json

go run github.com/microbus-io/fabric/cmd/genopenapispecs -base-url 'ORIGIN' < myservice/openapi.src > myservice/openapispecs.json
rm myservice/openapi.src

The tool is a pure offline filter (stdin to stdout; never touches the network).

-base-url is optional and defaults to the document's first servers URL. Real documents often declare a relative server (e.g. /api/v3); the tool then warns on stderr. Set -base-url to that URL's origin (scheme://host) joined with the relative server path, e.g. https://petstore3.swagger.io/api/v3. If the document was pasted with no absolute server and you have no URL, ask the user for the base URL.

The specs file has info, remote{baseURL,security}, types{} (raw JSON Schema keyed by name), and endpoints[] (each with name, feature, method, route, summary, description, params, requestBody, response). feature is function (JSON or empty body) or web (non-JSON body); trust it unless an endpoint is obviously misclassified.

If the specs info.description is non-empty, append it to the Service godoc and svc.SetDescription after the one-line summary from Step 1, separated by a blank line so it renders as a second godoc paragraph.

Step 4: Add the Base-URL and Credential Configs

Follow the add-config skill:

  1. RemoteBaseURL: default remote.baseURL from the specs, validation url.
  2. Credential, secret: true, no default. Only when remote.security is present. Name it for the scheme: APIKey (apiKey), BearerToken (http-bearer/oauth2), or BasicAuth (http-basic, value is the user:password pair).

Step 5: Add the Shared Request Helpers (Once)

Add these helpers to service.go exactly once, not per endpoint. They are the only delegation logic; every handler becomes a single call into them. Add imports bytes, context, encoding/json, io, net/http, strings, errors, github.com/microbus-io/fabric/httpx, and the httpegressapi package.

// remoteURL joins the configured base with an operation path, tolerating a configured base that
// has (or lacks) a trailing slas
Полный SKILL.md на GitHub

Установить import-openapi-microservice в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл import-openapi-microservice?

TRIGGER when the user asks to delegate to or integrate an external/third-party REST API, import an OpenAPI/Swagger document, or generate a microservice from an OpenAPI spec (by URL or pasted JSON/YAML). Produces a one-for-one delegating microservice and stores openapispecs.json in its directory so more endpoints can be imported later.

Как установить скилл import-openapi-microservice?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл import-openapi-microservice запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить import-openapi-microservice с