Back to guide/Developer Tools

Inline Generation Comment

Copilot reads the preceding comment block as context. Specifying input/output types, examples, and style constraints gives the model enough signal to generate correct code on the first try instead of generic boilerplate.

copilot-promptslanguagetaskDescriptioninputType
Edit View
Prompt
// Generate a {{language}} function that {{taskDescription}}
// Input: {{inputType}} — e.g. {{exampleInput}}
// Output: {{outputType}} — e.g. {{exampleOutput}}
// Constraints: {{constraints}}
// Style: use early returns, no nested ternaries

Variables to customize

{{language}}{{taskDescription}}{{inputType}}{{exampleInput}}{{outputType}}{{exampleOutput}}{{constraints}}

Why this prompt works

Copilot reads the preceding comment block as context. Specifying input/output types, examples, and style constraints gives the model enough signal to generate correct code on the first try instead of generic boilerplate.

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.