Bolt Commands and Controls

Bolt Commands: Slash Commands and Built-in Tools

A practical guide to every Bolt.new slash command and built-in capability — what each one does and when to reach for it.

Bolt's Command System

Bolt.new provides slash commands and special prompt conventions that trigger specific behaviors in the AI and development environment. Knowing when to reach for each one separates efficient Bolt users from those who fight the tool.

Core Slash Commands

/clear

Resets the conversation context. Use this when:

  • The conversation has become long and Bolt is starting to lose track of earlier decisions
  • You've completed a major feature and are starting a new one
  • The AI is generating code that contradicts previous instructions (often a sign of context overflow)
text
/clear
Now let's build the authentication flow. Here's the current project context: [paste summary]

Important: After /clear, always re-establish context with a brief summary of the project state and what you're working on next.

/fix

Triggers a targeted fix attempt for a specific problem. More focused than a general description.

text
/fix The task list isn't re-rendering after I mark a task complete.
The TaskList component reads from a local state array but the mutation
updates Supabase without invalidating the React Query cache.

/explain

Asks Bolt to explain a piece of code or a concept in the context of the current project.

text
/explain How does the useTaskFilters hook work? Walk through what happens
when the user switches between the "Active" and "Complete" filter tabs.

This is particularly useful for onboarding team members or for reviewing AI-generated code you want to fully understand before shipping.

/diff

Shows what changed in the most recent edit. Useful when Bolt made a change and you want to see exactly what it touched before accepting it.

The Revert Control

Bolt maintains a history of every AI action. You can revert to any previous state using the history panel. This is the safety net that makes aggressive iteration safe — if a change breaks something, roll back without undoing work manually.

Best practice: test in the preview after each significant change. If something breaks, revert immediately rather than trying to fix forward from a broken state.

Targeting Specific Files

You can tell Bolt to work in a specific file rather than letting it decide where to make changes:

text
In src/components/TaskCard.tsx, add a priority badge to the top-right corner
of the card. Use these color mappings: low = green-100 text-green-700,
medium = yellow-100 text-yellow-700, high = red-100 text-red-700.

File-targeted prompts reduce the risk of Bolt making unexpected changes in unrelated files.

The Lock File

When you want to protect a file from AI modification, you can lock it in Bolt's file explorer. Locked files are read by Bolt (for context) but never written to. Use this for:

  • Configuration files that are known-good
  • Files with complex manual edits you don't want overwritten
  • Environment variable files

Prompting for Export

When your project is ready to leave Bolt:

text
Prepare this project for export. Check that:
1. All environment variables are referenced via import.meta.env
2. No hardcoded values that should be configuration
3. package.json has all required scripts (dev, build, preview)
4. The README reflects the current project state and setup instructions

Then use Bolt's export function to download the full project as a zip.

Working with the Terminal

Bolt exposes a terminal panel. You can run commands directly:

bash
npm install [package]
npm run build
npx supabase db push

The terminal is useful for one-off operations you don't want to do via AI prompt — package installations, build verification, or database migrations.

Key Takeaways

  • /clear resets context when the conversation degrades — always re-establish context after clearing
  • /fix with a specific problem description produces more targeted fixes than general descriptions
  • Lock files before making broad changes to protect known-good configuration
  • The revert history is your safety net — use it immediately when a change breaks something

---

Try It Yourself: In a Bolt project with at least 10 files, use /explain on a component or hook that you didn't write yourself. Evaluate whether the explanation is accurate by reading the actual code. If Bolt's explanation contains any inaccuracies, note them — this tells you how well it's tracking the current project state.