Basic components of an effective prompting

Basic components of an effective prompting

The 3 basic components of an effective prompt are:


1) Role (Who the AI should act as)

This tells the AI what perspective or expertise to use while answering.

Examples:

  • “Act as a senior Angular architect…”
  • “You are a financial advisor…”
  • “Act as a Git expert…”

Why it matters: It sets the tone, depth, and domain knowledge of the response.


2) Task (What you want the AI to do)

This is the main instruction—the specific job you want the AI to perform.

Examples:

  • “Explain how Angular change detection works.”
  • “Write a LinkedIn post about AI trends.”
  • “Create a step-by-step migration plan.”

Why it matters: Without a clear task, the response becomes vague or off-topic.


3) Context (Background or constraints)

This provides additional details that help the AI give a more accurate and useful answer.

Examples:

  • “I have 13 years of experience in Angular.”
  • “The audience is non-technical.”
  • “Keep the response under 200 words.”

Why it matters: Context makes the response relevant, personalized, and precise.


Simple Formula

Effective Prompt = Role + Task + Context

Example:

“Act as a senior Angular architect (Role). Create a migration plan from Angular to React (Task). The project is a monolithic enterprise app with 10 modules (Context).”


Here are improved versions of each prompt using the Role + Task + Context structure so the AI can give more precise and useful answers.


1) Original

I need to loop through an array. Help?

Improved Prompt

Act as a JavaScript expert. Show me different ways to loop through an array in JavaScript, including for, forEach, map, and for…of. I’m a beginner and would like simple examples with explanations.

2) Original

I want my website to look good on phones too.

Improved Prompt

Act as a frontend UI/UX expert. Explain how to make a website responsive for mobile devices. My site is built with HTML and CSS, and I’m new to responsive design. Provide step-by-step guidance and code examples.

3) Original

I'm having issues bringing data into my React app.

Improved Prompt

Act as a senior React developer. Help me troubleshoot issues fetching and displaying API data in a React app. I’m using functional components with hooks, and the data is coming from a REST API. Provide possible causes, debugging steps, and sample code.

Clear and useful breakdown — effective prompting really does start with the basics: clarity, context, and intent. Even simple structure can dramatically improve AI output. 🧠✨ Great reminder for anyone working with AI daily. #PromptEngineering #AI #Productivity

Great man now you are completely into Gen AI and Agentic AI specialist

To view or add a comment, sign in

More articles by Hemanth Kumar

  • AI Agent Architecture Overview

    This diagram shows a complete AI agent architecture—how a user request travels through an API, reaches the LLM, and how…

  • AI Threshold

    What is a threshold (simple definition) In AI similarity search, a threshold is a minimum similarity score required for…

  • AI Prompting Techniques

    Prompting is the art of telling an AI what to do and how to do it using natural language (and sometimes examples…

  • AI Context Window

    A context window is basically the AI’s short-term memory size during a conversation. More clearly 👇 What it means The…

    1 Comment
  • Server Sent Events - SSE

    In today’s world of real-time applications—think live dashboards, notifications, or collaborative tools—developers…

  • Libuv: non-blocking I/O in nodejs

    is a multi-platform C library that provides asynchronous I/O and other system-level functionalities to Node.js.

  • Large Language Model(LLM) and its role in solving problems in modern age

    LLM stands for "Large Language Model." It is a type of artificial intelligence designed to understand and generate…

  • Javascript: Free Resources

    ❌Don’t pay 💰 for 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 courses you can learn here for free. 𝗣𝗿𝗼𝘃𝗶𝗱𝗶𝗻𝗴 𝘁𝗵𝗲…

  • Angular and its key features

    Angular is a popular open-source web application framework developed and maintained by Google. It is primarily used for…

  • Angular Service: Same instance vs Different instance of a service

    Services are considered as singletons - same instance of the service is used across the application. This behavior is…

Others also viewed

Explore content categories