Learn the phrases and patterns developers use when writing prompts for AI code generation tools — from generating new functions to requesting refactors and error handling.
0 / 5 completed
1 / 5
A developer writes: '___ a function that parses a CSV and returns an array of objects.' What pattern are they using?
'Generate a function that...' is a core prompt pattern for code generation. It tells the AI to create new code from scratch based on what you describe — the more specific the description, the better the output.
2 / 5
You prompt the AI: '___ this to use async/await instead of callbacks.' Which pattern are you applying?
'Refactor this to use...' is used when you want the AI to transform existing code to apply a different approach — async/await, a design pattern, or a different library — without changing the underlying behaviour.
3 / 5
After generating a database call, you prompt: '___ ___ handling so it catches connection timeouts.' What are you asking?
'Add error handling' is a prompt extension that tells the AI to augment existing code with defensive patterns — try/catch, retries, input validation — making it more robust in production.
4 / 5
A senior engineer says: 'Your prompt lacks ___. Add the framework name and a short code sample so the AI knows what you need.'
Context in a prompt means including relevant background: the language, framework, existing code patterns, or examples. More context helps the AI generate output that fits your actual codebase rather than a generic solution.
5 / 5
Which of the following is the most effective prompt for generating a validation function?
An effective prompt specifies the language, input type, expected output, and key constraints. The more precise the prompt, the less the AI has to guess — leading to code you can use with minimal editing.