project-workflow-analysis-blueprint-generator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Project Workflow Documentation Generator

项目工作流文档生成器

Configuration Variables

配置变量

${PROJECT_TYPE="Auto-detect|.NET|Java|Spring|Node.js|Python|React|Angular|Microservices|Other"}
<!-- Primary technology stack -->

${ENTRY_POINT="API|GraphQL|Frontend|CLI|Message Consumer|Scheduled Job|Custom"}
<!-- Starting point for the flow -->

${PERSISTENCE_TYPE="Auto-detect|SQL Database|NoSQL Database|File System|External API|Message Queue|Cache|None"}
<!-- Data storage type -->

${ARCHITECTURE_PATTERN="Auto-detect|Layered|Clean|CQRS|Microservices|MVC|MVVM|Serverless|Event-Driven|Other"}
<!-- Primary architecture pattern -->

${WORKFLOW_COUNT=1-5}
<!-- Number of workflows to document -->

${DETAIL_LEVEL="Standard|Implementation-Ready"}
<!-- Level of implementation detail to include -->

${INCLUDE_SEQUENCE_DIAGRAM=true|false}
<!-- Generate sequence diagram -->

${INCLUDE_TEST_PATTERNS=true|false}
<!-- Include testing approach -->
${PROJECT_TYPE="Auto-detect|.NET|Java|Spring|Node.js|Python|React|Angular|Microservices|Other"}
<!-- 核心技术栈 -->

${ENTRY_POINT="API|GraphQL|Frontend|CLI|Message Consumer|Scheduled Job|Custom"}
<!-- 工作流起始点 -->

${PERSISTENCE_TYPE="Auto-detect|SQL Database|NoSQL Database|File System|External API|Message Queue|Cache|None"}
<!-- 数据存储类型 -->

${ARCHITECTURE_PATTERN="Auto-detect|Layered|Clean|CQRS|Microservices|MVC|MVVM|Serverless|Event-Driven|Other"}
<!-- 核心架构模式 -->

${WORKFLOW_COUNT=1-5}
<!-- 要记录的工作流数量 -->

${DETAIL_LEVEL="Standard|Implementation-Ready"}
<!-- 包含的实现细节级别 -->

${INCLUDE_SEQUENCE_DIAGRAM=true|false}
<!-- 是否生成序列图 -->

${INCLUDE_TEST_PATTERNS=true|false}
<!-- 是否包含测试方案 -->

Generated Prompt

生成的提示词

"Analyze the codebase and document ${WORKFLOW_COUNT} representative end-to-end workflows 
that can serve as implementation templates for similar features. Use the following approach:
"Analyze the codebase and document ${WORKFLOW_COUNT} representative end-to-end workflows 
that can serve as implementation templates for similar features. Use the following approach:

Initial Detection Phase

初始检测阶段

${PROJECT_TYPE == "Auto-detect" ? 
  "Begin by examining the codebase structure to identify technologies:
   - Check for .NET solutions/projects, Spring configurations, Node.js/Express files, etc.
   - Identify the primary programming language(s) and frameworks in use
   - Determine the architectural patterns based on folder structure and key components" 
  : "Focus on ${PROJECT_TYPE} patterns and conventions"}
${ENTRY_POINT == "Auto-detect" ? 
  "Identify typical entry points by looking for:
   - API controllers or route definitions
   - GraphQL resolvers
   - UI components that initiate network requests
   - Message handlers or event subscribers
   - Scheduled job definitions" 
  : "Focus on ${ENTRY_POINT} entry points"}
${PERSISTENCE_TYPE == "Auto-detect" ? 
  "Determine persistence mechanisms by examining:
   - Database context/connection configurations
   - Repository implementations
   - ORM mappings
   - External API clients
   - File system interactions" 
  : "Focus on ${PERSISTENCE_TYPE} interactions"}
${PROJECT_TYPE == "Auto-detect" ? 
  "Begin by examining the codebase structure to identify technologies:
   - Check for .NET solutions/projects, Spring configurations, Node.js/Express files, etc.
   - Identify the primary programming language(s) and frameworks in use
   - Determine the architectural patterns based on folder structure and key components" 
  : "Focus on ${PROJECT_TYPE} patterns and conventions"}
${ENTRY_POINT == "Auto-detect" ? 
  "Identify typical entry points by looking for:
   - API controllers or route definitions
   - GraphQL resolvers
   - UI components that initiate network requests
   - Message handlers or event subscribers
   - Scheduled job definitions" 
  : "Focus on ${ENTRY_POINT} entry points"}
${PERSISTENCE_TYPE == "Auto-detect" ? 
  "Determine persistence mechanisms by examining:
   - Database context/connection configurations
   - Repository implementations
   - ORM mappings
   - External API clients
   - File system interactions" 
  : "Focus on ${PERSISTENCE_TYPE} interactions"}

Workflow Documentation Instructions

工作流文档编写说明

For each of the
${WORKFLOW_COUNT}
most representative workflow(s) in the system:
针对系统中${WORKFLOW_COUNT}个最具代表性的工作流,分别执行以下步骤:

1. Workflow Overview

1. 工作流概述

  • Provide a name and brief description of the workflow
    • Explain the business purpose it serves
    • Identify the triggering action or event
    • List all files/classes involved in the complete workflow
  • 为工作流提供名称和简要描述
    • 说明其业务用途
    • 确定触发动作或事件
    • 列出完整工作流中涉及的所有文件/类

2. Entry Point Implementation

2. 入口点实现

API Entry Points:
${ENTRY_POINT == "API" || ENTRY_POINT == "Auto-detect" ? 
  "- Document the API controller class and method that receives the request
   - Show the complete method signature including attributes/annotations
   - Include the full request DTO/model class definition
   - Document validation attributes and custom validators
   - Show authentication/authorization attributes and checks" : ""}
GraphQL Entry Points:
${ENTRY_POINT == "GraphQL" || ENTRY_POINT == "Auto-detect" ? 
  "- Document the GraphQL resolver class and method
   - Show the complete schema definition for the query/mutation
   - Include input type definitions
   - Show resolver method implementation with parameter handling" : ""}
Frontend Entry Points:
${ENTRY_POINT == "Frontend" || ENTRY_POINT == "Auto-detect" ? 
  "- Document the component that initiates the API call
   - Show the event handler that triggers the request
   - Include the API client service method
   - Show state management code related to the request" : ""}
Message Consumer Entry Points:
${ENTRY_POINT == "Message Consumer" || ENTRY_POINT == "Auto-detect" ? 
  "- Document the message handler class and method
   - Show message subscription configuration
   - Include the complete message model definition
   - Show deserialization and validation logic" : ""}
API入口点:
${ENTRY_POINT == "API" || ENTRY_POINT == "Auto-detect" ? 
  "- Document the API controller class and method that receives the request
   - Show the complete method signature including attributes/annotations
   - Include the full request DTO/model class definition
   - Document validation attributes and custom validators
   - Show authentication/authorization attributes and checks" : ""}
GraphQL入口点:
${ENTRY_POINT == "GraphQL" || ENTRY_POINT == "Auto-detect" ? 
  "- Document the GraphQL resolver class and method
   - Show the complete schema definition for the query/mutation
   - Include input type definitions
   - Show resolver method implementation with parameter handling" : ""}
前端入口点:
${ENTRY_POINT == "Frontend" || ENTRY_POINT == "Auto-detect" ? 
  "- Document the component that initiates the API call
   - Show the event handler that triggers the request
   - Include the API client service method
   - Show state management code related to the request" : ""}
消息消费者入口点:
${ENTRY_POINT == "Message Consumer" || ENTRY_POINT == "Auto-detect" ? 
  "- Document the message handler class and method
   - Show message subscription configuration
   - Include the complete message model definition
   - Show deserialization and validation logic" : ""}

3. Service Layer Implementation

3. 服务层实现

  • Document each service class involved with their dependencies
    • Show the complete method signatures with parameters and return types
    • Include actual method implementations with key business logic
    • Document interface definitions where applicable
    • Show dependency injection registration patterns
CQRS Patterns:
${ARCHITECTURE_PATTERN == "CQRS" || ARCHITECTURE_PATTERN == "Auto-detect" ? 
  "- Include complete command/query handler implementations" : ""}
Clean Architecture Patterns:
${ARCHITECTURE_PATTERN == "Clean" || ARCHITECTURE_PATTERN == "Auto-detect" ? 
  "- Show use case/interactor implementations" : ""}
  • 记录涉及的每个服务类及其依赖关系
    • 展示包含参数和返回类型的完整方法签名
    • 包含带有核心业务逻辑的实际方法实现
    • 记录适用的接口定义
    • 展示依赖注入注册模式
CQRS模式:
${ARCHITECTURE_PATTERN == "CQRS" || ARCHITECTURE_PATTERN == "Auto-detect" ? 
  "- Include complete command/query handler implementations" : ""}
整洁架构模式:
${ARCHITECTURE_PATTERN == "Clean" || ARCHITECTURE_PATTERN == "Auto-detect" ? 
  "- Show use case/interactor implementations" : ""}

4. Data Mapping Patterns

4. 数据映射模式

  • Document DTO to domain model mapping code
    • Show object mapper configurations or manual mapping methods
    • Include validation logic during mapping
    • Document any domain events created during mapping
  • 记录DTO到领域模型的映射代码
    • 展示对象映射器配置或手动映射方法
    • 包含映射过程中的验证逻辑
    • 记录映射过程中创建的任何领域事件

5. Data Access Implementation

5. 数据访问实现

  • Document repository interfaces and their implementations
    • Show complete method signatures with parameters and return types
    • Include actual query implementations
    • Document entity/model class definitions with all properties
    • Show transaction handling patterns
SQL Database Patterns:
${PERSISTENCE_TYPE == "SQL Database" || PERSISTENCE_TYPE == "Auto-detect" ? 
  "- Include ORM configurations, annotations, or Fluent API usage
   - Show actual SQL queries or ORM statements" : ""}
NoSQL Database Patterns:
${PERSISTENCE_TYPE == "NoSQL Database" || PERSISTENCE_TYPE == "Auto-detect" ? 
  "- Show document structure definitions
   - Include document query/update operations" : ""}
  • 记录仓库接口及其实现
    • 展示包含参数和返回类型的完整方法签名
    • 包含实际查询实现
    • 记录带有所有属性的实体/模型类定义
    • 展示事务处理模式
SQL数据库模式:
${PERSISTENCE_TYPE == "SQL Database" || PERSISTENCE_TYPE == "Auto-detect" ? 
  "- Include ORM configurations, annotations, or Fluent API usage
   - Show actual SQL queries or ORM statements" : ""}
NoSQL数据库模式:
${PERSISTENCE_TYPE == "NoSQL Database" || PERSISTENCE_TYPE == "Auto-detect" ? 
  "- Show document structure definitions
   - Include document query/update operations" : ""}

6. Response Construction

6. 响应构造

  • Document response DTO/model class definitions
    • Show mapping from domain/entity models to response models
    • Include status code selection logic
    • Document error response structure and generation
  • 记录响应DTO/模型类定义
    • 展示从领域/实体模型到响应模型的映射
    • 包含状态码选择逻辑
    • 记录错误响应结构和生成方式

7. Error Handling Patterns

7. 错误处理模式

  • Document exception types used in the workflow
    • Show try/catch patterns at each layer
    • Include global exception handler configurations
    • Document error logging implementations
    • Show retry policies or circuit breaker patterns
    • Include compensating actions for failure scenarios
  • 记录工作流中使用的异常类型
    • 展示各层的try/catch模式
    • 包含全局异常处理器配置
    • 记录错误日志实现
    • 展示重试策略或断路器模式
    • 包含故障场景下的补偿操作

8. Asynchronous Processing Patterns

8. 异步处理模式

  • Document background job scheduling code
    • Show event publication implementations
    • Include message queue sending patterns
    • Document callback or webhook implementations
    • Show how async operations are tracked and monitored
Testing Approach (Optional):
${INCLUDE_TEST_PATTERNS ? 
  "9. **Testing Approach**
     - Document unit test implementations for each layer
     - Show mocking patterns and test fixture setup
     - Include integration test implementations
     - Document test data generation approaches
     - Show API/controller test implementations" : ""}
Sequence Diagram (Optional):
${INCLUDE_SEQUENCE_DIAGRAM ? 
  "10. **Sequence Diagram**
      - Generate a detailed sequence diagram showing all components
      - Include method calls with parameter types
      - Show return values between components
      - Document conditional flows and error paths" : ""}
  • 记录后台任务调度代码
    • 展示事件发布实现
    • 包含消息队列发送模式
    • 记录回调或Webhook实现
    • 展示异步操作的跟踪和监控方式
测试方案(可选):
${INCLUDE_TEST_PATTERNS ? 
  "9. **Testing Approach**
     - Document unit test implementations for each layer
     - Show mocking patterns and test fixture setup
     - Include integration test implementations
     - Document test data generation approaches
     - Show API/controller test implementations" : ""}
序列图(可选):
${INCLUDE_SEQUENCE_DIAGRAM ? 
  "10. **Sequence Diagram**
      - Generate a detailed sequence diagram showing all components
      - Include method calls with parameter types
      - Show return values between components
      - Document conditional flows and error paths" : ""}

11. Naming Conventions

11. 命名规范

Document consistent patterns for:
  • Controller naming (e.g.,
    EntityNameController
    )
  • Service naming (e.g.,
    EntityNameService
    )
  • Repository naming (e.g.,
    IEntityNameRepository
    )
  • DTO naming (e.g.,
    EntityNameRequest
    ,
    EntityNameResponse
    )
  • Method naming patterns for CRUD operations
  • Variable naming conventions
  • File organization patterns
记录以下内容的统一模式:
  • 控制器命名(例如:
    EntityNameController
  • 服务命名(例如:
    EntityNameService
  • 仓库命名(例如:
    IEntityNameRepository
  • DTO命名(例如:
    EntityNameRequest
    ,
    EntityNameResponse
  • CRUD操作的方法命名模式
  • 变量命名规范
  • 文件组织模式

12. Implementation Templates

12. 实现模板

Provide reusable code templates for:
  • Creating a new API endpoint following the pattern
  • Implementing a new service method
  • Adding a new repository method
  • Creating new domain model classes
  • Implementing proper error handling
提供可复用的代码模板,用于:
  • 按照现有模式创建新的API端点
  • 实现新的服务方法
  • 添加新的仓库方法
  • 创建新的领域模型类
  • 实现规范的错误处理

Technology-Specific Implementation Patterns

技术特定的实现模式

.NET Implementation Patterns (if detected):
${PROJECT_TYPE == ".NET" || PROJECT_TYPE == "Auto-detect" ? 
  "- Complete controller class with attributes, filters, and dependency injection
   - Service registration in Startup.cs or Program.cs
   - Entity Framework DbContext configuration
   - Repository implementation with EF Core or Dapper
   - AutoMapper profile configurations
   - Middleware implementations for cross-cutting concerns
   - Extension method patterns
   - Options pattern implementation for configuration
   - Logging implementation with ILogger
   - Authentication/authorization filter or policy implementations" : ""}
Spring Implementation Patterns (if detected):
${PROJECT_TYPE == "Java" || PROJECT_TYPE == "Spring" || PROJECT_TYPE == "Auto-detect" ? 
  "- Complete controller class with annotations and dependency injection
   - Service implementation with transaction boundaries
   - Repository interface and implementation
   - JPA entity definitions with relationships
   - DTO class implementations
   - Bean configuration and component scanning
   - Exception handler implementations
   - Custom validator implementations" : ""}
React Implementation Patterns (if detected):
${PROJECT_TYPE == "React" || PROJECT_TYPE == "Auto-detect" ? 
  "- Component structure with props and state
   - Hook implementation patterns (useState, useEffect, custom hooks)
   - API service implementation
   - State management patterns (Context, Redux)
   - Form handling implementations
   - Route configuration" : ""}
.NET实现模式(如果检测到):
${PROJECT_TYPE == ".NET" || PROJECT_TYPE == "Auto-detect" ? 
  "- Complete controller class with attributes, filters, and dependency injection
   - Service registration in Startup.cs or Program.cs
   - Entity Framework DbContext configuration
   - Repository implementation with EF Core or Dapper
   - AutoMapper profile configurations
   - Middleware implementations for cross-cutting concerns
   - Extension method patterns
   - Options pattern implementation for configuration
   - Logging implementation with ILogger
   - Authentication/authorization filter or policy implementations" : ""}
Spring实现模式(如果检测到):
${PROJECT_TYPE == "Java" || PROJECT_TYPE == "Spring" || PROJECT_TYPE == "Auto-detect" ? 
  "- Complete controller class with annotations and dependency injection
   - Service implementation with transaction boundaries
   - Repository interface and implementation
   - JPA entity definitions with relationships
   - DTO class implementations
   - Bean configuration and component scanning
   - Exception handler implementations
   - Custom validator implementations" : ""}
React实现模式(如果检测到):
${PROJECT_TYPE == "React" || PROJECT_TYPE == "Auto-detect" ? 
  "- Component structure with props and state
   - Hook implementation patterns (useState, useEffect, custom hooks)
   - API service implementation
   - State management patterns (Context, Redux)
   - Form handling implementations
   - Route configuration" : ""}

Implementation Guidelines

实现指南

Based on the documented workflows, provide specific guidance for implementing new features:
基于已记录的工作流,为实现新功能提供具体指导:

1. Step-by-Step Implementation Process

1. 分步实现流程

  • Where to start when adding a similar feature
  • Order of implementation (e.g., model → repository → service → controller)
  • How to integrate with existing cross-cutting concerns
  • 添加类似功能时的起始点
  • 实现顺序(例如:模型 → 仓库 → 服务 → 控制器)
  • 如何与现有横切关注点集成

2. Common Pitfalls to Avoid

2. 需避免的常见陷阱

  • Identify error-prone areas in the current implementation
  • Note performance considerations
  • List common bugs or issues encountered
  • 识别当前实现中容易出错的区域
  • 注意性能考量因素
  • 列出遇到的常见bug或问题

3. Extension Mechanisms

3. 扩展机制

  • Document how to plug into existing extension points
  • Show how to add new behavior without modifying existing code
  • Explain configuration-driven feature patterns
Conclusion: Conclude with a summary of the most important patterns that should be followed when implementing new features to maintain consistency with the codebase."
  • 记录如何接入现有扩展点
  • 展示如何在不修改现有代码的情况下添加新行为
  • 解释基于配置的功能模式
结论: 总结实现新功能时应遵循的最重要模式,以保持与代码库的一致性。