giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-typescript/skills/nestjs-best-practices
nestjs-best-practices
VerifiedProvides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration. Use when designing NestJS modules, implementing providers, creating exception filters, validating DTOs, or integrating Drizzle ORM within NestJS applications.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.2 KB |
| assets/templates/controller-template.ts | script | 1.4 KB |
| assets/templates/module-template.ts | script | 629 B |
| assets/templates/service-template.ts | script | 1.5 KB |
| references/api-validation-dto.md | markdown | 4.0 KB |
| references/arch-module-boundaries.md | markdown | 2.6 KB |
| references/architecture.md | markdown | 5.4 KB |
| references/db-drizzle-patterns.md | markdown | 4.9 KB |
| references/di-provider-scoping.md | markdown | 3.4 KB |
| references/error-exception-filters.md | markdown | 4.5 KB |
assets/templates/service-template.ts
View on GitHub/**
* NestJS Service Template
*
* Usage: Copy this template and replace `Feature` with your domain name.
* Implements standard CRUD operations with proper error handling.
*/
import { Injectable, Logger } from '@nestjs/common';
import { FeatureRepository } from './feature.repository';
import { CreateFeatureDto } from './dto/create-feature.dto';
import { UpdateFeatureDto } from './dto/update-feature.dto';
import { FeatureNotFoundException } from './exceptions/feature-not-found.exception';
@Injectable()
export class FeatureService {
private readonly logger = new Logger(FeatureService.name);
constructor(private readonly featureRepository: FeatureRepository) {}
async findAll(): Promise<Feature[]> {
return this.featureRepository.findAll();
}
async findById(id: string): Promise<Feature> {
const feature = await this.featureRepository.findById(id);
if (feature === null) {
throw new FeatureNotFoundException(id);
}
return feature;
}
async create(dto: CreateFeatureDto): Promise<Feature> {
this.logger.log(`Creating feature with id: ${dto.constructor.name}`); // Avoid logging full DTOs — may contain PII
return this.featureRepository.save(dto);
}
async update(id: string, dto: UpdateFeatureDto): Promise<Feature> {
await this.findById(id); // Throws if not found
return this.featureRepository.update(id, dto);
}
async delete(id: string): Promise<void> {
await this.findById(id); // Throws if not found
await this.featureRepository.delete(id);
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |