Custom instructions in v0

In v0 there are three places where you can add custom instructions that are added to your messages

Using these well will guide v0 into producing better code for you

account custom instructions

Find these in Settings → General

The custom instructions in your account are for your own personal preferences and will apply to all generations you make on v0, across all your projects and chats.

These will be included in all messages you send, so keep them brief but focused

  • When debugging an undefined or null value, always attempt to fix the root cause that led to it being undefined rather than accepting it as optional
  • Never use any. If you can’t determine the type statically, use unknown with runtime checks
  • look for existing patterns in the codebase and copy those instead of introducing new ones

project instructions

Find these in Project → Knowledge

Project instructions are sent with every message within that project, but otherwise behave the same as the account custom instructions.

If multiple people are working on the project, keep in mind these will be shared and affect other peoples’ messages as well.

  • We use React 19 and React Compiler so we do not need to memoize anything
  • Always derive data in render instead of syncing it with useEffect
  • Colocate components in the same directory as they’re used
  • Treat API responses as unknown and use Zod to validate them

project sources

Find these in Project → Knowledge

These are files v0 can reference for extra context if it decides it’s relevant to the message you’re sending. These are not attached to all messages in a project, just the ones that seem related. That means they can be longer than your custom instructions without adversely affecting your overall token budgets.

  • If you are using a library that v0 doesn’t know very much about, adding its documentation or llms.txt as a source can be very helpful
  • Use good filenames that tell v0 when to include it. If you add the llms.txt file from StackAuth, name it stack-auth.txt instead.
  • routes.txt will be read any time v0 has to make new routes for you. I use this to get separate page.tsx (just for data fetching) and page-client.tsx (big component for most of the page) files
  • don’t add a style-guide.txt here since it won’t always be read. Keep that in project instructions
4 Likes

I learned something new today. Thanks for sharing these @jacobparis :clap: