nestjs-expert
Fungsinya
Skill ini memandu agent AI untuk membangun aplikasi backend dan API TypeScript dengan framework NestJS. Skill ini untuk pengembang yang menginginkan backend Node.js yang terstruktur dan bergaya perusahaan.
Kapan dipakai
- βSaat Anda membangun API REST atau layanan GraphQL dengan NestJS.
- βSaat Anda perlu login JWT atau Passport dengan guard.
- βSaat Anda memindahkan aplikasi Express ke NestJS.
Link skill
https://github.com/Jeffallan/claude-skills/blob/main/skills/nestjs-expert/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βBuat modul NestJS untuk mengelola produk, dengan DTO yang divalidasi dan rute yang dilindungi JWT.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent merencanakan modul dan dependensinya, membuat controller dan service dengan validasi, lalu menambahkan guard untuk autentikasi. Setelah itu agent menjalankan lint dan tes serta memeriksa graf dependensi.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
NestJS Expert
Senior NestJS specialist with deep expertise in enterprise-grade, scalable TypeScript backend applications.
Core Workflow
- Analyze requirements β Identify modules, endpoints, entities, and relationships
- Design structure β Plan module organization and inter-module dependencies
- Implement β Create modules, services, and controllers with proper DI wiring
- Secure β Add guards, validation pipes, and authentication
- Verify β Run
npm run lint,npm run test, and confirm DI graph withnest info - Test β Write unit tests for services and E2E tests for controllers
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Controllers | references/controllers-routing.md |
Creating controllers, routing, Swagger docs |
| Services | references/services-di.md |
Services, dependency injection, providers |
| DTOs | references/dtos-validation.md |
Validation, class-validator, DTOs |
| Authentication | references/authentication.md |
JWT, Passport, guards, authorization |
| Testing | references/testing-patterns.md |
Unit tests, E2E tests, mocking |
| Express Migration | references/migration-from-express.md |
Migrating from Express.js to NestJS |
Code Examples
Controller with DTO Validation and Swagger
// create-user.dto.ts
import { IsEmail, IsString, MinLength } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
export class CreateUserDto {
@ApiProperty({ example: 'user@example.com' })
@IsEmail()
email: string;
@ApiProperty({ example: '<password>', minLength: 8 })
@IsString()
@MinLength(8)
password: string;
}
// users.controller.ts
import { Body, Controller, Post, HttpCode, HttpStatus } from '@nestjs/common';
import { ApiCreatedResponse, ApiTags } from '@nestjs/swagger';
import { UsersService } from './users.service';
import { CreateUserDto } from './dto/create-user.dto';
@ApiTags('users')
@Controller('users')
export class UsersController {
constructor(private readonly usersService: UsersService) {}
@Post()
@HttpCode(HttpStatus.CREATED)
@ApiCreatedResponse({ description: 'User created successfully.' })
create(@Body() createUserDto: CreateUserDto) {
return this.usersService.create(createUserDto);
}
}
Service with Dependency Injection and Error Handling
// users.service.ts
import { Injectable, ConflictException, NotFoundException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { User } from './entities/user.entity';
import { CreateUserDto } from './dto/create-user.dto';
@Injectable()
export class UsersService {
constructor(
@InjectRepository(User)
private readonly usersRepository: Repository<User>,
) {}
async create(createUserDto: CreateUserDto): Promise<User> {
const existing = await this.usersRepository.findOneBy({ email: createUserDto.email });
if (existing) {
throw new ConflictException('Email already registered');
}
const user = this.usersRepository.create(createUserDto);
return this.usersRepository.save(user);
}
async findOne(id: number): Promise<User> {
const user = await this.usersRepository.findOneBy({ id });
if (!user) {
throw new NotFoundException(`User #${id} not found`);
}
return user;
}
}
Module Definition
// users.module.ts
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UsersController } from './users.controller';
import { UsersService } from './users.service';
import { User } from './entities/user.entity';
@Module({
imports: [TypeOrmModule.forFeature([User])],
controllers: [UsersController],
providers: [UsersService],
exports: [UsersService], // export only when other modules need this service
})
export class UsersModule {}
Unit Test for Service
// users.service.spec.ts
import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { ConflictException } from '@nestjs/common';
import { UsersService } from './users.service';
import { User } from './entities/user.entity';
const mockRepo = {
findOneBy: jest.fn(),
create: jest.fn(),
save: jest.fn(),
};
describe('UsersService', () => {
let service: UsersService;
beforeEach(async () => {
const module: TestingModule
Pertanyaan umum
Bagaimana skill ini memeriksa input?
Skill ini memakai DTO dengan class-validator dan validation pipe.
Bagaimana skill ini menguji aplikasi NestJS?
Skill ini menulis unit test untuk service dan tes end-to-end untuk controller.
Apakah skill ini bisa membantu saya pindah dari Express?
Ya. Skill ini menyertakan panduan migrasi dari Express.js ke NestJS.
Detail
Deskripsi asli dari pembuat
Creates and configures NestJS modules, controllers, services, DTOs, guards, and interceptors for enterprise-grade TypeScript backend applications. Use when building NestJS REST APIs or GraphQL services, implementing dependency injection, scaffolding modular architecture, adding JWT/Passport authentication, integrating TypeORM or Prisma, or working with .module.ts, .controller.ts, and .service.ts files. Invoke for guards, interceptors, pipes, validation, Swagger documentation, and unit/E2E testing in NestJS projects.
repo: Jeffallan/claude-skills
Popularitas
- Bintang GitHub
- 12k
- Peringkat
- #11440
- Lisensi
- MIT
- Diperbarui
- 30/10/2026
Komentar
- β¦
Skill lain dari repositori ini
angular-architect
12kMembantu agent Anda membangun aplikasi Angular 17 ke atas dengan komponen standalone, routing lazy-loaded, status NgRx, pola RxJS, dan penyetelan kinerja.
api-designer
12kMembantu agent Anda merancang API REST atau GraphQL dan menulis spesifikasi OpenAPI 3.1, dengan aturan untuk sumber daya, paginasi, format error, dan versi.
architecture-designer
12kMembantu agent Anda merancang arsitektur sistem, membandingkan pola dan teknologi, serta menulis Architecture Decision Record yang menjelaskan setiap pilihan.
atlassian-mcp
12kMembantu agent Anda mencari dan memperbarui isu Jira serta halaman Confluence melalui MCP, termasuk kueri JQL dan CQL, sprint, dan sinkronisasi dokumentasi.
Skill serupa
api-connector-builder
280kMembuat agent Anda membangun koneksi API baru mengikuti pola yang sudah ada. Gunakan saat ingin menambah integrasi lagi tanpa membuat cara baru.
api-design
280kMembantu agent Anda merancang REST API sesuai praktik terbaik. Berguna untuk mengatur cara API berkomunikasi, menampilkan error, dan mengorganisasi data.
backend-patterns
280kMembantu agent Anda dengan pola arsitektur sisi server dan optimasi database. Berguna untuk membangun atau meninjau kode yang berjalan di server.