Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· openaiHugging Face Suzhen/CodeChat

developerupdates Home Insights Top ChatGPT prompts for programmers with examples Top…

  1. User

    developerupdates Home Insights Top ChatGPT prompts for programmers with examples Top ChatGPT prompts for programmers with examples #chatgpt#ai#tutorial#programming Top ChatGPT prompts for programmers with examples Chetan Mahajan May 21, 2023 ChatGPT is going to change the world, and programmers also can't avoid this. The developer who uses AI will eventually replace the developer who does not use AI. Because AI will do your 8 hours of coding in just 2–3 hours.

    As I have a 400K+ audience on Instagram, I decided to write a ChatGPT Guide for Software Developers that will help them use ChatGPT to become more productive and stay ahead of the competition.

    So let's look at the top useful scenarios and prompts that will help you while coding.

    Assume you're working on a new project or feature that requires you to write new code. You can cut more than half of your development time by doing the following:

    Prompt to write a new code for new feature and functionality Prompt:

    Act as a [Technology Name] developer. [Write a detailed description]

    Example 1:

    Act as a Python developer. Write code to read and print duplicate records from the provided CSV file.

    Example 2:

    Act as a JavaScript Developer, Write a program that checks the information on a form. Name and email are required, but address and age are not.

    Example 3:

    Act as a JavaScript Developer, Write a program that checks if a string contains a substring.

    Prompt with technology stack and other details Prompt:

    Act as: [Enter your profile]

    Technology stack: [Enter your technology stack]

    Functionality: [Enter functionality]

    Mandatory Fields: [Enter Fields]

    Optional fields: [Enter Fields]

    Task: [Write a task description]

    Example 1:

    Act as: Node.js Developer

    Technology stack: Node.js, Express.js, MongoDB, Mongoose

    Functionality: Newsletter

    Mandatory Fields: Email

    Optional fields: name

    Task: Make an API that takes a name and an email address as inputs and sends back a success flag.

  2. Assistant

    Example 2:

    Act as: React Developer

    Technology stack: React, Redux, Node.js, MongoDB

    Functionality: User Authentication

    Mandatory Fields: Email, Password

    Optional fields: None

    Task: Create a login page using React and Redux that takes email and password as inputs and authenticates the user using server-side validation with Node.js and MongoDB.

    Prompt for code optimization Prompt:

    You are given a piece of code that needs optimization. Refactor it to make it more efficient.

    Example:

    Given the following code snippet:

    def sum_of_squares(nums):
        result = 0
        for i in range(len(nums)):
            result += nums[i] ** 2
        return result
    

    Refactor the above code to use Python built-in functions and make it more efficient.

    Prompt for debugging Prompt:

    You are given a piece of code that is not working as expected. Debug the code and find the issue.

    Example:

    Given the following code snippet:

    function findLargest(arr) {
        let largest = 0;
        for(let i = 0; i < arr.length; i++) {
            if(arr[i] > largest) {
                largest = i;
            }
        }
        return largest;
    }
    
    console.log(findLargest([1, 5, 2, 9, 3]));
    

    Identify and fix the issue in the above code.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.