postman-generator
Generate complete Postman collections and environments from OpenAPI/Swagger specs or code routing files. Includes rich JS tests validating RESTful compliance…
от Andersonlimahw★ 19 звёзд на GitHub
Установить postman-generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Postman Generator
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.
Quick Start
/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
Commands Details
- Create:
/postman-generator create new collections and env from <context>Parses the context and automatically outputs configured Postman Collections, Environments, and JavaScript RESTful tests. - Validate:
/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. - Run:
/postman-generator run --collection <collection_path> --env <environment_path>Launches the Newman runner to execute the specified test collection under the given environment scope. - Install Newman:
/postman-generator install-newmanEnsures the Newman execution package is properly installed on the host workspace.
Supported Inputs
- OpenAPI / Swagger Specs:
openapi.yaml,openapi.json,swagger.json - Code Route Files: Express (
router.get), Fastify (app.get), NestJS controllers, Next.js API route handlers, Hono, Django, FastAPI. - Raw API Documentation: Markdown files, text file lists of endpoints.
🛠️ Step-by-Step Execution Workflow
When running /postman-generator create new collections and env from <context>:
1. Analyze Context & Discover Endpoints
- Discover endpoint paths, request methods (
GET,POST,PUT,DELETE, etc.), query parameters, path variables, request bodies (JSON/form-data), and potential response structures. - Map out authentications (Bearer token, API Keys, Basic Auth).
2. Identify Test Scenarios (RESTful Best Practices)
For each endpoint, design a request item in the collection with corresponding Postman JS test scripts inside event arrays of type test:
- Success Scenarios:
GET/PUT/PATCH: Expect200 OKPOST(Creation): Expect201 CreatedDELETE: Expect204 No Contentor200 OK
- Failure/Edge-case Scenarios (if payload/routes details exist):
- Request with missing required parameters: Expect
400 Bad Requestor422 Unprocessable Entity - Request with invalid/missing token: Expect
401 Unauthorized - Request with restricted access role: Expect
403 Forbidden - Request for non-existent ID: Expect
404 Not Found - Request violating uniqueness/constraints: Expect
409 Conflict
- Request with missing required parameters: Expect
3. Generate Postman Collection JSON (v2.1.0)
Structure the collection JSON following the official Schema v2.1.0. Include:
- A descriptive name and info block.
- Folders grouping endpoints logically (e.g.
Auth,Users,Products). - Requests with variables (
{{baseUrl}},{{token}}, path variables as:id). - Pre-request scripts (if needed for timestamps or signature generation).
- Postman JS Test Scripts embedded in
"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" } } ]
4. Create Postman Environment JSON
Write a corresponding environment config file with placeholders:
baseUrl: Base URL of the API.tokenor authentication variables.- Dynamic ID placeholders populated from previous test scripts.
5. Install & Run Newman
- Install
newmanCLI for the user if it's not present:- Try using
plugins/postman-generator/scripts/newman-runner.sh install
- Try using
- Run the collections:
- Run
plugins/postman-generator/scripts/newman-runner.sh run <collection_path> [environment_path] - Output execution summaries to the terminal.
- Run
📄 Postman Collection Format Reference (v2.1.0)
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",
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- plugin.json
- scripts/install.sh
- scripts/newman-runner.sh
FAQ
Что делает скилл 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.
Как установить скилл postman-generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл postman-generator запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…