This guide covers common tasks when interacting with Bolt. You should also review the Best practices guides, for tips on getting the most out of Bolt.

Automatically improve your prompts

Bolt helps you craft better prompts, which are key to building successfully.

  1. Write your prompt in the chatbox.
  2. Click Enhance prompt Star icon. Bolt generates a recommended prompt, which you can then edit.

Change the mode

When talking with Bolt in your project, you can switch between two modes:

  • Build Mode: Bolt takes your prompt and makes changes to your files immediately.
  • Discussion Mode: talk with Bolt, without it making changes. This is useful if you want to discuss ideas, plan work, or troubleshoot, without using a large amount of tokens. Refer to Discussion mode for more information on this feature.

To switch between modes: in the Bolt prompt box in your project, click Toggle Chat icons used as button to toggle between build mode and discussion mode to toggle between Discussion Mode and Build Mode.

Add files to inform Bolt

You can give Bolt extra information by uploading files.

You can upload files when creating a new project on the Bolt homepage, or in an existing project in your chat. To upload a file, either:

  • In the chatbox, click Upload files Upload file icon, then select the files you want to upload.
  • Drag and drop the file into the chatbox.

For example, you can:

  • Add an image as an example of the look and feel you want.
  • Work on defining your product features with your team in a separate document, then upload it to Bolt.

Guide Bolt’s focus

You’ll get more accurate results if you’re explicit about what Bolt should and shouldn’t change.

Limit Bolt to specific files:

  1. Right-click the files you want to focus on in the Bolt Code editor.
  2. Select Target file.

Exclude specific files or directories:

  1. Right-click the files or directories you want to exclude in the Bolt Code editor.
  2. Select Lock file (single file) or Lock all (directory).

Focus on a code section:

  1. Highlight the code you want to discuss or change.
  2. Click the Ask Bolt button (if the button doesn’t appear immediately, try right-clicking). Bolt links the selection in the prompt box.
  3. Enter your question or request.

Clean up unused files

Cleaning up unused files reduces the size of the context window, which means you use fewer tokens.

Bolt uses a tool called Knip to perform the cleanup. You can run this when prompted by Bolt, or run it manually at any time.

Before proceeding, back up your project using both of these methods:

  • Click Export > Download to get a local copy of your project.
  • Open the menu Menu icon next to the project name, then click Duplicate to create a fresh copy of your project in Bolt.

Automatic cleanup when prompted:

If your Bolt project exceeds the context window (200k tokens for free accounts, 500k for paid accounts), Bolt notifies you in the chat, saying Project size exceeded. Click Remove unused files to run the cleanup.

Manually run the cleanup:

In the Bolt terminal run the following command:

npx knip --production --fix --allow-remove-files

Check the output in the terminal to see if the command ran successfully. This command removes unnecessary files from the codebase, which reduces the project size.

Change individual lines rather than rewriting whole files

By default, Bolt rewrites the entire file when making a change. Enable diff-based editing to make Bolt change specific lines, instead of rewriting the whole file.

The benefits of diff-based editing include:

  • Token efficiency: each change consumes fewer tokens.
  • Speed: changes take less time to run.
  • Precision: you can make isolated changes exactly where needed, without disturbing the surrounding code.

Enable diff-based editing:

  1. In Bolt, open the menu by hovering over the left side of the screen or clicking Open sidebar Open sidebar icon.
  2. Click Settings > Feature Previews.
  3. Toggle Diffs on.