All the tips and tricks I’ve learned over the years to speed up my workflow and build features or fix bugs at lightning speed.

Avoid brain rot ‘vibe coding’ by blindly accepting changes. You should read and review changes so that you learn and become a better engineer as you build.

Editor Efficiency

We’re using Cursor for all our code editing. It’s a powerful AI-powered editor that can help you write code faster and more efficiently.

If you haven’t set up Cursor yet, follow our Pre-Requisites guide to get your editor configured with all the recommended settings and shortcuts.

Check out this Masterclass to quickly get familiar with all the most important features.

Prompt Engineering

Crafting effective prompts is an art. AI modals can hallucinate if they aren’t given enough context, my best tips:

  • Be Specific: Clearly state what you want the AI to do in your own words.
  • Provide Context: Tag the right files/folders to give the AI enough information to understand roughly where to make changes (preventing hallucinations).

Research

Before implementing any feature, research the best approach using Perplexity Deep Research.

First, get your codebase structure:

tree -I 'node_modules|.git' | pbcopy

Then use this prompt template:

I'm building a product with the following tech stack:

- [NextJS 15](https://nextjs.org/) - Full-Stack React framework
- [Supabase](https://supabase.com/) - Database Provider
- [Clerk](https://clerk.com/) - Authenticate your users (ban, impersonate etc.)
- [Stripe](https://stripe.com/) - Collect Payments
- [Plunk](https://useplunk.com/) - Send Emails Programmatically
- [DataFast](https://datafa.st/) - User Analytics for Actionable Growth (Know exactly which marketing channels are working)
- [UserJot](https://userjot.com/) - User Feedback/Bug-Reports and Product Roadmap
- [GetFernand](https://getfernand.com/) - Fast, Calm Customer Support
- [Vercel](https://vercel.com/) - Deployments without worrying about infrastructure (DDoS protection, etc.)

This is my package.json:

[Insert package.json file contents]

I'm also using pnpm as the package manager

Also here is the file tree:

[Insert file tree]

[Explain what feature you would like to create]

Give me a sufficient enough breakdown of the top 3 solutions and what libraries and providers I would need (if any), the pros and cons and any costs associated with the solution.

Generate a prompt for Cursor Composer that would give it enough context to build the feature autonomously

Debugging

When debugging issues, you have two approaches:

Option 1: Direct Bug Report

Start a new Composer session and paste the following prompt:

[Explain the bug in your own words] + [Attach a screenshot if applicable]

Does that make sense? Double check with me before you actually start making any changes.

Here are the relevant logs:

Client-side logs:
[Browser console logs]

Server logs:
[Server terminal logs]

[tag any relevant files or folders]

Take your time. Repeat back to me the problem so that I know you understand it (with an example)

Use chain of thought reasoning to efficiently and accurately solve the bug, explaining how the fix will definitely get rid of the bug.

Explain how I can test the fix to make sure it works.

If, however, you may not be sure why the bug is occuring, then add DEBUG logs to all the right files to help us pinpoint the issue.

For complex bugs, use jam.dev to capture all the context in one place:

  1. Install the jam.dev browser extension
  2. When you encounter a bug:
    • Click the jam.dev icon to start recording
    • Reproduce the bug
    • Click stop when done
    • Add any notes/comments
    • Share the jam link with Cursor

The jam will include:

  • Screen recording
  • Network requests
  • Console logs
  • State changes
  • React component tree
  • System info

Example prompt with jam:

Here's a bug I need help with. I've created a jam that shows the issue:

[Paste jam.dev link]

Can you help me understand and fix this issue?

[tag any relevant files or folders]

Add a new feature

For optimal feature implementation, use a hybrid approach:

  1. Start a Chat session to plan the feature implementation:

Use one of the more powerful reasoning models like DeepSeek R1, o1-pro, or Grok3. (You’ll have to use Repomix or RepoPrompt to pack the codebase into an AI-friendly format first and then use their respective model sites)

I want to add the following feature to my app:

[explain the feature in your own words in as much detail as possible]

Help me plan the implementation.

[Tag/paste relevant files]

Come up with the following:
1. Architecture design
2. Data flow
3. Edge cases
4. Performance considerations
5. Security implications

Focus on high-level design decisions and tradeoffs.

Take your time. Break it down into steps:

1. Database Changes:
- List any new tables needed
- Or list any new columns needed in existing tables
- Explain how these integrate with existing schema
- Provide the exact schema updates needed in @prisma/schema.prisma

2. Third-party Integration:
- List any new providers/services needed
- Provide setup steps and configuration
- List any environment variables needed

3. Dependencies:
- List any new packages needed (I'm using [npm/pnpm/yarn])
- Specify exact versions for compatibility

4. Implementation Plan:
- Break down the feature into small, manageable steps
- Reference relevant files and objects for each step
- Highlight any potential bottlenecks or challenges

5. Testing Strategy:
- Unit tests (only if unit testing is being done at the moment in this codebase)
- Integration tests (only if integration testing is being done at the moment in this codebase)
- Manual testing steps
- Edge cases to verify

Let me know if you need any clarification before we start implementing.

Once we're 95% confident (or more) about the plan, generate a plan in a new markdown file in the `features` folder at the root of the project.
  1. Now that we have the plan, start a new Agent session to implement the feature:
[tag the feature plan file]

Let's implement this feature following the plan above.

[tag any other relevant files or folders - if applicable]

This hybrid approach:

  • Reduces costs by up to 97% vs using a single model
  • Leverages DeepSeek R1’s superior reasoning for architecture/planning
  • Uses Claude Sonnet’s speed and accuracy for actual implementation
  • Prevents hallucinations through structured planning

Refactor codebase

Our codebase should remain maintainable at every stage.

Try to:

  • Keep individual files under 300 lines of code. Longer files:
    • Make AI tools more likely to hallucinate when analyzing your code
    • Are harder to understand and debug
    • Often indicate too many responsibilities in one file
  • Keep functions as small and focused as possible
  • Keep components as small and focused as possible

Doing so makes the codebase more maintainable and easier to understand/debug (especially for Cursor Composer).

If any of these heuristics are violated, then it’s a clear sign that an area of the codebase needs refactoring.

Start a new Composer session and paste the following prompt:

Please refactor this area of the codebase 

[Tag the relevant files or folders you want to refactor]

Does that make sense?

Take your time. Use chain of thought reasoning to efficiently and accurately refactor the code without breaking the existing functionality.

Once you're finished, explain what you did and how it has improved the codebase.

Learning a new Concept

When learning a new concept, use Cursor Composer to create an isolated environment to experiment:

Help me learn [concept/framework/library]. Create a minimal sandbox project that demonstrates its core functionality.

Structure:
1. Basic example showing core concept
2. Common patterns and idioms
3. Error handling and edge cases
4. Integration with other tools/libraries (if applicable)
5. Performance considerations and optimizations (if applicable)

Start with the most basic example possible, then we'll iterate to cover more advanced use cases.

See @Docs (tag the docs in Cursor) for more information on the concept.

or

See [insert link to specific article or blog post] for reference.

Example: Learning async/await in JavaScript

Help me learn async/await in JavaScript. Create a minimal sandbox project that demonstrates its core functionality.

Structure:
1. Basic example showing core concept
2. Common patterns and idioms
3. Error handling and edge cases
4. Integration with other tools/libraries (if applicable)
5. Performance considerations and optimizations (if applicable)

Use these pages from the MDN docs for reference:

- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await

This approach helps you:

  • Focus on one concept at a time without distractions
  • Get hands-on practice immediately
  • Build a reference implementation you can come back to later
  • Understand best practices and common patterns through examples

Complex Bug Fixing

Sometimes the default claude-3.5-sonnet modal isn’t enough and can start hallucinating on very complex bugs.

Not to worry. You can use Repomix to pack your entire codebase into an AI-friendly format.

Setup is simple:

brew install repomix

This creates a repomix-output.txt file containing your codebase in an AI-friendly format. You can then use this with:

  1. DeepSeek r1

    • On-par with o1 for reasoning through complex codebases
    • Completely free to use
    • Available here
  2. o1-pro

    • For extremely complex bugs where you need maximum reasoning power
    • Requires an OpenAI subscription
    • Available here
  3. Gemini-Exp-1206

    • Free alternative to o1-pro
    • Google’s most powerful model, available here
    • 2-million token context window!
    • Great for understanding complex architectural issues

Example prompt:

This file contains all the files in the repository combined into one.
I'm debugging an issue where [describe the bug].

Please:
1. Review the codebase
2. Identify potential causes
3. Suggest specific fixes with file locations

Key benefits:

  • AI-optimized output format
  • Automatic token counting for LLM limits
  • Respects .gitignore files
  • Built-in security checks for sensitive info
  • Multiple output formats (plain text, XML, Markdown)

Alias Commands

Speed up your workflow with alias commands.

Never think about commit messages again

  1. Follow quick installation guide for aicommits

  2. Set alias:

alias gagc='git add . && aicommits'
  1. Now you can just run gagc to add all files to git and generate a commit message based on the file changes