AI Skill Report Card

Generated Skill

B-70·May 4, 2026·Source: Web

Building NestJS Applications

TypeScript
// app.module.ts import { Module } from '@nestjs/common'; import { UsersModule } from './users/users.module'; @Module({ imports: [UsersModule], }) export class AppModule {} // users/users.controller.ts import { Controller, Get, Post, Body, Param } from '@nestjs/common'; import { UsersService } from './users.service'; @Controller('users') export class UsersController { constructor(private readonly usersService: UsersService) {} @Get() findAll() { return this.usersService.findAll(); } @Post() create(@Body() createUserDto: any) { return this.usersService.create(createUserDto); } }
Recommendation
Consider adding more specific examples
  1. Project Setup

    Bash
    npm i -g @nestjs/cli nest new project-name cd project-name
  2. Generate Resources

    Bash
    nest generate resource users --no-spec
  3. Structure Implementation Progress:

    • Create DTOs for request/response validation
    • Implement service layer with business logic
    • Configure controller endpoints
    • Set up module with providers and imports
    • Add database integration if needed
    • Configure middleware and guards
  4. Testing Setup

    Bash
    npm run test npm run test:e2e
Recommendation
Include edge cases

Example 1: Complete CRUD Module Input: User management with validation Output:

TypeScript
// create-user.dto.ts import { IsEmail, IsNotEmpty } from 'class-validator'; export class CreateUserDto { @IsNotEmpty() name: string; @IsEmail() email: string; } // users.service.ts import { Injectable } from '@nestjs/common'; @Injectable() export class UsersService { private users = []; create(createUserDto: CreateUserDto) { const user = { id: Date.now(), ...createUserDto }; this.users.push(user); return user; } findAll() { return this.users; } } // users.module.ts import { Module } from '@nestjs/common'; import { UsersController } from './users.controller'; import { UsersService } from './users.service'; @Module({ controllers: [UsersController], providers: [UsersService], exports: [UsersService], }) export class UsersModule {}

Example 2: Database Integration Input: TypeORM with PostgreSQL Output:

TypeScript
// app.module.ts import { TypeOrmModule } from '@nestjs/typeorm'; @Module({ imports: [ TypeOrmModule.forRoot({ type: 'postgres', host: 'localhost', port: 5432, username: 'user', password: 'password', database: 'nestjs_db', entities: [User], synchronize: true, }), UsersModule, ], }) export class AppModule {} // user.entity.ts import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'; @Entity() export class User { @PrimaryGeneratedColumn() id: number; @Column() name: string; @Column({ unique: true }) email: string; }
  • Module Organization: One feature per module, keep related functionality together
  • Dependency Injection: Use constructor injection, avoid circular dependencies
  • DTOs: Always validate input with class-validator and class-transformer
  • Error Handling: Use built-in HTTP exceptions (BadRequestException, NotFoundException)
  • Configuration: Use @nestjs/config for environment variables
  • Testing: Write unit tests for services, integration tests for controllers
  • Guards: Implement authentication/authorization with guards
  • Interceptors: Use for logging, transformation, caching
  • Pipes: Validate and transform data at endpoint level
  • Circular Dependencies: Avoid importing modules that import each other
  • Missing Providers: Always register services in module providers array
  • Synchronous Operations: Use async/await for database operations
  • Global Scope: Don't make everything global; use proper module imports
  • Direct Database Access: Always use repositories/services, not direct entity access in controllers
  • Missing Validation: Always validate DTOs with decorators
  • Hardcoded Values: Use configuration service instead of environment variables directly
  • Missing Error Handling: Don't let unhandled promises crash the application
0
Grade B-AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
11/15
Workflow
11/15
Examples
15/20
Completeness
15/20
Format
11/15
Conciseness
11/15