DEV Community

Huaqing Xu
Huaqing Xu

Posted on

How to Write ChatGPT Prompts That Actually Work (With Examples)

Most people use ChatGPT wrong. They type vague requests like "write a blog post" and get mediocre results.

After a year of daily use, I discovered that great prompts follow a specific framework. Here's how to write prompts that get professional-quality results every time.

The 5-Part Prompt Framework

Every effective prompt contains these 5 elements:

1. Role     → Who should ChatGPT be?
2. Task     → What specifically should it do?
3. Context  → What background info is needed?
4. Requirements → What constraints apply?
5. Format   → How should the output look?
Enter fullscreen mode Exit fullscreen mode

Example: Bad vs Good Prompt

Bad: "Write a blog post about AI"

Good:

Act as an expert tech blogger.
Your task is to write a 1500-word blog post about how AI is changing content creation.
Target audience: marketing managers at mid-size companies.
Include: catchy headline, intro hook, 3 main sections with examples, conclusion with CTA.
Tone: informative but conversational.
Enter fullscreen mode Exit fullscreen mode

The difference is night and day.

3 More Examples

Code Review

Review the following [LANGUAGE] code for [CONCERN: performance/security/readability].
Provide:
- 3-5 specific issues with line references
- Suggested fixes with code examples
- Quality score (1-10) with justification

Code: [PASTE CODE]
Enter fullscreen mode Exit fullscreen mode

Email Response

Draft a [TONE: professional/friendly] response to this email.
Context: [BRIEF CONTEXT]
Keep it under [X] words.
Include: acknowledgment, main response, clear next step.

Email: [PASTE EMAIL]
Enter fullscreen mode Exit fullscreen mode

Learning a New Concept

Explain [CONCEPT] as if teaching a [LEVEL] student.
Include:
- A simple analogy
- Step-by-step breakdown
- 3 practice questions with answers
- Common misconceptions to avoid
Enter fullscreen mode Exit fullscreen mode

Why This Framework Works

  1. Role primes ChatGPT to adopt expertise and vocabulary
  2. Task gives a clear, actionable objective
  3. Context grounds the response in your specific situation
  4. Requirements set boundaries (word count, tone, structure)
  5. Format ensures usable output you can act on immediately

Get 100+ Ready-to-Use Templates

I compiled 100+ templates using this framework across 10 categories:

  • Writing & Content Creation
  • Programming & Code Review
  • Marketing & Business
  • Learning & Education
  • Productivity & Task Management
  • Career & Job Search
  • Data Analysis
  • Email Management
  • Creative Writing
  • Personal Development

Each template uses fill-in-the-blank format — just copy, paste, fill in your details, and get great results.

Get the full collection — $4.99 instant PDF download

Works with ChatGPT, Claude, Gemini, and any AI assistant. Secure PayPal payment with automatic delivery.


What's your favorite ChatGPT prompt? Share in the comments!

Top comments (0)