packages/kilo-docs/pages/customize/prompt-engineering.md
Prompt engineering is the art of crafting effective instructions for AI models like Kilo Code. Well-written prompts lead to better results, fewer errors, and a more efficient workflow.
Be Clear and Specific: Clearly state what you want Kilo Code to do. Avoid ambiguity.
calculateTotal function that causes it to return incorrect results.Provide Context: Use Context Mentions to refer to specific files, folders, or problems.
@/src/utils.ts Refactor the calculateTotal function to use async/await.Break Down Tasks: Divide complex tasks into smaller, well-defined steps.
Give Examples: If you have a specific coding style or pattern in mind, provide examples.
Specify Output Format: If you need the output in a particular format (e.g., JSON, Markdown), specify it in the prompt.
Iterate: Don't be afraid to refine your prompt if the initial results aren't what you expect.
It's often helpful to guide Kilo Code through a "think-then-do" process:
You can provide custom instructions to further tailor Kilo Code's behavior. There are two types of custom instructions:
Custom instructions are added to the system prompt, providing persistent guidance to the AI model. You can use these to:
See the Custom Instructions section for more details.
If your request is ambiguous or lacks sufficient detail, Kilo Code might:
ask_followup_question tool to clarify your request.It's generally better to provide clear and specific instructions from the start to avoid unnecessary back-and-forth.
If Kilo Code doesn't produce the desired results, you can provide feedback by:
Good Prompt:
@/src/components/Button.tsxRefactor theButtoncomponent to use theuseStatehook instead of theuseReducerhook.
Bad Prompt:
Fix the button.
Good Prompt:
Create a new file named
utils.pyand add a function calledcalculate_averagethat takes a list of numbers and returns their average.
Bad Prompt:
Write some Python code.
Good Prompt:
@problemsAddress all errors and warnings in the current file.
Bad Prompt:
Fix everything.
By following these tips, you can write effective prompts that get the most out of Kilo Code's capabilities.