
Generate Swagger Docs
- 231 installs
- 38 repo stars
- Updated January 5, 2026
- qodex-ai/ai-agent-skills
Auto-generate accurate OpenAPI/Swagger specs from code or routes so teams ship documented REST APIs, SDKs, and interactive explorers faster.
About
Provides workflows to produce and maintain Swagger/OpenAPI documentation from backend codebases. Covers schema accuracy, endpoint metadata, example payloads, and publishing patterns that keep API references current for developers, clients, and coding agents.
- OpenAPI schema generation
- Route and model annotation patterns
- Interactive Swagger UI setup
- Versioned API contract exports
- Agent-readable endpoint catalogs
Generate Swagger Docs by the numbers
- 231 all-time installs (skills.sh)
- +3 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #493 of 1,879 Documentation skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/qodex-ai/ai-agent-skills --skill generate-swagger-docsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 231 |
|---|---|
| repo stars | ★ 38 |
| Last updated | January 5, 2026 |
| Repository | qodex-ai/ai-agent-skills ↗ |
What it does
Auto-generate accurate OpenAPI/Swagger specs from code or routes so teams ship documented REST APIs, SDKs, and interactive explorers faster.
Files
Generate Swagger Documentation
Generate OpenAPI docs from your codebase in seconds with automatic API key setup.
How It Works
This skill automates the Swagger/OpenAPI documentation generation:
1. API Key Setup - Accepts your OpenAI API key and sets it as an environment variable 2. Initialization - Downloads and sets up the apimesh tool 3. Automatic Processing - The tool analyzes your codebase and generates documentation 4. Output - Outputs are saved to the apimesh/ directory
Setup Requirements
You need an OpenAI API key to use this skill. Get one from OpenAI's platform if you don't have one already.
Recommended: Quick Setup with API Key
The easiest way to use this skill is to pass your API key directly:
/Users/ankits/.claude/skills/generate-swagger-docs/generate-with-key.sh "sk-proj-your-api-key-here"This will: 1. Accept your OpenAI API key as an argument 2. Create the apimesh/ directory and download the apimesh tool 3. Set up the environment variables correctly 4. Generate your Swagger documentation automatically 5. Display the output file locations
Automatic Flow
When you run this skill:
1. First Time: You'll be prompted for your OpenAI API key (starts with sk-proj-)
- The key is saved locally and used for subsequent runs
- The key is NOT committed to version control
2. Subsequent Runs: The skill uses the saved API key automatically
- No additional prompts for the key unless you clear the config
3. Framework Detection: Automatically detects your API framework
- Supports: Express, NestJS, FastAPI, Django, Rails, Go, and more
What It Does
- Scans your repository for API endpoints
- Detects the web framework (Django, Flask, FastAPI, Express, NestJS, Rails, Go)
- Generates OpenAPI 3.0 specification (
swagger.json) - Creates interactive HTML documentation (
apimesh-docs.html)
Output
apimesh/swagger.json- OpenAPI 3.0 specapimesh/apimesh-docs.html- Interactive Swagger UI (self-contained, shareable)apimesh/config.json- Saved configuration (includes your settings, gitignore this file)
Important Notes
- Your OpenAI API key is needed for the LLM analysis
- The generated
config.jsonshould be added to.gitignoreas it contains secrets - Framework detection is automatic but can be manually specified if needed
- The tool supports both public and private repositories
API Key Setup Methods
Method 1: Wrapper Script (Recommended) ✓
Use the provided wrapper script that properly handles environment variable propagation:
/Users/ankits/.claude/skills/generate-swagger-docs/generate-with-key.sh "sk-proj-your-api-key-here"Why this works best:
- Properly passes the API key to the Python subprocess
- No interactive prompts in non-TTY environments
- Handles environment variable propagation correctly
- Provides clear success/error messages
Method 2: Using Saved Configuration
After the first run with Method 1, your key is saved in apimesh/config.json. On subsequent runs, you can omit the key (if you trust your local setup):
/Users/ankits/.claude/skills/generate-swagger-docs/generate-with-key.shImportant: Never commit the config.json file to version control. Add it to .gitignore.
Method 3: Manual apimesh Setup
If you need more control, download and run apimesh directly:
export OPENAI_API_KEY="sk-proj-your-api-key-here"
mkdir -p apimesh && \
curl -sSL https://raw.githubusercontent.com/qodex-ai/apimesh/refs/heads/main/run.sh -o apimesh/run.sh && \
chmod +x apimesh/run.sh && \
cd apimesh && \
OPENAI_API_KEY="$OPENAI_API_KEY" ./run.shNote: The OPENAI_API_KEY must be explicitly passed to the subprocess as shown above.
#!/bin/bash
# Generate Swagger Documentation with OpenAI API Key
# This script accepts an OpenAI API key and generates Swagger/OpenAPI docs
set -e
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}===================================================${NC}"
echo -e "${BLUE}Swagger Documentation Generator${NC}"
echo -e "${BLUE}===================================================${NC}"
echo ""
# Check if API key is provided as argument
if [ -z "$1" ]; then
echo -e "${RED}Error: OpenAI API key required${NC}"
echo ""
echo "Usage: $0 <openai-api-key>"
echo ""
echo "Example:"
echo " $0 sk-proj-your-api-key-here"
echo ""
echo "Or set the environment variable:"
echo " export OPENAI_API_KEY='sk-proj-your-api-key-here'"
echo " $0"
exit 1
fi
API_KEY="$1"
# Validate API key format
if [[ ! "$API_KEY" =~ ^sk-proj- ]]; then
echo -e "${RED}Warning: API key does not match expected format (should start with 'sk-proj-')${NC}"
echo ""
fi
# Export the API key as environment variable
export OPENAI_API_KEY="$API_KEY"
echo -e "${GREEN}✓ OpenAI API key configured${NC}"
echo ""
# Create apimesh directory structure
echo -e "${BLUE}Setting up apimesh...${NC}"
mkdir -p apimesh
# Download the apimesh tool
echo -e "${BLUE}Downloading apimesh tool...${NC}"
curl -sSL https://raw.githubusercontent.com/qodex-ai/apimesh/refs/heads/main/run.sh -o apimesh/run.sh
chmod +x apimesh/run.sh
echo -e "${GREEN}✓ apimesh downloaded and configured${NC}"
echo ""
# Run the apimesh tool
echo -e "${BLUE}Generating Swagger documentation...${NC}"
echo -e "${BLUE}This may take a few moments...${NC}"
echo ""
# Store current directory (the repository to document)
REPO_DIR="$(pwd)"
# Pass the API key as a command-line argument to the apimesh run.sh script
# Run from the repository directory, not from inside apimesh folder
cd "$REPO_DIR"
bash apimesh/run.sh --openai-api-key "$API_KEY"
echo ""
echo -e "${GREEN}===================================================${NC}"
echo -e "${GREEN}✓ Swagger documentation generated successfully!${NC}"
echo -e "${GREEN}===================================================${NC}"
echo ""
echo "Output files:"
echo " - apimesh/swagger.json"
echo " - apimesh/apimesh-docs.html"
echo " - apimesh/config.json (contains your settings)"
echo ""
echo -e "${BLUE}Next steps:${NC}"
echo " 1. Add 'apimesh/config.json' to .gitignore"
echo " 2. Open apimesh/apimesh-docs.html in your browser to view docs"
echo " 3. Share apimesh-docs.html with your team"
echo ""