Genereate new Prompt for Copilot
Custom instructions for TypeScript development with strict typing
- 💡 Use Case:
- Set as Copilot instructions for TypeScript projects
Prompt Content
agent: agent
model: Claude Sonnet 4.5 (copilot)
tools: [‘edit’, ‘search/codebase’, ‘think’]
description: From a short task description, generate a Copilot .prompt.md file at .github/prompts/
Copilot Prompt File Generator (VS Code prompt files)
Turn a short description into a complete VS Code Copilot prompt file (.prompt.md) saved under .github/prompts, following the official prompt-file structure and best practices.
If any required value is missing, infer sensible defaults without back-and-forth.
Behavior priority (in order)
- Successfully create a valid
.prompt.mdfile that VS Code can run. - Do not ask follow-up questions; infer sensible defaults from inputs.
- If a step is impossible, stop and briefly explain the problem in chat.
Inputs
Normalize all inputs by trimming whitespace.
- Task description (required) →
${input:desc:Briefly describe what the prompt should do}- If empty or only whitespace, stop and report the error in chat.
- Prompt file base name (kebab-case, filename-safe) →
${input:name:${fileBasenameNoExtension}-prompt} - Prompt display name (optional; shown after
/in chat) →${input:promptName} - Argument hint (optional; hint text in chat input) →
${input:argumentHint} - Agent / mode (
ask|edit|agent; defaultagent) →${input:agent:agent}- If
${input:agent}is not one ofask,edit,agent, treat it asagent.
- If
- Model (optional; defaults to model picker) →
${input:model} - Tools (optional; comma-separated tool or tool-set names) →
${input:tools}- Parse into an array: split by
,, trim, drop empty entries, deduplicate. - Support patterns like
serverName/*for MCP servers when provided.
- Parse into an array: split by
- Additional references (optional; comma-separated relative paths) →
${input:refs}- Parse into an array: split by
,, trim, drop empty entries, deduplicate.
- Parse into an array: split by
Treat “workspace prompt files” as files under
.github/prompts. This generator only creates workspace prompt files.
What to generate
Create one .prompt.md file with the official VS Code prompt-file structure:
1) YAML frontmatter (only non-empty keys)
Use the following keys, matching the VS Code docs:
description: ≤ 90 chars summary crafted from${input:desc}.- If
${input:desc}is longer, truncate at a word boundary.
- If
name: from${input:promptName}if provided, otherwise:- Use the computed base filename (without extension) as a reasonable default.
argument-hint: from${input:argumentHint}if provided.agent: from normalized${input:agent}(ask,edit, oragent).model: from${input:model}if provided.tools: from parsed${input:tools}if non-empty (YAML list).
Omit any key whose value is empty, null, or an empty array.
Example shape (for preview only):
description: Review Python code for security issues and suggest fixes
name: review-python-security
argument-hint: Paste the Python code you want reviewed
agent: ask
model: gpt-4.1
tools:
- search
- githubRepo
2) Body (clear, actionable, self-contained)
The body is the prompt text VS Code sends to the LLM when the prompt is run. It must be structured and aligned with best practices.
Use the following sections in this exact order:
-
## Task- 1–3 sentences summarizing what the prompt does and when to use it, based on
${input:desc}.
- 1–3 sentences summarizing what the prompt does and when to use it, based on
-
## Instructions- Numbered, deterministic steps to accomplish
${input:desc}. - Use imperative mood and active voice.
- Clearly describe:
- What the AI should do.
- How it should use any selections, files, or inputs.
- Any language / framework / version constraints that are explicitly implied by the task (do not invent constraints).
When relevant, encourage using VS Code prompt variables to make the prompt reusable and flexible, for example:
${selection}or${selectedText}for code under review or to transform.${file},${fileBasename},${fileDirname},${fileBasenameNoExtension}when operating on the current file.${workspaceFolder},${workspaceFolderBasename}for workspace-level operations.${input:variableName}/${input:variableName:placeholder}to pass user parameters into the prompt (for things like component names, API names, etc.).
- Numbered, deterministic steps to accomplish
-
## Expected output- A bulleted or numbered list describing the exact output format the AI should produce, for example:
- Required sections and headings.
- When to use fenced code blocks (and which languages).
- When to use tables, lists, or checklists.
- Any JSON or structured formats, including required fields.
- A bulleted or numbered list describing the exact output format the AI should produce, for example:
-
## References(include only if${input:refs}is non-empty)-
Bullet list of reference files, each as a relative Markdown link, for example:
[API specification](docs/api.md)
-
Use the parsed
${input:refs}values directly as relative paths from.github/prompts. -
Do not reference files that are not listed in
${input:refs}. -
When relevant, suggest how the AI should use these references (for example, “Follow the guidelines in custom instructions instead of duplicating them here”).
If the prompt benefits from agent tools (like
githubRepo,search, or others), you may mention them in the body using the VS Code tool reference syntax, for example:#tool:githubRepo. -
-
## Done when- A checklist that clearly states the completion criteria for this prompt.
- Use
- [ ]items. - Include checks like:
- Output matches the described structure.
- Any required examples of input and output are included.
- Any referenced files are linked correctly and actually used.
- The prompt does not depend on hidden context beyond the described variables and references.
In the body:
-
Encourage
${selection},${file}, and input variables only when they add clarity and reuse, not by default. -
Avoid depending on external context beyond:
- Workspace-relative files you’ve linked.
- Built-in variables (
${selection},${file},${workspaceFolder}, input variables).
-
Use Markdown consistently (headings, lists, code blocks).
-
Do not leak internal environment details or paths outside
.github/prompts.
File operations
Use the available workspace/file tools (for example, edit) to actually modify the repository; do not simulate edits in prose.
-
Compute base slug:
- If
${input:name}is provided and non-empty, start from that. - Otherwise, slugify
${input:desc}as follows:- Lowercase the string.
- Replace any sequence of characters outside
[a-z0-9]with a single-. - Collapse repeated
-into one. - Trim leading and trailing
-. - Optionally truncate the slug to a safe length (for example, 60 characters) without cutting inside a word if practical.
- If
-
Apply extension:
- Use
<slug>.prompt.mdas the base filename.
- Use
-
Ensure folder exists:
- Ensure
.github/promptsexists, creating it if necessary. - Treat this folder as the workspace prompt-file folder.
- Ensure
-
Resolve collisions:
-
If
.github/prompts/<slug>.prompt.mdalready exists, try:.github/prompts/<slug>-1.prompt.md,.github/prompts/<slug>-2.prompt.md, etc.
-
Increment the numeric suffix until a unique path is found.
-
-
Write file:
- Write the YAML frontmatter and body to
.github/prompts/<final-name>.prompt.md. - Never overwrite existing files; always create a new file.
- Write the YAML frontmatter and body to
Return in chat (always)
After successfully writing the file:
-
Provide a one-line confirmation with the final saved path, wrapped in backticks, for example: _
Created \.github/prompts/my-task.prompt.md._ -
Show a short frontmatter preview (3–6 lines) in a fenced
yamlcode block, using the final values, for example:description: Review Python code for security issues and suggest fixes name: review-python-security agent: ask model: gpt-4.1 tools: - search - githubRepo -
If
${input:refs}parsed to a non-empty list, output:- “Reference files:” followed by a bullet list of the detected reference paths.
-
If
${input:refs}is empty or only whitespace, output:- “No reference files provided.”
If any required step fails (for example, unable to write the file), explain briefly what failed and which step you reached.
Tool selection (least-privilege)
Start with no additional tools beyond those configured for this agent. Add tools only if strictly necessary and available in the current environment.
- Prefer read-only tools when you need to inspect the workspace (for example,
search,search/codebase,problems,usages,extensions,vscodeAPI), if they exist. - Use write/exec tools only when needed:
- Create scaffolding/files →
editornew. - Run commands →
runCommands. - Build/run/test →
runTasks,runTests. - Local preview →
openSimpleBrowser. - Public code examples →
githubRepo. - Fetch a specific URL’s content →
fetch.
- Create scaffolding/files →
If a tool mentioned above is not available in this environment, omit it and choose the minimal available alternative. Do not substitute more powerful or riskier tools than necessary.
Implementation algorithm (you execute now)
-
Parse
${input:desc},${input:name},${input:promptName},${input:argumentHint},${input:agent},${input:model},${input:tools}, and${input:refs}and normalize them as described above. -
Validate that
${input:desc}is non-empty; if it is empty, report the error in chat and stop. -
Craft the
descriptionfield (≤ 90 chars) from${input:desc}. -
Build the YAML frontmatter with
description,name,argument-hint,agent,model, andtools, omitting empty keys. -
Write the body with:
## Tasksummary,## Instructionsnumbered steps (using variables and tools when helpful),## Expected outputsection,- optional
## Referencessection (if refs exist), ## Done whenchecklist.
-
Ensure
.github/promptsexists, compute a safe, unique filename, and write the file. -
Reply in chat with the confirmation line, frontmatter preview, and reference files list (or “No reference files provided”).
Style & best practices (aligning with VS Code docs)
- Clearly describe what the prompt should accomplish and what output format is expected.
- Provide or request examples of expected input and output when that helps guide responses.
- Prefer referencing common guidelines or custom instructions via Markdown links instead of duplicating them.
- Leverage built-in variables like
${selection},${file},${workspaceFolder}, and${input:*}to keep prompts flexible and reusable. - Use the editor’s run/play button (and
/promptNamein chat) to test prompts, then refine wording and output format instructions to improve determinism. - Be concise, precise, and neutral; no emojis or fluff.
- Use active voice and imperative mood.
- Avoid ambiguous language like “a few” or “some”.
- Do not leak internal environment details or paths outside
.github/prompts.
Example transformation (illustrative; do not save)
Input desc: “Create a prompt to review Python code for security issues and suggest fixes.”
description:“Review Python code for security issues and suggest fixes”name:review-python-securityargument-hint:“Paste the Python code you want reviewed”agent:asktools:might includesearch,githubRepo
Body should:
- Use
${selection}to receive the code under review. - In
## Instructions, instruct the AI to identify common security issues (injection, insecure deserialization, SSRF, secrets, weak crypto) and suggest fixes. - In
## Expected output, require a Markdown list grouped by severity with code examples of safer alternatives. - In
## Done when, ensure the output follows the described format and covers all detected issues.
“Done when” checklist
- A unique file exists at
.github/prompts/<name>.prompt.md. - Frontmatter uses only official VS Code fields (
description,name,argument-hint,agent,model,tools) with non-empty valid values. - Body contains
## Task,## Instructions,## Expected output, optional## References(if refs exist), and## Done when. - Any
${input:refs}were linked via relative Markdown paths in the## Referencessection. - The prompt body uses VS Code variables and tool references (
${selection},${input:*},#tool:<name>) when beneficial. - Chat reply includes the final path, frontmatter preview, and reference files list (or “No reference files provided”).