# Best practices

Habits that get better results from the AI and keep your project safe, from rules and Plan mode to versions and row level security.

These habits help on your first project and your fiftieth.

## 1. Tell the AI about your project once

Write what the app does, who it is for and the patterns you want in [project knowledge](/features/ai/knowledge-and-memory). Put firm instructions, such as "use the Brand colors only" or "every page must work on a phone", in [rules](/features/ai/rules): open **Settings > AI > Customize** or type `/rules`.

The AI reads both on every turn, so you do not have to repeat yourself.

## 2. Plan the big changes

For anything that touches several pages or adds data, switch to **Plan** mode: press `Cmd/Ctrl + .` to open the mode menu and pick **Plan**, or type `/plan`. Review the plan, change it, then build from it. For small changes, such as a color or a label, stay in **Build**. See [Chat modes](/features/ai/chat-modes).

## 3. Ask for one thing at a time

One page or one feature per message gives cleaner results than a long list. Be concrete about what, where and how it should look.

| Instead of          | Try                                                                                                                |
| ------------------- | ------------------------------------------------------------------------------------------------------------------ |
| "Make a login page" | "Add a sign-in page with email and password, a Forgot password link and inline errors."                            |
| "Add a dashboard"   | "Add a /dashboard page with a sidebar, the user's name in the header and three cards: members, bookings, revenue." |
| "Fix the styling"   | "The three pricing cards have different heights. Make them the same height."                                       |

More in [Prompting best practices](/prompting/best-practices).

## 4. Point the AI to the right place

- Select an element on the canvas before you write. The AI gets the element and where it lives in the code.
- Type `@` to add files, folders, a URL, your Git changes or the current problems. See [Mentions and context](/features/ai/mentions-and-context).
- Attach a screenshot when words are not enough.

## 5. Make small visual changes yourself

Spacing, colors, font sizes, alignment and radius are faster in the [Styles](/features/design/styles) panel than in a prompt. Select the element on the [canvas](/features/design/canvas) and change the value.

## 6. Go back instead of piling up fixes

Every AI turn that changes files leaves a version card. If a change goes wrong, revert to the version before it, then ask again with a clearer prompt. Save a named version before a big change. See [Version history](/features/projects/version-history).

To try a risky idea without touching your project, [duplicate it](/features/projects/duplicate-and-remix) first.

## 7. Keep the conversation short

Long conversations cost more credits and blur the context.

- `/context` shows how full the conversation is.
- `/compact` summarizes it and keeps going.
- `/clear` starts a new conversation.

See [Slash commands](/features/ai/slash-commands).

## 8. Protect your data from day one

- Ask for row level security on every table when you create it. See [Database](/features/cloud/database).
- Keep secret keys in [Secrets](/features/cloud/secrets) and use them in [edge functions](/features/cloud/edge-functions), never in page code.
- Run the [security scan](/features/test-and-debug/security-scan) before you publish.

More in [Security best practices](/tips-and-tricks/security-best-practices).

## 9. Back up your code

Connect [GitHub](/integrations/github) to keep a copy of your code in your own repository and to work on it with others.

## 10. Give precise feedback

When the result is close but not right, say what is wrong, what you expected and where:

> The header covers the content on phones. It should stay at the top and the content should scroll under it.

> [!NOTE]
>
> **Learn a few shortcuts**
>
> `Cmd/Ctrl + K` opens the command palette and `Cmd/Ctrl + Shift + L` adds the selection to the chat. See [Keyboard shortcuts](/tips-and-tricks/keyboard-shortcuts).

## Related

- [Prompting best practices](/prompting/best-practices): Write prompts that work.
- [From idea to app](/tips-and-tricks/from-idea-to-app): The full path, step by step.
- [Security best practices](/tips-and-tricks/security-best-practices): Keep your data safe.
