> For the complete documentation index, see [llms.txt](https://codertapsu.gitbook.io/tech-note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codertapsu.gitbook.io/tech-note/chatgpt-prompt-for-coder.md).

# Chatgpt Prompt for coder

## For coding

* **Code Generation:**
  * Act as a Python developer. Show me how to ...
  * Act as a Python developer. Write code to ...
* **Code Explanation:** explain this python code
* **Code Refactoring:**
  * Can you refactor the following code to make it more efficient?
  * Do you see any problems with this implementation?
  * Please further optimize this code
* **Docstrings Generation:** write a docstring description for this function
* **Programming Language Conversion:** convert this code from Python to Javascript
* **Solution with** **technology stack:**

  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.
* **Fixing errors and bugs:**
  * I am working on the CAGR calculation functionality, but my code is giving the wrong answer. Tell me what the error is. Here is my code.

    function calculateCAGR(startValue, endValue, years)

    {

    &#x20; const cagr = (Math.pow(endValue / startValue) - 1) \* 100;

    &#x20; return cagr.toFixed(2);

    }
  * Help me find mistakes in the following code
  * Please continue writing this C++ code
* **Testing:**
  * Write unitest for c++ code
  * Please generate some testcases for when sid or uid are invalid
  * Testplan for ... Prepare testcase table to enter into jira ticket
