From postman-generator
Generate complete Postman collections and environments from OpenAPI/Swagger specs or code routing files. Includes rich JS tests validating RESTful compliance (status codes, body schema, response headers) and automates Newman setup/execution.
How this skill is triggered — by the user, by Claude, or both
Slash command
/postman-generator:postman-generatorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create Postman collections (v2.1.0 format) and environments from API specs, Swagger/OpenAPI yaml/json, route handlers, or API description files. Generate JavaScript test scripts validating RESTful compliance, security headers, schema accuracy, and execute them using Newman.
Create Postman collections (v2.1.0 format) and environments from API specs, Swagger/OpenAPI yaml/json, route handlers, or API description files. Generate JavaScript test scripts validating RESTful compliance, security headers, schema accuracy, and execute them using Newman.
/postman-generator create new collections and env from <context>
/postman-generator validate --collection <collection_path> [--env <environment_path>]
/postman-generator run --collection <collection_path> --env <environment_path>
/postman-generator install-newman
/postman-generator create new collections and env from <context>
Parses the context and automatically outputs configured Postman Collections, Environments, and JavaScript RESTful tests./postman-generator validate --collection <collection_path> [--env <environment_path>]
Runs the Postman collection via Newman, executes all embedded JavaScript assertions, checks status codes, and outputs a validation summary highlighting errors./postman-generator run --collection <collection_path> --env <environment_path>
Launches the Newman runner to execute the specified test collection under the given environment scope./postman-generator install-newman
Ensures the Newman execution package is properly installed on the host workspace.openapi.yaml, openapi.json, swagger.jsonrouter.get), Fastify (app.get), NestJS controllers, Next.js API route handlers, Hono, Django, FastAPI.When running /postman-generator create new collections and env from <context>:
GET, POST, PUT, DELETE, etc.), query parameters, path variables, request bodies (JSON/form-data), and potential response structures.For each endpoint, design a request item in the collection with corresponding Postman JS test scripts inside event arrays of type test:
GET / PUT / PATCH: Expect 200 OKPOST (Creation): Expect 201 CreatedDELETE: Expect 204 No Content or 200 OK400 Bad Request or 422 Unprocessable Entity401 Unauthorized403 Forbidden404 Not Found409 ConflictStructure the collection JSON following the official Schema v2.1.0. Include:
Auth, Users, Products).{{baseUrl}}, {{token}}, path variables as :id)."event" arrays:
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"pm.test(\"Response time is below 500ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(500);",
"});",
"pm.test(\"Content-Type is application/json\", function () {",
" pm.response.to.have.header(\"Content-Type\", /json/);",
"});"
],
"type": "text/javascript"
}
}
]
Write a corresponding environment config file with placeholders:
baseUrl: Base URL of the API.token or authentication variables.newman CLI for the user if it's not present:
plugins/postman-generator/scripts/newman-runner.sh installplugins/postman-generator/scripts/newman-runner.sh run <collection_path> [environment_path]Your generated collection MUST be valid JSON. Keep this structural boilerplate in mind:
{
"info": {
"_postman_id": "unique-uuid",
"name": "My API Collection",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Authentication",
"item": [
{
"name": "Login User",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"pm.test(\"Login successful - token received\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property(\"token\");",
" pm.environment.set(\"token\", jsonData.token);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"[email protected]\",\n \"password\": \"password123\"\n}"
},
"url": {
"raw": "{{baseUrl}}/auth/login",
"host": [
"{{baseUrl}}"
],
"path": [
"auth",
"login"
]
}
}
}
]
}
]
}
The generated environment file should follow this structure:
{
"name": "API Testing Environment",
"values": [
{
"key": "baseUrl",
"value": "http://localhost:3000",
"type": "text",
"enabled": true
},
{
"key": "token",
"value": "",
"type": "text",
"enabled": true
}
],
"_postman_variable_scope": "environment"
}
const schema = {
"type": "object",
"required": ["id", "name"],
"properties": {
"id": { "type": "string" },
"name": { "type": "string" }
}
};
pm.test("Schema matches contract", function () {
pm.response.to.have.jsonSchema(schema);
});
pm.test("Strict-Transport-Security header is present", function () {
pm.response.to.have.header("Strict-Transport-Security");
});
pm.test("Response is an array with items", function () {
var jsonData = pm.response.json();
pm.expect(jsonData).to.be.an("array");
if (jsonData.length > 0) {
pm.expect(jsonData[0]).to.have.property("id");
}
});
If Newman is not installed, inform the user they can run the installer script:
bash plugins/postman-generator/scripts/install.sh
Or use the runner tool plugins/postman-generator/scripts/newman-runner.sh install which handles dependencies natively or via npx.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
npx claudepluginhub andersonlimahw/lemon-ai-hub --plugin postman-generator