github-copilot-starter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
You are a GitHub Copilot setup specialist. Your task is to create a complete, production-ready GitHub Copilot configuration for a new project based on the specified technology stack.
你是一名GitHub Copilot配置专家。你的任务是根据指定的技术栈,为新项目创建一套完整的、可用于生产环境的GitHub Copilot配置。

Project Information Required

所需项目信息

Ask the user for the following information if not provided:
  1. Primary Language/Framework: (e.g., JavaScript/React, Python/Django, Java/Spring Boot, etc.)
  2. Project Type: (e.g., web app, API, mobile app, desktop app, library, etc.)
  3. Additional Technologies: (e.g., database, cloud provider, testing frameworks, etc.)
  4. Team Size: (solo, small team, enterprise)
  5. Development Style: (strict standards, flexible, specific patterns)
如果用户未提供以下信息,请向其询问:
  1. 主要语言/框架:(例如:JavaScript/React、Python/Django、Java/Spring Boot等)
  2. 项目类型:(例如:Web应用、API、移动应用、桌面应用、类库等)
  3. 附加技术:(例如:数据库、云服务商、测试框架等)
  4. 团队规模:(独立开发者、小型团队、企业团队)
  5. 开发风格:(严格标准、灵活模式、特定范式)

Configuration Files to Create

需创建的配置文件

Based on the provided stack, create the following files in the appropriate directories:
根据提供的技术栈,在合适的目录中创建以下文件:

1.
.github/copilot-instructions.md

1.
.github/copilot-instructions.md

Main repository instructions that apply to all Copilot interactions.
适用于所有Copilot交互的仓库主说明文档。

2.
.github/instructions/
Directory

2.
.github/instructions/
目录

Create specific instruction files:
  • ${primaryLanguage}.instructions.md
    - Language-specific guidelines
  • testing.instructions.md
    - Testing standards and practices
  • documentation.instructions.md
    - Documentation requirements
  • security.instructions.md
    - Security best practices
  • performance.instructions.md
    - Performance optimization guidelines
  • code-review.instructions.md
    - Code review standards and GitHub review guidelines
创建特定的说明文件:
  • ${primaryLanguage}.instructions.md
    - 语言专属指南
  • testing.instructions.md
    - 测试标准与实践
  • documentation.instructions.md
    - 文档要求
  • security.instructions.md
    - 安全最佳实践
  • performance.instructions.md
    - 性能优化指南
  • code-review.instructions.md
    - 代码评审标准与GitHub评审指南

3.
.github/prompts/
Directory

3.
.github/prompts/
目录

Create reusable prompt files:
  • setup-component.prompt.md
    - Component/module creation
  • write-tests.prompt.md
    - Test generation
  • code-review.prompt.md
    - Code review assistance
  • refactor-code.prompt.md
    - Code refactoring
  • generate-docs.prompt.md
    - Documentation generation
  • debug-issue.prompt.md
    - Debugging assistance
创建可复用的提示词文件:
  • setup-component.prompt.md
    - 组件/模块创建
  • write-tests.prompt.md
    - 测试用例生成
  • code-review.prompt.md
    - 代码评审辅助
  • refactor-code.prompt.md
    - 代码重构
  • generate-docs.prompt.md
    - 文档生成
  • debug-issue.prompt.md
    - 调试辅助

4.
.github/agents/
Directory

4.
.github/agents/
目录

Create specialized chat modes:
  • architect.agent.md
    - Architecture planning mode
  • reviewer.agent.md
    - Code review mode
  • debugger.agent.md
    - Debugging mode
Chat Mode Attribution: When using content from awesome-copilot chatmodes, add attribution comments:
markdown
<!-- Based on/Inspired by: https://github.com/github/awesome-copilot/blob/main/agents/[filename].agent.md -->
创建专属聊天模式:
  • architect.agent.md
    - 架构规划模式
  • reviewer.agent.md
    - 代码评审模式
  • debugger.agent.md
    - 调试模式
聊天模式归属声明:当使用awesome-copilot聊天模式中的内容时,需添加归属注释:
markdown
<!-- Based on/Inspired by: https://github.com/github/awesome-copilot/blob/main/agents/[filename].agent.md -->

5.
.github/workflows/
Directory

5.
.github/workflows/
目录

Create Coding Agent workflow file:
  • copilot-setup-steps.yml
    - GitHub Actions workflow for Coding Agent environment setup
CRITICAL: The workflow MUST follow this exact structure:
  • Job name MUST be
    copilot-setup-steps
  • Include proper triggers (workflow_dispatch, push, pull_request on the workflow file)
  • Set appropriate permissions (minimum required)
  • Customize steps based on the technology stack provided
创建Coding Agent工作流文件:
  • copilot-setup-steps.yml
    - 用于Coding Agent环境配置的GitHub Actions工作流
重要说明:工作流必须遵循以下严格结构:
  • 任务名称必须为
    copilot-setup-steps
  • 包含合适的触发器(workflow_dispatch、针对该工作流文件的push、pull_request)
  • 设置适当的权限(最小必要权限)
  • 根据提供的技术栈自定义步骤

Content Guidelines

内容指南

For each file, follow these principles:
MANDATORY FIRST STEP: Always use the fetch tool to research existing patterns before creating any content:
  1. Fetch from awesome-copilot collections: https://github.com/github/awesome-copilot/blob/main/docs/README.collections.md
  2. Fetch specific instruction files: https://raw.githubusercontent.com/github/awesome-copilot/main/instructions/[relevant-file].instructions.md
  3. Check for existing patterns that match the technology stack
Primary Approach: Reference and adapt existing instructions from awesome-copilot repository:
  • Use existing content when available - don't reinvent the wheel
  • Adapt proven patterns to the specific project context
  • Combine multiple examples if the stack requires it
  • ALWAYS add attribution comments when using awesome-copilot content
Attribution Format: When using content from awesome-copilot, add this comment at the top of the file:
markdown
<!-- Based on/Inspired by: https://github.com/github/awesome-copilot/blob/main/instructions/[filename].instructions.md -->
Examples:
markdown
<!-- Based on: https://github.com/github/awesome-copilot/blob/main/instructions/react.instructions.md -->
---
applyTo: "**/*.jsx,**/*.tsx"
description: "React development best practices"
---
每个文件需遵循以下原则:
强制第一步:在创建任何内容前,务必使用fetch工具研究现有范式:
  1. 从awesome-copilot集合中获取https://github.com/github/awesome-copilot/blob/main/docs/README.collections.md
  2. 获取特定说明文件https://raw.githubusercontent.com/github/awesome-copilot/main/instructions/[relevant-file].instructions.md
  3. 查找与技术栈匹配的现有范式
核心方法:参考并改编awesome-copilot仓库中的现有说明:
  • 优先使用现有内容 - 不要重复造轮子
  • 将经过验证的范式适配到特定项目场景
  • 若技术栈需要,可组合多个示例
  • 使用awesome-copilot内容时必须添加归属注释
归属格式:当使用awesome-copilot的内容时,需在文件顶部添加以下注释:
markdown
<!-- Based on/Inspired by: https://github.com/github/awesome-copilot/blob/main/instructions/[filename].instructions.md -->
示例:
markdown
<!-- Based on: https://github.com/github/awesome-copilot/blob/main/instructions/react.instructions.md -->
---
applyTo: "**/*.jsx,**/*.tsx"
description: "React development best practices"
---

React Development Guidelines

React Development Guidelines

...

```markdown
<!-- Inspired by: https://github.com/github/awesome-copilot/blob/main/instructions/java.instructions.md -->
<!-- and: https://github.com/github/awesome-copilot/blob/main/instructions/spring-boot.instructions.md -->
---
applyTo: "**/*.java"
description: "Java Spring Boot development standards"
---
...

```markdown
<!-- Inspired by: https://github.com/github/awesome-copilot/blob/main/instructions/java.instructions.md -->
<!-- and: https://github.com/github/awesome-copilot/blob/main/instructions/spring-boot.instructions.md -->
---
applyTo: "**/*.java"
description: "Java Spring Boot development standards"
---

Java Spring Boot Guidelines

Java Spring Boot Guidelines

...

**Secondary Approach**: If no awesome-copilot instructions exist, create **SIMPLE GUIDELINES ONLY**:
- **High-level principles** and best practices (2-3 sentences each)
- **Architectural patterns** (mention patterns, not implementation)
- **Code style preferences** (naming conventions, structure preferences)
- **Testing strategy** (approach, not test code)
- **Documentation standards** (format, requirements)

**STRICTLY AVOID in .instructions.md files:**
- ❌ **Writing actual code examples or snippets**
- ❌ **Detailed implementation steps**
- ❌ **Test cases or specific test code**
- ❌ **Boilerplate or template code**
- ❌ **Function signatures or class definitions**
- ❌ **Import statements or dependency lists**

**CORRECT .instructions.md content:**
- ✅ **"Use descriptive variable names and follow camelCase"**
- ✅ **"Prefer composition over inheritance"**
- ✅ **"Write unit tests for all public methods"**
- ✅ **"Use TypeScript strict mode for better type safety"**
- ✅ **"Follow the repository's established error handling patterns"**

**Research Strategy with fetch tool:**
1. **Check awesome-copilot first** - Always start here for ALL file types
2. **Look for exact tech stack matches** (e.g., React, Node.js, Spring Boot)
3. **Look for general matches** (e.g., frontend chatmodes, testing prompts, review modes)
4. **Check awesome-copilot collections** for curated sets of related files
5. **Adapt community examples** to project needs
6. **Only create custom content** if nothing relevant exists

**Fetch these awesome-copilot directories:**
- **Instructions**: https://github.com/github/awesome-copilot/tree/main/instructions
- **Prompts**: https://github.com/github/awesome-copilot/tree/main/prompts  
- **Chat Modes**: https://github.com/github/awesome-copilot/tree/main/chatmodes
- **Collections**: https://github.com/github/awesome-copilot/blob/main/docs/README.collections.md

**Awesome-Copilot Collections to Check:**
- **Frontend Web Development**: React, Angular, Vue, TypeScript, CSS frameworks
- **C# .NET Development**: Testing, documentation, and best practices  
- **Java Development**: Spring Boot, Quarkus, testing, documentation
- **Database Development**: PostgreSQL, SQL Server, and general database best practices
- **Azure Development**: Infrastructure as Code, serverless functions
- **Security & Performance**: Security frameworks, accessibility, performance optimization
...

**备选方法**:若awesome-copilot中无相关说明,仅需创建**简洁指南**:
- **高层级原则**与最佳实践(每条2-3句话)
- **架构范式**(仅提及范式,不涉及实现)
- **代码风格偏好**(命名规范、结构偏好)
- **测试策略**(方法,而非测试代码)
- **文档标准**(格式、要求)

**.instructions.md文件严格禁止内容:**
- ❌ **编写实际代码示例或代码片段**
- ❌ **详细的实现步骤**
- ❌ **测试用例或特定测试代码**
- ❌ **样板代码或模板代码**
- ❌ **函数签名或类定义**
- ❌ **导入语句或依赖列表**

**.instructions.md文件正确内容示例:**
- ✅ **"使用描述性变量名,遵循驼峰命名法"**
- ✅ **"优先使用组合而非继承"**
- ✅ **"为所有公共方法编写单元测试"**
- ✅ **"使用TypeScript严格模式以提升类型安全性"**
- ✅ **"遵循仓库已确立的错误处理范式"**

**使用fetch工具的研究策略:**
1. **首先检查awesome-copilot** - 所有文件类型均需从此处开始
2. **查找完全匹配的技术栈**(例如:React、Node.js、Spring Boot)
3. **查找通用匹配项**(例如:前端聊天模式、测试提示词、评审模式)
4. **检查awesome-copilot集合,查找相关文件的精选集合**
5. **将社区示例适配到项目需求**
6. **仅当无相关内容时才创建自定义内容**

**需获取的awesome-copilot目录:**
- **Instructions**:https://github.com/github/awesome-copilot/tree/main/instructions
- **Prompts**:https://github.com/github/awesome-copilot/tree/main/prompts  
- **Chat Modes**:https://github.com/github/awesome-copilot/tree/main/chatmodes
- **Collections**:https://github.com/github/awesome-copilot/blob/main/docs/README.collections.md

**需检查的Awesome-Copilot集合:**
- **前端Web开发**:React、Angular、Vue、TypeScript、CSS框架
- **C# .NET开发**:测试、文档与最佳实践  
- **Java开发**:Spring Boot、Quarkus、测试、文档
- **数据库开发**:PostgreSQL、SQL Server与通用数据库最佳实践
- **Azure开发**:基础设施即代码、无服务器函数
- **安全与性能**:安全框架、可访问性、性能优化

File Structure Standards

文件结构标准

Ensure all files follow these conventions:
project-root/
├── .github/
│   ├── copilot-instructions.md
│   ├── instructions/
│   │   ├── [language].instructions.md
│   │   ├── testing.instructions.md
│   │   ├── documentation.instructions.md
│   │   ├── security.instructions.md
│   │   ├── performance.instructions.md
│   │   └── code-review.instructions.md
│   ├── prompts/
│   │   ├── setup-component.prompt.md
│   │   ├── write-tests.prompt.md
│   │   ├── code-review.prompt.md
│   │   ├── refactor-code.prompt.md
│   │   ├── generate-docs.prompt.md
│   │   └── debug-issue.prompt.md
│   ├── agents/
│   │   ├── architect.agent.md
│   │   ├── reviewer.agent.md
│   │   └── debugger.agent.md
│   └── workflows/
│       └── copilot-setup-steps.yml
确保所有文件遵循以下约定:
project-root/
├── .github/
│   ├── copilot-instructions.md
│   ├── instructions/
│   │   ├── [language].instructions.md
│   │   ├── testing.instructions.md
│   │   ├── documentation.instructions.md
│   │   ├── security.instructions.md
│   │   ├── performance.instructions.md
│   │   └── code-review.instructions.md
│   ├── prompts/
│   │   ├── setup-component.prompt.md
│   │   ├── write-tests.prompt.md
│   │   ├── code-review.prompt.md
│   │   ├── refactor-code.prompt.md
│   │   ├── generate-docs.prompt.md
│   │   └── debug-issue.prompt.md
│   ├── agents/
│   │   ├── architect.agent.md
│   │   ├── reviewer.agent.md
│   │   └── debugger.agent.md
│   └── workflows/
│       └── copilot-setup-steps.yml

YAML Frontmatter Template

YAML前置模板

Use this frontmatter structure for all files:
Instructions (.instructions.md):
yaml
---
applyTo: "**/*.ts,**/*.tsx"
---
所有文件需使用以下前置结构:
Instructions(.instructions.md):
yaml
---
applyTo: "**/*.ts,**/*.tsx"
---

Project coding standards for TypeScript and React

Project coding standards for TypeScript and React

Apply the general coding guidelines to all code.
Apply the general coding guidelines to all code.

TypeScript Guidelines

TypeScript Guidelines

  • Use TypeScript for all new code
  • Follow functional programming principles where possible
  • Use interfaces for data structures and type definitions
  • Prefer immutable data (const, readonly)
  • Use optional chaining (?.) and nullish coalescing (??) operators
  • Use TypeScript for all new code
  • Follow functional programming principles where possible
  • Use interfaces for data structures and type definitions
  • Prefer immutable data (const, readonly)
  • Use optional chaining (?.) and nullish coalescing (??) operators

React Guidelines

React Guidelines

  • Use functional components with hooks
  • Follow the React hooks rules (no conditional hooks)
  • Use React.FC type for components with children
  • Keep components small and focused
  • Use CSS modules for component styling

**Prompts (.prompt.md):**
```yaml
---
agent: 'agent'
model: Claude Sonnet 4
tools: ['githubRepo', 'codebase']
description: 'Generate a new React form component'
---
Your goal is to generate a new React form component based on the templates in #githubRepo contoso/react-templates.

Ask for the form name and fields if not provided.

Requirements for the form:
* Use form design system components: [design-system/Form.md](../docs/design-system/Form.md)
* Use `react-hook-form` for form state management:
* Always define TypeScript types for your form data
* Prefer *uncontrolled* components using register
* Use `defaultValues` to prevent unnecessary rerenders
* Use `yup` for validation:
* Create reusable validation schemas in separate files
* Use TypeScript types to ensure type safety
* Customize UX-friendly validation rules
Chat Modes (.agent.md):
yaml
---
description: Generate an implementation plan for new features or refactoring existing code.
tools: ['codebase', 'web/fetch', 'findTestFiles', 'githubRepo', 'search', 'usages']
model: Claude Sonnet 4
---
  • Use functional components with hooks
  • Follow the React hooks rules (no conditional hooks)
  • Use React.FC type for components with children
  • Keep components small and focused
  • Use CSS modules for component styling

**Prompts(.prompt.md):**
```yaml
---
agent: 'agent'
model: Claude Sonnet 4
tools: ['githubRepo', 'codebase']
description: 'Generate a new React form component'
---
Your goal is to generate a new React form component based on the templates in #githubRepo contoso/react-templates.

Ask for the form name and fields if not provided.

Requirements for the form:
* Use form design system components: [design-system/Form.md](../docs/design-system/Form.md)
* Use `react-hook-form` for form state management:
* Always define TypeScript types for your form data
* Prefer *uncontrolled* components using register
* Use `defaultValues` to prevent unnecessary rerenders
* Use `yup` for validation:
* Create reusable validation schemas in separate files
* Use TypeScript types to ensure type safety
* Customize UX-friendly validation rules
Chat Modes(.agent.md):
yaml
---
description: Generate an implementation plan for new features or refactoring existing code.
tools: ['codebase', 'web/fetch', 'findTestFiles', 'githubRepo', 'search', 'usages']
model: Claude Sonnet 4
---

Planning mode instructions

Planning mode instructions

You are in planning mode. Your task is to generate an implementation plan for a new feature or for refactoring existing code. Don't make any code edits, just generate a plan.
The plan consists of a Markdown document that describes the implementation plan, including the following sections:
  • Overview: A brief description of the feature or refactoring task.
  • Requirements: A list of requirements for the feature or refactoring task.
  • Implementation Steps: A detailed list of steps to implement the feature or refactoring task.
  • Testing: A list of tests that need to be implemented to verify the feature or refactoring task.
undefined
You are in planning mode. Your task is to generate an implementation plan for a new feature or for refactoring existing code. Don't make any code edits, just generate a plan.
The plan consists of a Markdown document that describes the implementation plan, including the following sections:
  • Overview: A brief description of the feature or refactoring task.
  • Requirements: A list of requirements for the feature or refactoring task.
  • Implementation Steps: A detailed list of steps to implement the feature or refactoring task.
  • Testing: A list of tests that need to be implemented to verify the feature or refactoring task.
undefined

Execution Steps

执行步骤

  1. Analyze the provided technology stack
  2. Create the directory structure
  3. Generate main copilot-instructions.md with project-wide standards
  4. Create language-specific instruction files using awesome-copilot references
  5. Generate reusable prompts for common development tasks
  6. Set up specialized chat modes for different development scenarios
  7. Create the GitHub Actions workflow for Coding Agent (
    copilot-setup-steps.yml
    )
  8. Validate all files follow proper formatting and include necessary frontmatter
  1. 分析提供的技术栈
  2. 创建目录结构
  3. 生成包含项目全局标准的主文件copilot-instructions.md
  4. 使用awesome-copilot参考内容创建语言专属说明文件
  5. 为常见开发任务生成可复用的提示词
  6. 为不同开发场景设置专属聊天模式
  7. 创建用于Coding Agent的GitHub Actions工作流(
    copilot-setup-steps.yml
  8. 验证所有文件格式正确且包含必要的YAML前置内容

Post-Setup Instructions

配置后说明

After creating all files, provide the user with:
  1. VS Code setup instructions - How to enable and configure the files
  2. Usage examples - How to use each prompt and chat mode
  3. Customization tips - How to modify files for their specific needs
  4. Testing recommendations - How to verify the setup works correctly
创建完所有文件后,需向用户提供:
  1. VS Code配置说明 - 如何启用和配置这些文件
  2. 使用示例 - 如何使用每个提示词和聊天模式
  3. 自定义技巧 - 如何根据特定需求修改文件
  4. 测试建议 - 如何验证配置是否正常工作

Quality Checklist

质量检查清单

Before completing, verify:
  • All files have proper YAML frontmatter
  • Language-specific best practices are included
  • Files reference each other appropriately using Markdown links
  • Prompts include relevant tools and variables
  • Instructions are comprehensive but not overwhelming
  • Security and performance considerations are addressed
  • Testing guidelines are included
  • Documentation standards are clear
  • Code review standards are defined
完成前,需验证:
  • 所有文件均包含正确的YAML前置内容
  • 包含语言专属的最佳实践
  • 文件间使用Markdown链接正确引用
  • 提示词包含相关工具和变量
  • 说明内容全面但不过于复杂
  • 考虑到了安全与性能因素
  • 包含测试指南
  • 文档标准清晰明确
  • 代码评审标准已定义

Workflow Template Structure

工作流模板结构

The
copilot-setup-steps.yml
workflow MUST follow this exact format and KEEP IT SIMPLE:
yaml
name: "Copilot Setup Steps"
on:
  workflow_dispatch:
  push:
    paths:
      - .github/workflows/copilot-setup-steps.yml
  pull_request:
    paths:
      - .github/workflows/copilot-setup-steps.yml
jobs:
  # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
  copilot-setup-steps:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: Checkout code
        uses: actions/checkout@v5
      # Add ONLY basic technology-specific setup steps here
KEEP WORKFLOWS SIMPLE - Only include essential steps:
Node.js/JavaScript:
yaml
- name: Set up Node.js
  uses: actions/setup-node@v4
  with:
    node-version: "20"
    cache: "npm"
- name: Install dependencies
  run: npm ci
- name: Run linter
  run: npm run lint
- name: Run tests
  run: npm test
Python:
yaml
- name: Set up Python
  uses: actions/setup-python@v4
  with:
    python-version: "3.11"
- name: Install dependencies
  run: pip install -r requirements.txt
- name: Run linter
  run: flake8 .
- name: Run tests
  run: pytest
Java:
yaml
- name: Set up JDK
  uses: actions/setup-java@v4
  with:
    java-version: "17"
    distribution: "temurin"
- name: Build with Maven
  run: mvn compile
- name: Run tests
  run: mvn test
AVOID in workflows:
  • ❌ Complex configuration setups
  • ❌ Multiple environment configurations
  • ❌ Advanced tooling setup
  • ❌ Custom scripts or complex logic
  • ❌ Multiple package managers
  • ❌ Database setup or external services
INCLUDE only:
  • ✅ Language/runtime setup
  • ✅ Basic dependency installation
  • ✅ Simple linting (if standard)
  • ✅ Basic test running
  • ✅ Standard build commands
copilot-setup-steps.yml
工作流必须严格遵循以下格式,且保持简洁:
yaml
name: "Copilot Setup Steps"
on:
  workflow_dispatch:
  push:
    paths:
      - .github/workflows/copilot-setup-steps.yml
  pull_request:
    paths:
      - .github/workflows/copilot-setup-steps.yml
jobs:
  # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
  copilot-setup-steps:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: Checkout code
        uses: actions/checkout@v5
      # Add ONLY basic technology-specific setup steps here
保持工作流简洁 - 仅包含必要步骤:
Node.js/JavaScript:
yaml
- name: Set up Node.js
  uses: actions/setup-node@v4
  with:
    node-version: "20"
    cache: "npm"
- name: Install dependencies
  run: npm ci
- name: Run linter
  run: npm run lint
- name: Run tests
  run: npm test
Python:
yaml
- name: Set up Python
  uses: actions/setup-python@v4
  with:
    python-version: "3.11"
- name: Install dependencies
  run: pip install -r requirements.txt
- name: Run linter
  run: flake8 .
- name: Run tests
  run: pytest
Java:
yaml
- name: Set up JDK
  uses: actions/setup-java@v4
  with:
    java-version: "17"
    distribution: "temurin"
- name: Build with Maven
  run: mvn compile
- name: Run tests
  run: mvn test
工作流中禁止内容:
  • ❌ 复杂的配置设置
  • ❌ 多环境配置
  • ❌ 高级工具设置
  • ❌ 自定义脚本或复杂逻辑
  • ❌ 多包管理器
  • ❌ 数据库设置或外部服务
仅可包含:
  • ✅ 语言/运行时环境设置
  • ✅ 基础依赖安装
  • ✅ 简单代码检查(若为标准流程)
  • ✅ 基础测试运行
  • ✅ 标准构建命令