nestjs-swagger-docs

Document NestJS controllers and endpoints with Swagger/OpenAPI annotations.

Updated Apr 17, 2026
One-click install
npx skills add https://github.com/KapilKumar88/ai-workspace-platform --skill nestjs-swagger-docs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nestjs-swagger-docs
Source: https://github.com/KapilKumar88/ai-workspace-platform/tree/main/.agents/skills/nestjs-swagger-docs
Command: npx skills add https://github.com/KapilKumar88/ai-workspace-platform --skill nestjs-swagger-docs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill unit ensures that NestJS controllers and endpoints are documented with best practices, improving consistency and reducing errors in Swagger/OpenAPI annotations.

Core Features & Use Cases

  • Best Practices Guide: Provides guidelines for @ApiResponse decorators, Swagger schema examples, and shared error response decorators.
  • Real-time Response Validation: Ensures documented response shapes match actual runtime output.
  • Shared Error Decorators: Encourages reusability and standardization of error responses across endpoints.
  • Quick Documentation Procedures: Offers step-by-step guidance for documenting new endpoints and updating existing ones.
  • Decorator Order Convention: Suggests an order for API decorators to maintain clarity and consistency.

Quick Start

To document a new endpoint, follow these steps:

  1. Read the service method to understand the return type and fields.
  2. Write the 200 @ApiResponse with a schema.example including the full ApiResponseDto envelope and all data fields.
  3. Add endpoint-specific non-2xx codes with schema.example.
  4. Apply the shared error decorator as the last decorator before the method.
  5. Verify the @ApiTags class decorator exists and the tag is registered in main.ts.

Frequently Asked Questions about nestjs-swagger-docs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I document NestJS controller endpoints with Swagger annotations?

To document NestJS endpoints with Swagger, read the service method return type, write the 200 @ApiResponse with a schema.example including the full ApiResponseDto envelope, add non-2xx error codes, and apply shared error decorators before the method.

What is the best way to standardize error responses in NestJS Swagger?

Standardize error responses in NestJS Swagger by applying shared error decorators as the last decorator before the method, ensuring reusability and consistent error response shapes across all documented endpoints.

How do I keep Swagger schema examples consistent with NestJS runtime output?

Keep Swagger schema examples consistent with NestJS runtime output by validating that the documented response shapes match the actual runtime output, using schema.example within @ApiResponse decorators for accurate reflection.

Does the order of Swagger API decorators matter in NestJS?

Swagger API decorator order in NestJS matters for clarity and consistency. Maintain a convention by applying endpoint-specific response decorators first, followed by shared error decorators as the last decorator before the method.

How do I register a new Swagger tag for a NestJS endpoint?

To register a Swagger tag for a NestJS endpoint, verify the @ApiTags class decorator exists on the controller and ensure the tag is properly registered in the main.ts file to group endpoints correctly.

What does the nestjs-swagger-docs Skill do?

The nestjs-swagger-docs Skill enhances NestJS controller and endpoint documentation through YAML frontmatter and Markdown body, focusing on Swagger/OpenAPI annotations, error response shapes, and documentation best practices.