Extract Openapi From Code
Automatically generates OpenAPI specifications from existing codebase, streamlining API documentation and development workflows.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add extract-openapi-from-code npx -- -y @trustedskills/extract-openapi-from-code
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"extract-openapi-from-code": {
"command": "npx",
"args": [
"-y",
"@trustedskills/extract-openapi-from-code"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill automatically generates OpenAPI specifications directly from existing codebases. It analyzes your implementation to map out endpoints, request/response schemas, and authentication flows without manual documentation.
When to use it
- You need to document a legacy API where original specs are missing or outdated.
- You want to ensure your AI agents understand the exact structure of your backend services.
- You are refactoring code and need to verify that new implementations match expected API contracts.
- You require machine-readable documentation for rapid client SDK generation.
Key capabilities
- Parses source code to identify HTTP methods, paths, and parameters.
- Infers data models and validation rules from typed variables and function signatures.
- Outputs standard OpenAPI 3.x format compatible with major tools like Swagger UI.
- Handles complex scenarios including authentication headers and file uploads.
Example prompts
"Extract an OpenAPI spec from my Python FastAPI application located in the src directory."
"Generate an OpenAPI document from this Node.js Express server code to help my AI agent interact with it."
"Analyze my Go HTTP handlers and create a corresponding OpenAPI specification file."
Tips & gotchas
Ensure your codebase includes type hints or explicit struct definitions, as the extraction relies on these for accurate schema generation. Review the output carefully, as inferred logic may occasionally miss edge cases present only in runtime behavior.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.