# Using Custom Commands in Prompts

Custom commands allow you to teach Tabnine to perform specific tasks repeatedly using a short alias. Once defined, you can reference the command in natural language prompts to streamline your workflows.

Custom commands are essentially **macros for your agent**: Once defined, they let you trigger a complex, project-specific behavior with a short alias.

### **Examples of usage:**

* "Run the `@summarize_diff` command on the last commit"
* "Use `@gen_test` to create unit tests for this function"

### **Best Practices:**

* Combine custom commands with ***descriptive*** naming: use aliases like `@clean_jsdoc` instead of `@cmd1`
* Reference them naturally. Treat the alias as a capability the model understands.
* Use them as part of longer prompts: e.g., "Use `@gen_test`, but make sure you mock the database layer."

**When&#x20;*****not*****&#x20;to use:** Avoid custom commands if your workflow or expectations change often. They work best for stable, repeatable patterns.

### **Common Prompting Pitfalls**

#### **Using Imprecise Language**

Phrases like "clean this up," "make it better," or "optimize" are vague. The model will guess your intent, often leading to results that don’t meet your expectations. Developments in LLMs over time might demonstrate these kinds of prompts get better at approximating what you want, but just like with a person, be direct.

A better approach is to be explicit about certain things in the response.

For example, even if you don’t need to use a `map()` function in a JavaScript result, but you know it would be effective, prompt the model to use this method just to make sure it’s achieving usable results. Further iterations can swap out a `map()` option for something else, like `forEach()`.

```
"Refactor this loop to use map() and remove side effects."
```

LLMs interpret specific goals more reliably than broad, fuzzy ones. Be explicit about structure, language features, or formatting rules.

### **Debugging Failed Prompts**

Not every prompt gets the right result on the first try. Here’s how to debug, revise, and improve them.

#### **1. Rewriting Strategies**

* **Be more specific:** Clarify file names, methods, formats.
* **Simplify:** Break the task into multiple, smaller prompts.
* **Reframe:** Instead of "Fix this code," say, "What does this function do and what edge cases does it miss?"
* **Shift focus:** Ask for intermediate steps or analysis instead of full solutions.

#### **2. What to Try Next**

* **Restart** the conversation to clear conflicting context.
* **Rerun** the prompt with an example input/output.
* **Ask the model** to "walk through the reasoning" if its answers seem wrong.
* **Try asking:** "What assumptions are you making based on this prompt?"


---

# 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/tabnines-prompting-guide/using-custom-commands-in-prompts.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.
