Skip to main content

Prompt Engineering Tips

Prompt engineering is the art of crafting effective instructions for AI models like brewdata. Well-written prompts lead to better results, fewer errors, and a more efficient workflow.

General Principles

  • Be Clear and Specific: Clearly state what you want brewdata to do. Avoid ambiguity.

    • Bad: Fix the code.
    • Good: Fix the bug in the calculateTotal function that causes it to return incorrect results.
  • Provide Context: Use Context Mentions to refer to specific files, folders, or problems.

    • Good: @/model/items.sql Refactor the calculateTotal table .
  • 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.

Thinking vs. Doing

It's often helpful to guide brewdata through a "think-then-do" process:

  1. Analyze: Ask brewdata to analyze the current code, identify problems, or plan the approach.
  2. Plan: Have brewdata outline the steps it will take to complete the task.
  3. Execute: Instruct brewdata to implement the plan, one step at a time.
  4. Review: Carefully review the results of each step before proceeding.

Handling Ambiguity

If your request is ambiguous or lacks sufficient detail, brewdata might:

  • Make Assumptions: It might proceed based on its best guess, which may not be what you intended.
  • Ask Follow-Up Questions: It might use the 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.

Providing Feedback

If brewdata doesn't produce the desired results, you can provide feedback by:

  • Rejecting Actions: Click the "Reject" button when brewdata proposes an action you don't want.
  • Providing Explanations: When rejecting, explain why you're rejecting the action. This helps brewdata learn from its mistakes.
  • Rewording Your Request: Try rephrasing your initial task or providing more specific instructions.
  • Manually Correcting: If there are a few small issues, you can also directly modify the code before accepting the changes.