AI-Assisted Content Creation
Estimated time to read: 5 minutes
Creating and Using Workspace Prompt Files in VS Code¶
What You'll Learn¶
In this lab, you will:
- Understand the format and structure of workspace prompt files in VS Code
- Create and configure prompt files in the
.github/promptsfolder - Reference variables and other files in prompt instructions
- Use prompt files to guide AI chat and completions for your documentation project
Prerequisites¶
- VS Code with GitHub Copilot extension installed
- Your existing workshop documentation project
Introduction¶
Workspace prompt files in VS Code let you customize how Copilot and chat-based AI tools respond to your documentation needs. By creating prompt files in your project’s .github/prompts folder, you can guide Copilot to follow your preferred style, structure, and requirements—making AI assistance more relevant and effective for your workshop materials.
Lab Exercise¶
You'll learn to create, format, and use workspace prompt files to improve Copilot’s output for your documentation workflow.
Step 1: Create a Workspace Prompt File¶
- In your project root, create a new folder
.github/promptsif it doesn’t exist. - Add a new prompt file with the
.prompt.mdextension, e.g..github/prompts/workshop-style.prompt.md. - Start your prompt file with optional YAML frontmatter:
-
See VS Code documentation on prompt files for details.
Markdown 1 2 3 4 5 6 7 8 9 10 11 12 13
--- description: Short description of the prompt mode: Chat mode used for running the prompt: ask, edit, or agent (default). model: Language model used when running the prompt. If not specified, the currently selected model in model picker is used. tools: - Array of tool (set) names that can be used. - Select Configure Tools to select the tools from the list of available tools in your workspace. - If a given tool (set) is not available when running the prompt, it is ignored. --- # Workshop Documentation Prompt Use clear section headers for each lab. Write in an engaging, concise style for technical learners. Include prerequisites, learning objectives, and troubleshooting sections. Format code blocks using markdown. Follow the structure used in Lab 1. -
Reference other workspace files or prompt files using Markdown links, e.g.
[Lab 1](../Lab-1-understanding-audience.md). - Use variables in your prompt file, such as
${workspaceFolder},${selection}, or${input:labTitle:Enter lab title}.
Step 2: Create and Manage Prompt Files in VS Code¶
- Enable the
chat.promptFilessetting in VS Code. - In the Chat view, select Configure Chat > Prompt Files, then New prompt file.
- Or use the Command Palette (
⇧⌘P) and runChat: New Prompt File. - Choose the
.github/promptsfolder for workspace prompt files. - Enter a name and author your prompt using Markdown formatting.
Step 3: Use Prompt Files in Chat¶
- In the Chat view, type
/followed by the prompt file name to run it (e.g.,/workshop-style). - Pass additional information in the chat input field, e.g.,
/workshop-style: labTitle=Lab 2. - Or use the Command Palette (
⇧⌘P) and runChat: Run Prompt. - Open the prompt file and press the play button in the editor title area to run it in chat.
Best Practices for Workspace Prompt Files¶
- Use Markdown: Author prompt files in Markdown with
.prompt.mdextension. - Add YAML frontmatter: Include description, mode, model, and tools for clarity.
- Reference files and variables: Use Markdown links and variables for dynamic prompts.
- Store in version control: Keep prompt files in
.github/promptsfor team consistency. - Iterate and test: Refine prompts based on output and team feedback.
Exercise Results¶
After completing this lab, you should have:
- ✅ A workspace prompt file in
.github/promptsguiding Copilot for your documentation project - ✅ Improved consistency and relevance in Copilot’s suggestions
- ✅ A process for refining and sharing prompt files with your team
Lab 50 Complete!
You’ve learned to create and use workspace prompt files to customize Copilot’s behavior in VS Code. In the next lab, you’ll focus on publishing and deploying your materials.
Troubleshooting¶
Issue: "Copilot ignores my prompt file instructions"
Solution: Check that your prompt file is in .github/prompts and uses the .prompt.md extension. Ensure instructions and YAML frontmatter are clear and specific.
Issue: "Team members get inconsistent Copilot results" Solution: Store your prompt file in version control and communicate updates to your team.
Issue: "Instructions are too broad or too detailed" Solution: Focus on actionable, high-impact guidance. Test and iterate for best results.