Clean NestJS API development with TypeScript following SOLID principles, modular architecture, and comprehensive testing practices.
Install
npx skills add https://github.com/mindrally/skills --skill nestjs-clean-typescriptSKILL.md
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
Related skills
entra-app-registrationmicrosoft606KGuides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.azure-messagingmicrosoft595KTroubleshoot and resolve issues with Azure Messaging SDKs for Event Hubs and Service Bus. Covers connection failures, authentication errors, message processing issues, and SDK configuration problems. WHEN: event hub SDK error, service bus SDK issue, messaging connection failure, AMQP error, event processor host issue, message lock lost, message lock expired, lock renewal, lock renewal batch, send timeout, receiver disconnected, SDK troubleshooting, azure messaging SDK, event hub consumer, servicentra-agent-idmicrosoft328KProvision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmi_path, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmi_path token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registsupabasesupabase298KUse when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, declarative schemas, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector); deb