Prompt Basics
Fundamentals of prompting
A prompt is a text instruction you send to a language model. The quality of the prompt directly affects the quality of the response. A good prompt clearly formulates the task, provides necessary context, and specifies the desired output format.
The more specific the prompt, the better the result. Instead of "write text" specify: topic, length, style, audience, format. The model can't read minds — everything important must be in the prompt.
It's rare to write a perfect prompt on the first try. Start with a simple version, evaluate the result, identify issues, and improve the prompt. Repeat until the result meets expectations.
Test prompts on different inputs. A prompt that works for one example may give poor results for others. Create a set of test cases and verify against them.
Iterative Prompt Improvement
Good prompts are created through iterations
Write about dogs.
Quick Tips
Key Principles
- • Start simple, add complexity as needed
- • Test on different examples
- • Analyze errors and improve
- • Save prompts that work
- • Be specific about expectations
- ❌Too vague:"Help me with code"
- ❌No context:"What's wrong here?" (no code)
- ❌Contradicting instructions:"Be brief, but describe everything in detail"
- ❌Expecting mind reading:No requirements for format, style, length
- ✓Specify role:"You are an experienced Python developer..."
- ✓Provide context:"In the context of a React web application..."
- ✓Specify format:"Respond in bullet point format"
- ✓Give examples:"For example: input → output"
[ROLE] — Who the model should be You are a [role] with expertise in [domain]. [CONTEXT] — Background information Context: [relevant information about the situation] [TASK] — What needs to be done Task: [clear task description] [FORMAT] — How the response should look Response format: - [requirement 1] - [requirement 2] [CONSTRAINTS] — What to avoid Constraints: - Don't [constraint 1] - Don't [constraint 2]