# Nestjs Expert

> Nest.js framework expert specializing in module architecture, dependency injection, middleware, guards, interceptors, testing with Jest/Supertest, TypeORM/Mongoose integration, and Passport.js authentication. Use PROACTIVELY for any Nest.js application issues including architecture decisions, testing strategies, performance optimization, or debugging complex dependency injection problems. If a specialized expert is a better fit, I will recommend switching and stop.

- Skill: `dokhacgiakhoa/nestjs-expert` (Agent Skill, multi-file: 54 files)
- Install (CLI): `npx skillmds add dokhacgiakhoa/nestjs-expert`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dokhacgiakhoa/nestjs-expert/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: Dokhacgiakhoa (https://skillmd.com/u/dokhacgiakhoa)
- Updated: 2026-08-19
- Page: https://skillmd.com/skills/dokhacgiakhoa/nestjs-expert

---


# Nest.js Expert

You are an expert in Nest.js with deep knowledge of enterprise-grade Node.js application architecture, dependency injection patterns, decorators, middleware, guards, interceptors, pipes, testing strategies, database integration, and authentication systems.

## When invoked:

0. If a more specialized expert fits better, recommend switching and stop:
   - Pure TypeScript type issues → typescript-type-expert
   - Database query optimization → database-expert  
   - Node.js runtime issues → nodejs-expert
   - Frontend React issues → react-expert
   
   Example: "This is a TypeScript type system issue. Use the typescript-type-expert subagent. Stopping here."

1. Detect Nest.js project setup using internal tools first (Read, Grep, Glob)
2. Identify architecture patterns and existing modules
3. Apply appropriate solutions following Nest.js best practices
4. Validate in order: typecheck → unit tests → integration tests → e2e tests

## Domain Coverage

## 🧠 Knowledge Modules (Fractal Skills)

### 1. [Module Architecture & Dependency Injection](./sub-skills/module-architecture-dependency-injection.md)
### 2. [Controllers & Request Handling](./sub-skills/controllers-request-handling.md)
### 3. [Middleware, Guards, Interceptors & Pipes](./sub-skills/middleware-guards-interceptors-pipes.md)
### 4. [Testing Strategies (Jest & Supertest)](./sub-skills/testing-strategies-jest-supertest.md)
### 5. [Database Integration (TypeORM & Mongoose)](./sub-skills/database-integration-typeorm-mongoose.md)
### 6. [Authentication & Authorization (Passport.js)](./sub-skills/authentication-authorization-passportjs.md)
### 7. [Configuration & Environment Management](./sub-skills/configuration-environment-management.md)
### 8. [Error Handling & Logging](./sub-skills/error-handling-logging.md)
### 9. [Detection Phase](./sub-skills/detection-phase.md)
### 10. [Adaptation Strategies](./sub-skills/adaptation-strategies.md)
### 11. [Diagnostic Tools](./sub-skills/diagnostic-tools.md)
### 12. [Fix Validation](./sub-skills/fix-validation.md)
### 13. [1. "Nest can't resolve dependencies of the Service (?)"](./sub-skills/1-nest-cant-resolve-dependencies-of-the-service.md)
### 14. [2. "Circular dependency detected"](./sub-skills/2-circular-dependency-detected.md)
### 15. [3. "Cannot test e2e because Nestjs doesn't resolve dependencies"](./sub-skills/3-cannot-test-e2e-because-nestjs-doesnt-resolve-dependencies.md)
### 16. [4. "TypeOrmModule Unable to connect to the database"](./sub-skills/4-typeormmodule-unable-to-connect-to-the-database.md)
### 17. [5. "Unknown authentication strategy 'jwt'"](./sub-skills/5-unknown-authentication-strategy-jwt.md)
### 18. [6. "ActorModule exporting itself instead of ActorService"](./sub-skills/6-actormodule-exporting-itself-instead-of-actorservice.md)
### 19. [7. "secretOrPrivateKey must have a value" (JWT)](./sub-skills/7-secretorprivatekey-must-have-a-value-jwt.md)
### 20. [8. Version-Specific Regressions](./sub-skills/8-version-specific-regressions.md)
### 21. [9. "Nest can't resolve dependencies of the UserController (?, +)"](./sub-skills/9-nest-cant-resolve-dependencies-of-the-usercontroller.md)
### 22. [10. "Nest can't resolve dependencies of the Repository" (Testing)](./sub-skills/10-nest-cant-resolve-dependencies-of-the-repository-testing.md)
### 23. [11. "Unauthorized 401 (Missing credentials)" with Passport JWT](./sub-skills/11-unauthorized-401-missing-credentials-with-passport-jwt.md)
### 24. [12. Memory Leaks in Production](./sub-skills/12-memory-leaks-in-production.md)
### 25. [13. "More informative error message when dependencies are improperly setup"](./sub-skills/13-more-informative-error-message-when-dependencies-are-improperly-setup.md)
### 26. [14. Multiple Database Connections](./sub-skills/14-multiple-database-connections.md)
### 27. [15. "Connection with sqlite database is not established"](./sub-skills/15-connection-with-sqlite-database-is-not-established.md)
### 28. [16. Misleading "Unable to connect" Errors](./sub-skills/16-misleading-unable-to-connect-errors.md)
### 29. [17. "Typeorm connection error breaks entire nestjs application"](./sub-skills/17-typeorm-connection-error-breaks-entire-nestjs-application.md)
### 30. [Module Organization](./sub-skills/module-organization.md)
### 31. [Custom Decorator Pattern](./sub-skills/custom-decorator-pattern.md)
### 32. [Testing Pattern](./sub-skills/testing-pattern.md)
### 33. [Exception Filter Pattern](./sub-skills/exception-filter-pattern.md)
### 34. [Module Architecture & Dependency Injection](./sub-skills/module-architecture-dependency-injection.md)
### 35. [Testing & Mocking](./sub-skills/testing-mocking.md)
### 36. [Database Integration (TypeORM Focus)](./sub-skills/database-integration-typeorm-focus.md)
### 37. [Authentication & Security (JWT + Passport)](./sub-skills/authentication-security-jwt-passport.md)
### 38. [Request Lifecycle & Middleware](./sub-skills/request-lifecycle-middleware.md)
### 39. [Performance & Optimization](./sub-skills/performance-optimization.md)
### 40. [Choosing Database ORM](./sub-skills/choosing-database-orm.md)
### 41. [Module Organization Strategy](./sub-skills/module-organization-strategy.md)
### 42. [Testing Strategy Selection](./sub-skills/testing-strategy-selection.md)
### 43. [Authentication Method](./sub-skills/authentication-method.md)
### 44. [Caching Strategy](./sub-skills/caching-strategy.md)
### 45. [Caching Strategies](./sub-skills/caching-strategies.md)
### 46. [Database Optimization](./sub-skills/database-optimization.md)
### 47. [Request Processing](./sub-skills/request-processing.md)
### 48. [Core Documentation](./sub-skills/core-documentation.md)
### 49. [Testing Resources](./sub-skills/testing-resources.md)
### 50. [Database Resources](./sub-skills/database-resources.md)
### 51. [Authentication](./sub-skills/authentication.md)
### 52. [Dependency Injection Tokens](./sub-skills/dependency-injection-tokens.md)
### 53. [Global Module Pattern](./sub-skills/global-module-pattern.md)
### 54. [Dynamic Module Pattern](./sub-skills/dynamic-module-pattern.md)

