Skip to main content
skill CX Codex

nestjs-clean-typescript — Claude Code skill: setup and guide

Guides Claude Code to write clean NestJS APIs using TypeScript, MikroORM, class-validator, and Jest testing conventions.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill nestjs-clean-typescript -a claude-code
Open on GitHub

What nestjs-clean-typescript does

This skill applies Alberto Basalo's guidelines for building NestJS services with TypeScript. It enforces explicit types on all parameters and return values. The skill blocks any and requires JSDoc on public methods. Files follow kebab-case naming and carry a single export each.

Logic stays compact under these rules. Functions must stay under 20 instructions and rely on early returns alongside the RO-RO pattern. Classes are capped at 200 instructions, 10 properties, and 10 public methods. Domain architecture dictates one module per route and one service per entity.

Persistence relies on MikroORM entities, while tests use Jest with the Arrange-Act-Assert structure. If your project uses Prisma or TypeORM, the persistence instructions will clash with your setup.

What it helps with

  • enforce strict TypeScript types and eliminate any in NestJS
  • limit function and class sizes to prevent bloated code
  • structure NestJS modules with dedicated entity services
  • generate Jest unit and integration tests using Arrange-Act-Assert

Example prompts for the agent

  • Build a NestJS billing module following nestjs-clean-typescript guidelines with class-validator DTOs.
  • Write a user service with MikroORM entities using early returns and RO-RO pattern.
  • Create Jest unit tests for the AuthService methods using the Arrange-Act-Assert structure.

How to install nestjs-clean-typescript

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill nestjs-clean-typescript -a claude-code

2Manually: put the files in place

~/.claude/skills/nestjs-clean-typescript/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/nestjs-clean-typescript/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about nestjs-clean-typescript

How to install nestjs-clean-typescript in Claude Code?

Run npx skills add Mindrally/skills --skill nestjs-clean-typescript -a claude-code in your terminal.

What ORM does nestjs-clean-typescript expect?

The skill specifies MikroORM for persistence, assigning a dedicated service to each entity.

What limits does the skill impose on class and function sizes?

Functions must stay below 20 instructions, while classes cannot exceed 200 instructions, 10 properties, and 10 public methods.

Source text

SKILL.md · Apache-2.0
---
name: nestjs-clean-typescript
description: Clean NestJS API development with TypeScript following SOLID principles, modular architecture, and comprehensive testing practices.
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# NestJS Clean TypeScript

Guidelines by Alberto Basalo for developing clean NestJS APIs using TypeScript. These rules emphasize strong typing, clean code principles, and architectural best practices.

## TypeScript General Principles

- Always declare the type of each variable and function (parameters and return value)
- Avoid using any; create necessary types instead
- Use JSDoc for public classes and methods
- One export per file

## Naming Conventions

- PascalCase for classes
- camelCase for variables and functions
- kebab-case for files and directories
- UPPERCASE for environment variables
- Boolean variables use prefixes: isX, hasX, canX

## Function Design

- Write short functions with a single purpose. Less than 20 instructions
- Use early returns to avoid nesting
- Apply RO-RO pattern: pass objects for multiple parameters, return objects for results

## Data and Classes

- Prefer immutability for data with readonly and as const
- Follow SOLID principles
- Classes should have:
  - Less than 200 instructions
  - Fewer than 10 public methods
  - Fewer than 10 properties

## NestJS Specific Guidelines

- Use modular architecture with one module per domain/route
- Use MikroORM entities for persistence
- One service per entity
- DTOs validated with class-validator
- Global filters, middlewares, guards, and interceptors in core module

## Testing

- Use Jest framework
- Follow Arrange-Act-Assert convention
- Write unit tests for each public function
- Include end-to-end tests per API module

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

All skills for Backend and APIs →

From the same set214

pixi-js A skill that steers your coding agent toward performant Pixi.js games in TypeScript, with mobile and rendering advice baked in. CX Codex +1 948installs deep-learning Gives your agent a rulebook for neural network work: layer design, optimizers, mixed precision, memory. Useful when you write or refactor model code. CX Codex +1 946installs react This skill gives your agent a fixed React style: hooks, Server Components, Tailwind, TypeScript. Useful when several people or agents touch the same codebase. CX Codex +1 944installs sequelize A skill that gives your agent rules for writing Sequelize code: models, associations, migrations and queries. Useful for Node.js projects on a relational database. CX Codex +1 942installs gcp-development A rule set for building on Google Cloud: Cloud Functions, Cloud Run, Firestore, BigQuery and Terraform. Useful when your agent writes GCP code or infrastructure. CX Codex +1 937installs django-python A skill that steers your agent through Django work: MVT structure, ORM over raw SQL, class-based views and view-level error handling. CX Codex +1 933installs security-best-practices A skill providing security principles for backend and microservice development. It helps agents enforce strict input validation, protect APIs, and prevent sensitive data leaks. CX Codex +1 930installs flutter Enforces Flutter and Dart standards: feature-first clean architecture, state management with Riverpod or BLoC, and strict limits on widget tree depth. CX Codex +1 925installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor