plugins/developer-kit-typescript/skills/nestjs/SKILL.md
Provides comprehensive NestJS framework patterns with Drizzle ORM integration for building scalable server-side applications. Generates REST/GraphQL APIs, implements authentication guards, creates database schemas, and sets up microservices. Use when building NestJS applications, setting up APIs, implementing authentication, working with databases, or integrating Drizzle ORM.
npx skillsauth add giuseppe-trisciuoglio/developer-kit nestjsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Provides NestJS patterns with Drizzle ORM for building production-ready server-side applications. Covers CRUD modules, JWT authentication, database operations, migrations, testing, microservices, and GraphQL integration.
npm i drizzle-orm pg && npm i -D drizzle-kit tsxsrc/db/schema.ts with Drizzle table definitions@nestjs/testing with mocked repositoriesnpx drizzle-kit generate → Verify SQL → npx drizzle-kit migrate// src/db/schema.ts
export const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
email: text('email').notNull().unique(),
createdAt: timestamp('created_at').defaultNow(),
});
// src/users/dto/create-user.dto.ts
export class CreateUserDto {
@IsString() @IsNotEmpty() name: string;
@IsEmail() email: string;
}
// src/users/user.repository.ts
@Injectable()
export class UserRepository {
constructor(private db: DatabaseService) {}
async findAll() {
return this.db.database.select().from(users);
}
async create(data: typeof users.$inferInsert) {
return this.db.database.insert(users).values(data).returning();
}
}
// src/users/users.service.ts
@Injectable()
export class UsersService {
constructor(private repo: UserRepository) {}
async create(dto: CreateUserDto) {
return this.repo.create(dto);
}
}
// src/users/users.controller.ts
@Controller('users')
export class UsersController {
constructor(private service: UsersService) {}
@Post()
create(@Body() dto: CreateUserDto) {
return this.service.create(dto);
}
}
// src/users/users.module.ts
@Module({
controllers: [UsersController],
providers: [UsersService, UserRepository, DatabaseService],
exports: [UsersService],
})
export class UsersModule {}
@Injectable()
export class JwtAuthGuard implements CanActivate {
constructor(private jwtService: JwtService) {}
canActivate(context: ExecutionContext) {
const token = context.switchToHttp().getRequest()
.headers.authorization?.split(' ')[1];
if (!token) return false;
try {
const decoded = this.jwtService.verify(token);
context.switchToHttp().getRequest().user = decoded;
return true;
} catch {
return false;
}
}
}
async transferFunds(fromId: number, toId: number, amount: number) {
return this.db.database.transaction(async (tx) => {
await tx.update(accounts)
.set({ balance: sql`${accounts.balance} - ${amount}` })
.where(eq(accounts.id, fromId));
await tx.update(accounts)
.set({ balance: sql`${accounts.balance} + ${amount}` })
.where(eq(accounts.id, toId));
});
}
describe('UsersService', () => {
let service: UsersService;
let repo: jest.Mocked<UserRepository>;
beforeEach(async () => {
const module = await Test.createTestingModule({
providers: [
UsersService,
{ provide: UserRepository, useValue: { findAll: jest.fn(), create: jest.fn() } },
],
}).compile();
service = module.get(UsersService);
repo = module.get(UserRepository);
});
it('should create user', async () => {
const dto = { name: 'John', email: '[email protected]' };
repo.create.mockResolvedValue({ id: 1, ...dto, createdAt: new Date() });
expect(await service.create(dto)).toMatchObject(dto);
});
});
drizzle-kit generate after schema changes before deployingforwardRef() carefully; prefer module restructuringValidationPipeAdvanced patterns and detailed examples available in:
references/reference.md - Core patterns, guards, interceptors, microservices, GraphQLreferences/drizzle-reference.md - Drizzle ORM installation, configuration, queriesreferences/workflow-optimization.md - Development workflows, parallel execution strategiesdevelopment
Explore codebase before committing to a change. Phase executor skill for specs.explore command.
development
Executes real end-to-end verification against a running application after specification implementation. Detects the application type, starts the local runtime (Docker, Node, Spring Boot, etc.), runs real tests (curl for REST APIs, Playwright for web SPAs, computer-use for desktop apps), verifies acceptance criteria from the functional specification, generates a markdown report, and tears down the environment. Use when: user asks to verify a completed spec with real tests, run e2e checks after implementation, validate acceptance criteria in a live environment, or test the feature for real after task completion.
development
Initialize Spec-Driven Development context — detects tech stack, conventions, architecture patterns, and bootstraps persistence backends. Triggers on 'sdd-init', 'init sdd', 'setup sdd', 'initialize sdd', 'setup project', 'initialize project context'. Creates/updates docs/specs/architecture.md & ontology.md (Constitution), and populates knowledge-graph.json.
development
Optimizes raw idea descriptions into structured prompts ready for the brainstorming workflow. TRIGGER when: user says "optimize for brainstorm", "prepare idea for brainstorm", "enhance this idea", "make this ready for brainstorming", "imposta per brainstorm", or wants to improve a feature idea before using /specs.brainstorm. DO NOT TRIGGER for code optimization, refactoring, or general prompt engineering tasks.