3 Keys to Coding with AI - My favorite Jr. Dev
If you could hire a junior developer who was an amazing team player but also an idiot-savant, would you do it? I feel like I just did. Bolt.new and Cursor Composer open up a world of possibilities for teams without software developers. Beware, though, because AI code composers might have a deep academic knowledge and the ability to write code very quickly, but they don't always have a great sense of when to apply that knowledge. This quickly leads to some unique challenges that you should consider when coding with these tools—much like working with smart junior developers. So, if you're thinking of having an AI developer join your team, make sure to follow these 3 keys to working with them:
1. Focus on the details—
GenAI Creativity isn't your friend: Just like working with a junior employee, GenAI can be overly eager. It will implement changes you didn't ask for, rewrite business rules it thinks you misstated, and overlook best practices to impress you with flashy features, often ignoring error handling or security. While this eagerness makes rapid prototyping a breeze, it can really slow down a more serious endeavour.
My recommendation: focus on the details. Business analysts and product managers will excel at working with GenAI coding because they're in the habit of writing down their requirements and thinking through edge cases. You need to do this too. Be explicit in the order things should happen in an application. It may seem obvious to you, but it won't be obvious to the AI— it will happily format your data after it's already written it to a database.
2. Give it a seat at the table
Ask for its opinion: GenAI knows all about the security best practices and error handling you should be implementing, but like a junior dev, it will assume you know what you're doing and not implement them beacuse you didn't ask it to. So invite it to the table. Ask it how it would improve your requirements. Get it to walk you step-by-step through its plans, and don’t shy away from clarifications. It will have a lot of opinions and will want to implement all of them—sometimes all at once.
Involve GenAI in the planning phase to get its insights and suggestions. This collaborative approach can lead to more robust and secure implementations. And hey, if you're working with junior developers, you should take the same approach: invite them to the table.
3. Make small changes; test often
It looks too good to be true because it is: Even with clear requirements, ask the AI to implement changes in small, incremental steps. Large changes across multiple files are prone to errors. Break down tasks, and get involved in understanding these smaller changes. It may feel slower, but it will save you hours of break-fix later.
Test each small change thoroughly. The AI is excellent at creating test plans and comprehensive sets of test data. Deploy small changes frequently to a staging environment, and monitor for issues. This iterative approach ensures stability and reduces the risk of significant bugs.
Deploy your small changes to a live environment— I'm hosting a live staging environment on Vercel and Supabase and I deploy a lot more often than I thought I would. If you're not paying attention, the AI will make mistakes like implementing database and API calls in the front-end or it will hardcode links to point towards urls that are on your PC (i.e. localhost) and while these might work on your laptop, they won't work well in a live environment.
Better yet, read the code. If you can't read code, think of this as a learning opportunity. There's no better way to learn than through play. And trust me, playing with GenAI coders is FUN. It is play. Hundreds of hours and millions of tokens later, it's my favourite game.
领英推荐
The initial honeymoon is exciting, but misleading
When I first started implementing changes with Bolt.new, there was a real honeymoon phase. We built so many things together so quickly— a sales enablement tool to replace a $20-50K annual recurring spend, a data processor to map product categories, and my son even made a riff on Flappy Bird called Flappy Walrus.
The rapid prototyping capabilities of Bolt.new have enormous potential. Moving fast is fun and exciting, but if you want to use those tools effectively and ensure they have an impact, there’s a lot more work to do. You have to find a place to actually host those changes (I use Vercel and Supabase).
Then you have to make sure the application performs: it needs to be fast, secure, and connected to other applications. Your security team will want to ensure everything passes muster. That means you’ll probably need a backend. Enter Cursor. It can help you code your full-stack, but that’s where you start to run into real context window limits. Check out the helpful hints at the bottom of the article on how to work within those limitations.
Ultimately, while the honeymoon phase was exhilarating, the real success lies in the follow-through. The tools' potential is immense, but realizing that potential requires careful planning and execution. By leveraging platforms like Vercel and Supabase, and ensuring secure, efficient, and integrated applications, we can truly harness the power of innovation. So, while the journey from idea to impact is challenging, it’s also incredibly rewarding—and worth every step.
Handy tips
Re-share the file(s) you're working on—compartmentalize your work and build things out one at a time in modules. GenAI's context window is shallow, it will forget what you told it 30 minutes ago - it will need you to reshare the code. If you don't re-share the database schema, it will make up field names that don't exist.
AI read comments too— Well commented code is a code reminder to the AI what it's doing without always having to explicitly tell it. But, like that junior dev, it won't really comment the code very well unless you explicitly tell it to do so! You can also create project context files or requirements files for it to reference.
Remind the AI what it's doing— Incremental implementation requires dilligence, if you're working on implementing each step in a flow one at a time (as you should), you will need to consistently remind it about the order of operations.