Writing Prompts
Create, update, or correct prompt files (*.prompt.md) for GitHub Copilot in VS Code.
Mode Selection
Determine the mode from the user's request:
| Signal |
Mode |
Section |
| "Create a prompt", "write a prompt", "new prompt", convert chat workflow |
Create |
Create Mode below |
| "Update", "improve", "tighten", "the output format is inconsistent" |
Update |
Update Mode below |
| "Fix", "correct", "prompt doesn't load", "prompt is broken" |
Correct |
Correct Mode below |
Create Mode (6-Step Process)
Step 1: Routing Check
Verify a prompt file is the right surface. Ask two questions:
- Is this a repeatable, multi-step task? If no → one-off, type in chat directly.
- Does it need a specialised persona, handoffs, or bundled resources? If no → prompt file. If yes → agent or skill.
If the answer is not a prompt file, tell the user which surface to use and stop.
Step 2: Identify the Pattern
Match the user's task to one of the six prompt patterns:
| Pattern |
Use When |
Agent Mode |
| Research |
Explore and report without changes |
ask |
| Generation |
Create new files following conventions |
agent |
| Review / Audit |
Analyse code against a checklist |
ask |
| Workflow / Pipeline |
Orchestrate multi-phase tasks with gates; plan before acting |
agent or plan |
| Transformation |
Convert code or data between formats |
agent |
| Capture / Documentation |
Extract and preserve knowledge |
agent |
If the task combines two patterns, compose them. Keep body under 150 lines.
Step 3: Determine File Location and Name
- Team prompts:
.github/prompts/<command-name>.prompt.md
- Personal prompts: VS Code profile
prompts folder
Naming rules:
- Lowercase with hyphens
- 1–3 words, verb-noun pattern:
research-topic, gen-model, review-code
- Avoid vague names:
help, do-stuff, run
Step 4: Write the Frontmatter
Read references/prompt-writer-guide.md section "Frontmatter Template" for the full field reference. Apply these rules:
description (required):
- Start with a verb: "Research…", "Create…", "Review…"
- Keep under ~80 characters
- State the output or benefit
- Formula:
<Verb> <what> <output/benefit>
argument-hint (if ${input:} used):
- One phrase with parenthetical examples:
topic to research (e.g., authentication, caching)
- Pair with the primary
${input:} variable
agent (when not default):
ask — read-only conversational mode; no file edits or tool calls
agent — full agent mode with all tools (default when omitted)
plan — generates an implementation plan before taking any action; use for complex multi-step tasks where upfront planning improves outcomes
<custom-agent-name> — delegates to a named .agent.md; applies its persona, tools, and model
tools (when restricting):
- Omit for full access; list only to restrict
- Read-only:
[search, readFile, listDirectory]
- Pure conversation:
[]
model (only when needed):
- Pin complex reasoning to a high-capability model
- Use array syntax for fallback across plans
Step 5: Write the Body
Follow the four-part structure:
1. Task Statement — one sentence saying what to do
2. Instructions — numbered steps
3. Constraints — scope boundaries
4. Output Format — structural template
Body rules:
- Imperative mood: "Search for…" not "It would be good if…"
- Be specific: name files, directories, tools
- Frame instructions positively; negation is fine for constraints
- State act vs. advise explicitly
- Place file references at the top (front-load context)
- Variables work only in the body, never in frontmatter
- One
${input:} variable is ideal; two acceptable; three+ → redesign
- Use
${input:variableName:placeholder text} to provide a hint inside the input field
Built-in context variables (VS Code-resolved, no user input):
${file} — full path of the currently open file
${fileBasename} — filename with extension (e.g., Money.ts)
${fileBasenameNoExtension} — filename without extension (e.g., Money)
${fileDirname} — directory of the current file
${selection} / ${selectedText} — currently selected text in the active editor
${workspaceFolder} — full path of the workspace folder
${workspaceFolderBasename} — workspace folder name only
Combine: ${input:featureName} for what the user specifies + ${file} for context the editor already knows.
Include these clauses as appropriate to the pattern:
- Anti-overengineering: "Only make changes that are directly requested."
- Anti-hallucination: "Never speculate about code you have not opened."
- Parallelism: "Make independent tool calls in parallel."
- Read-first: "Read all mentioned files FULLY before acting."
- Anti-drift: "Do not add features beyond what is described in this prompt."
- Chainability: "## Next Step\nTo do X, run
/next-command."
Read references/prompt-writer-guide.md section "Six Prompt Patterns" for frontmatter skeletons and body templates for each pattern.
Step 6: Validate
Structural checks:
Functional checks:
Update Mode
- Read the existing prompt file fully.
- Identify the user's concern or improvement goal.
- Diagnose against the anti-patterns list in references/anti-patterns.md. Quick diagnosis: check #6 (Invisible Prompt), #17 (Tab-Indented YAML), #9 (Magic Dependency) first. Extended check for:
- Wall of Text (body >150 lines)
- Vague Command (no specific steps)
- Swiss Army Knife (does too many things)
- Phantom Input (
${input:} without argument-hint)
- Context Bomb (too many large file references)
- Format Ambiguity (no output format spec)
- Magic Dependency (works only with prior context)
- Overengineer Enabler (no anti-overengineering clause)
- Silent Hallucinator (no anti-hallucination clause)
- Apply improvements:
- Body too long → Split into focused prompts or upgrade to a skill
- Output inconsistent → Add explicit output format section with headers
- Agent goes off-scope → Add anti-drift, anti-overengineering clauses
- Agent speculates → Add anti-hallucination clause and read-first pattern
- Description vague → Rewrite with description formula (verb + what + output)
- Missing parallelism → Add parallelism clause for multi-file tasks
- Re-validate (Step 6 above).
Correct Mode
- Validate structure (Step 6 structural checks).
- If structural issues found, fix them first.
- Use the diagnostics view: right-click in Chat → Diagnostics to see loaded prompts and errors.
- Diagnose the issue:
| Symptom |
Likely Cause |
Fix |
Not in / picker |
Wrong location, extension, or invalid YAML |
Check location, filename; diagnostics view |
| Agent ignores body |
Invalid YAML frontmatter — --- delimiters or tabs |
Validate ---; use spaces only |
| Agent uses restricted tools |
tools field missing or wrong IDs |
Add/fix tools; check priority chain |
| File reference not loaded |
Wrong relative path (must be relative to prompt file) |
Verify and fix relative paths |
${input:} not substituted |
Variable in frontmatter or name mismatch |
Move to body; check spelling |
| Works in one session, fails in another |
Depends on prior conversation context |
Make self-contained; pass cold invocation test |
| Agent overengineers |
No scope control clauses |
Add anti-overengineering and anti-drift clauses |
| Output varies each time |
No output format specification |
Add structural template with headers |
| Agent asks instead of acting |
No "act vs. advise" directive |
Add "Implement changes rather than suggesting" |
| Agent hallucinates about code |
No anti-hallucination clause |
Add "Read files FULLY before answering" |
- Apply fixes.
- Re-validate (Step 6 above).
Deep Reference
For detailed guidance on any aspect, read specific sections from references/prompt-writer-guide.md:
- Routing decisions → search for
## Routing
- Frontmatter fields → search for
## Frontmatter Template
- Body structure and writing style → search for
## Body — Four-Part Structure
- Context injection (file refs, tool refs) → search for
## Context Injection
- Variables and parameterisation → search for
## Variables
- Six prompt patterns (templates) → search for
## Six Prompt Patterns
- Prompt chaining → search for
## Prompt Chaining
- Prompt engineering techniques → search for
## Prompt Engineering Techniques
- Anti-patterns (full gallery) → search for
## Anti-Patterns
- Validation and testing → search for
## Validation Checklist
- Debugging and diagnostics → search for
## Debugging Diagnostic Steps
- Security considerations → search for
## Security
- YAML pitfalls → search for
## YAML Pitfalls
Source: pslits/copilot-session-feedback — distributed by TomeVault.
1---2name: writing-prompts3description: Creates, updates, and corrects prompt files (*.prompt.md) for GitHub Copilot in VS Code. Covers the full prompt lifecycle: routing decision, frontmatter fields (description, agent modes ask/agent/plan/custom, tools, model, argument-hint), body structure, context injection (Markdown links, #tool: references), parameterisation (${input:} and built-in variables like ${file} ${selection}), six prompt patterns, chaining, validation, and debugging. Use when: creating a new prompt file, updating or improving an existing prompt, fixing a broken prompt that doesn't load or misbehaves, converting a repeated chat workflow into a prompt, reviewing a prompt for anti-patterns, or writing *.prompt.md files. Triggers on: 'create prompt', 'write prompt', 'new prompt', 'update prompt', 'fix prompt', 'prompt file', 'slash command', 'prompt.md', 'prompt writer'. Do not use for: writing copilot-instructions.md, custom agents (.agent.md), skills (SKILL.md), hooks, or general prompt engineering outside VS Code.4---56# Writing Prompts78Create, update, or correct prompt files (`*.prompt.md`) for GitHub Copilot in VS Code.910## Mode Selection1112Determine the mode from the user's request:1314| Signal | Mode | Section |15|--------|------|---------|16| "Create a prompt", "write a prompt", "new prompt", convert chat workflow | **Create** | Create Mode below |17| "Update", "improve", "tighten", "the output format is inconsistent" | **Update** | Update Mode below |18| "Fix", "correct", "prompt doesn't load", "prompt is broken" | **Correct** | Correct Mode below |1920---2122## Create Mode (6-Step Process)2324### Step 1: Routing Check2526Verify a prompt file is the right surface. Ask two questions:27281. **Is this a repeatable, multi-step task?** If no → one-off, type in chat directly.292. **Does it need a specialised persona, handoffs, or bundled resources?** If no → **prompt file**. If yes → agent or skill.3031If the answer is **not** a prompt file, tell the user which surface to use and stop.3233### Step 2: Identify the Pattern3435Match the user's task to one of the six prompt patterns:3637| Pattern | Use When | Agent Mode |38|---------|----------|------------|39| **Research** | Explore and report without changes | `ask` |40| **Generation** | Create new files following conventions | `agent` |41| **Review / Audit** | Analyse code against a checklist | `ask` |42| **Workflow / Pipeline** | Orchestrate multi-phase tasks with gates; plan before acting | `agent` or `plan` |43| **Transformation** | Convert code or data between formats | `agent` |44| **Capture / Documentation** | Extract and preserve knowledge | `agent` |4546If the task combines two patterns, compose them. Keep body under 150 lines.4748### Step 3: Determine File Location and Name4950- **Team prompts:** `.github/prompts/<command-name>.prompt.md`51- **Personal prompts:** VS Code profile `prompts` folder5253Naming rules:54- Lowercase with hyphens55- 1–3 words, verb-noun pattern: `research-topic`, `gen-model`, `review-code`56- Avoid vague names: `help`, `do-stuff`, `run`5758### Step 4: Write the Frontmatter5960Read [references/prompt-writer-guide.md](references/prompt-writer-guide.md) section "Frontmatter Template" for the full field reference. Apply these rules:6162**`description` (required):**63- Start with a verb: "Research…", "Create…", "Review…"64- Keep under ~80 characters65- State the output or benefit66- Formula: `<Verb> <what> <output/benefit>`6768**`argument-hint` (if `${input:}` used):**69- One phrase with parenthetical examples: `topic to research (e.g., authentication, caching)`70- Pair with the primary `${input:}` variable7172**`agent` (when not default):**73- `ask` — read-only conversational mode; no file edits or tool calls74- `agent` — full agent mode with all tools (default when omitted)75- `plan` — generates an implementation plan before taking any action; use for complex multi-step tasks where upfront planning improves outcomes76- `<custom-agent-name>` — delegates to a named `.agent.md`; applies its persona, tools, and model7778**`tools` (when restricting):**79- Omit for full access; list only to restrict80- Read-only: `[search, readFile, listDirectory]`81- Pure conversation: `[]`8283**`model` (only when needed):**84- Pin complex reasoning to a high-capability model85- Use array syntax for fallback across plans8687### Step 5: Write the Body8889Follow the four-part structure:9091```921. Task Statement — one sentence saying what to do932. Instructions — numbered steps943. Constraints — scope boundaries954. Output Format — structural template96```9798**Body rules:**99- Imperative mood: "Search for…" not "It would be good if…"100- Be specific: name files, directories, tools101- Frame instructions positively; negation is fine for constraints102- State act vs. advise explicitly103- Place file references at the **top** (front-load context)104- Variables work only in the body, never in frontmatter105- One `${input:}` variable is ideal; two acceptable; three+ → redesign106- Use `${input:variableName:placeholder text}` to provide a hint inside the input field107108**Built-in context variables (VS Code-resolved, no user input):**109- `${file}` — full path of the currently open file110- `${fileBasename}` — filename with extension (e.g., `Money.ts`)111- `${fileBasenameNoExtension}` — filename without extension (e.g., `Money`)112- `${fileDirname}` — directory of the current file113- `${selection}` / `${selectedText}` — currently selected text in the active editor114- `${workspaceFolder}` — full path of the workspace folder115- `${workspaceFolderBasename}` — workspace folder name only116117Combine: `${input:featureName}` for what the user specifies + `${file}` for context the editor already knows.118119**Include these clauses as appropriate to the pattern:**120- Anti-overengineering: "Only make changes that are directly requested."121- Anti-hallucination: "Never speculate about code you have not opened."122- Parallelism: "Make independent tool calls in parallel."123- Read-first: "Read all mentioned files FULLY before acting."124- Anti-drift: "Do not add features beyond what is described in this prompt."125- Chainability: "## Next Step\nTo do X, run `/next-command`."126127Read [references/prompt-writer-guide.md](references/prompt-writer-guide.md) section "Six Prompt Patterns" for frontmatter skeletons and body templates for each pattern.128129### Step 6: Validate130131**Structural checks:**132133- [ ] File in `.github/prompts/` or configured location134- [ ] Filename ends with `.prompt.md`135- [ ] Both `---` delimiters present; YAML uses spaces only136- [ ] `description` present, non-empty, <80 chars, verb-first137- [ ] `tools` entries match valid tool IDs (if set)138- [ ] File references (Markdown links) resolve to existing files139- [ ] `${input:}` paired with `argument-hint`; variables (`${input:}` and built-in) only in body140- [ ] Three invocation methods tested: `/command`, Command Palette (`Chat: Run Prompt`), play button in editor title141142**Functional checks:**143144- [ ] **Discoverability test:** appears in `/` picker and diagnostics view145- [ ] **Cold invocation test:** works in a fresh session with no prior context146- [ ] **Output format test:** response matches specified structure147- [ ] **Tool restriction test:** agent uses only allowed tools148- [ ] **Scope test:** agent doesn't make out-of-scope changes149- [ ] **Edge cases:** empty input, ambiguous input, non-matching workspace150151---152153## Update Mode1541551. Read the existing prompt file fully.1562. Identify the user's concern or improvement goal.1573. Diagnose against the anti-patterns list in [references/anti-patterns.md](references/anti-patterns.md). Quick diagnosis: check #6 (Invisible Prompt), #17 (Tab-Indented YAML), #9 (Magic Dependency) first. Extended check for:158 - Wall of Text (body >150 lines)159 - Vague Command (no specific steps)160 - Swiss Army Knife (does too many things)161 - Phantom Input (`${input:}` without `argument-hint`)162 - Context Bomb (too many large file references)163 - Format Ambiguity (no output format spec)164 - Magic Dependency (works only with prior context)165 - Overengineer Enabler (no anti-overengineering clause)166 - Silent Hallucinator (no anti-hallucination clause)1674. Apply improvements:168 - **Body too long** → Split into focused prompts or upgrade to a skill169 - **Output inconsistent** → Add explicit output format section with headers170 - **Agent goes off-scope** → Add anti-drift, anti-overengineering clauses171 - **Agent speculates** → Add anti-hallucination clause and read-first pattern172 - **Description vague** → Rewrite with description formula (verb + what + output)173 - **Missing parallelism** → Add parallelism clause for multi-file tasks1745. Re-validate (Step 6 above).175176---177178## Correct Mode1791801. Validate structure (Step 6 structural checks).1812. If structural issues found, fix them first.1823. Use the diagnostics view: right-click in Chat → Diagnostics to see loaded prompts and errors.1834. Diagnose the issue:184185| Symptom | Likely Cause | Fix |186|---------|-------------|-----|187| Not in `/` picker | Wrong location, extension, or invalid YAML | Check location, filename; diagnostics view |188| Agent ignores body | Invalid YAML frontmatter — `---` delimiters or tabs | Validate `---`; use spaces only |189| Agent uses restricted tools | `tools` field missing or wrong IDs | Add/fix `tools`; check priority chain |190| File reference not loaded | Wrong relative path (must be relative to prompt file) | Verify and fix relative paths |191| `${input:}` not substituted | Variable in frontmatter or name mismatch | Move to body; check spelling |192| Works in one session, fails in another | Depends on prior conversation context | Make self-contained; pass cold invocation test |193| Agent overengineers | No scope control clauses | Add anti-overengineering and anti-drift clauses |194| Output varies each time | No output format specification | Add structural template with headers |195| Agent asks instead of acting | No "act vs. advise" directive | Add "Implement changes rather than suggesting" |196| Agent hallucinates about code | No anti-hallucination clause | Add "Read files FULLY before answering" |1971985. Apply fixes.1996. Re-validate (Step 6 above).200201---202203## Deep Reference204205For detailed guidance on any aspect, read specific sections from [references/prompt-writer-guide.md](references/prompt-writer-guide.md):206207- Routing decisions → search for `## Routing`208- Frontmatter fields → search for `## Frontmatter Template`209- Body structure and writing style → search for `## Body — Four-Part Structure`210- Context injection (file refs, tool refs) → search for `## Context Injection`211- Variables and parameterisation → search for `## Variables`212- Six prompt patterns (templates) → search for `## Six Prompt Patterns`213- Prompt chaining → search for `## Prompt Chaining`214- Prompt engineering techniques → search for `## Prompt Engineering Techniques`215- Anti-patterns (full gallery) → search for `## Anti-Patterns`216- Validation and testing → search for `## Validation Checklist`217- Debugging and diagnostics → search for `## Debugging Diagnostic Steps`218- Security considerations → search for `## Security`219- YAML pitfalls → search for `## YAML Pitfalls`220221---222> Source: [pslits/copilot-session-feedback](https://github.com/pslits/copilot-session-feedback) — distributed by [TomeVault](https://tomevault.io).223<!-- tomevault:4.0:skill_md:2026-06-16 -->