Creating Reusable Prompts
File Format
- •Extension:
.prompt.md - •Location:
.github/prompts/
Frontmatter
yaml
--- name: refactor-component description: Refactor a component to use the new design system. tools: ['read_file'] ---
Body
The body is the user message sent to the LLM.
- •Variables: Use mustache syntax
{{ variable }}if supported by your setup, or standard placeholders. - •Context: You can reference specific files or selections.
Best Practices
- •Self-Contained: The prompt should explain the task fully.
- •Tools: List necessary tools in frontmatter.
- •Output Format: Specify how you want the answer (e.g., "Show diff only").
Example
markdown
---
name: explain-code
description: Explain the selected code in simple terms.
---
Please explain the following code:
{{ selection }}
Focus on the business logic.