Module 4: Prompting by Domain


    4.1 Prompting for Coding (Python, JavaScript, etc.)

    When using AI for coding tasks, your prompts must be clear, structured, and specific. Whether you're writing a small function or a full-stack application, the way you frame your request directly impacts the quality and correctness of the output.

    Best Practices for Code Prompts

    • State the Language: Always mention whether you want Python, JavaScript, C++, etc.
    • Be Specific: Describe exactly what you want the code to do.
    • Include Inputs & Expected Outputs: Provide examples for better accuracy.
    • Mention Constraints: Word limits, optimization requirements, or framework preferences (like React or Flask).
    • Ask for Explanation (Optional): You can request annotated code or comments to understand logic.

    Prompt Examples

    Python Function

    Write a Python function that takes a list of integers and returns 
    a new list with only the prime numbers. Include comments.
      

    JavaScript with UI

    Create a simple HTML + JavaScript snippet for a to-do list. 
    It should allow users to add tasks and remove them. Use basic DOM manipulation only.
      

    Framework-Specific Prompt

    Build a login form using React and Tailwind CSS. It should include 
    input fields for email and password, with basic client-side validation.
      

    Prompt with Test Cases

    Write a Python function to check if a string is a palindrome. 
    Return True or False. Include 3 test cases using assert statements.
      

    Advanced Prompting Tips

    • Ask to break complex code into smaller functions
    • Use: "Now explain this code step by step"
    • Ask for: "Make it more optimized for speed/memory"
    • For backend logic, specify framework (Django, Express)
    • For frontend, mention if you're using plain JS or a framework (Vue, React, etc.)

    Useful Extras

    • Debugging: “This code gives an error. Can you debug it?”
    • Conversion: “Convert this Python code into JavaScript.”
    • Documentation: “Add docstrings to this Python function.”


    4.2 Prompting for Marketing (Copywriting, SEO, Email)

    AI can be a powerful assistant in marketing—whether you're writing ad copy, blog posts, SEO-optimized content, or email campaigns. The key is to prompt with the right structure, tone, and target audience in mind.

    Best Practices for Marketing Prompts

    • Be Clear About the Objective: Sales? Engagement? Click-throughs?
    • Specify the Platform: Instagram, Facebook, blog, email, Google Ads, etc.
    • Mention the Target Audience: Age, region, interests, pain points.
    • Define Tone & Style: Professional, casual, witty, urgent, persuasive.
    • Use Keywords (SEO): List primary and secondary keywords if relevant.
    • Request Format: List, paragraph, heading-based, or even AIDA/PAS framework.

    Prompt Examples

    SEO Blog Prompt

    Write a 300-word blog post optimized for the keyword "best vegan protein powders." 
    Use a friendly and informative tone. Include subheadings and a bullet list of 5 product names.
      

    Ad Copy Prompt

    Write a catchy Google ad headline and description for a brand selling eco-friendly phone cases. 
    Target Gen Z audience in the US. Tone: bold and eco-conscious.
      

    Email Campaign Prompt

    Write a promotional email for a 50% off summer sale on men's shoes. 
    Use persuasive language and include a clear CTA (Shop Now). Target audience: Men aged 25-45.
      

    Instagram Caption Prompt

    Write a fun and engaging Instagram caption for a new bubble tea launch. 
    Tone: playful and trendy. Include 3 emojis and a hashtag.
      

    Keyword-Driven Prompt

    Write an SEO meta description for a page selling Himalayan pink salt. 
    Use the keyword "buy Himalayan pink salt online" and keep it under 155 characters.
      

    Advanced Prompting Tips

    • Use frameworks like AIDA (Attention, Interest, Desire, Action) or PAS (Problem, Agitate, Solution)
    • Request tone variation: “Now rewrite in a more humorous tone”
    • Ask for alternatives: “Give me 3 headline options”
    • Specify CTA: “End the copy with a strong call to action”
    • Request personalization: “Include [customer_name] in the email greeting”

    Useful Extras

    • Hashtag Suggestions: “Suggest 10 trending hashtags for this Instagram post”
    • CTA Enhancements: “Improve this call-to-action for urgency”
    • Keyword Density: “Keep keyword density around 1.5%”
    • Competitive Comparison: “Write a comparison of our tool vs. competitors”


    4.3 Prompting for Education (Lesson Plans, Quizzes)

    AI can be a valuable tool in creating educational content such as lesson plans, quizzes, summaries, explanations, worksheets, and more. By writing clear and structured prompts, educators can quickly generate high-quality material tailored to any level or subject.

    Best Practices for Educational Prompts

    • Define the Education Level: Primary, secondary, undergraduate, etc.
    • Mention Subject/Topic: e.g., Algebra, Biology, History of India.
    • Specify the Format: Lesson plan, quiz, summary, worksheet, etc.
    • Set Tone: Conversational, academic, exam-focused, etc.
    • Length Constraint: Word count, number of questions, etc.
    • Add Learning Objectives: What should students understand by the end?
    • Request Bloom's Taxonomy levels: Remember, Understand, Apply, Analyze, Evaluate, Create.

    Prompt Examples

    Lesson Plan Prompt

    Create a 45-minute lesson plan for teaching Newton’s Laws of Motion to 9th-grade students. 
    Include objectives, activities, materials needed, and an assessment task.
      

    Quiz Prompt

    Generate a 10-question multiple-choice quiz on the topic of World War II for high school students. 
    Include 4 options per question and indicate the correct answer.
      

    Summary Prompt

    Summarize the chapter “Cell Structure and Function” from Class 9 Biology in under 300 words 
    using simple language for quick revision.
      

    Worksheet Prompt

    Create a worksheet with 5 short-answer questions and 2 diagram-labeling exercises 
    for the topic “Photosynthesis” aimed at 8th-grade students.
      

    Concept Explanation Prompt

    Explain the concept of Pythagoras' Theorem to a 12-year-old using a real-life example 
    and a diagram description.
      

    Advanced Prompting Tips

    • Use Learning Styles: “Design this for visual learners”
    • Incorporate Real-World Applications: “Relate this concept to daily life”
    • Bloom’s Taxonomy Integration: “Ask 1 question from each level of Bloom’s Taxonomy”
    • Request Different Formats: MCQs, True/False, Fill in the blanks, Long answers
    • Curriculum Reference: “Align this with CBSE Class 10 syllabus”

    Useful Extras

    • Translation Support: “Translate this quiz into Hindi”
    • Gamified Prompts: “Turn this lesson into a fun classroom quiz game”
    • Concept Reinforcement: “Suggest 3 activities to reinforce this concept”
    • Homework Ideas: “Create 3 homework questions based on today’s lesson”


    4.4 Prompting for Business (Product Descriptions, Reports)

    In business contexts, AI prompts can streamline content creation for product listings, internal/external reports, market research, investor pitches, and customer communication. Well-structured prompts lead to more relevant, professional, and effective outputs.

    Best Practices for Business Prompts

    • Define the Goal: e.g., “Drive conversions”, “Summarize Q2 sales”, “Explain product features”.
    • Mention the Audience: B2B clients, customers, executives, stakeholders, etc.
    • Include Product/Service Details: Name, features, pricing, target market, etc.
    • Set Tone: Professional, persuasive, concise, informative, formal, etc.
    • Request Format: Paragraph, bullet points, table, executive summary, etc.
    • Specify Language Style: Use of jargon, plain English, technical, marketing copy, etc.

    Prompt Examples

    Product Description Prompt

    Write a compelling product description for a noise-cancelling Bluetooth headphone (Model XZ5), 
    targeting tech-savvy millennials. Highlight battery life, comfort, sound quality, and price.
      

    Business Report Summary Prompt

    Summarize the key findings of our Q3 2024 Sales Report. Highlight revenue growth, 
    top-performing regions, and any noticeable customer trends. Use bullet points.
      

    Market Research Prompt

    Generate a competitive analysis comparing our cloud storage product with Dropbox and Google Drive. 
    Focus on pricing, storage capacity, security, and unique selling points.
      

    Pitch Deck Prompt

    Write an investor pitch paragraph for a SaaS-based productivity tool helping remote teams 
    manage daily tasks, meetings, and communication in one platform.
      

    Client Email Prompt

    Write a formal follow-up email to a client who attended our product demo yesterday. 
    Thank them for their time and offer a 10% discount if they purchase within 7 days.
      

    Advanced Prompting Tips

    • Ask for Specific Angles: “Emphasize eco-friendliness”, “Highlight ROI for enterprises”
    • Multilingual Requests: “Translate into Spanish for Latin American market”
    • Data-Driven Outputs: “Use this raw data to create an executive summary”
    • Format Customization: “Write as a LinkedIn post / Slide / One-page PDF brief”
    • Audience Tuning: “Tailor the tone for Gen Z / C-level / small business owners”

    Useful Extras

    • Customer Support Copy: Generate response templates for FAQs or complaints
    • Product FAQs: “Create 5 most asked questions about this product with answers”
    • SWOT Analysis: “Write a SWOT analysis for our digital payment service”
    • Press Release: “Write a press release for our product launch next month”


    4.5 Prompting for Data (SQL, Data Cleaning, Analysis)

    Prompt engineering can significantly boost productivity for data professionals by assisting with SQL queries, data cleaning scripts, exploratory data analysis (EDA), and report summaries. The key is providing structured input and context for the data and goal.

    Best Practices for Data-Related Prompts

    • Be Clear on Task: Do you want to generate a SQL query, clean a dataset, or interpret data?
    • Describe the Data: Include table name, column names, data types, and sample rows if needed.
    • Mention the Tool/Language: SQL, Python (pandas), Excel, R, etc.
    • State the Output Format: SQL query, cleaned dataframe, summary table, chart description, etc.
    • Clarify the Goal: e.g., “Find top customers by revenue”, “Clean missing data”, “Visualize trends”.

    Prompt Examples

    SQL Query Prompt

    Write a SQL query to find the top 5 customers by total order value from the 'orders' table.
    Include customer_id, total_spent, and order_count.
      

    Data Cleaning Prompt (Python/pandas)

    Generate Python (pandas) code to clean a CSV file containing user data. 
    Handle missing values in the 'email' and 'age' columns. Remove duplicate entries.
      

    Data Analysis Prompt

    Analyze a dataset with columns: date, product, sales. Provide insights such as 
    top-selling products, monthly sales trends, and outlier days.
      

    SQL Joins Prompt

    Write a SQL query that joins the 'customers' and 'orders' tables on customer_id 
    and returns the total number of orders per customer.
      

    Visualization Prompt

    Suggest the best charts to visualize a dataset of website traffic with columns: date, source, sessions, bounce_rate.
    Generate code in Python using matplotlib or seaborn.
      

    Advanced Prompting Tips

    • Provide Sample Data: Give 2–3 rows of input for better code/output generation.
    • Ask for Explanation: “Explain this SQL query line by line.”
    • Chain Tasks: “Clean the data and generate summary statistics.”
    • Optimize Code: “Improve the performance of this pandas groupby operation.”
    • Ask for Tests: “Add unit tests for this data cleaning function.”

    Useful Extras

    • ETL Prompt: “Create an ETL pipeline to extract a CSV, transform and load to PostgreSQL.”
    • Missing Data Analysis: “Which columns have missing values and how can I handle them?”
    • SQL Error Fixing: “Fix this SQL query: [insert code]”
    • Data Summary: “Summarize this dataframe in plain English.”

    No comments:

    Post a Comment