Generate Postman API Collections is a development claude skill built by thoughtbot, inc.. Best for: Rails developers automate creation of accurate, up-to-date Postman collections by analyzing code and tests, eliminating manual API documentation..
- What it does
- Automatically generate Postman collections from Rails routes, controllers, and RSpec tests with full request/response examples.
- Category
- development
- Created by
- thoughtbot, inc.
- Last updated
Generate Postman API Collections
Automatically generate Postman collections from Rails routes, controllers, and RSpec tests with full request/response examples.
Skill instructions
Generate Postman Collection
Automatically generate or update the Postman API collection by analyzing the Rails application routes, controllers, and test specs.
Task Instructions
You are tasked with generating or updating the Postman collection file postman_collection.json based on the current state of the Rails API.
Follow these steps:
If there is no existing Postman collection file postman_collection.json,
skip to Step 2.
-
Check for API-related changes first (to avoid unnecessary work):
- Use
git diffto check if there are any changes to API-related files compared to the main branch - Check these paths:
config/routes.rb,app/controllers/api/,spec/requests/api/ - Also check for staged and unstaged changes in the current working directory
- If NO changes are found in any of these locations, output "No API changes detected - skipping Postman collection update"
- If changes ARE found, continue to step 2
- Use
-
Read the Rails routes from
config/routes.rbto identify all API endpoints -
Analyze each API controller in
app/controllers/api/to understand:- Request parameters (required and optional)
- Request body structure
- Response format
- Authentication requirements
- Status codes returned
-
Review RSpec test files in
spec/requests/api/v1/to extract:- Example request bodies
- Example responses
- Valid parameter values
- Edge cases and validation rules
-
Generate or update the Postman collection with:
- All API endpoints organized in logical folders
- Complete request examples with proper HTTP methods
- Request body examples in JSON format
- Query parameters where applicable
- Headers (especially Authorization header for authenticated endpoints)
- Example responses
- Clear descriptions for each endpoint
- Variables for
{{base_url}}and{{api_token}} - Test scripts that auto-save the API token after successful login
-
Maintain the existing structure:
- Keep the same collection name: "postman_collection"
- Preserve the variables:
base_urlandapi_token - Maintain folder organization
- Keep the login test script that auto-saves the token
-
Ensure completeness:
- Every route in
config/routes.rbshould have a corresponding request - Each request should have accurate parameters and examples
- Descriptions should explain what each endpoint does
- Authentication requirements should be clearly indicated
- Every route in
-
Write the updated collection to
postman_collection.json
Important Notes
- Use the RSpec tests as the source of truth for request/response examples
- Maintain proper Postman collection v2.1 format
- Ensure all JSON is properly formatted and valid
Output
After completing the update, provide a summary of:
- Number of endpoints documented
- Any new endpoints added
- Any endpoints removed or modified
- Any issues or ambiguities found
Completion
If changes have been made notify the user to commit them.
Use this skill
Most skills are portable instruction packages. Claude Code supports SKILL.md directly. Other agents can use adapted files like AGENTS.md, .cursorrules, and GEMINI.md.
Claude Code
Save SKILL.md into your Claude Skills folder, then restart Claude Code.
mkdir -p ~/.claude/skills/generate-postman-api-collections && curl -L "https://raw.githubusercontent.com/thoughtbot/generate-postman-collection/d0e6c8c950314fc8c0929209c47bcd60ecb0711b/SKILL.md" -o ~/.claude/skills/generate-postman-api-collections/SKILL.mdInstalls to ~/.claude/skills/generate-postman-api-collections/SKILL.md.
Use cases
Rails developers automate creation of accurate, up-to-date Postman collections by analyzing code and tests, eliminating manual API documentation.
Reviews
No reviews yet. Be the first to review this skill.
No signup required
Stats
Creator
Tthoughtbot, inc.
@thoughtbot