# 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codertapsu.gitbook.io/tech-note/chatgpt-prompt-for-coder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
