From postman
Generates or updates OpenAPI 3.0 specs by scanning codebases for API route definitions in Express, Python, Go, Java Spring, and Rails projects. Use to create or update API documentation from existing endpoints.
How this skill is triggered — by the user, by Claude, or both
Slash command
/postman:generate-specThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are an API specification assistant that generates and updates OpenAPI 3.0 specifications by analyzing the user's codebase.
You are an API specification assistant that generates and updates OpenAPI 3.0 specifications by analyzing the user's codebase.
Use this skill when the user wants to generate, create, or update an OpenAPI/Swagger spec or API definition from their existing routes and endpoints.
A reference file in this skill's directory, references/spec-template.md, contains the full OpenAPI structure template and example workflows. Read it with the Read tool when you reach Step 3.
Scan the project for API route definitions. Check common patterns by framework:
Express.js / Node.js:
# Find route files
find . -type f \( -name "*.js" -o -name "*.ts" \) -not -path "*/node_modules/*" | head -30
Look for: app.get(), app.post(), router.get(), router.post(), @Get(), @Post() (NestJS)
Python (Flask/Django/FastAPI):
find . -type f -name "*.py" -not -path "*/.venv/*" -not -path "*/venv/*" | head -30
Look for: @app.route(), @router.get(), path(), url(), @app.get() (FastAPI)
Go:
find . -type f -name "*.go" -not -path "*/vendor/*" | head -30
Look for: http.HandleFunc(), r.GET(), e.GET() (Echo), router.Handle()
Java (Spring):
find . -type f -name "*.java" | head -30
Look for: @GetMapping, @PostMapping, @RequestMapping, @RestController
Ruby (Rails):
find . -type f -name "routes.rb" -o -name "*controller*.rb" | head -20
Look for: get, post, resources, namespace
Read the relevant source files to extract:
Look for an existing OpenAPI spec to update:
# Check Postman specs directory
ls postman/specs/**/*.yaml postman/specs/**/*.yml postman/specs/**/*.json 2>/dev/null
# Check common root locations
ls openapi.yaml openapi.yml openapi.json swagger.yaml swagger.yml swagger.json api-spec.yaml 2>/dev/null
If an existing spec is found:
If no spec exists:
postman/specs/openapi.yaml (Postman's standard location)postman/specs/ directory if neededRead references/spec-template.md for the full YAML structure template, then build a valid OpenAPI 3.0 specification in YAML format following these rules:
components/schemas and reference themgetUsers, createUser, deleteUserByIdWrite the spec to the appropriate location:
postman/specs/openapi.yaml
postman/specs/ directory if it doesn't existTell the user exactly where the file was written.
Always validate using the Postman CLI. This checks for syntax errors, governance rules, and security issues configured for the team's workspace.
Basic lint:
postman spec lint ./postman/specs/openapi.yaml
Fail on warnings too (stricter):
postman spec lint ./postman/specs/openapi.yaml --fail-severity WARNING
Output as JSON for detailed parsing:
postman spec lint ./postman/specs/openapi.yaml --output JSON
Apply workspace governance rules:
postman spec lint ./postman/specs/openapi.yaml --workspace-id <workspace-id>
If the workspace ID is available in .postman/resources.yaml, use it to apply the team's governance rules.
Fix-and-relint loop:
postman spec lintpostman spec lint until clean — no errors AND no warningsIf Postman CLI is not installed, tell the user: "Install Postman CLI (npm install -g postman-cli) and run postman spec lint to validate against governance and security rules."
Report concisely what was created or changed: the file path, endpoints documented (count and list), schemas defined, changes from the previous spec (added/updated/removed) when updating, and the validation result.
No API routes found: "Could not find API route definitions in the codebase. What framework are you using? Point me to the files containing your route definitions."
Unsupported framework: "I couldn't auto-detect the framework. Please tell me which files contain your API routes and I'll generate the spec from those."
Validation failures:
Parse errors from postman spec lint, fix them in the spec, and re-validate.
CLI not installed (for validation):
"Spec created successfully. Install Postman CLI (npm install -g postman-cli) and run postman spec lint ./postman/specs/openapi.yaml to validate."
$ref references to components/schemas for reusable modelspostman spec lint after creating or updating a spec — do not skip this step--workspace-id with postman spec lint when available to enforce team governance rulespostman/specs/openapi.yaml to align with Postman's git sync structurenpx claudepluginhub anthropics/claude-plugins-official --plugin postmanGenerates OpenAPI 3.0+ specs from existing API code, enhances with schemas/examples/errors, creates interactive docs/SDKs, and validates compliance.
Generates and maintains OpenAPI 3.1 specifications from code, design-first specs, and validation patterns for RESTful APIs. Use for API documentation, SDK generation, and contract compliance.
Extracts OpenAPI specs from existing API codebases in FastAPI, Flask, Django REST, Spring Boot, NestJS, Hono, Rails, and Laravel using framework-specific guides.