# Prompting best practices

Write prompts that get the result you want on the first try. Be specific, give context, work in small steps and pick the right mode.

The AI does its best work when it knows what you want, where, and why. These habits help on every project.

A specific prompt in the composer with a selected element and a mentioned file.

## 1. Say what, where and how

Name the page or component, the change, and how it should look or behave.

| Vague                   | Specific                                                                                                       |
| ----------------------- | -------------------------------------------------------------------------------------------------------------- |
| Make the header better. | On the Home page, make the header sticky, add the logo on the left and a "Book a table" button on the right.   |
| Add a form.             | On the Contact page, add a form with name, email and message. Show "Thanks, we will reply soon" after sending. |
| Fix the colors.         | Use the primary color for all buttons and increase the contrast of body text on dark backgrounds.              |

## 2. Give context

- **Select the element** on the canvas before you write.
- **Mention files** with `@` when you know where the code is.
- **Attach a screenshot** and circle what should change.
- **Explain the goal**: "Visitors should find the opening hours in one glance" guides better choices than "move the hours up".

## 3. Work in small steps

One clear change per message is easier to check and easier to undo. Build the main page first, then add pages and features one by one. Check each result on the canvas before you move on.

## 4. Pick the right mode

| Situation                                        | Mode      |
| ------------------------------------------------ | --------- |
| You want to understand code or an error          | **Ask**   |
| The change is large, risky or touches many files | **Plan**  |
| The change is clear and contained                | **Build** |

## 5. Say what to keep

When you change one part, say what must stay the same:

```text
Change the hero title to "Fresh pasta, every day". Keep the layout,
the image and the button exactly as they are.
```

## 6. Set standards once

Do not repeat the same instructions in every message. Put them in:

- [Rules](/features/ai/rules) for technical standards.
- [Project knowledge](/features/ai/knowledge-and-memory) for product facts and preferences.
- [Skills](/features/ai/skills) for workflows you use often.

## 7. Keep conversations focused

Start a new chat for a new topic. Long conversations cost more and can lose focus. Use `/compact` to summarize a long one.

## 8. Review and iterate

Read the summary at the end of each turn and check the canvas. If the result is close, ask for the difference ("make the gap between the cards smaller"). If it went the wrong way, go back to the previous version in [Version history](/features/projects/version-history) and rephrase.

> [!NOTE]
>
> **Let the AI ask**
>
> If you are not sure what you want, say so: "Ask me a few questions first, then propose a plan." The AI asks in a card titled **A question for you**, with answers to pick from and a **Let Lyna decide** option.

## Related

- [Prompt library](/prompting/prompt-library): Ready-made prompts to copy.
- [Debugging with the AI](/prompting/debugging): Fix errors fast.
- [Chat modes](/features/ai/chat-modes): Build, Plan and Ask.
