# Writing prompts

## How to write the most effective prompts in Tabnine Chat

* Don't ask for multiple tasks at once.
* Plan your task step by step.
* For each step, be as specific and detailed as you can.
* Write clear, well-written prompts.
* Write prompts in English. You can try other languages, but English will probably return better results.
* Select the most relevant context: Select or mention the most relevant function or block of code.

You can try and type anything you want, but keep in mind that Tabnine Chat was designed to answer questions related to code. If you write good prompts, that are specific, detailed, and to the point, you increase the chances of getting an accurate and useful result.

Learn more on the [Tabnine Chat context](https://docs.tabnine.com/main/getting-started/tabnine-chat/chat-context/context-context-window) and [prompt engineering](https://docs.tabnine.com/main/getting-started/tabnine-chat/prompt).

**Example 1: Sort a list of words**

* `sort words`\ <mark style="color:red;">This is too generic</mark>
* `write a method that sorts a list of Strings`\ <mark style="color:yellow;">This is ok</mark>
* `write a function that gets a list of Strings as an input and returns that list of Strings ordered by Strings lengths and then alphabetically`\ <mark style="color:green;">This is great</mark>

<figure><img src="https://3436682446-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY2qxVf5VTm3fmwP4B4Gx%2Fuploads%2Fgit-blob-651f2d10aaf32eef8b9471d1e5e8f8027862d31f%2F4.webp?alt=media" alt=""><figcaption></figcaption></figure>

**Example 2: Refactor to meaningful variable names**

* `refactor this code`\ <mark style="color:red;">This is too generic</mark>
* `change var names`\ <mark style="color:yellow;">This is not explicit enough</mark>
* `how would you improve the variable names in this code?`\ <mark style="color:green;">This is great</mark>

<figure><img src="https://3436682446-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY2qxVf5VTm3fmwP4B4Gx%2Fuploads%2Fgit-blob-48ad3b4e652011dc0e35341b186d6c10365f9ead%2Fp2.webp?alt=media" alt=""><figcaption></figcaption></figure>


---

# 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://docs.tabnine.com/main/getting-started/tabnine-chat/prompt.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.
