AI code generation tools are great at producing working code, but they often miss the mark on your team’s specific coding standards. You end up with generic functions that work fine but need manual cleanup to match your style guide. This wastes time and introduces inconsistency.
In this tutorial, you’ll learn how to configure Cursor to automatically generate code that follows your team’s exact coding standards. You’ll build a persistent style guide that Cursor references across all your coding sessions, ensuring every generated function matches your conventions from the start.
Understanding Cursor’s Default Code Generation
First, let’s see what happens when you generate code without any context. Open Cursor and create a new file called greeting.js
.
Press Cmd+K
(or Ctrl+K
on Windows) to bring up the inline edit prompt.
Notice the model selector showing “Auto”. This lets Cursor choose the best AI model for your request. You can click it to see options like Claude and Gemini, but “Auto” works well for most tasks.
Type “create a hello function” and press Enter.
Cursor generates a basic JavaScript function:
function hello() { // Simple hello function as requested return "Hello"; }
This code is correct but generic. It doesn’t follow any specific coding standards your team might have. Notice the Reject and Accept buttons at the bottom – click Accept to keep this code.
Clear the editor and try one more. Press Cmd+K
again and type “create an add function”.

Again, you get basic, working code:
function add(a, b) { return a + b; // simple add function as requested }
These functions work, but they probably don’t match your team’s style guide. Maybe you use arrow functions exclusively, avoid semicolons, or have a custom logging solution. Let’s fix that.
Using the Chat Panel for Detailed Instructions
For more complex requests, use the chat panel instead of inline edits. Press Cmd+L
(or Ctrl+L
on Windows) to open it.

Now provide specific coding standards in your prompt:
Create subtract function using arrow syntax, single quotes only, no semicolons, use debug() not console.log, use template literals
Look at the difference in the generated code:
const subtract = (a, b) => { const result = a - b debug(`result: ${result}`) return result }
The code now:
- Uses arrow syntax (
=>
) - Calls a custom
debug()
function - Uses template literals for string formatting
- Has no semicolons
Cursor followed every instruction because you were explicit about your requirements.
Leveraging Chat Context
The AI remembers context within your current chat session. Without repeating all those rules, type “create a divide function”.
The divide function automatically follows the same conventions:
const divide = (a, b) => { if (b === 0) { debug('Error: Division by zero') return undefined } const result = a / b debug(`result: ${result}`) return result }
Try once more with “create a multiply function”:

Again, the same style is preserved. This context is temporary though. Close your editor or start a new chat, and these rules disappear. That’s where Notepads come in.
Creating a Persistent Style Guide with Notepads
Notepads store instructions and context that Cursor can reference across different chats and sessions.
Look for the Notepads section in your Explorer sidebar. You’ll see an option to “Open Folder” or create a new notepad.

Click the notepad icon to create a new one. You’ll see it’s been named “Team Style Guide” and contains your coding standards:
# Team Style Guide ## Functions ALWAYS use arrow functions: const name = () => {} NEVER use function keyword ## Strings ALWAYS use single quotes: 'text' ALWAYS use literals for variables: `Hello ${name}` NEVER use double quotes or concatenation ## Semicolons NO semicolons at end of lines ## Debugging Use debug() for debugging output: - NEVER use console.log - Import it using import { debug } from './debug' ## Example const greet = (name) => { debug(`Processing ${name}`) return `Hello, ${name}` }
Applying Your Style Guide to New Code
Create a new file called test.js
and start a fresh chat to simulate coming back to your project later.
Type “create an add function” in the chat. Notice that without referencing the style guide, Cursor generates a basic function that doesn’t follow your standards.
Now let’s fix this. Type “create an add function @” and when the menu appears, select Notepads → Team Style Guide.
Press Enter and watch what happens. The AI reads your style guide and attempts to follow it:

Notice the AI is planning to create a separate debug.js
file because it interpreted “Import it using import { debug } from ‘./debug'” literally. This shows an important lesson: the AI follows instructions precisely, sometimes too precisely.
Click “Reject” to stop this action.
Handling Misinterpretations
When the AI misinterprets your instructions, provide clarification. The notepad shows that you’ve already addressed this by updating the debugging section:
## Debugging Use debug() for debugging output: - NEVER use console.log - Define debug function locally at top of file - Example: const debug = (message) => console.log(message)
This clearer instruction tells the AI to define the debug function within the same file rather than importing it.
Now with the improved style guide, type “create an add function @Team Style Guide” again:

The code is perfect:
const debug = (message) => console.log(message) const add = (a, b) => { debug(`Adding numbers`) return a + b }
The AI:
- Defined a local debug function at the top
- Used arrow function syntax
- Used single quotes
- Omitted semicolons
- Used the debug function instead of console.log
Building a Library of Context
You’re not limited to one notepad. Create multiple notepads for different aspects of your project:
- API Conventions
- Database Patterns
- Testing Standards
- Component Structure
Reference multiple notepads in a single prompt:
Create a user service @Team Style Guide @API Conventions
Next Steps
Now that you’ve configured Cursor to follow your coding standards, you can:
- Share your Team Style Guide notepad with colleagues
- Create project-specific notepads for different codebases
- Refine your instructions based on AI feedback
- Build a comprehensive library of coding patterns
Every function Cursor generates will now match your team’s established conventions, saving cleanup time and maintaining consistency across your codebase.
Remember: the clearer your instructions in the notepad, the better Cursor performs. Treat it like documentation for both your team and the AI.