Prompt Framework
π Table of Contentsβ
- π Table of Contents
- π§ β¨ Introduction
- π§© 5W1H
- β Good Prompt vs β Bad Prompt
- π Combination
- Final Thoughts π
π§ β¨ Introductionβ
π§ Prompting is quickly becoming a core skill for developers, designers, and knowledge workers.
β³ A good prompt can save hours of work, while a vague one can lead to confusing or unusable results.
π§© Think of prompts as interfaces for thinking β the clearer your interface, the better the output.
π This post introduces a simple, reusable Prompt Framework that helps you to:
- π£οΈ communicate intent clearly
- π― get more consistent results
- π reuse prompts across tools and projects
π§© 5W1Hβ
π§ One of the easiest ways to structure a strong prompt is by borrowing the classic 5W1H framework.
π€ Whoβ
π€ Who is the AI supposed to be?
- A senior engineer
- A product manager
- A teacher explaining to beginners
βAct as a senior backend engineerβ¦β
π Whatβ
π What exactly do you want?
- Generate code
- Review text
- Explain a concept
βExplain how Kafka consumer groups workβ¦β
π― Whyβ
π― Why are you asking?
- Learning
- Production use
- Decision making
π§ This helps the model choose the right depth and tone.
ββ¦so I can explain it to junior developers.β
β±οΈ When (optional)β
β±οΈ When are time or context constraints relevant?
- Current trends
- Backward compatibility
- Version-specific behavior
βUsing Kafka 3.xβ¦β
π Where (optional)β
π Where will this be used?
- Web
- Mobile
- Backend
- React, Spring Boot, FastAPI
ββ¦in a Spring Boot application.β
βοΈ Howβ
βοΈ How should the output look?
- Bullet points
- Code only
- Step-by-step explanation
βUse simple examples and diagrams in text.β
β Good Prompt vs β Bad Promptβ
β Bad Promptβ
βExplain Kafkaβ
π¨ Problems:
- π€ No role
- π― No goal
- π No context
- βοΈ No format
- β No example
π€ The AI must guess everything, which often leads to generic or unfocused answers.
β Good Promptβ
βAct as a senior backend engineer.
Explain Kafka consumer groups in simple terms for junior developers, using Kafka 3.x and a Spring Boot context.
Use bullet points and a short example, similar to explaining how HTTP load balancing works.β
β Why this works:
- π€ Clear role
- π― Clear goal
- π Clear context
- π Clear format
- π§© Clear example
π§ Examples act as anchors β they show the AI what βgoodβ looks like, not just what to do.
π Combinationβ
π The real power comes from combining frameworks.
π§ Prompt Formulaβ
Role + Task + Context + Constraints + Output Format + (Optional) Example
π Reusable Prompt Templateβ
Act as [ROLE].
Your task is to [WHAT].
This is for [WHY].
Context: [WHERE / WHEN].
Output requirements:
- Format: [FORMAT]
- Style: [STYLE]
- Length: [LENGTH]
- Example (optional): [REFERENCE OR SAMPLE]
π You can store these templates and reuse them across:
- ChatGPT
- Claude
- GitHub Copilot
- Internal AI tools
4οΈβ£ Why This Worksβ
π§ This framework works because it separates structure from intent.
-
π§© Who + How β quality control (template-owned)
ποΈ These define how the AI should think and respond.
π They improve output quality regardless of topic. -
π― What + Why β intent (user-owned)
π§ These define what matters.
π Only the user knows the real task and success criteria. -
π Where / When β relevance (user-owned, optional)
π§ These ground the response in a real-world context, when needed.
π§© Examples sit at the boundary:
- Optional
- User-provided
- Extremely powerful when clarity or style matters
βοΈ By keeping:
- ποΈ structure in the template
- βοΈ meaning in the userβs hands
π you avoid over-constraining prompts while still getting consistent, high-quality results.
β¨ Template sets clarity. User sets purpose. Examples set direction.
Final Thoughts πβ
π§ Prompting is not about βtalking nicely to AIβ.
π― Itβs about thinking clearly and expressing intent.
β A good prompt:
- βοΈ reduces ambiguity
- π improves output quality
- β³ saves time
π Start simple. Use 5W1H.
π Then combine and refine as you go.
β¨ Clear thinking β Clear prompts β Better results
π Happy prompting!
