PromptEngNotes
PromptEngNotes
ers
1. Ask the Model to Adopt a Role or Define a Persona
title
When you assign a specific role to the model (e.g., ”Be an ethical
hacker” or ”Act as a Python tutor”), its responses become more tar-
geted and relevant.
You are a cybersecurity expert. Explain how to ethically test the security of a w
title
The model provides ethical and professional advice specific to cyber-
security.
title
The more context you provide, the more accurate and tailored the
response.
How: Clearly state the language, framework, tools, or version you are
working with. Example:
title
A detailed response with Python 3.10 and Flask-specific code.
1
title
Breaking down tasks into steps helps the model structure the response
in a way that is easy to follow and implement.
How: Use phrases like Step-by-step, List the steps, or Explain the
process. Example:
Provide step-by-step instructions to set up a Node.js server using Express and Mo
title
A step-by-step guide to set up the server, install dependencies, and
connect to MongoDB.
title
Examples give the model context for the output you expect and im-
prove response quality.
How: Include your example and specify the desired format. Example:
Create a Python function to hash a password using bcrypt. Example:
Input: "my_password"
Output: A hashed password
title
A Python function using bcrypt to hash the given password.
title
Understanding the reasoning helps validate or refine the solution.
How: Use phrases like Explain why or Provide reasoning for. Ex-
ample:
Write a secure SQL query to prevent injection attacks and explain why it is secur
title
Code using parameterized queries and an explanation of how it pre-
vents SQL injection.
2
6. Ask for Optimization or Alternatives
title
Sometimes you need better performance, simpler code, or different
approaches.
title
Constraints guide the model to provide solutions that meet your exact
requirements.
Create a Python function to sort a list without using the built-in ‘sort()‘ funct
title
A sorting function that does not rely on sort().
title
Saves time and gets a comprehensive answer.
Write a Python script to scrape data from a website and save it to a CSV file. Al
title
A complete script that includes web scraping, data saving, and error
handling.
3
title
Ensures the response matches your expected structure or style.
title
If the initial response is not accurate, refine the prompt to include
additional context or adjust instructions.
How: Use phrases like Refine this or Based on this code, do the
following. Example:
Based on the Node.js server code you provided, add a route for deleting a user by
title
An updated code snippet with the delete route.
title
Ambiguity in the prompt can lead to irrelevant or generic responses.
title
Useful for finding bugs and understanding issues in your code.
4
How: Share the problematic code and describe the issue. Example:
title
Adding background details or omitting irrelevant context affects the
quality of the response.
How: Provide necessary details but avoid overloading the prompt. Ex-
ample:
title
Focused guidance on JWT implementation in Django.
title
Verifies that the solution works in all scenarios.
How: Ask the model to include edge case handling in its response. Ex-
ample:
title
By mastering these techniques, you can maximize the value you derive
from AI tools.
==========Done================