From 5298635c77e6ccd6dbad5d1113c5031d58a40a62 Mon Sep 17 00:00:00 2001 From: hizahizi-hizumi <163728895+hizahizi-hizumi@users.noreply.github.com> Date: Mon, 13 Oct 2025 10:06:01 +0900 Subject: [PATCH] feat(instructions): add .prompt.md instructions (#310) * feat(instructions): add `.prompt.md` instructions * chore: update README * typo: fulfil -> fulfill Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * typo: favour -> favor Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.instructions.md | 1 + instructions/prompt.instructions.md | 73 +++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 instructions/prompt.instructions.md diff --git a/README.instructions.md b/README.instructions.md index 7a9bb06..a61c055 100644 --- a/README.instructions.md +++ b/README.instructions.md @@ -41,6 +41,7 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for | [Conventional Commit](instructions/conventional-commit.prompt.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fconventional-commit.prompt.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fconventional-commit.prompt.md) | Prompt and workflow for generating conventional commit messages using a structured XML format. Guides users to create standardized, descriptive commit messages in line with the Conventional Commits specification, including instructions, examples, and validation. | | [Convert Spring JPA project to Spring Data Cosmos](instructions/convert-jpa-to-spring-data-cosmos.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fconvert-jpa-to-spring-data-cosmos.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fconvert-jpa-to-spring-data-cosmos.instructions.md) | Step-by-step guide for converting Spring Boot JPA applications to use Azure Cosmos DB with Spring Data Cosmos | | [Copilot Process tracking Instructions](instructions/copilot-thought-logging.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcopilot-thought-logging.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcopilot-thought-logging.instructions.md) | See process Copilot is following where you can edit this to reshape the interaction or save when follow up may be needed | +| [Copilot Prompt Files Guidelines](instructions/prompt.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fprompt.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fprompt.instructions.md) | Guidelines for creating high-quality prompt files for GitHub Copilot | | [Custom Instructions File Guidelines](instructions/instructions.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Finstructions.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Finstructions.instructions.md) | Guidelines for creating high-quality custom instruction files for GitHub Copilot | | [Dart and Flutter](instructions/dart-n-flutter.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdart-n-flutter.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdart-n-flutter.instructions.md) | Instructions for writing Dart and Flutter code following the official recommendations. | | [DDD Systems & .NET Guidelines](instructions/dotnet-architecture-good-practices.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdotnet-architecture-good-practices.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdotnet-architecture-good-practices.instructions.md) | DDD and .NET architecture guidelines | diff --git a/instructions/prompt.instructions.md b/instructions/prompt.instructions.md new file mode 100644 index 0000000..7ca0432 --- /dev/null +++ b/instructions/prompt.instructions.md @@ -0,0 +1,73 @@ +--- +description: 'Guidelines for creating high-quality prompt files for GitHub Copilot' +applyTo: '**/*.prompt.md' +--- + +# Copilot Prompt Files Guidelines + +Instructions for creating effective and maintainable prompt files that guide GitHub Copilot in delivering consistent, high-quality outcomes across any repository. + +## Scope and Principles +- Target audience: maintainers and contributors authoring reusable prompts for Copilot Chat. +- Goals: predictable behaviour, clear expectations, minimal permissions, and portability across repositories. +- Primary references: VS Code documentation on prompt files and organization-specific conventions. + +## Frontmatter Requirements +- Include `description` (single sentence, actionable outcome), `mode` (explicitly choose `ask`, `edit`, or `agent`), and `tools` (minimal set of tool bundles required to fulfill the prompt). +- Declare `model` when the prompt depends on a specific capability tier; otherwise inherit the active model. +- Preserve any additional metadata (`language`, `tags`, `visibility`, etc.) required by your organization. +- Use consistent quoting (single quotes recommended) and keep one field per line for readability and version control clarity. + +## File Naming and Placement +- Use kebab-case filenames ending with `.prompt.md` and store them under `.github/prompts/` unless your workspace standard specifies another directory. +- Provide a short filename that communicates the action (for example, `generate-readme.prompt.md` rather than `prompt1.prompt.md`). + +## Body Structure +- Start with an `#` level heading that matches the prompt intent so it surfaces well in Quick Pick search. +- Organize content with predictable sections. Recommended baseline: `Mission` or `Primary Directive`, `Scope & Preconditions`, `Inputs`, `Workflow` (step-by-step), `Output Expectations`, and `Quality Assurance`. +- Adjust section names to fit the domain, but retain the logical flow: why → context → inputs → actions → outputs → validation. +- Reference related prompts or instruction files using relative links to aid discoverability. + +## Input and Context Handling +- Use `${input:variableName[:placeholder]}` for required values and explain when the user must supply them. Provide defaults or alternatives where possible. +- Call out contextual variables such as `${selection}`, `${file}`, `${workspaceFolder}` only when they are essential, and describe how Copilot should interpret them. +- Document how to proceed when mandatory context is missing (for example, “Request the file path and stop if it remains undefined”). + +## Tool and Permission Guidance +- Limit `tools` to the smallest set that enables the task. List them in the preferred execution order when the sequence matters. +- If the prompt inherits tools from a chat mode, mention that relationship and state any critical tool behaviours or side effects. +- Warn about destructive operations (file creation, edits, terminal commands) and include guard rails or confirmation steps in the workflow. + +## Instruction Tone and Style +- Write in direct, imperative sentences targeted at Copilot (for example, “Analyze”, “Generate”, “Summarize”). +- Keep sentences short and unambiguous, following Google Developer Documentation translation best practices to support localization. +- Avoid idioms, humor, or culturally specific references; favor neutral, inclusive language. + +## Output Definition +- Specify the format, structure, and location of expected results (for example, “Create `docs/adr/adr-XXXX.md` using the template below”). +- Include success criteria and failure triggers so Copilot knows when to halt or retry. +- Provide validation steps—manual checks, automated commands, or acceptance criteria lists—that reviewers can execute after running the prompt. + +## Examples and Reusable Assets +- Embed Good/Bad examples or scaffolds (Markdown templates, JSON stubs) that the prompt should produce or follow. +- Maintain reference tables (capabilities, status codes, role descriptions) inline to keep the prompt self-contained. Update these tables when upstream resources change. +- Link to authoritative documentation instead of duplicating lengthy guidance. + +## Quality Assurance Checklist +- [ ] Frontmatter fields are complete, accurate, and least-privilege. +- [ ] Inputs include placeholders, default behaviours, and fallbacks. +- [ ] Workflow covers preparation, execution, and post-processing without gaps. +- [ ] Output expectations include formatting and storage details. +- [ ] Validation steps are actionable (commands, diff checks, review prompts). +- [ ] Security, compliance, and privacy policies referenced by the prompt are current. +- [ ] Prompt executes successfully in VS Code (`Chat: Run Prompt`) using representative scenarios. + +## Maintenance Guidance +- Version-control prompts alongside the code they affect; update them when dependencies, tooling, or review processes change. +- Review prompts periodically to ensure tool lists, model requirements, and linked documents remain valid. +- Coordinate with other repositories: when a prompt proves broadly useful, extract common guidance into instruction files or shared prompt packs. + +## Additional Resources +- [Prompt Files Documentation](https://code.visualstudio.com/docs/copilot/customization/prompt-files#_prompt-file-format) +- [Awesome Copilot Prompt Files](https://github.com/github/awesome-copilot/tree/main/prompts) +- [Tool Configuration](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode#_agent-mode-tools)