Comment-Driven Completion
Getting the function you meant by writing the contract above it first, not by retrying the same prompt.
What it is for
Retrying the same prompt gets the same completion. Writing the contract first — what goes in, what comes out, what must not happen — changes what the model is completing, which is why the second attempt succeeds where ten identical ones did not.
The skill
Copilot completes from what is above the cursor. So put the contract there. Before the function body, write: 1. The signature, with real types. Not `data: any`. 2. A one-line docstring of what it returns — the RESULT, not the process. 3. The edge cases as bullets: empty input, duplicate, not found, overflow. 4. One example call with its expected output. Then let it complete. If the completion is wrong, do not retry — the input did not change, so neither will the output. Add the constraint it violated as another bullet and let it complete again. Two things that improve every completion in a file: - **Open the file it should imitate.** Copilot reads other open tabs. The fastest way to get code that matches your codebase is to have a good example of it open in the next tab. - **Name things the way the repo names them.** A completion follows the naming it can see; inconsistent local names produce inconsistent suggestions. Never accept a completion that calls an API you have not verified exists. It is the one failure mode that looks completely correct until it runs.
How to install it
1. Open the tool and start a new conversation, project or template. 2. Paste the text below wherever the tool keeps standing instructions — usually called system prompt, instructions, or persona. 3. Save it so it applies to every run rather than a single message.