Building
Build and debug anything with AI. Leverage the right models, shortcuts, and prompts to do anything at lightning speed.
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:
Then use this prompt template:
Debugging
When debugging issues, you have two approaches:
Option 1: Direct Bug Report
Start a new Composer session and paste the following prompt:
Option 2: Using jam.dev (Recommended for Complex Bugs)
For complex bugs, use jam.dev to capture all the context in one place:
- Install the jam.dev browser extension
- 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:
Add a new feature
For optimal feature implementation, use a hybrid approach:
- 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)
- Now that we have the plan, start a new Agent session to implement the feature:
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:
Learning a new Concept
When learning a new concept, use Cursor Composer to create an isolated environment to experiment:
Example: Learning async/await in JavaScript
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:
This creates a repomix-output.txt
file containing your codebase in an AI-friendly format. You can then use this with:
-
DeepSeek r1
- On-par with o1 for reasoning through complex codebases
- Completely free to use
- Available here
-
o1-pro
- For extremely complex bugs where you need maximum reasoning power
- Requires an OpenAI subscription
- Available here
-
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:
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
-
Follow quick installation guide for aicommits
-
Set alias:
- Now you can just run
gagc
to add all files to git and generate a commit message based on the file changes