Convert API documentation into Python modules. Orchestrates doc2spec and spec2mod skills. Use when user mentions api2mod, converting API to module, or wants to generate a Python client from API docs or specs.
Orchestrator skill that converts API documentation into Python packages. Delegates to specialized sub-skills based on input format.
api2mod (orchestrator)
│
├─→ doc2spec: API docs (HTML, PDF, wiki) → OpenAPI spec
│
└─→ spec2mod: OpenAPI/Swagger/Postman spec → Python module
Use this skill when:
┌─────────────────────────────────────────────────────────────┐
│ api2mod (orchestrator) │
├─────────────────────────────────────────────────────────────┤
│ 1. Detect input format │
│ 2. Route to appropriate sub-skill │
│ 3. Coordinate execution │
│ 4. Verify output │
└─────────────────────────────────────────────────────────────┘
│
▼
┌────────────────────────────────────────┐
│ Format Detection │
├────────────────────────────────────────┤
│ OpenAPI YAML/JSON → spec2mod │
│ Swagger JSON → spec2mod │
│ Postman Collection → spec2mod │
│ Insomnia Export → spec2mod │
│ HTML/PDF/Wiki Docs → doc2spec → spec2mod │
└────────────────────────────────────────┘
Ask the user for:
Detect the API documentation format and delegate accordingly:
If the input is a structured API specification:
| Format | Detection |
|---|---|
| OpenAPI JSON | "openapi" key in JSON |
| OpenAPI YAML | openapi: at root |
| Swagger JSON | "swagger" key with version |
| Postman | "info" with "_postman_id" |
| Insomnia | "_type": "export" |
Action: Call spec2mod skill with the spec file and output location.
Use Skill tool:
skill: "spec2mod"
args: "<spec_file> --output <output_dir>"
If the input is unstructured API documentation:
| Format | Examples |
|---|---|
| HTML docs | Confluence, ReadTheDocs, API reference pages |
| API documentation PDFs | |
| Wiki | Atlassian wiki, GitHub wiki |
Action:
doc2spec to convert docs to OpenAPI specspec2mod with the generated specUse Skill tool:
skill: "doc2spec"
args: "<docs_url_or_file> --output <temp_spec.yaml>"
Then:
skill: "spec2mod"
args: "<temp_spec.yaml> --output <output_dir>"
After the sub-skill completes, verify:
User: api2mod ~/myapi/openapi.yaml --output ./myapi-client
Agent:
1. Detects OpenAPI YAML format
2. Calls spec2mod with the spec file
3. spec2mod generates the Python package
User: api2mod https://api.example.com/docs --output ./example-client
Agent:
1. Detects HTML documentation format
2. Calls doc2spec to extract OpenAPI spec
3. Calls spec2mod with the generated spec
4. Generates Python package
| Skill | Responsibility |
|---|---|
doc2spec | Convert unstructured docs to OpenAPI spec |
spec2mod | Generate Python module from OpenAPI spec |
api-architect | Design APIs (opposite direction) |