diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ee9e4f..eed9c78 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,12 +9,16 @@ Thank you for your interest in contributing to the Awesome GitHub Copilot reposi Instructions help customize GitHub Copilot's behavior for specific technologies, coding practices, or domains. 1. **Create your instruction file**: Add a new `.md` file in the `instructions/` directory -2. **Follow the naming convention**: Use descriptive, lowercase filenames with hyphens (e.g., `python-django.md`) +2. **Follow the naming convention**: Use descriptive, lowercase filenames with hyphens (e.g., `python-django.instructions.md`) 3. **Structure your content**: Start with a clear heading and organize your instructions logically 4. **Test your instructions**: Make sure your instructions work well with GitHub Copilot #### Example instruction format: ```markdown +--- +description: 'Instructions for customizing GitHub Copilot behavior for specific technologies and practices' +--- + # Your Technology/Framework Name ## Instructions @@ -40,9 +44,9 @@ Prompts are ready-to-use templates for specific development scenarios and tasks. #### Example prompt format: ```markdown --- -mode: "agent" -tools: ["codebase", "terminalCommand"] -description: "Brief description of what this prompt does" +mode: 'agent' +tools: ['codebase', 'terminalCommand'] +description: 'Brief description of what this prompt does' --- # Prompt Title @@ -55,6 +59,47 @@ Your goal is to... - Include examples where helpful ``` +### Adding Chat Modes + +Chat modes are specialized configurations that transform GitHub Copilot Chat into domain-specific assistants or personas for particular development scenarios. + +1. **Create your chat mode file**: Add a new `.chatmode.md` file in the `chatmodes/` directory +2. **Follow the naming convention**: Use descriptive, lowercase filenames with hyphens and the `.chatmode.md` extension (e.g., `react-performance-expert.chatmode.md`) +3. **Include frontmatter**: Add metadata at the top of your file with required fields +4. **Define the persona**: Create a clear identity and expertise area for the chat mode +5. **Test your chat mode**: Ensure the chat mode provides helpful, accurate responses in its domain + +#### Example chat mode format: +```markdown +--- +description: 'Brief description of the chat mode and its purpose' +model: 'gpt-5' +tools: ['codebase', 'terminalCommand'] +--- + +# Chat Mode Title + +You are an expert [domain/role] with deep knowledge in [specific areas]. + +## Your Expertise + +- [Specific skill 1] +- [Specific skill 2] +- [Specific skill 3] + +## Your Approach + +- [How you help users] +- [Your communication style] +- [What you prioritize] + +## Guidelines + +- [Specific instructions for responses] +- [Constraints or limitations] +- [Best practices to follow] +``` + ## Submitting Your Contribution 1. **Fork this repository** @@ -68,6 +113,29 @@ Your goal is to... - A brief description of what your instruction/prompt does - Any relevant context or usage notes +## What We Accept + +We welcome contributions covering any technology, framework, or development practice that helps developers work more effectively with GitHub Copilot. This includes: + +- Programming languages and frameworks +- Development methodologies and best practices +- Architecture patterns and design principles +- Testing strategies and quality assurance +- DevOps and deployment practices +- Accessibility and inclusive design +- Performance optimization techniques + +## What We Don't Accept + +To maintain a safe, responsible, and constructive community, we will **not accept** contributions that: + +- **Violate Responsible AI Principles**: Content that attempts to circumvent Microsoft/GitHub's Responsible AI guidelines or promotes harmful AI usage +- **Compromise Security**: Instructions designed to bypass security policies, exploit vulnerabilities, or weaken system security +- **Enable Malicious Activities**: Content intended to harm other systems, users, or organizations +- **Exploit Weaknesses**: Instructions that take advantage of vulnerabilities in other platforms or services +- **Promote Harmful Content**: Guidance that could lead to the creation of harmful, discriminatory, or inappropriate content +- **Circumvent Platform Policies**: Attempts to work around GitHub, Microsoft, or other platform terms of service + ## Quality Guidelines - **Be specific**: Generic instructions are less helpful than specific, actionable guidance @@ -75,6 +143,7 @@ Your goal is to... - **Follow conventions**: Use consistent formatting and naming - **Keep it focused**: Each file should address a specific technology, framework, or use case - **Write clearly**: Use simple, direct language +- **Promote best practices**: Encourage secure, maintainable, and ethical development practices ## Code of Conduct diff --git a/README.md b/README.md index 9595aef..6105a87 100644 --- a/README.md +++ b/README.md @@ -267,4 +267,4 @@ This project may contain trademarks or logos for projects, products, or services trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. -Any use of third-party trademarks or logos are subject to those third-party's policies. +Any use of third-party trademarks or logos are subject to those third-party's policies. \ No newline at end of file diff --git a/instructions/containerization-docker-best-practices.instructions.md b/instructions/containerization-docker-best-practices.instructions.md index 0d5f890..bb534d3 100644 --- a/instructions/containerization-docker-best-practices.instructions.md +++ b/instructions/containerization-docker-best-practices.instructions.md @@ -1,5 +1,5 @@ --- -applyTo: '*' +applyTo: '**/Dockerfile,**/Dockerfile.*,**/*.dockerfile,**/docker-compose*.yml,**/docker-compose*.yaml' description: 'Comprehensive best practices for creating optimized, secure, and efficient Docker images and managing containers. Covers multi-stage builds, image layer optimization, security scanning, and runtime best practices.' --- diff --git a/prompts/java-junit.prompt.md b/prompts/java-junit.prompt.md index 5fd1a4b..e16129b 100644 --- a/prompts/java-junit.prompt.md +++ b/prompts/java-junit.prompt.md @@ -17,7 +17,7 @@ Your goal is to help me write effective unit tests with JUnit 5, covering both s ## Test Structure -- Test classes should have a `Test` suffix, e.g., `CalculatorTests` for a `Calculator` class. +- Test classes should have a `Test` suffix, e.g., `CalculatorTest` for a `Calculator` class. - Use `@Test` for test methods. - Follow the Arrange-Act-Assert (AAA) pattern. - Name tests using a descriptive convention, like `methodName_should_expectedBehavior_when_scenario`. diff --git a/update-readme.js b/update-readme.js index cd416d7..e9c33e5 100755 --- a/update-readme.js +++ b/update-readme.js @@ -7,22 +7,27 @@ const path = require("path"); const TEMPLATES = { header: `# 🤖 Awesome GitHub Copilot Customizations -Enhance your GitHub Copilot experience with community-contributed instructions, prompts, and configurations. Get consistent AI assistance that follows your team's coding standards and project requirements. +Enhance your GitHub Copilot experience with community-contributed [instructions](#-custom-instructions), [prompts](#-reusable-prompts), and [chat modes](#-custom-chat-modes). Get consistent AI assistance that follows your team's coding standards and project requirements. -## 🎯 GitHub Copilot Customization Features +
+🎯 GitHub Copilot Customization Features GitHub Copilot provides three main ways to customize AI responses and tailor assistance to your specific workflows, team guidelines, and project requirements: -| **📋 [Custom Instructions](#-custom-instructions)** | **🎯 [Reusable Prompts](#-reusable-prompts)** | **🧩 [Custom Chat Modes](#-custom-chat-modes)** | +| **🧩 [Custom Chat Modes](#-custom-chat-modes)** | **🎯 [Reusable Prompts](#-reusable-prompts)** | **📋 [Custom Instructions](#-custom-instructions)** | | --- | --- | --- | -| Define common guidelines for tasks like code generation, reviews, and commit messages. Describe *how* tasks should be performed

**Benefits:**
• Automatic inclusion in every chat request
• Repository-wide consistency
• Multiple implementation options | Create reusable, standalone prompts for specific tasks. Describe *what* should be done with optional task-specific guidelines

**Benefits:**
• Eliminate repetitive prompt writing
• Shareable across teams
• Support for variables and dependencies | Define chat behavior, available tools, and codebase interaction patterns within specific boundaries for each request

**Benefits:**
• Context-aware assistance
• Tool configuration
• Role-specific workflows | +| Define chat behavior, available tools, and codebase interaction patterns within specific boundaries for each request

**Benefits:**
• Context-aware assistance
• Tool configuration
• Role-specific workflows | Create reusable, standalone prompts for specific tasks. Describe *what* should be done with optional task-specific guidelines

**Benefits:**
• Eliminate repetitive prompt writing
• Shareable across teams
• Support for variables and dependencies | Define common guidelines for tasks like code generation, reviews, and commit messages. Describe *how* tasks should be performed

**Benefits:**
• Automatic inclusion in every chat request
• Repository-wide consistency
• Multiple implementation options | > **💡 Pro Tip:** Custom instructions only affect Copilot Chat (not inline code completions). You can combine all three customization types - use custom instructions for general guidelines, prompt files for specific tasks, and chat modes to control the interaction context. +
-## 📝 Contributing +
+📝 Contributing -We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details on how to submit new instructions and prompts.`, +We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details on how to submit new instructions and prompts. + +
`, instructionsSection: `## 📋 Custom Instructions @@ -273,7 +278,7 @@ const vscodeInsidersBaseUrl = "https://insiders.vscode.dev/redirect?url="; function makeBadges(link, type) { return `[![Install in VS Code](${vscodeInstallImage})](${vscodeBaseUrl}${encodeURIComponent( `vscode:chat-${type}/install?url=${repoBaseUrl}/${link})` - )} [![Install in VS Code](${vscodeInsidersInstallImage})](${vscodeInsidersBaseUrl}${encodeURIComponent( + )}
[![Install in VS Code](${vscodeInsidersInstallImage})](${vscodeInsidersBaseUrl}${encodeURIComponent( `vscode-insiders:chat-${type}/install?url=${repoBaseUrl}/${link})` )}`; } @@ -282,6 +287,11 @@ function makeBadges(link, type) { * Generate the instructions section with a table of all instructions */ function generateInstructionsSection(instructionsDir) { + // Check if directory exists + if (!fs.existsSync(instructionsDir)) { + return ""; + } + // Get all instruction files const instructionFiles = fs .readdirSync(instructionsDir) @@ -290,9 +300,14 @@ function generateInstructionsSection(instructionsDir) { console.log(`Found ${instructionFiles.length} instruction files`); + // Return empty string if no files found + if (instructionFiles.length === 0) { + return ""; + } + // Create table header let instructionsContent = - "| Title | Description | Install |\n| ----- | ----------- | ------- |\n"; + "| Title | Description |\n| ----- | ----------- |\n"; // Generate table rows for each instruction file for (const file of instructionFiles) { @@ -308,21 +323,26 @@ function generateInstructionsSection(instructionsDir) { if (customDescription && customDescription !== "null") { // Use the description from frontmatter - instructionsContent += `| [${title}](${link}) | ${customDescription} | ${badges} |\n`; + instructionsContent += `| [${title}](${link})
${badges} | ${customDescription} |\n`; } else { // Fallback to the default approach - use last word of title for description, removing trailing 's' if present const topic = title.split(" ").pop().replace(/s$/, ""); - instructionsContent += `| [${title}](${link}) | ${topic} specific coding standards and best practices | ${badges} |\n`; + instructionsContent += `| [${title}](${link})
${badges} | ${topic} specific coding standards and best practices |\n`; } } - return `${TEMPLATES.instructionsSection}\n\n${instructionsContent}\n${TEMPLATES.instructionsUsage}`; + return `${TEMPLATES.instructionsSection}\n${TEMPLATES.instructionsUsage}\n\n${instructionsContent}`; } /** * Generate the prompts section with a table of all prompts */ function generatePromptsSection(promptsDir) { + // Check if directory exists + if (!fs.existsSync(promptsDir)) { + return ""; + } + // Get all prompt files const promptFiles = fs .readdirSync(promptsDir) @@ -331,9 +351,14 @@ function generatePromptsSection(promptsDir) { console.log(`Found ${promptFiles.length} prompt files`); + // Return empty string if no files found + if (promptFiles.length === 0) { + return ""; + } + // Create table header let promptsContent = - "| Title | Description | Install |\n| ----- | ----------- | ------- |\n"; + "| Title | Description |\n| ----- | ----------- |\n"; // Generate table rows for each prompt file for (const file of promptFiles) { @@ -348,13 +373,13 @@ function generatePromptsSection(promptsDir) { const badges = makeBadges(link, "prompt"); if (customDescription && customDescription !== "null") { - promptsContent += `| [${title}](${link}) | ${customDescription} | ${badges} |\n`; + promptsContent += `| [${title}](${link})
${badges} | ${customDescription} |\n`; } else { - promptsContent += `| [${title}](${link}) | | ${badges} |\n`; + promptsContent += `| [${title}](${link})
${badges} | | |\n`; } } - return `${TEMPLATES.promptsSection}\n\n${promptsContent}\n${TEMPLATES.promptsUsage}`; + return `${TEMPLATES.promptsSection}\n${TEMPLATES.promptsUsage}\n\n${promptsContent}`; } /** @@ -382,7 +407,7 @@ function generateChatModesSection(chatmodesDir) { // Create table header let chatmodesContent = - "| Title | Description | Install |\n| ----- | ----------- | ------- |\n"; + "| Title | Description |\n| ----- | ----------- |\n"; // Generate table rows for each chat mode file for (const file of chatmodeFiles) { @@ -397,13 +422,13 @@ function generateChatModesSection(chatmodesDir) { const badges = makeBadges(link, "mode"); if (customDescription && customDescription !== "null") { - chatmodesContent += `| [${title}](${link}) | ${customDescription} | ${badges} |\n`; + chatmodesContent += `| [${title}](${link})
${badges} | ${customDescription} |\n`; } else { - chatmodesContent += `| [${title}](${link}) | | ${badges} |\n`; + chatmodesContent += `| [${title}](${link})
${badges} | | |\n`; } } - return `${TEMPLATES.chatmodesSection}\n\n${chatmodesContent}\n${TEMPLATES.chatmodesUsage}`; + return `${TEMPLATES.chatmodesSection}\n${TEMPLATES.chatmodesUsage}\n\n${chatmodesContent}`; } /** @@ -420,17 +445,16 @@ function generateReadme() { const chatmodesSection = generateChatModesSection(chatmodesDir); // Build the complete README content with template sections - let readmeContent = [TEMPLATES.header, instructionsSection, promptsSection]; + const sections = [TEMPLATES.header]; - // Only include chat modes section if we have any chat modes - if (chatmodesSection) { - readmeContent.push(chatmodesSection); - } + // Only include sections that have content + if (instructionsSection.trim()) sections.push(instructionsSection); + if (promptsSection.trim()) sections.push(promptsSection); + if (chatmodesSection.trim()) sections.push(chatmodesSection); - // Add footer - readmeContent.push(TEMPLATES.footer); + sections.push(TEMPLATES.footer); - return readmeContent.join("\n\n"); + return sections.join("\n\n"); } // Main execution