code-exemplars-blueprint-generator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Exemplars Blueprint Generator

代码范例蓝图生成器

Configuration Variables

配置变量

${PROJECT_TYPE="Auto-detect|.NET|Java|JavaScript|TypeScript|React|Angular|Python|Other"} <!-- Primary technology --> ${SCAN_DEPTH="Basic|Standard|Comprehensive"} <!-- How deeply to analyze the codebase --> ${INCLUDE_CODE_SNIPPETS=true|false} <!-- Include actual code snippets in addition to file references --> ${CATEGORIZATION="Pattern Type|Architecture Layer|File Type"} <!-- How to organize exemplars --> ${MAX_EXAMPLES_PER_CATEGORY=3} <!-- Maximum number of examples per category --> ${INCLUDE_COMMENTS=true|false} <!-- Include explanatory comments for each exemplar -->
${PROJECT_TYPE="Auto-detect|.NET|Java|JavaScript|TypeScript|React|Angular|Python|Other"} <!-- 主要技术栈 --> ${SCAN_DEPTH="Basic|Standard|Comprehensive"} <!-- 代码库分析深度 --> ${INCLUDE_CODE_SNIPPETS=true|false} <!-- 除文件引用外,是否包含实际代码片段 --> ${CATEGORIZATION="Pattern Type|Architecture Layer|File Type"} <!-- 范例的组织方式 --> ${MAX_EXAMPLES_PER_CATEGORY=3} <!-- 每个分类下的最大范例数量 --> ${INCLUDE_COMMENTS=true|false} <!-- 是否为每个范例添加解释性注释 -->

Generated Prompt

生成的提示词

"Scan this codebase and generate an exemplars.md file that identifies high-quality, representative code examples. The exemplars should demonstrate our coding standards and patterns to help maintain consistency. Use the following approach:
"扫描此代码库并生成exemplars.md文件,识别高质量、具有代表性的代码范例。这些范例应展示我们的编码标准和模式,以帮助保持一致性。请采用以下方法:

1. Codebase Analysis Phase

1. 代码库分析阶段

  • ${PROJECT_TYPE == "Auto-detect" ? "Automatically detect primary programming languages and frameworks by scanning file extensions and configuration files" :
    Focus on ${PROJECT_TYPE} code files
    }
  • Identify files with high-quality implementation, good documentation, and clear structure
  • Look for commonly used patterns, architecture components, and well-structured implementations
  • Prioritize files that demonstrate best practices for our technology stack
  • Only reference actual files that exist in the codebase - no hypothetical examples
  • ${PROJECT_TYPE == "Auto-detect" ? "通过扫描文件扩展名和配置文件,自动检测主要编程语言和框架" :
    重点分析${PROJECT_TYPE}代码文件
    }
  • 识别实现质量高、文档完善、结构清晰的文件
  • 寻找常用模式、架构组件和结构良好的实现
  • 优先选择能展示我们技术栈最佳实践的文件
  • 仅引用代码库中实际存在的文件 - 不包含假设性示例

2. Exemplar Identification Criteria

2. 范例识别标准

  • Well-structured, readable code with clear naming conventions
  • Comprehensive comments and documentation
  • Proper error handling and validation
  • Adherence to design patterns and architectural principles
  • Separation of concerns and single responsibility principle
  • Efficient implementation without code smells
  • Representative of our standard approaches
  • 结构清晰、可读性强且命名规范的代码
  • 全面的注释和文档
  • 完善的错误处理和验证机制
  • 遵循设计模式和架构原则
  • 关注点分离与单一职责原则
  • 高效的实现,无代码异味
  • 能代表我们的标准实现方式

3. Core Pattern Categories

3. 核心模式分类

${PROJECT_TYPE == ".NET" || PROJECT_TYPE == "Auto-detect" ? `#### .NET Exemplars (if detected)
  • Domain Models: Find entities that properly implement encapsulation and domain logic
  • Repository Implementations: Examples of our data access approach
  • Service Layer Components: Well-structured business logic implementations
  • Controller Patterns: Clean API controllers with proper validation and responses
  • Dependency Injection Usage: Good examples of DI configuration and usage
  • Middleware Components: Custom middleware implementations
  • Unit Test Patterns: Well-structured tests with proper arrangement and assertions` : ""}
${(PROJECT_TYPE == "JavaScript" || PROJECT_TYPE == "TypeScript" || PROJECT_TYPE == "React" || PROJECT_TYPE == "Angular" || PROJECT_TYPE == "Auto-detect") ? `#### Frontend Exemplars (if detected)
  • Component Structure: Clean, well-structured components
  • State Management: Good examples of state handling
  • API Integration: Well-implemented service calls and data handling
  • Form Handling: Validation and submission patterns
  • Routing Implementation: Navigation and route configuration
  • UI Components: Reusable, well-structured UI elements
  • Unit Test Examples: Component and service tests` : ""}
${PROJECT_TYPE == "Java" || PROJECT_TYPE == "Auto-detect" ? `#### Java Exemplars (if detected)
  • Entity Classes: Well-designed JPA entities or domain models
  • Service Implementations: Clean service layer components
  • Repository Patterns: Data access implementations
  • Controller/Resource Classes: API endpoint implementations
  • Configuration Classes: Application configuration
  • Unit Tests: Well-structured JUnit tests` : ""}
${PROJECT_TYPE == "Python" || PROJECT_TYPE == "Auto-detect" ? `#### Python Exemplars (if detected)
  • Class Definitions: Well-structured classes with proper documentation
  • API Routes/Views: Clean API implementations
  • Data Models: ORM model definitions
  • Service Functions: Business logic implementations
  • Utility Modules: Helper and utility functions
  • Test Cases: Well-structured unit tests` : ""}
${PROJECT_TYPE == ".NET" || PROJECT_TYPE == "Auto-detect" ? `#### .NET范例(若检测到)
  • 领域模型:寻找正确实现封装和领域逻辑的实体
  • 仓储实现:我们的数据访问方式示例
  • 服务层组件:结构清晰的业务逻辑实现
  • 控制器模式:具备完善验证和响应机制的简洁API控制器
  • 依赖注入使用:DI配置与使用的优秀示例
  • 中间件组件:自定义中间件实现
  • 单元测试模式:结构清晰、包含合理准备和断言的测试` : ""}
${(PROJECT_TYPE == "JavaScript" || PROJECT_TYPE == "TypeScript" || PROJECT_TYPE == "React" || PROJECT_TYPE == "Angular" || PROJECT_TYPE == "Auto-detect") ? `#### 前端范例(若检测到)
  • 组件结构:简洁、结构清晰的组件
  • 状态管理:状态处理的优秀示例
  • API集成:实现完善的服务调用和数据处理
  • 表单处理:验证与提交模式
  • 路由实现:导航与路由配置
  • UI组件:可复用、结构清晰的UI元素
  • 单元测试示例:组件与服务测试` : ""}
${PROJECT_TYPE == "Java" || PROJECT_TYPE == "Auto-detect" ? `#### Java范例(若检测到)
  • 实体类:设计良好的JPA实体或领域模型
  • 服务实现:简洁的服务层组件
  • 仓储模式:数据访问实现
  • 控制器/资源类:API端点实现
  • 配置类:应用配置
  • 单元测试:结构清晰的JUnit测试` : ""}
${PROJECT_TYPE == "Python" || PROJECT_TYPE == "Auto-detect" ? `#### Python范例(若检测到)
  • 类定义:结构清晰、文档完善的类
  • API路由/视图:简洁的API实现
  • 数据模型:ORM模型定义
  • 服务函数:业务逻辑实现
  • 工具模块:辅助工具函数
  • 测试用例:结构清晰的单元测试` : ""}

4. Architecture Layer Exemplars

4. 架构层范例

  • Presentation Layer:
    • User interface components
    • Controllers/API endpoints
    • View models/DTOs
  • Business Logic Layer:
    • Service implementations
    • Business logic components
    • Workflow orchestration
  • Data Access Layer:
    • Repository implementations
    • Data models
    • Query patterns
  • Cross-Cutting Concerns:
    • Logging implementations
    • Error handling
    • Authentication/authorization
    • Validation
  • 表示层:
    • 用户界面组件
    • 控制器/API端点
    • 视图模型/DTO
  • 业务逻辑层:
    • 服务实现
    • 业务逻辑组件
    • 工作流编排
  • 数据访问层:
    • 仓储实现
    • 数据模型
    • 查询模式
  • 横切关注点:
    • 日志实现
    • 错误处理
    • 认证/授权
    • 验证

5. Exemplar Documentation Format

5. 范例文档格式

For each identified exemplar, document:
  • File path (relative to repository root)
  • Brief description of what makes it exemplary
  • Pattern or component type it represents ${INCLUDE_COMMENTS ? "- Key implementation details and coding principles demonstrated" : ""} ${INCLUDE_CODE_SNIPPETS ? "- Small, representative code snippet (if applicable)" : ""}
${SCAN_DEPTH == "Comprehensive" ? `### 6. Additional Documentation
  • Consistency Patterns: Note consistent patterns observed across the codebase
  • Architecture Observations: Document architectural patterns evident in the code
  • Implementation Conventions: Identify naming and structural conventions
  • Anti-patterns to Avoid: Note any areas where the codebase deviates from best practices` : ""}
对于每个识别出的范例,需记录:
  • 文件路径(相对于仓库根目录)
  • 简述该范例的优秀之处
  • 它所代表的模式或组件类型 ${INCLUDE_COMMENTS ? "- 展示的关键实现细节和编码原则" : ""} ${INCLUDE_CODE_SNIPPETS ? "- 小型、具有代表性的代码片段(如适用)" : ""}
${SCAN_DEPTH == "Comprehensive" ? `### 6. 额外文档内容
  • 一致性模式:记录代码库中观察到的一致模式
  • 架构观察:记录代码库中体现的架构模式
  • 实现约定:识别命名和结构约定
  • 需避免的反模式:记录代码库中偏离最佳实践的部分` : ""}

${SCAN_DEPTH == "Comprehensive" ? "7" : "6"}. Output Format

${SCAN_DEPTH == "Comprehensive" ? "7" : "6"}. 输出格式

Create exemplars.md with:
  1. Introduction explaining the purpose of the document
  2. Table of contents with links to categories
  3. Organized sections based on ${CATEGORIZATION}
  4. Up to ${MAX_EXAMPLES_PER_CATEGORY} exemplars per category
  5. Conclusion with recommendations for maintaining code quality
The document should be actionable for developers needing guidance on implementing new features consistent with existing patterns.
Important: Only include actual files from the codebase. Verify all file paths exist. Do not include placeholder or hypothetical examples. "
创建exemplars.md文件,包含:
  1. 说明文档用途的引言
  2. 带分类链接的目录
  3. 基于${CATEGORIZATION}组织的章节
  4. 每个分类最多包含${MAX_EXAMPLES_PER_CATEGORY}个范例
  5. 包含维护代码质量建议的结论
该文档应对需要参考现有模式实现新功能的开发人员具备实际指导意义。
重要提示:仅包含代码库中的实际文件。验证所有文件路径是否存在。请勿包含占位符或假设性示例。 "

Expected Output

预期输出

Upon running this prompt, GitHub Copilot will scan your codebase and generate an exemplars.md file containing real references to high-quality code examples in your repository, organized according to your selected parameters.
运行此提示词后,GitHub Copilot将扫描你的代码库,并生成exemplars.md文件,其中包含仓库中高质量代码示例的真实引用,且会根据你选择的参数进行组织。