关于 project-workflow-analysis-blueprint-generator
这是一个用于生成代码库工作流文档的提示词蓝图,面向需要梳理现有项目实现模式的开发者。它引导分析入口、服务层、数据访问、错误处理等环节,并可生成实施模板与指导。
主要功能
- 01按项目类型和入口配置分析
- 02梳理端到端代表性工作流
- 03记录各层实现与数据映射
- 04可选生成测试说明和时序图
- 05提供命名规范与实现模板
适用场景
- 01为现有代码库编写工作流文档
- 02了解新功能应遵循的分层模式
- 03为相似功能生成可复用实施模板
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ github/ awesome-copilot --skill project-workflow-analysis-blueprint-generator安装后在 Claude Code 中输入/project-workflow-analysis-blueprint-generator确认已加载。
详细介绍
项目工作流文档生成器
配置变量
${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}
生成的提示词
"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:
初始检测阶段
${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_COUNT} 个最具代表性的工作流:
1. 工作流概览
- 提供工作流的名称和简要描述
- 说明它所服务的业务目的
- 确定触发操作或事件
- 列出完整工作流中涉及的所有文件/类
2. 入口点实现
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. 服务层实现
- 记录涉及的每个服务类及其依赖项
- 展示包含参数和返回类型的完整方法签名
- 包含带有核心业务逻辑的实际方法实现
- 在适用的情况下记录接口定义
- 展示依赖注入注册模式
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. 数据映射模式
- 记录 DTO 到领域模型的映射代码
- 展示对象映射器配置或手动映射方法
- 包含映射期间的校验逻辑
- 记录映射期间创建的任何领域事件
5. 数据访问实现
- 记录仓储接口及其实现
- 展示包含参数和返回类型的完整方法签名
- 包含实际的查询实现
- 记录包含所有属性的实体/模型类定义
- 展示事务处理模式
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. 响应构建
- 记录响应 DTO/模型类定义
- 展示从领域/实体模型到响应模型的映射
- 包含状态码选择逻辑
- 记录错误响应结构及其生成方式
7. 错误处理模式
- 记录工作流中使用的异常类型
- 展示每一层的 try/catch 模式
- 包含全局异常处理器配置
- 记录错误日志实现
- 展示重试策略或熔断器模式
- 包含失败场景的补偿操作
8. 异步处理模式
- 记录后台任务调度代码
- 展示事件发布实现
- 包含消息队列发送模式
- 记录回调或 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. 命名约定
记录以下方面的一致模式:
- 控制器命名(例如
EntityNameController) - 服务命名(例如
EntityNameService) - 仓储命名(例如
IEntityNameRepository) - DTO 命名(例如
EntityNameRequest、EntityNameResponse) - CRUD 操作的方法命名模式
- 变量命名约定
- 文件组织模式
12. 实现模板
提供以下方面的可复用代码模板:
- 按照此模式创建新的 API 端点
- 实现新的服务方法
- 添加新的仓储方法
- 创建新的领域模型类
- 实现正确的错误处理
技术特定的实现模式
.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" : ""}
实现指南
基于已记录的工作流,为实现新功能提供具体指导:
1. 分步实现过程
- 添加类似功能时从哪里开始
- 实现顺序(例如,模型 → 仓储 → 服务 → 控制器)
- 如何与现有的横切关注点集成
2. 应避免的常见陷阱
- 识别当前实现中容易出错的区域
- 注明性能方面的考量
- 列出常见的 bug 或遇到的问题
3. 扩展机制
- 说明如何接入现有的扩展点
- 展示如何在不修改现有代码的情况下添加新行为
- 解释由配置驱动的功能模式
结论: 最后总结在实现新功能时应遵循的最重要模式,以保持与代码库的一致性。"
评论
支持 Markdown