Skip to content
Back to skills

Api Spec Generator

ASecurity

Generates OpenAPI/Swagger specifications from route handlers and controllers

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
ai-agentstypescriptpythongobashexpressfastapiflaskapisecuritydocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add NAME0x0/CLAUDE_SETUP --skill api-spec-generator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Spec Generator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Api Spec Generator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/name0x0-api-spec-generator/badge)](https://www.skillsdirectory.com/skills/name0x0-api-spec-generator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: api-spec-generator
description: Generates OpenAPI/Swagger specifications from route handlers and controllers
triggers:
  - /api-spec-generator
  - /openapi
  - /swagger
---

# Instructions

When this skill is invoked, analyze API routes and generate comprehensive OpenAPI 3.0 specification.

## Process

1. **Discover API Routes**:
   - Use Glob to find route files (`**/routes/**`, `**/controllers/**`, `**/api/**`)
   - Identify framework (Express, FastAPI, Flask, Gin, etc.)
   - Read all route definitions

2. **Extract Route Information**:

   For each endpoint, identify:
   - HTTP method (GET, POST, PUT, DELETE, PATCH)
   - Path with parameters (`/users/{id}`)
   - Request body schema
   - Query parameters
   - Path parameters
   - Response schemas (success and error)
   - Authentication requirements
   - Rate limiting info

3. **Infer Schemas**:
   - From TypeScript interfaces/types
   - From Python type hints / Pydantic models
   - From JSDoc comments
   - From validation libraries (Joi, Zod, Yup)
   - From actual response examples in code

4. **Generate OpenAPI Spec**:

   ```yaml
   openapi: 3.0.3
   info:
     title: API Name
     description: Auto-generated API documentation
     version: 1.0.0

   servers:
     - url: http://localhost:3000
       description: Development
     - url: https://api.example.com
       description: Production

   paths:
     /users:
       get:
         summary: List all users
         tags: [Users]
         parameters:
           - name: limit
             in: query
             schema:
               type: integer
               default: 10
         responses:
           '200':
             description: Successful response
             content:
               application/json:
                 schema:
                   type: array
                   items:
                     $ref: '#/components/schemas/User'

     /users/{id}:
       get:
         summary: Get user by ID
         tags: [Users]
         parameters:
           - name: id
             in: path
             required: true
             schema:
               type: string
         responses:
           '200':
             description: User found
             content:
               application/json:
                 schema:
                   $ref: '#/components/schemas/User'
           '404':
             description: User not found

   components:
     schemas:
       User:
         type: object
         properties:
           id:
             type: string
           email:
             type: string
             format: email
           name:
             type: string
         required: [id, email]

     securitySchemes:
       bearerAuth:
         type: http
         scheme: bearer
         bearerFormat: JWT

   security:
     - bearerAuth: []
   ```

5. **Validate Specification**:
   - Check for missing required fields
   - Verify schema references exist
   - Validate against OpenAPI 3.0 schema

## Output Format

```markdown
## OpenAPI Specification Generated

**File**: `openapi.yaml` (or `openapi.json`)
**Endpoints Documented**: 24
**Schemas Defined**: 15

### Endpoints by Tag
- **Users** (6 endpoints): CRUD + search, profile
- **Orders** (8 endpoints): CRUD + status, payments
- **Auth** (4 endpoints): login, logout, refresh, register

### Schemas
- User, UserCreate, UserUpdate
- Order, OrderCreate, OrderStatus
- Error, PaginatedResponse

### Viewing the Docs
```bash
# Swagger UI
npx swagger-ui-express

# Redoc
npx redoc-cli serve openapi.yaml
```

### Integration
[Instructions for integrating with existing app]
```

## Enhancements

- Generate client SDKs using openapi-generator
- Add example values based on test fixtures
- Include authentication flow diagrams
- Generate Postman collection from spec
- Add webhook documentation
- Include rate limiting headers in responses
- Validate spec against existing tests

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.