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.

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.

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

Essential Keyboard Shortcuts for Cursor

If you’re not already using Cursor, you should be. Check out the Pre-Requisites guide

The fastest way to get my keyboard shortcuts setup:

  1. Make sure you have Cursor installed and open
  2. Install my Complete Profile
  3. It will automatically ask to open in Cursor. Click “Create”

This will give you my exact profile including all shortcuts, extensions, and settings.

Some of my most-used shortcuts (Mac-specific):

  • Cmd + P: Quick Open (search for files)
  • Cmd + Shift + P: Command Palette (access all commands)
  • Cmd + Shift + F: Global search across the codebase
  • Ctrl + backtick: Toggle terminal
  • Option + Up/Down Arrow: Expand text selection
  • Cmd + Option + Left/Right Arrow: To easily navigate back and forth between cursor positions
  • Cmd + /: Comment/Uncomment code
  • Cmd + B: Open left sidebar file tree
  • Cmd + L: Open Cursor AI Chat interface to chat with files or the entire codebase (using either @codebase or Cmd+Enter when asking a question to let it use the entire codebase context)
  • Cmd + I: To open Cursor AI Composer interface when you want Cursor to help you implement a new feature, fix a bug, refactor code, etc. autonomously (Most Powerful Cursor Feature!)
  • Cmd + K: 2 uses:
    • When inside a file -> Lets you generate new code where the pointer is currently (with an AI prompt), or edit the selected code (with an AI prompt)
    • When in the terminal -> Lets you ask the AI to generate a command to run in the terminal

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).

Using Cursor Composer, you can use the following prompts to:

Fix a bug

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:
[Client console logs]

Server logs:
[Server 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 happening, then add DEBUG logs to all the right files to help us pinpoint the issue.

Add a new feature

Start a new Composer session and paste the following prompt:

[Explain the feature in your own words]

Does that make sense?

[tag any relevant files or folders]

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

Use chain of thought reasoning to efficiently and accurately implement the feature, explaining how the feature will work.

Let me know if I need to make any changes to the database and provide the schema updates, or if I need to connect and setup a third party provider.

Remember, I'm using [npm/pnpm/yarn], so if this feature requires any new dependencies, help me add them.

Add any relevant tests (if I already have a testing library installed). Otherwise, just tell me how I can test this feature manually.

Refactor codebase

Our codebase should remain maintainable at every stage.

Try to:

  • Keep individual files under 400 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

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