Create GitHub Copilot setup instructions
Added comprehensive GitHub Copilot setup instructions for new projects, including configuration files, content guidelines, execution steps, and a quality checklist.
This commit is contained in:
parent
0f1a48e482
commit
afcc1a53b4
327
instructions/github-copilot-starter.md
Normal file
327
instructions/github-copilot-starter.md
Normal file
@ -0,0 +1,327 @@
|
||||
---
|
||||
mode: 'agent'
|
||||
model: Claude Sonnet 4
|
||||
tools: ['edit', 'githubRepo', 'changes', 'problems', 'search', 'runCommands', 'fetch']
|
||||
description: 'Set up complete GitHub Copilot configuration for a new project based on technology stack'
|
||||
---
|
||||
|
||||
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.
|
||||
|
||||
## 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)
|
||||
|
||||
## Configuration Files to Create
|
||||
|
||||
Based on the provided stack, create the following files in the appropriate directories:
|
||||
|
||||
### 1. `.github/copilot-instructions.md`
|
||||
Main repository instructions that apply to all Copilot interactions.
|
||||
|
||||
### 2. `.github/instructions/` Directory
|
||||
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
|
||||
|
||||
### 3. `.github/prompts/` Directory
|
||||
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
|
||||
|
||||
### 4. `.github/chatmodes/` Directory
|
||||
Create specialized chat modes:
|
||||
- `architect.chatmode.md` - Architecture planning mode
|
||||
- `reviewer.chatmode.md` - Code review mode
|
||||
- `debugger.chatmode.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/chatmodes/[filename].chatmode.md -->
|
||||
```
|
||||
|
||||
### 5. `.github/workflows/` Directory
|
||||
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
|
||||
|
||||
## 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/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"
|
||||
---
|
||||
# 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"
|
||||
---
|
||||
# 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/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
|
||||
|
||||
## 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
|
||||
│ ├── 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
|
||||
│ ├── chatmodes/
|
||||
│ │ ├── architect.chatmode.md
|
||||
│ │ ├── reviewer.chatmode.md
|
||||
│ │ └── debugger.chatmode.md
|
||||
│ └── workflows/
|
||||
│ └── copilot-setup-steps.yml
|
||||
```
|
||||
|
||||
## YAML Frontmatter Template
|
||||
|
||||
Use this frontmatter structure for all files:
|
||||
|
||||
**Instructions (.instructions.md):**
|
||||
```yaml
|
||||
---
|
||||
applyTo: ["**/*.{ext}"]
|
||||
description: "Description of what this instruction covers"
|
||||
tags: ["language", "framework", "best-practices"]
|
||||
---
|
||||
```
|
||||
|
||||
**Prompts (.prompt.md):**
|
||||
```yaml
|
||||
---
|
||||
mode: 'agent'
|
||||
model: Claude Sonnet 4
|
||||
tools: ['edit', 'githubRepo', 'changes', 'problems', 'search', 'fetch']
|
||||
description: 'Brief description of the prompt purpose'
|
||||
---
|
||||
```
|
||||
|
||||
**Chat Modes (.chatmode.md):**
|
||||
```yaml
|
||||
---
|
||||
mode: 'ask'
|
||||
description: 'Description of the specialized mode'
|
||||
instructions: 'Link to relevant instruction files'
|
||||
---
|
||||
```
|
||||
|
||||
## 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**
|
||||
|
||||
## 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
|
||||
|
||||
## 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
|
||||
|
||||
## 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 # Adjust based on tech stack needs
|
||||
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
|
||||
Loading…
x
Reference in New Issue
Block a user