ai · English Article · Software

Prompt Engineering

What’s the prompt? It’s simply a question or instruction. A prompt is the art of communicating with AI models to get a desired output. The clearer and more detailed the prompt, the better the response. The more specific and thorough you are, the more accurately the task will be completed.

Prompt requires 3 things:

  1. Context – the material to be worked on.
  2. Role – you and your role (who you are and what you do).
  3. Expectation – the desired material to be generated.

Example of crafting promps:

  1. Okay:
    • “Can you help me understand the current trends in global markets?”
  2. Better (+context and role):
    • I am a Business Analyst at Abc Co exploring global market trends. Can you help me understand the key trends across industries and regions?”
  3. Best (+expectation):
    • “I am a Business Analyst at Abc Co exploring global market trends. Can you help me understand the major trends impacting global markets, focusing specifically on how technological advancements and geopolitical shifts are influencing vatius industries? Please highlight the key trends, assess their potential risks, and identify any challenges organizations might face in adapting their strategies to these changes.

Example of crafring prompts with document:

  1. Okay:
    • “Can you help me analyze the attached product feedback?” [upload document into chat]
  2. Better (+context and role):
    • I am a Product Manager at Abc Co, and Im’m analyzing feedback on our latest product release. Can you help me identify common themes in the attached user feedback?” [upload document into chat]
  3. Best (+expectation):
    • “I am a Product Manager at Abc Co focused on improving our latest product release. Can you help me analyze recent user feedback to identify key themes and prioritize areas for improvement? Please highlight any recurring issues, assess the potential impact on user satisfaction, and suggest actionable steps we could take to address high-priority concerns.” [upload document into chat]

Software example, a new feature:

  1. Okay:
    • “Can you help me add a new Excel feature to my ASP.NET app?”
  2. Better (+context and role):
    • I’m a Backend Developer working on an ASP.NET Core 7 web API in Visual Studio 2022. I need to add a feature to allow users to export data to Excel.”
  3. Best (+expectation):
    • “I’m a Backend Developer working on an ASP.NET Core 7 web API in Visual Studio 2022. I need to implement a feature that allows users to export filtered data from the database to an Excel (.xlsx) file via a REST endpoint. Can you help me design and implement this functionality? Please suggest the best library for Excel export (e.g., EPPlus or ClosedXML), show example code for generating the file, and outline how to structure the controller and service layers. Also, include any tips for optimizing performance with large datasets and handling edge cases like empty results or special characters.

Software example, fixing a bug:

  1. Okay:
    • “Can you help me fix a bug in my C# code?”
  2. Better (+context and role):
    • I’m a C# Developer working on a .NET 6 web API. I’m encountering a bug where a null reference exception occurs when accessing a user profile.”
  3. Best (+expectation):
    • “I’m a C# Developer working on a .NET 6 web API for a user management system. I’m encountering a bug where a NullReferenceException is thrown when trying to access the User.Profile property after login. Can you help me identify the root cause and suggest a fix? Please explain possible reasons this could happen in a typical Entity Framework Core setup, and show how I can safely handle null references, including checking whether the navigation property is loaded and using best practices like null guards or optional chaining. Bonus if you can suggest how to write a unit test to prevent regressions.

Calculator implementation example:

  1. Okay:
    • “Can you help me build a calculator in C#?”
  2. Better (+context and role):
    • As a .NET Developer I’m building a C# console app and want to make a basic calculator that takes user input and performs operations like add, subtract, multiply, and divide. Can you help me write the code?”
  3. Best (+expectation):
    • “I’m creating a .NET 8 C# console application that functions as an interactive calculator. I want users to be able to enter two numbers and choose operations (add, subtract, multiply, divide, modulo, exponentiation). The program should loop until the user decides to exit. It should have a clear text-based UI in the console, handle invalid input gracefully (like non-numeric input or division by zero), and support basic theming (like displaying a welcome banner or separator lines). Can you generate the full code structure with proper methods, user prompts, and input validation?

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.