Prompt Engineering Basics
The quality of an LLM's output depends heavily on the prompt. A reliable pattern is: state a role, then the task. Clear structure beats clever wording.
We want prompts shaped exactly like:
You are a helpful assistant.
Task: Summarize the meeting notes.
Your task
Write buildPrompt(role, task) that returns a string in this exact format:
You are {role}.\nTask: {task}
(That's a newline between the two lines.)
β‘ 30 XP
solution.jsRuns in your browser
Loading editorβ¦
Tests2 to pass
formats role and task
works with other inputs
Run your code to check these.