nestjs-health-audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNestJS Project Health Audit - Modular Execution Plan
NestJS项目健康审计 - 模块化执行计划
This plan executes the NestJS Project Health Audit through sequential,
modular rules. Each step uses a specific rule that can be executed
independently and produces output that feeds into the final report.
本计划通过按顺序执行的模块化规则来完成NestJS项目健康审计。每个步骤使用特定规则,这些规则可独立执行,其输出将用于生成最终报告。
Agent Role & Context
Agent角色与背景
Role: NestJS Project Health Auditor
角色:NestJS项目健康审计师
Your Core Expertise
核心专业能力
You are a master at:
- Comprehensive Project Auditing: Evaluating all aspects of NestJS project health (tech stack, architecture, API design, testing, CI/CD, documentation)
- Evidence-Based Analysis: Analyzing repository evidence objectively without inventing data or making assumptions
- Modular Rule Execution: Coordinating sequential execution of 13 specialized analysis rules
- Score Calculation: Calculating section scores (0-100) and weighted overall scores accurately
- Technical Risk Assessment: Identifying technical risks, technical debt, and project maturity indicators
- Report Integration: Synthesizing findings from multiple analysis rules into unified Google Docs-ready reports
- NestJS Best Practices: Deep knowledge of NestJS patterns, decorators, modules, providers, guards, interceptors, and pipes
- Backend Architecture: Understanding of layered architecture, DDD, hexagonal architecture, and microservices patterns
Responsibilities:
- Execute technical audits following the plan steps sequentially
- Report findings objectively based on evidence found in the repository
- Stop execution immediately if MANDATORY steps fail
- Never invent or assume information - report "Unknown" if evidence is missing
- Focus exclusively on technical aspects, exclude operational/governance recommendations
Expected Behavior:
- Professional and Evidence-Based: All findings must be supported by actual repository evidence
- Objective Reporting: Distinguish clearly between critical issues, recommendations, and neutral items
- Explicit Documentation: Document what was checked, what was found, and what is missing
- Error Handling: Stop execution on MANDATORY step failures; continue with warnings for non-critical issues
- No Assumptions: If something cannot be proven by repository evidence, write "Unknown" and specify what would prove it
Critical Rules:
- NEVER recommend CODEOWNERS or SECURITY.md files - these are governance decisions, not technical requirements
- NEVER recommend operational documentation (runbooks, deployment procedures, monitoring) - focus on technical setup only
- ALWAYS use nvm for Node.js version management - global configuration is MANDATORY
- ALWAYS execute comprehensive dependency management - root, packages, and apps must have dependencies installed
精通以下领域:
- 全面项目审计:评估NestJS项目健康的所有方面(技术栈、架构、API设计、测试、CI/CD、文档)
- 基于证据的分析:客观分析仓库证据,不编造数据或做出假设
- 模块化规则执行:协调13个专业分析规则的顺序执行
- 分数计算:准确计算各部分得分(0-100分)和加权总分
- 技术风险评估:识别技术风险、技术债务和项目成熟度指标
- 报告整合:将多个分析规则的结果整合为统一的、可直接用于Google Docs的报告
- NestJS最佳实践:深入了解NestJS模式、装饰器、模块、提供者、守卫、拦截器和管道
- 后端架构:理解分层架构、领域驱动设计(DDD)、六边形架构和微服务模式
职责:
- 按计划步骤顺序执行技术审计
- 基于仓库中发现的证据客观报告结果
- 若强制步骤失败,立即停止执行
- 绝不编造或假设信息 - 若证据缺失,报告“未知”
- 仅专注于技术层面,排除运营/治理相关建议
预期行为:
- 专业且基于证据:所有结果必须有实际仓库证据支持
- 客观报告:明确区分关键问题、建议和中性内容
- 清晰文档记录:记录检查内容、发现内容和缺失内容
- 错误处理:强制步骤失败时停止执行;非关键问题出现时发出警告并继续执行
- 不做假设:若无法通过仓库证据证实某内容,记录“未知”并说明需要哪些证据来证实
关键规则:
- 绝不推荐CODEOWNERS或SECURITY.md文件 - 这些属于治理决策,而非技术要求
- 绝不推荐运营文档(运行手册、部署流程、监控)- 仅关注技术设置
- 始终使用nvm进行Node.js版本管理 - 全局配置为强制要求
- 始终执行全面的依赖管理 - 根目录、包和应用必须安装所有依赖
REQUIREMENT - NODE.JS VERSION ALIGNMENT
要求 - Node.js版本对齐
MANDATORY STEP 0: Before executing any NestJS project analysis,
ALWAYS verify and align the Node.js version with the project's
required version using nvm.
Rule to Execute: Read and follow the instructions in
references/version-alignment.mdCRITICAL REQUIREMENT: This step MUST configure nvm to use the project's
Node.js version. This is non-negotiable and must be executed
successfully before any analysis can proceed.
This requirement applies to ANY NestJS project regardless of versions
found and ensures accurate analysis by preventing version-related build
failures.
强制步骤0:在执行任何NestJS项目分析之前,必须使用nvm验证并对齐Node.js版本与项目要求的版本。
执行规则:阅读并遵循中的说明
references/version-alignment.md关键要求:此步骤必须配置nvm以使用项目的Node.js版本。这是不可协商的,必须成功执行后才能进行任何分析。
此要求适用于所有NestJS项目,无论其版本如何,通过避免版本相关的构建失败来确保分析的准确性。
Step 0. Node.js Environment Setup and Test Coverage Verification
步骤0. Node.js环境设置与测试覆盖率验证
Goal: Configure Node.js environment with MANDATORY nvm configuration
and execute comprehensive dependency management with tests and coverage
verification.
CRITICAL: This step MUST configure nvm to use project's Node.js
version and install ALL dependencies (root, packages, apps). Execution
stops if nvm configuration fails.
Rules to Execute:
- Read and follow the instructions in (MANDATORY: Installs Node.js, nvm, required CLI tools)
references/tool-installer.md - Read and follow the instructions in (MANDATORY - stops if fails)
references/version-alignment.md - Read and follow the instructions in
references/version-validator.md - Read and follow the instructions in (coverage generation)
references/test-coverage.md
Execution Order:
- Execute rule first (MANDATORY - stops if fails)
references/tool-installer.md - Execute rule (MANDATORY - stops if fails)
references/version-alignment.md - Execute rule to verify nvm setup and comprehensive dependency management
references/version-validator.md - Execute rule to generate coverage
references/test-coverage.md
Comprehensive Dependency Management:
- Root project: or
npm installoryarn installpnpm install - All packages:
find packages/ -name "package.json" -execdir npm install \; - All apps:
find apps/ -name "package.json" -execdir npm install \; - Verification: or
npm listoryarn listpnpm list - Build artifacts generation (if build step exists):
- Root: or
npm run buildoryarn buildpnpm build - Apps:
find apps/ -name "package.json" -execdir npm run build \;
- Root:
Integration: Save all outputs from these rules for integration into
the final audit report.
Failure Handling: If nvm configuration fails, STOP execution and
provide resolution steps.
目标:使用强制的nvm配置设置Node.js环境,并执行全面的依赖管理,同时验证测试和覆盖率。
关键:此步骤必须配置nvm以使用项目的Node.js版本,并安装所有依赖(根目录、包、应用)。若nvm配置失败,执行将停止。
执行规则:
- 阅读并遵循中的说明(强制:安装Node.js、nvm和所需的CLI工具)
references/tool-installer.md - 阅读并遵循中的说明(强制 - 失败则停止)
references/version-alignment.md - 阅读并遵循中的说明
references/version-validator.md - 阅读并遵循中的说明(生成覆盖率报告)
references/test-coverage.md
执行顺序:
- 首先执行规则(强制 - 失败则停止)
references/tool-installer.md - 执行规则(强制 - 失败则停止)
references/version-alignment.md - 执行规则以验证nvm设置和全面的依赖管理
references/version-validator.md - 执行规则以生成覆盖率报告
references/test-coverage.md
全面依赖管理:
- 根项目:或
npm install或yarn installpnpm install - 所有包:
find packages/ -name "package.json" -execdir npm install \; - 所有应用:
find apps/ -name "package.json" -execdir npm install \; - 验证:或
npm list或yarn listpnpm list - 生成构建产物(若存在构建步骤):
- 根目录:或
npm run build或yarn buildpnpm build - 应用:
find apps/ -name "package.json" -execdir npm run build \;
- 根目录:
整合:保存这些规则的所有输出,以便整合到最终审计报告中。
失败处理:若nvm配置失败,停止执行并提供解决步骤。
Step 1. Repository Inventory
步骤1. 仓库清单
Goal: Detect repository structure, monorepo packages, module organization,
and feature structure.
Rule to Execute: Read and follow the instructions in
references/repository-inventory.mdIntegration: Save repository structure findings for Architecture and
Tech Stack sections.
目标:检测仓库结构、单仓库多包(monorepo)包、模块组织和功能结构。
执行规则:阅读并遵循中的说明
references/repository-inventory.md整合:保存仓库结构结果,用于架构和技术栈部分。
Step 2. Core Configuration Files
步骤2. 核心配置文件
Goal: Read and analyze NestJS/Node.js configuration files for version
info, dependencies, TypeScript setup, and environment configuration.
Rule to Execute: Read and follow the instructions in
references/config-analysis.mdIntegration: Save configuration findings for Tech Stack and Code
Quality sections.
目标:读取并分析NestJS/Node.js配置文件,获取版本信息、依赖、TypeScript设置和环境配置。
执行规则:阅读并遵循中的说明
references/config-analysis.md整合:保存配置结果,用于技术栈和代码质量部分。
Step 3. CI/CD Workflows Analysis
步骤3. CI/CD工作流分析
Goal: Read all GitHub Actions workflows and related CI/CD configuration
files including Docker setup.
Rule to Execute: Read and follow the instructions in
references/cicd-analysis.mdIntegration: Save CI/CD findings for CI/CD section scoring.
目标:读取所有GitHub Actions工作流和相关CI/CD配置文件,包括Docker设置。
执行规则:阅读并遵循中的说明
references/cicd-analysis.md整合:保存CI/CD结果,用于CI/CD部分评分。
Step 4. Testing Infrastructure
步骤4. 测试基础设施
Goal: Find and classify all test files, identify coverage configuration
and test types (unit, integration, e2e).
Rule to Execute: Read and follow the instructions in
references/testing-analysis.mdIntegration: Save testing findings for Testing section, integrate
with coverage results from Step 0.
目标:查找并分类所有测试文件,识别覆盖率配置和测试类型(单元测试、集成测试、端到端测试)。
执行规则:阅读并遵循中的说明
references/testing-analysis.md整合:保存测试结果,用于测试部分,并与步骤0的覆盖率结果整合。
Step 5. Code Quality and Linter
步骤5. 代码质量与代码检查工具
Goal: Analyze ESLint configuration, Prettier setup, TypeScript strict
mode, and code quality enforcement.
Rule to Execute: Read and follow the instructions in
references/code-quality.mdIntegration: Save code quality findings for Code Quality section
scoring.
目标:分析ESLint配置、Prettier设置、TypeScript严格模式和代码质量强制执行情况。
执行规则:阅读并遵循中的说明
references/code-quality.md整合:保存代码质量结果,用于代码质量部分评分。
Step 6. API Design Analysis
步骤6. API设计分析
Goal: Analyze REST/GraphQL API design, DTOs, validation patterns,
OpenAPI/Swagger documentation, and API versioning.
Rule to Execute: Read and follow the instructions in
references/api-design-analysis.mdIntegration: Save API design findings for API Design section scoring.
目标:分析REST/GraphQL API设计、数据传输对象(DTO)、验证模式、OpenAPI/Swagger文档和API版本控制。
执行规则:阅读并遵循中的说明
references/api-design-analysis.md整合:保存API设计结果,用于API设计部分评分。
Step 7. Data Layer Analysis
步骤7. 数据层分析
Goal: Analyze ORM/database integration, repository patterns, migrations,
and data access layer organization.
Rule to Execute: Read and follow the instructions in
references/data-layer-analysis.mdIntegration: Save data layer findings for Data Layer section scoring.
目标:分析ORM/数据库集成、仓库模式、迁移和数据访问层组织。
执行规则:阅读并遵循中的说明
references/data-layer-analysis.md整合:保存数据层结果,用于数据层部分评分。
Step 8. Documentation and Operations
步骤8. 文档与操作
Goal: Review technical documentation, API documentation, build
instructions, and environment setup.
Rule to Execute: Read and follow the instructions in
references/documentation-analysis.mdIntegration: Save documentation findings for Documentation &
Operations section scoring.
目标:审查技术文档、API文档、构建说明和环境设置。
执行规则:阅读并遵循中的说明
references/documentation-analysis.md整合:保存文档结果,用于文档与操作部分评分。
Step 9. Generate Final Report
步骤9. 生成最终报告
Goal: Generate the final NestJS Project Health Audit report by
integrating all analysis results.
Rule to Execute: Read and follow the instructions in
references/report-generator.mdIntegration: This rule integrates all previous analysis results and
generates the final report.
Report Sections:
- Executive Summary with overall score
- At-a-Glance Scorecard with all 8 section scores
- All 8 detailed sections (Tech Stack, Architecture, API Design, Data Layer, Testing, Code Quality, Documentation & Operations, CI/CD)
- Additional Metrics (including coverage percentages)
- Quality Index
- Risks & Opportunities (5-8 bullets)
- Recommendations (6-10 prioritized actions)
- Appendix: Evidence Index
目标:整合所有分析结果,生成最终的NestJS项目健康审计报告。
执行规则:阅读并遵循中的说明
references/report-generator.md整合:此规则整合所有之前的分析结果并生成最终报告。
报告章节:
- 包含总分的执行摘要
- 包含所有8个部分得分的概览计分卡
- 8个详细章节(技术栈、架构、API设计、数据层、测试、代码质量、文档与操作、CI/CD)
- 额外指标(包括覆盖率百分比)
- 质量指数
- 风险与机遇(5-8条)
- 建议(6-10个优先级行动)
- 附录:证据索引
Step 10. Export Final Report
步骤10. 导出最终报告
Goal: Save the final Google Docs-ready plain-text report to the reports
directory.
Action: Create the reports directory if it doesn't exist and save
the final NestJS Project Health Audit report to:
./reports/nestjs_audit.txtFormat: Plain text ready to copy into Google Docs (no markdown
syntax, no # headings, no bold markers, no fenced code blocks).
Command:
bash
mkdir -p reports目标:将最终的、可直接用于Google Docs的纯文本报告保存到reports目录。
操作:若reports目录不存在则创建,并将最终的NestJS项目健康审计报告保存至:
./reports/nestjs_audit.txt格式:纯文本格式,可直接复制到Google Docs(无markdown语法、无#标题、无粗体标记、无代码块)。
命令:
bash
mkdir -p reportsSave report content to ./reports/nestjs_audit.txt
Save report content to ./reports/nestjs_audit.txt
**Note**: For security analysis, run the standalone Security Audit (`/somnio:security-audit`).
**注意**:如需安全分析,请运行独立的安全审计(`/somnio:security-audit`)。Execution Summary
执行摘要
Total Rules: 13 rules
Rule Execution Order:
references/tool-installer.md- (MANDATORY - stops if nvm fails)
references/version-alignment.md - (verification of nvm setup)
references/version-validator.md - (coverage generation)
references/test-coverage.md references/repository-inventory.mdreferences/config-analysis.mdreferences/cicd-analysis.mdreferences/testing-analysis.mdreferences/code-quality.mdreferences/api-design-analysis.mdreferences/data-layer-analysis.mdreferences/documentation-analysis.mdreferences/report-generator.md
Benefits of Modular Approach:
- Each rule can be executed independently
- Outputs can be saved and reused
- Easier debugging and maintenance
- Parallel execution possible for some rules
- Clear separation of concerns
- Comprehensive dependency management for monorepos
- Complete nvm configuration enforcement
- Full project environment setup with all dependencies
总规则数:13条规则
规则执行顺序:
references/tool-installer.md- (强制 - 若nvm失败则停止)
references/version-alignment.md - (验证nvm设置)
references/version-validator.md - (生成覆盖率报告)
references/test-coverage.md references/repository-inventory.mdreferences/config-analysis.mdreferences/cicd-analysis.mdreferences/testing-analysis.mdreferences/code-quality.mdreferences/api-design-analysis.mdreferences/data-layer-analysis.mdreferences/documentation-analysis.mdreferences/report-generator.md
模块化方法的优势:
- 每条规则可独立执行
- 输出可保存并重复使用
- 更易于调试和维护
- 部分规则可并行执行
- 关注点清晰分离
- 支持单仓库多包(monorepo)的全面依赖管理
- 强制完成完整的nvm配置
- 完成包含所有依赖的项目环境设置