nestjs
npx skills add https://github.com/teachingai/full-stack-skills --skill nestjs
Agent 安装分布
Skill 文档
When to use this skill
Use this skill whenever the user wants to:
- Build or refactor a NestJS application
- Implement controllers, providers, and modules
- Apply middleware, pipes, guards, or interceptors
- Configure DI scopes, dynamic modules, or lifecycle hooks
- Add validation, serialization, caching, logging, or queues
- Integrate GraphQL, WebSockets, or microservices
- Document APIs with OpenAPI/Swagger
- Implement authentication/authorization or security hardening
- Write unit or e2e tests for NestJS
How to use this skill
-
Identify the topic from the user’s request and find the corresponding example file in the mapping below
-
Load the appropriate example file from the
examples/directory -
Follow the specific instructions in that example file for syntax, structure, and best practices
Important Notes:
- All examples follow NestJS official documentation structure
- Examples include both JavaScript and TypeScript versions where applicable
- Each example file includes key concepts, code examples, and official documentation links
- Always check the example file for best practices and common patterns
-
Use templates from the
templates/directory to speed up common scaffolding
Doc mapping (one-to-one with https://docs.nestjs.com/)
Overview (æ¦è§)
examples/overview/introduction.mdâ https://docs.nestjs.com/examples/fundamentals/first-steps.mdâ https://docs.nestjs.com/first-stepsexamples/fundamentals/controllers.mdâ https://docs.nestjs.com/controllersexamples/fundamentals/providers.mdâ https://docs.nestjs.com/providersexamples/fundamentals/modules.mdâ https://docs.nestjs.com/modulesexamples/fundamentals/middleware.mdâ https://docs.nestjs.com/middlewareexamples/fundamentals/exception-filters.mdâ https://docs.nestjs.com/exception-filtersexamples/fundamentals/pipes.mdâ https://docs.nestjs.com/pipesexamples/fundamentals/guards.mdâ https://docs.nestjs.com/guardsexamples/fundamentals/interceptors.mdâ https://docs.nestjs.com/interceptorsexamples/overview/custom-decorators.mdâ https://docs.nestjs.com/custom-decorators
Fundamentals (åºç¡)
examples/fundamentals/custom-providers.mdâ https://docs.nestjs.com/fundamentals/custom-providersexamples/fundamentals/async-providers.mdâ https://docs.nestjs.com/fundamentals/async-providersexamples/fundamentals/dynamic-modules.mdâ https://docs.nestjs.com/fundamentals/dynamic-modulesexamples/fundamentals/module-ref.mdâ https://docs.nestjs.com/fundamentals/module-refexamples/fundamentals/execution-context.mdâ https://docs.nestjs.com/fundamentals/execution-contextexamples/fundamentals/lifecycle-events.mdâ https://docs.nestjs.com/fundamentals/lifecycle-eventsexamples/fundamentals/injection-scopes.mdâ https://docs.nestjs.com/fundamentals/injection-scopesexamples/fundamentals/request-scoped.mdâ https://docs.nestjs.com/fundamentals/request-scopedexamples/fundamentals/circular-dependency.mdâ https://docs.nestjs.com/fundamentals/circular-dependency
Techniques (æå·§)
examples/techniques/configuration.mdâ https://docs.nestjs.com/techniques/configurationexamples/techniques/validation.mdâ https://docs.nestjs.com/techniques/validationexamples/techniques/serialization.mdâ https://docs.nestjs.com/techniques/serializationexamples/techniques/caching.mdâ https://docs.nestjs.com/techniques/cachingexamples/techniques/logger.mdâ https://docs.nestjs.com/techniques/loggerexamples/techniques/events.mdâ https://docs.nestjs.com/techniques/eventsexamples/techniques/task-scheduling.mdâ https://docs.nestjs.com/techniques/task-schedulingexamples/techniques/queues.mdâ https://docs.nestjs.com/techniques/queuesexamples/techniques/file-upload.mdâ https://docs.nestjs.com/techniques/file-uploadexamples/techniques/streaming-files.mdâ https://docs.nestjs.com/techniques/streaming-filesexamples/techniques/database.mdâ https://docs.nestjs.com/techniques/databaseexamples/techniques/mongodb.mdâ https://docs.nestjs.com/techniques/mongodbexamples/techniques/mongoose.mdâ https://docs.nestjs.com/techniques/mongooseexamples/techniques/sequelize.mdâ https://docs.nestjs.com/techniques/sequelizeexamples/techniques/prisma.mdâ https://docs.nestjs.com/recipes/prisma
Security (å®å ¨)
examples/security/authentication.mdâ https://docs.nestjs.com/security/authenticationexamples/security/authorization.mdâ https://docs.nestjs.com/security/authorizationexamples/security/helmet.mdâ https://docs.nestjs.com/security/helmetexamples/security/cors.mdâ https://docs.nestjs.com/security/corsexamples/security/rate-limiting.mdâ https://docs.nestjs.com/security/rate-limiting
GraphQL
examples/graphql/quick-start.mdâ https://docs.nestjs.com/graphql/quick-startexamples/graphql/resolvers.mdâ https://docs.nestjs.com/graphql/resolversexamples/graphql/scalars.mdâ https://docs.nestjs.com/graphql/scalarsexamples/graphql/interfaces.mdâ https://docs.nestjs.com/graphql/interfacesexamples/graphql/unions.mdâ https://docs.nestjs.com/graphql/unionsexamples/graphql/directives.mdâ https://docs.nestjs.com/graphql/directivesexamples/graphql/plugins.mdâ https://docs.nestjs.com/graphql/pluginsexamples/graphql/subscriptions.mdâ https://docs.nestjs.com/graphql/subscriptionsexamples/graphql/federation.mdâ https://docs.nestjs.com/graphql/federationexamples/graphql/migration.mdâ https://docs.nestjs.com/graphql/migration
WebSockets
examples/websockets/gateways.mdâ https://docs.nestjs.com/websockets/gatewaysexamples/websockets/exception-filters.mdâ https://docs.nestjs.com/websockets/exception-filtersexamples/websockets/guards.mdâ https://docs.nestjs.com/websockets/guardsexamples/websockets/interceptors.mdâ https://docs.nestjs.com/websockets/interceptorsexamples/websockets/adapters.mdâ https://docs.nestjs.com/websockets/adapters
Microservices
examples/microservices/basics.mdâ https://docs.nestjs.com/microservices/basicsexamples/microservices/redis.mdâ https://docs.nestjs.com/microservices/redisexamples/microservices/mqtt.mdâ https://docs.nestjs.com/microservices/mqttexamples/microservices/nats.mdâ https://docs.nestjs.com/microservices/natsexamples/microservices/kafka.mdâ https://docs.nestjs.com/microservices/kafkaexamples/microservices/grpc.mdâ https://docs.nestjs.com/microservices/grpcexamples/microservices/rabbitmq.mdâ https://docs.nestjs.com/microservices/rabbitmqexamples/microservices/custom-transport.mdâ https://docs.nestjs.com/microservices/custom-transportexamples/microservices/hybrid-application.mdâ https://docs.nestjs.com/microservices/hybrid-application
OpenAPI (Swagger)
examples/openapi/introduction.mdâ https://docs.nestjs.com/openapi/introductionexamples/openapi/operations.mdâ https://docs.nestjs.com/openapi/operationsexamples/openapi/types-and-parameters.mdâ https://docs.nestjs.com/openapi/types-and-parametersexamples/openapi/security.mdâ https://docs.nestjs.com/openapi/securityexamples/openapi/mapped-types.mdâ https://docs.nestjs.com/openapi/mapped-types
CLI & Testing & Recipes
examples/cli/overview.mdâ https://docs.nestjs.com/cli/overviewexamples/testing/unit-testing.mdâ https://docs.nestjs.com/fundamentals/testingexamples/testing/e2e-testing.mdâ https://docs.nestjs.com/fundamentals/testingexamples/recipes/cqrs.mdâ https://docs.nestjs.com/recipes/cqrsexamples/recipes/mikroorm.mdâ https://docs.nestjs.com/recipes/mikroormexamples/recipes/terminus.mdâ https://docs.nestjs.com/recipes/terminusexamples/faq.mdâ https://docs.nestjs.com/faq
Examples and Templates
This skill includes detailed examples organized to match the NestJS official documentation structure (https://docs.nestjs.com/). All examples are in the examples/ directory, organized by topic (see mapping above).
To use examples:
- Identify the topic from the user’s request
- Load the appropriate example file from the mapping above
- Follow the instructions, syntax, and best practices in that file
- Adapt the code examples to your specific use case
To use templates:
- Reference templates in
templates/directory for common scaffolding - Templates include: controller, provider, module, middleware, guard, pipe, interceptor, exception filter, DTO, and project structure
- Adapt templates to your specific needs and coding style
Best Practices
- Use dependency injection: Leverage NestJS DI container for better testability and maintainability
- Organize by modules: Group related functionality into feature modules
- Use decorators consistently: Follow NestJS decorator patterns for controllers, providers, and routes
- Validate input data: Use ValidationPipe and DTOs for request validation
- Handle errors gracefully: Implement global exception filters for consistent error handling
- Use guards for authorization: Protect routes with guards rather than inline checks
- Leverage interceptors: Use interceptors for cross-cutting concerns like logging and transformation
- Type safety: Use TypeScript for better type safety and developer experience
- Test thoroughly: Write unit tests for services and E2E tests for API endpoints
- Follow official patterns: Refer to official documentation for recommended patterns and practices
Resources
- Official Documentation: https://docs.nestjs.com/
- GitHub Repository: https://github.com/nestjs/nest
Keywords
NestJS, Node.js, framework, controller, provider, module, middleware, exception filter, pipe, guard, interceptor, dependency injection, GraphQL, WebSocket, microservice, OpenAPI, Swagger, testing, validation, caching, logging, TypeScript, decorator, DI, IoC, æ§å¶å¨, æä¾è , 模å, ä¸é´ä»¶, å®å«, 管é, æ¦æªå¨, ä¾èµæ³¨å ¥