Case Studies
Prompt Engineering Case Study
Exploring Generative AI Through Text and Image Generation
This case study documents my practical exploration of Generative AI and prompt engineering while developing my GenAI Studio project — what I tested, what changed, and what I learned.
01
Introduction
Generative AI is a type of artificial intelligence that creates new content — text, images and more — based on patterns it learned from large amounts of data.
Prompt engineering is the skill of writing clear instructions (prompts) so the AI produces useful, relevant results.
The model only knows what the prompt tells it. A vague prompt leaves the AI to guess; a clear prompt guides it. I wanted to understand this practically, by building and testing rather than only reading about it.
02
Project Context
I built GenAI Studio — Text & Image Generation Lab as a hands-on environment to explore Generative AI, text generation, image generation, prompt engineering and AI experimentation.
This page documents the experiments and learning behind that project. The application itself is a separate piece of work.
03
Problem Statement
Vague prompts tend to produce generic or unpredictable outputs. For example:
Initial prompt
Write something about AI.
This prompt does not specify:
04
Text Generation Experiment
The initial prompt gave the model a topic but no direction. Results were generic, overly broad, and the length and tone changed between attempts.
Before
Write a LinkedIn post about AI.
After
Role: You are a career coach who writes for early-career IT professionals. Context: I am an IT graduate building practical Generative AI projects to grow my skills. Audience: Recruiters and peers in the South African tech industry. Task: Write a LinkedIn post sharing one lesson I learned about prompt engineering. Tone: Professional, warm and authentic — no hype. Length: 150–200 words. Output structure: A one-line hook, three short bullet points, and a closing question that invites comments.
Why each element was added:
05
Image Generation Experiment
“A futuristic city” could mean almost anything — the style, time of day, viewpoint and mood were all left to chance, so every result looked different.
Before
A futuristic city.
After
Subject: A sustainable futuristic city skyline with vertical gardens on glass towers. Environment: Built along a river, with elevated walkways and electric trams. Lighting: Soft golden-hour sunlight with warm reflections on the water. Mood: Optimistic and calm. Style: Photorealistic architectural visualisation. Composition: Rule of thirds, skyline on the upper third, river leading the eye inward. Perspective: Wide-angle, slightly elevated drone view. Visual details: Green rooftops, people on walkways, subtle haze, no text or logos.
Typical result — before
- • Generic sci-fi neon skyline
- • Random style and lighting
- • Inconsistent between attempts
Typical result — after
- • Matches the intended scene and mood
- • Controlled composition and viewpoint
- • Far more repeatable
06
Text vs Image Prompting
Text generation
Image generation
Both use Generative AI, but the information the model needs reflects the type of output: text prompts describe meaning and communication, while image prompts describe what can be seen.
07
Prompt Refinement Process
- Write
- Test
- Evaluate
- Refine
- Repeat
Rather than expecting the first prompt to be perfect, I treated each prompt as a draft: test it, review the output against what I wanted, change one thing at a time, and try again.
08
Prompt Engineering Techniques
Role prompting
Assigning the model a role (e.g. career coach) to shape expertise and voice.
Context
Giving background so the output fits the real situation.
Specific instructions
Stating exactly what to produce instead of hinting.
Constraints
Setting limits such as length, tone or things to avoid.
Examples
Showing a sample of the desired style or format.
Output formatting
Defining the structure: bullets, headings, sections.
Iterative refinement
Testing, reviewing and improving the prompt step by step.
09
What Worked
- Providing relevant context
- Being specific about the desired result
- Defining constraints
- Specifying the output format
- Iteratively improving prompts
10
What Did Not Work
Making a prompt longer did not automatically make it better. Overloaded prompts with conflicting or irrelevant details often confused the model and produced worse results.
11
Challenges
12
Lessons Learned
13
Future Improvements
See the project behind this case study
GenAI Studio is the working application where these experiments were carried out.
View GenAI Studio Project