Back Original

Cursor AI Best Practices: Using the Gold Standard Files Workflow for Precise Results

This is a part of my “AI in SF” series, where I share real AI engineering workflows of SF startups. I recently interviewed an engineer from Pallet (they’re hiring - more on that at the end). Here’s an insight that will make your AI-generated code better.

Most developers use Cursor like expensive autocomplete. They let it generate whatever code it wants, fight with inconsistent outputs, and spend more time debugging AI mistakes than they save.

There’s a better way. During my interview with Vidhur from Pallet, I learned about a simple technique that made their AI-generated code dramatically better: the “gold standard” file approach.

What Is a Gold Standard File?

You pick one ideal file for each common pattern in your codebase and reference it in your .cursorrules file. Think of it as showing Cursor your team’s style guide through working examples rather than abstract rules.

For a typical backend API following a controller-service pattern, you’d maintain three gold standard files:

The key insight: don’t let AI guess what good code looks like. Show it explicitly.

AI Gold Standard Files

Setting Up Your Rules File

Your .cursorrules file should point directly to these examples:

You are an expert software engineer. 

Reference these gold standard files for patterns:

- Controllers: /src/controllers/orders.controller.ts
- Services: /src/services/orders.service.ts
- Tests: /src/tests/orders.test.ts
Follow these patterns exactly. Don't change existing implementations unless asked.
Use our existing utilities instead of writing new ones.

How to Choose Your Gold Standard Files

I made something that does all of this for you automatically. If you’re interested, give it a try.

What Actually Changes

The transformation is immediate. Code reviews become faster because AI-generated code follows your established patterns instead of random internet examples. New code consistently looks like it was written by your senior engineers, not pulled from different tutorials. Junior developers start absorbing good patterns from AI-generated examples, accelerating their learning curve.

And the real win for startups — development velocity increases without sacrificing code quality. When you’re racing to product-market fit, you can’t afford to choose between shipping fast and maintaining clean code. This approach gives you both.

Beyond Just Code Generation

This approach works for any AI coding task. Testing, documentation, even complex algorithms - if you have a good example, AI can follow that pattern reliably.

The bigger principle: AI tools are only as good as the examples you give them. Feed them your best code, get better results.

Getting Started Today

  1. Find your best-written controller, service, and test files
  2. Create a .cursorrules file that references them specifically
  3. Add any anti-patterns you want to avoid
  4. Share with your team and iterate

This isn’t revolutionary AI technology. It’s just good engineering: showing tools what you want instead of hoping they guess correctly.

Pallet is hiring engineers who want to build AI agents grounded in real-world applications. They’re looking for people who understand that agents aren’t fully autonomous yet and take a pragmatic approach to AI reliability. If you want to work on logistics AI with a team that accepts agents are imperfect and builds proper guardrails around them, check out the Pallet careers page.

Further Reading

If you found this post useful, please consider sharing it with your friends and colleagues. Your support is my biggest motivation.

P.S. Frustrated by AI forgetting existing code and making mistakes? I built something for codebases large enough that AI loses track. Loved by devs from Google, Uber, and more. Check out Giga AI.