Tabnine's Prompting Guide
Defining a Prompting Strategy for Code Projects
Every project is going to require a different strategy based on your priorities. Effective prompting starts with structured thinking.
In Tabnine, you’re not just prompting a text model, but an Agent that has access to your codebase, open files, and custom commands.
A good prompt doesn’t just describe what you want but instructs the Agent how to operate in your project: what it can look at, what rules to follow, and what to leave alone.
A. Specify the Key Elements
When designing a prompt, clarify the following:
The Task:
What are you trying to achieve? What’s the ‘goal state’? What should the result be?
Example: "Apply the extract method for refactoring to this code."
Context:
What is the source material you’re working from, and where should the agent look (open file, specific path, remote repo)?
Example: "@related_class" or "See the implementation in
utils/helpers.py."
Constraints: What boundaries or conditions must be respected?
Example: "Keep current behavior. Preserve function signatures."
Note: It is best to avoid negative prompting. A negative version of the above example would be "Do not change behavior. Preserve function signatures."
Process: What are the instructions, or how should the agent approach the work step-by-step?
Example: "Start by identifying duplicate logic, then suggest reusable methods."
Validation: What signals indicate that the prompt was successful?
Example: "Refactored code should pass all existing tests."
Format: How should the output be structured?
Example: "Respond with a JSON object containing
method_name,start_line, andnew_code."
(Re-)Iteration Plan: What are the next steps if the first output isn’t perfect? Treat this like directing a junior engineer: tell the agent when to pause, ask questions, or request approval before applying large changes.
Example: "After generating the refactor, ask: 'Do you want to apply this to other classes?'"
Ask for Feedback (optional):
Example: "If this approach looks flawed, explain why and propose an alternative."
Template Example
When using Tabnine as an Agent over your codebase, be explicit about scope and permissions:
Scope: “Only modify this file and test files in
/tests/user/.”Permissions: “Do not create new services; only change existing methods.”
Safety checks: “Before proposing changes, summarize what you understood about the current behavior.”
Why This Works
A prompting strategy aligns the LLM with your development mindset. Instead of fishing for the right phrasing, you define a clear lane for the model to operate in—resulting in better, faster, and more predictable completions.
Last updated
Was this helpful?
