AI Prompting course - Lesson 6 of 10

Lesson 6: GitHub Copilot: Ask for code that fits your project

Learn practical prompts for ChatGPT, Gemini, Claude, Microsoft Copilot, Perplexity, GitHub Copilot, Adobe Firefly, Canva, Grammarly, and NotebookLM.

← All AI Prompting lessons

Lesson 6 of 10 ยท GitHub Copilot

Ask for code that fits your project

For coding, provide the language, relevant files or interfaces, expected behavior, constraints, and a small example. Ask for a focused change and tests. Review suggested code for security, licensing and project conventions; run tests and inspect the diff before accepting it.

Example: implement a validator

In this TypeScript project, implement a function that validates
an email field for a signup form.
Constraints: follow the existing style, do not add dependencies,
return a clear validation result, and do not log the input.
First inspect the related form and tests. Then propose the smallest
change and add tests for valid input, missing input, and malformed
input. Do not change unrelated files.

Safer workflow: Ask for an explanation of assumptions. Check boundary cases and use a code review rather than treating generated code as production-ready.