Skip to main content

Using Cursor with Convex

Cursor, the AI code editor, makes it easy to write and maintain apps built with Convex. Let's walk through how to setup Cursor for the best possible results with Convex.

Add Convex .cursor/rules

To get the best results from Cursor put the model specific .mdc files in your project's .cursor/rules directory.

We're constantly working on improving the quality of these rules for Convex by using rigorous evals. You can help by contributing to our evals repo.

Install and run Convex yourself

Keeping Convex running is crucial because it automatically generates the client-side types. Without this, the agent can get stuck in a linting loop since it can't access the types for the queries and mutations it created.

We recommended that you install (npm install convex) and run convex (npx convex dev) yourself in a terminal window.

Keep your requests small

The best results when using agentic LLMs can be found when keeping the amount of changes you want to make small and git commit frequently. This lets you be more specific around the context you provide the agent and it means the agent doesn't need to do a lot of searching for context.

After each successful prompt or series of prompts it is a good idea to commit your changes so that its simple to rollback to that point should the next prompt cause issues.

Update and reference your README.md

The agent needs context about the specific business goals for your project. While it can infer some details from the files it reads, this becomes more challenging as your project grows. Providing general information about your project gives the agent a helpful head start.

Rather than including this information in each prompt, it's better to write a comprehensive README.md file in your project root and reference it.

Some people advocate for crafting a Product Requirements Document (PRD), this may be a good idea for more complex projects.

Add Convex docs

Adding Convex docs can let you specifically refer to Convex features when building your app.

From Cursor Settings > Features > Docs add new doc, use the URL "https://docs.convex.dev/"

Chat UI

Cursor will then index all of the Convex docs for the LLM to use.

Chat UI

You can then reference those docs in your prompt with the @Convex symbol.

Chat UI

Add more Convex knowledge

You can perform the above steps for https://stack.convex.dev/ too if you would like to provide even more context to the agent.