Back to Skills

nestjs

KubrickCode
Updated Today
441 views
1
1
View on GitHub
Metaaiapidesigndata

About

This skill provides NestJS development standards and architectural patterns for building domain-centric applications. It covers modular design, dependency injection, decorator patterns, and key framework features like controllers, services, middleware, and interceptors. Use it when developing NestJS applications, implementing APIs, configuring microservices, or integrating with databases.

Quick Install

Claude Code

Recommended
Plugin CommandRecommended
/plugin add https://github.com/KubrickCode/ai-config-toolkit
Git CloneAlternative
git clone https://github.com/KubrickCode/ai-config-toolkit.git ~/.claude/skills/nestjs

Copy and paste this command in Claude Code to install this skill

Documentation

NestJS Development Standards

Module Organization Principles

Domain-Centric Modularization

Organize modules by business domain, not by function.

  • ❌ Bad: controllers/, services/, repositories/
  • ✅ Good: users/, products/, orders/

Single Responsibility Module

Each module is responsible for only one domain.

  • Separate common functionality into common/ or shared/ modules
  • Inter-domain communication must go through Services only

Dependency Injection Rules

Constructor Injection Only

Property injection (@Inject) is forbidden.

// ✅ Good
constructor(private readonly userService: UserService) {}

// ❌ Bad
@Inject() userService: UserService;

Provider Registration Location

Providers are registered only in the module where they are used.

  • Minimize global providers
  • Use forRoot/forRootAsync only in AppModule

Decorator Usage Rules

Prioritize Custom Decorators

Abstract repeated decorator combinations into custom decorators.

// Create custom decorator when combining 3+ decorators
@Auth() // Integrates @UseGuards + @ApiBearerAuth + @CurrentUser

Decorator Order

Arrange in execution order from top to bottom.

  1. Metadata decorators (@ApiTags, @Controller, @Resolver)
  2. Guards/Interceptors (@UseGuards, @UseInterceptors)
  3. Route decorators (@Get, @Post, @Query, @Mutation)
  4. Parameter decorators (@Body, @Param, @Args)

DTO/Entity Rules

DTO is Pure Data Transfer

Business logic is forbidden; only validation is allowed.

// ✅ Good: Validation only
class CreateUserDto {
  @IsEmail()
  email: string;
}

// ❌ Bad: Contains business logic
class CreateUserDto {
  toEntity(): User {} // Forbidden
}

Separate Entity and DTO

Never return Entity directly; always convert to DTO.

  • Request: CreateInput, UpdateInput (GraphQL) / CreateDto, UpdateDto (REST)
  • Response: Type definition or plain object

Error Handling

Domain-Specific Exception Filter

Each domain has its own Exception Filter.

@Module({
  providers: [
    {
      provide: APP_FILTER,
      useClass: UserExceptionFilter,
    },
  ],
})

Explicit Error Throwing

Always throw Exception explicitly in all error situations.

  • REST: Use HttpException series
  • GraphQL: Use GraphQLError or custom error
  • Forbid implicit null/undefined returns
  • Error messages should be understandable by users

GitHub Repository

KubrickCode/ai-config-toolkit
Path: .claude/skills/nestjs

Related Skills

content-collections

Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill

creating-opencode-plugins

Meta

This skill provides the structure and API specifications for creating OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It offers implementation patterns for JavaScript/TypeScript modules that intercept and extend the AI assistant's lifecycle. Use it when you need to build event-driven plugins for monitoring, custom handling, or extending OpenCode's capabilities.

View skill

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill

evaluating-llms-harness

Testing

This Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.

View skill