G/GenAI Studio

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.

Generative AIPrompt EngineeringText GenerationImage GenerationAI APIsReact

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:

AudiencePurposeToneLengthContextDesired structure

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:

RoleSets the voice and expertise the response should have.
ContextExplains who I am so the post sounds personal and relevant.
AudienceDetermines vocabulary and what readers care about.
TaskNarrows the topic to one clear lesson.
ToneKeeps the post professional and avoids hype.
LengthFits LinkedIn reading habits and keeps results consistent.
Output structureMakes the post scannable and encourages engagement.
Defining the audience and output structure made the biggest difference — the post went from generic to something I could actually publish.

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
Concrete visual language (lighting, camera angle, composition) works better than subjective words like “beautiful” or “amazing”.

06

Text vs Image Prompting

Text generation

ContextAudienceToneConstraintsStructureDesired output

Image generation

SubjectEnvironmentStyleLightingCompositionPerspectiveMood

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

  1. Write
  2. Test
  3. Evaluate
  4. Refine
  5. 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.

Key lesson: Relevant specificity is more valuable than unnecessary complexity.

11

Challenges

Understanding AI-generated outputs
Prompt ambiguity
Controlling image-generation results
Evaluating output quality
Understanding API integration
Dealing with AI limitations

12

Lessons Learned

Generative AIIt predicts likely content from patterns — powerful, but not always correct.
Prompt engineeringPrompts work like specifications: clearer specs, better results.
APIsAI features rely on secure server-side API calls with keys kept private.
ExperimentationChange one variable at a time to see what actually helped.
IterationSmall, repeated improvements beat trying to get it perfect first time.
EvaluationJudge outputs against clear criteria and keep a human review step.
CommunicationClear communication with AI systems is a core skill, like with people.

13

Future Improvements

Prompt version historyPrompt comparisonMultiple AI modelsOutput evaluationPrompt sharingAdvanced image controlsAI prompt suggestionsAnalytics

See the project behind this case study

GenAI Studio is the working application where these experiments were carried out.

View GenAI Studio Project