Openapi generator
Skill juankmvanegas/factoria-powers/skills/openapi-generator
Generate OpenAPI 3.1 specification as a contract between backend and frontendFrom its SKILL.md
npx -y skills add juankmvanegas/factoria-powers --skill openapi-generatorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
9.0 KB, as published. Nobody here has run it
Skill: OpenAPI Generator
Purpose
Generate the OpenAPI specification that serves as the single contract between the backend factory (e.g. net, pyt, nest) and the frontend factory (ang). This spec is the source of truth — nothing is coded until it is approved. The contract is factory-agnostic: each factory derives its own artifacts from the same spec.
When it activates
- Automatic: When the orchestrator detects it is a new project from scratch (API-First gate)
- Manual: When the user invokes
/openapi-generator - Does NOT apply: Migrations (extracted from legacy), existing features, sprints, bug fixes
Execution Flow
Phase 1: Endpoint Interview
Ask the user (or infer from context):
- Domain: What entity/resource does this endpoint handle?
- Operations: Full CRUD? Read-only? Custom actions?
- Input data: What fields does it receive? Which are required?
- Output data: What fields does it return? Pagination? Filters?
- Authentication: Does it require auth? What roles?
- Errors: What business errors can it have?
If context already exists (PRP, BUSINESS_LOGIC.md, discovery), infer without asking.
Phase 2: Generate OpenAPI 3.1 Spec
openapi: "3.1.0"
info:
title: "{Project Name} API"
version: "1.0.0"
description: "API contract generated by Factoria"
servers:
- url: https://api.example.com/v1
description: Production
- url: http://localhost:5000/v1
description: Development
security:
- bearerAuth: []
paths:
/notes:
get:
operationId: getAllNotes
summary: Get all notes
tags: [Notes]
parameters:
- name: page
in: query
schema: { type: integer, default: 1 }
- name: pageSize
in: query
schema: { type: integer, default: 20 }
responses:
"200":
description: List of notes
content:
application/json:
schema:
$ref: "#/components/schemas/PaginatedNotesResponse"
"401":
$ref: "#/components/responses/Unauthorized"
post:
operationId: createNote
summary: Create a note
tags: [Notes]
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NoteInput"
responses:
"201":
description: Note created
content:
application/json:
schema:
$ref: "#/components/schemas/NoteOutput"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
/notes/{id}:
get:
operationId: getNoteById
summary: Get note by ID
tags: [Notes]
parameters:
- name: id
in: path
required: true
schema: { type: integer }
responses:
"200":
description: Note found
content:
application/json:
schema:
$ref: "#/components/schemas/NoteOutput"
"404":
$ref: "#/components/responses/NotFound"
components:
schemas:
NoteInput:
type: object
required: [title, content]
properties:
title:
type: string
maxLength: 200
example: "My first note"
content:
type: string
example: "Note content"
tags:
type: array
items: { type: string }
NoteOutput:
type: object
properties:
id:
type: integer
title:
type: string
content:
type: string
tags:
type: array
items: { type: string }
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
PaginatedNotesResponse:
type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/NoteOutput"
totalCount:
type: integer
page:
type: integer
pageSize:
type: integer
ErrorResponse:
type: object
properties:
code:
type: string
message:
type: string
details:
type: array
items: { type: string }
responses:
BadRequest:
description: Invalid input data
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
Unauthorized:
description: Not authenticated or invalid token
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
NotFound:
description: Resource not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
Phase 3: Mapping to the Factories
Generate a correspondence table so each involved factory knows what to create. The columns are the backend factory (e.g. net, pyt, nest) and the frontend factory (ang); fill them according to the factories the orchestrator selected for this project.
OPENAPI BACKEND FACTORY (e.g. net/pyt) FRONTEND FACTORY (ang)
─────── ────────────────────────────── ──────────────────────
NoteInput (schema) → NoteInput DTO → note.input.ts (DTO)
NoteOutput (schema) → NoteOutput DTO → note.output.ts (DTO)
GET /notes → NotesController.GetAll() → NotesAdapter.getAllNotes()
POST /notes → NotesController.Create() → NotesAdapter.createNote()
GET /notes/{id} → NotesController.GetById() → NotesAdapter.getNoteById()
bearerAuth → Auth attribute / dependency → Auth token in header
400 BadRequest → Validation → Form validation + error event
404 NotFound → BusinessException → Graceful handling
The exact artifact names per stack come from each factory's
references/<factory>/CLAUDE.md. For the precise OpenAPI-element → artifact mapping per factory (net, ang, nest, pyt), see the "What each factory extracts from the OpenAPI" table inreferences/orchestrator.md.
Phase 4: Present for Approval
Show the user:
OPENAPI CONTRACT — {Name}
════════════════════════════
Version: 1.0.0
Endpoints: N
Schemas: N
Auth: Bearer JWT
ENDPOINTS:
GET /notes → Paginated list of notes
POST /notes → Create note
GET /notes/{id} → Get note by ID
PUT /notes/{id} → Update note
DELETE /notes/{id} → Delete note
SCHEMAS:
NoteInput → title (req), content (req), tags (opt)
NoteOutput → id, title, content, tags, createdAt, updatedAt
Do you approve this contract? (yes/no/modify)
Phase 5: Save and Version
Upon approval:
- Save to
.cloud/contracts/openapi.yaml - Copy to
.cloud/contracts/openapi-history/v{version}-openapi.yaml - Generate mapping table in
.cloud/contracts/mapping.md
Phase 6: Existing Spec Update
If an openapi.yaml already exists:
- Read current spec
- Identify what changes are needed
- Classify changes:
- Non-breaking: New optional field, new endpoint →
minor++ - Breaking: Removed field, changed type, removed endpoint →
major++
- Non-breaking: New optional field, new endpoint →
- Show diff to user
- Approve → update spec + version
Breaking changes require double confirmation:
"This change is BREAKING — the frontend will stop working if not updated. Do you confirm?"
From Migration
When used in migration context:
- Read legacy contracts (from
.cloud/planning/legacy-discovery/) - Generate OpenAPI that replicates legacy endpoints
- Mark endpoints that change vs those that remain the same
- Present for approval with legacy vs new diff
From PRP
When generated from an approved PRP:
- Read the PRP (architectural impact, API changes)
- Generate/update OpenAPI with PRP endpoints
- Map to the involved factories
- Present for approval
Rules
- NEVER code without an approved OpenAPI in Full Stack mode
- ALWAYS version changes to the spec
- ALWAYS show mapping to the involved factories (backend + frontend)
- ALWAYS classify changes as breaking/non-breaking
- ALWAYS use OpenAPI 3.1 (YAML, not JSON)
- ALWAYS include examples in schemas
- ALWAYS include error responses (400, 401, 404, 500)
- ALWAYS include securitySchemes if there is auth
- NEVER generate a spec without understanding the input and output data
- The user has the FINAL WORD on the contract