docs/skills/openapi/SKILL.md
Generate OpenAPI specification from ALPS profile. Converts ALPS semantic descriptors to RESTful API definitions with automatic validation.
npx skillsauth add alps-asd/app-state-diagram alps2openapiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate OpenAPI 3.1 specification from ALPS profile with validation loop.
| ALPS type | HTTP Method | Description | |-----------|-------------|-------------| | safe | GET | Read operations | | unsafe | POST | Create operations (non-idempotent) | | idempotent | PUT/DELETE/PATCH | Update/Delete operations (idempotent) |
Infer from transition ID:
PUT (Update):
update, edit, modify, change, set, replacedoUpdateUser, doEditPost, doSetStatusDELETE:
delete, remove, cancel, clear, destroydoDeleteUser, doRemoveItem, doCancelOrderPATCH:
toggle, patch, increment, decrementdoToggleComplete, doPatchProfileUse ALPS transition ID directly as operationId:
goTodoList → operationId: goTodoListdoCreateTodo → operationId: doCreateTodo| Transition Pattern | Path | Method | |-------------------|------|--------| | goXxxList | /xxxs | GET | | goXxxDetail | /xxxs/{xxxId} | GET | | doCreateXxx | /xxxs | POST | | doUpdateXxx | /xxxs/{xxxId} | PUT | | doDeleteXxx | /xxxs/{xxxId} | DELETE | | doToggleYyy | /xxxs/{xxxId}/yyy | PATCH |
/todos, /users, /products/order-items, /user-profiles/users/{userId}/postsMap ALPS semantic descriptors to OpenAPI schema properties:
# ALPS
{"id": "todoId", "title": "Task ID", "def": "https://schema.org/identifier"}
# OpenAPI
todoId:
type: string
description: Task ID
ALPS states become OpenAPI schema names:
TodoList → TodoListItem (for list responses)TodoDetail → TodoDetail (for single item responses)| schema.org | OpenAPI |
|------------|---------|
| https://schema.org/DateTime | type: string, format: date-time |
| https://schema.org/Date | type: string, format: date |
| https://schema.org/Time | type: string, format: time |
| https://schema.org/Email | type: string, format: email |
| https://schema.org/URL | type: string, format: uri |
| https://schema.org/identifier | type: string |
| https://schema.org/Integer | type: integer |
| https://schema.org/Number | type: number |
| https://schema.org/Boolean | type: boolean |
| https://schema.org/Text | type: string |
Extract from transition's nested descriptors:
{"id": "doCreateTodo", "type": "unsafe", "rt": "#TodoDetail", "descriptor": [
{"href": "#title"},
{"href": "#description"},
{"href": "#dueDate"}
]}
Becomes:
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateTodoRequest'
With schema:
CreateTodoRequest:
type: object
properties:
title:
type: string
description:
type: string
dueDate:
type: string
format: date-time
required:
- title
| Operation | Success | Client Error | Not Found | |-----------|---------|--------------|-----------| | GET (single) | 200 | 400 | 404 | | GET (list) | 200 | 400 | - | | POST | 201 | 400, 409 | - | | PUT | 200 | 400 | 404 | | PATCH | 200 | 400 | 404 | | DELETE | 204 | 400 | 404 |
Always include standard error schema:
components:
schemas:
Error:
type: object
properties:
code:
type: string
description: Error code
message:
type: string
description: Error message
required:
- code
- message
responses:
NotFound:
description: Resource not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Request (POST/PUT):
(optional) in ALPS docResponse:
Use ALPS tag attribute for OpenAPI tags:
{"id": "goTodoList", "type": "safe", "rt": "#TodoList", "tag": "todo"}
Becomes:
tags:
- todo
npx @stoplight/spectral-cli lint <output_file>
$schema referencetitleopenapi: 3.1.0
info:
title: {alps.title}
description: {alps.doc}
version: 1.0.0
servers:
- url: http://localhost:8080/api
description: Development server
paths:
# Generated from transitions
components:
schemas:
# Generated from semantic descriptors and states
Error:
type: object
properties:
code:
type: string
message:
type: string
required:
- code
- message
responses:
NotFound:
description: Resource not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
After generating OpenAPI, validate:
npx @stoplight/spectral-cli lint openapi.yaml
If errors occur:
{
"alps": {
"title": "Todo API",
"descriptor": [
{"id": "todoId", "title": "Task ID"},
{"id": "title", "title": "Title"},
{"id": "completed", "title": "Completed"},
{"id": "TodoList", "descriptor": [
{"href": "#todoId"},
{"href": "#title"},
{"href": "#goTodoDetail"},
{"href": "#doCreateTodo"}
]},
{"id": "goTodoList", "type": "safe", "rt": "#TodoList"},
{"id": "goTodoDetail", "type": "safe", "rt": "#TodoDetail", "descriptor": [
{"href": "#todoId"}
]},
{"id": "doCreateTodo", "type": "unsafe", "rt": "#TodoDetail", "descriptor": [
{"href": "#title"}
]},
{"id": "doDeleteTodo", "type": "idempotent", "rt": "#TodoList", "descriptor": [
{"href": "#todoId"}
]}
]
}
}
openapi: 3.1.0
info:
title: Todo API
version: 1.0.0
paths:
/todos:
get:
operationId: goTodoList
summary: Get todo list
responses:
'200':
description: Todo list
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/TodoListItem'
post:
operationId: doCreateTodo
summary: Create todo
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateTodoRequest'
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/TodoDetail'
'400':
$ref: '#/components/responses/BadRequest'
/todos/{todoId}:
parameters:
- name: todoId
in: path
required: true
schema:
type: string
get:
operationId: goTodoDetail
summary: Get todo detail
responses:
'200':
description: Todo detail
content:
application/json:
schema:
$ref: '#/components/schemas/TodoDetail'
'404':
$ref: '#/components/responses/NotFound'
delete:
operationId: doDeleteTodo
summary: Delete todo
responses:
'204':
description: Deleted
'404':
$ref: '#/components/responses/NotFound'
components:
schemas:
TodoListItem:
type: object
properties:
todoId:
type: string
description: Task ID
title:
type: string
description: Title
required:
- todoId
- title
TodoDetail:
type: object
properties:
todoId:
type: string
title:
type: string
completed:
type: boolean
required:
- todoId
- title
- completed
CreateTodoRequest:
type: object
properties:
title:
type: string
required:
- title
Error:
type: object
properties:
code:
type: string
message:
type: string
required:
- code
- message
responses:
NotFound:
description: Resource not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
tools
Release npm packages and create git tags. Handles @alps-asd/app-state-diagram, @alps-asd/mcp, and Homebrew formula updates.
development
Generate multi-fidelity HTML mock from ALPS profile. Creates semantic HTML pages, three CSS fidelity levels, mock API responses, and i18n labels — all from a single ALPS profile.
testing
Create, validate, and improve ALPS profiles. Generate from natural language descriptions, validate existing profiles, and get improvement suggestions.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.