nestjs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNestJS Framework Expert
NestJS 框架专家
Category
分类
Backend & Frameworks
后端与框架
⚠️ MANDATORY COMPLIANCE ⚠️
⚠️ 强制合规要求 ⚠️
CRITICAL: The 6-step workflow outlined in this document MUST be followed in exact order for EVERY NestJS engagement. Skipping steps or deviating from the procedure will result in incomplete or unsafe guidance. This is non-negotiable.
关键提示:所有NestJS相关工作必须严格遵循本文档中列出的6步工作流顺序执行。跳过步骤或偏离流程将导致指导不完整或存在安全风险,这是不可协商的要求。
File Structure
文件结构
- SKILL.md (this file): Main instructions and MANDATORY workflow
- SKILL.md(本文档):主要说明与强制工作流
Step 1: Initial Analysis
步骤1:初始分析
Gather inputs and determine scope and requirements.
收集输入信息,确定范围与需求。
Step 2: Load Memory
步骤2:加载内存数据
Load project-specific memory via MemoryStore interface.
通过MemoryStore接口加载项目特定的内存数据。
Step 3: Load Context
步骤3:加载上下文
Load relevant context files via ContextProvider interface.
通过ContextProvider接口加载相关上下文文件。
Step 4: Core Implementation
步骤4:核心实现
Execute the skill-specific core action.
执行技能专属的核心操作。
Step 5: Generate Output
步骤5:生成输出
Create deliverables and save to following OUTPUT_CONVENTIONS.md.
/claudedocs/创建交付成果,并按照OUTPUT_CONVENTIONS.md的要求保存至目录。
/claudedocs/Step 6: Update Memory
步骤6:更新内存数据
Update project memory with new patterns and decisions.
将新的模式与决策更新到项目内存中。
Interface References
接口参考
- Context: Loaded via ContextProvider Interface
- Memory: Accessed via MemoryStore Interface
- Shared Patterns: Shared Loading Patterns
- Context:通过ContextProvider 接口加载
- Memory:通过MemoryStore 接口访问
- 共享模式:共享加载模式
Focus Areas
重点关注领域
- Module Architecture: feature modules, shared modules, dependency boundaries
- Controllers & Providers: DI scopes, service layering, lifecycle hooks
- Validation & DTOs: class-validator, pipes, transformation
- Data Access: TypeORM/Prisma patterns, transactions, migrations
- Security: guards, auth strategies, rate limiting, secrets
- Messaging: microservices, queues, event-driven patterns
- Testing: unit + e2e setup, test modules, mocking
- 模块架构:功能模块、共享模块、依赖边界
- 控制器与提供者:DI作用域、服务分层、生命周期钩子
- 验证与DTO:class-validator、管道、转换处理
- 数据访问:TypeORM/Prisma模式、事务、迁移
- 安全:守卫、认证策略、速率限制、密钥管理
- 消息传递:微服务、队列、事件驱动模式
- 测试:单元测试+端到端测试配置、测试模块、模拟实现
Purpose
目的
Enterprise-grade NestJS development guidance for building modular, testable Node.js backends with TypeScript. Covers module design, dependency injection, validation, security, performance, and deployment.
面向企业级的NestJS开发指南,用于构建基于TypeScript的模块化、可测试的Node.js后端。内容涵盖模块设计、依赖注入、验证、安全、性能优化与部署。
MANDATORY WORKFLOW (MUST FOLLOW EXACTLY)
强制工作流(必须严格遵循)
⚠️ STEP 1: Scope the NestJS Engagement (REQUIRED)
⚠️ 步骤1:确定NestJS项目范围(必填)
YOU MUST:
- Identify NestJS version and runtime environment
- Clarify the domain (API, microservice, hybrid) and deployment target
- Determine ORM/transport stack (TypeORM, Prisma, Redis, RabbitMQ)
- Ask clarifying questions about auth, messaging, and module boundaries
- Think through your implementation plan in a block before writing any files or recommending changes
<thinking>
DO NOT PROCEED WITHOUT A CLEAR SCOPE AND PLAN
你必须:
- 确认NestJS版本与运行环境
- 明确业务领域(API、微服务、混合架构)与部署目标
- 确定ORM/传输栈(TypeORM、Prisma、Redis、RabbitMQ)
- 询问关于认证、消息传递与模块边界的澄清问题
- 在编写任何文件或提出修改建议前,在块中梳理你的实现计划
<thinking>
未明确范围与计划前,不得继续推进
⚠️ STEP 2: Load Project Memory (REQUIRED)
⚠️ 步骤2:加载项目内存数据(必填)
YOU MUST:
- Load memory with
memoryStore.getSkillMemory("nestjs", "{project-name}") - Review cross-skill memory with
memoryStore.getByProject("{project-name}") - Note existing module conventions and integrations
DO NOT PROCEED WITHOUT CHECKING MEMORY
你必须:
- 通过加载内存数据
memoryStore.getSkillMemory("nestjs", "{project-name}") - 通过查看跨技能内存数据
memoryStore.getByProject("{project-name}") - 记录现有的模块约定与集成情况
未检查内存数据前,不得继续推进
⚠️ STEP 3: Load Context (REQUIRED)
⚠️ 步骤3:加载上下文(必填)
YOU MUST:
- Use for general architecture patterns
contextProvider.getDomainIndex("engineering") - Pull security context with
contextProvider.getCrossDomainContext("engineering", ["auth", "security"]) - Stay within the declared file budget
DO NOT PROCEED WITHOUT RELEVANT CONTEXT
你必须:
- 使用获取通用架构模式
contextProvider.getDomainIndex("engineering") - 通过获取安全上下文
contextProvider.getCrossDomainContext("engineering", ["auth", "security"]) - 严格遵守已声明的文件预算
未加载相关上下文前,不得继续推进
⚠️ STEP 4: Analyze Architecture & Code Paths (REQUIRED)
⚠️ 步骤4:分析架构与代码路径(必填)
YOU MUST:
- Review module boundaries, controller routes, and provider scopes
- Inspect DTO validation, pipes, and exception filters
- Evaluate data access patterns and transaction handling
- Check integration points (queues, caches, external services)
DO NOT PROCEED WITHOUT A COMPLETE ANALYSIS
你必须:
- 检查模块边界、控制器路由与提供者作用域
- 审查DTO验证、管道与异常过滤器
- 评估数据访问模式与事务处理
- 检查集成点(队列、缓存、外部服务)
未完成完整分析前,不得继续推进
⚠️ STEP 5: Provide NestJS Guidance (REQUIRED)
⚠️ 步骤5:提供NestJS指导建议(必填)
YOU MUST:
- Recommend module restructuring or DI improvements
- Provide validation, security, and testing guidance
- Suggest performance or messaging enhancements
DO NOT PROVIDE GENERIC OR UNSUPPORTED RECOMMENDATIONS
你必须:
- 建议模块重构或依赖注入优化方案
- 提供验证、安全与测试相关指导
- 提出性能优化或消息传递增强建议
不得提供通用或无依据的建议
⚠️ STEP 6: Generate Output & Update Memory (REQUIRED)
⚠️ 步骤6:生成输出并更新内存数据(必填)
YOU MUST:
- Produce a structured report in
/claudedocs/nestjs_{project}_{YYYY-MM-DD}.md - Follow the naming conventions in
../OUTPUT_CONVENTIONS.md - Update memory with :
memoryStore.update("nestjs", "{project-name}", ...)project_overview.mdmodule_map.mdintegration_notes.mdtesting_strategy.md
DO NOT FINISH WITHOUT SAVING OUTPUT AND UPDATING MEMORY
你必须:
- 在路径下生成结构化报告
/claudedocs/nestjs_{project}_{YYYY-MM-DD}.md - 遵循中的命名规范
../OUTPUT_CONVENTIONS.md - 通过更新内存数据:
memoryStore.update("nestjs", "{project-name}", ...)project_overview.mdmodule_map.mdintegration_notes.mdtesting_strategy.md
未保存输出与更新内存数据前,不得结束任务
Compliance Checklist
合规检查清单
Before completing ANY NestJS task, verify:
- Step 1: Scope defined and plan documented in
<thinking> - Step 2: Project memory loaded via
memoryStore.getSkillMemory() - Step 3: Context loaded via
contextProvider - Step 4: Architecture and code paths analyzed
- Step 5: NestJS guidance provided with actionable recommendations
- Step 6: Output saved to and memory updated
/claudedocs/
FAILURE TO COMPLETE ALL STEPS INVALIDATES THE GUIDANCE
在完成任何NestJS任务前,请验证:
- 步骤1:已定义范围并在中记录计划
<thinking> - 步骤2:已通过加载项目内存数据
memoryStore.getSkillMemory() - 步骤3:已通过加载上下文
contextProvider - 步骤4:已完成架构与代码路径分析
- 步骤5:已提供NestJS指导建议与可执行方案
- 步骤6:已将输出保存至并更新内存数据
/claudedocs/
未完成所有步骤的指导建议视为无效
Version History
版本历史
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | 2026-02-12 | Initial release for NestJS framework guidance |
| 版本 | 日期 | 变更内容 |
|---|---|---|
| 1.0.0 | 2026-02-12 | 首次发布NestJS框架指导文档 |