Best Practices for AI Coding Assistants: Avoiding Common Mistakes
I burned through half my weekly Codex limit in one session and got nothing usable.
That’s the painful lesson from a developer who let an AI agent run autonomously for 6 hours. The result? Poor code, wasted budget, and a realization: “I understand that 99.9% of the problem lies in my flawed approach to development.”
This resonated with me. I’ve made similar mistakes. The problem isn’t the AI - it’s how we use it. Here’s what I’ve learned about working effectively with AI coding assistants.
The Five Common Mistakes
Mistake 1: Giving AI Too Much Autonomy
+-------------------+ +-------------------+| What Happened | | What Should Happen|+-------------------+ +-------------------+| "Build an app" | | "Create user model|| | | with email field"|| 6 hours later... | | || | | 15 min later... || Token budget: 50% | | Token budget: 2% || Usable code: 0% | | Usable code: 100% |+-------------------+ +-------------------+AI lacks project context. It doesn’t know your coding standards, your existing patterns, or your unwritten requirements. Every minute it runs without your input, it drifts further from what you actually need.
Mistake 2: Vague Specifications
The worst prompt I’ve seen:
"Build me an app"This isn’t a prompt. It’s a wish. AI fills gaps with assumptions, and those assumptions are rarely what you want.
Mistake 3: Skipping the Planning Phase
When I jump straight to code generation, I always regret it. AI will generate something - but without a plan, that something rarely fits together.
NO PLANNING: WITH PLANNING:+------------------+ +------------------+| Generate | | Plan features || Generate | | Break into tasks || Generate | | Order tasks || Fix conflicts | | Generate task 1 || Refactor | | Generate task 2 || Rewrite | | Generate task 3 |+------------------+ +------------------+ Time: 4 hours Time: 1.5 hours Tokens: High Tokens: Low Quality: Poor Quality: GoodMistake 4: Not Reviewing Incrementally
The Reddit user let AI run for 6 hours before checking results. By then, problems had compounded. Small issues became architectural problems.
Mistake 5: Ignoring Token Costs
$20/month tier example:+----------------------------------+| One 6-hour autonomous session || = ~50% of weekly limit || = $10 burned || = 0 usable features || || Same feature, done right: || = 30 min planning || = 10 focused prompts || = $2 spent || = Working feature |+----------------------------------+The Right Approach
The Golden Rule
Break everything into small, reviewable chunks.
I’ve found that each AI task should take about 15 minutes. This isn’t arbitrary - it’s the sweet spot where:
- Output is complete enough to review
- Problems are caught before compounding
- You maintain momentum with quick wins
- Token costs stay predictable
Task Breakdown Strategies
Instead of: “Build user authentication”
+----+---------------------------+----------+| # | Task | Time |+----+---------------------------+----------+| 1 | Design auth schema | 15 min || 2 | Create user model | 15 min || 3 | Implement password hash | 15 min || 4 | Build registration API | 15 min || 5 | Build login API | 15 min || 6 | Add session management | 15 min || 7 | Implement logout | 15 min || 8 | Add middleware protection | 15 min |+----+---------------------------+----------+| | Total | 2 hours |+----+---------------------------+----------+Instead of: “Create the dashboard”
+----+---------------------------+----------+| # | Task | Time |+----+---------------------------+----------+| 1 | Define dashboard layout | 15 min || 2 | Build sidebar component | 15 min || 3 | Create metric cards | 15 min || 4 | Implement data fetching | 15 min || 5 | Add loading states | 15 min || 6 | Handle error states | 15 min || 7 | Add refresh functionality | 15 min |+----+---------------------------+----------+| | Total | 1.75 hrs |+----+---------------------------+----------+The SPEC Framework for Prompts
I use this structure for every prompt:
+------+----------------------------------------+| S | State the goal clearly || P | Provide context and constraints || E | Exemplify with code or patterns || C | Clarify success criteria |+------+----------------------------------------+Good Prompt Example
Create a React hook for debouncing a value.
CONTEXT:- This is for a search input in a dashboard- Need to prevent API calls on every keystroke
REQUIREMENTS:- TypeScript with proper types- Default delay of 300ms- Cleanup on unmount- Return the debounced value
REFERENCE PATTERN:function useExample<T>(value: T): T { // implementation}
SUCCESS CRITERIA:- Works with string and number types- Cancels pending updates on unmount- Handles rapid value changes correctlyBad Prompt Example
"Make me a debounce hook"The difference is clear. The good prompt gives AI everything it needs to succeed. The bad prompt forces AI to guess.
The Review-Refine Loop
+------------+ +------------+ +------------+| Generate | --> | Review | --> | Refine || | | | | || AI creates | | I check | | AI fixes || code | | for issues | | specific || | | | | problems |+------------+ +------------+ +------------+ ^ | | v +-------------------------------------+ (until satisfied)When to Regenerate vs. Edit
REGENERATE WHEN: EDIT WHEN:+------------------------+ +------------------------+| Fundamental approach | | Small fix needed || is wrong | | || | | Single issue to || Multiple issues | | address || compound | | || | | Clear understanding || Would take longer to | | of the fix || explain fixes | | |+------------------------+ +------------------------+Cost Management
Model Selection Strategy
+-------------------------+------------------+| Task Type | Model Choice |+-------------------------+------------------+| Simple utilities | Faster/cheaper || Code review | Lighter model || Bug fixes | Capable model || Architecture decisions | Premium model || Complex refactoring | Premium model |+-------------------------+------------------+Efficiency Patterns
- Reuse prompts with variations - Template your common requests
- Reference previous outputs - “Like the UserCard but for Products”
- Summarize context efficiently - Don’t repeat project context
- Avoid repeating information - AI remembers within a conversation
Token Budget Planning
Before Session:+------------------+------------------+| Available Tokens | [amount] || Session Budget | [amount] |+------------------+------------------+
During Session:+------------------+------------------+| Task | Tokens Used |+------------------+------------------+| User model | ~500 || Auth endpoints | ~800 || Dashboard UI | ~1200 |+------------------+------------------+| Remaining | [calculate] |+------------------+------------------+Workflow Templates
Starting a New Feature
1. Write requirements (5 min) - What does it do? - What are the edge cases? - What's out of scope?
2. Break into tasks (5 min) - Each task: single responsibility - Clear input/output - ~15 min to implement
3. Order tasks (5 min) - Dependencies first - High-risk items early - Quick wins for momentum
4. Generate first task (15 min)5. Test immediately (5 min)6. Repeat for remaining tasksDebugging with AI
1. Describe the bug - Expected behavior - Actual behavior - Steps to reproduce
2. Share context - Relevant code - Error messages - Environment details
3. Ask for hypothesis, not just fix - "Why might this happen?" - "What could cause this?"
4. Verify fix doesn't break other things5. Document the solutionCode Review with AI
1. Share code with specific concerns - "Review this for security issues" - "Check for performance problems"
2. Get suggestions, not mandates - AI recommends, you decide
3. Apply judgment to suggestions - Not every suggestion is right
4. Verify changes workRed Flags to Watch For
+----------------------------------------+| You're misusing AI if: |+----------------------------------------+| - Prompts are paragraphs long || - Can't explain what AI generated || - Spending more time fixing than || building || - Token costs exceeding expectations || - No clear task boundaries || - Results are consistently wrong |+----------------------------------------+Course Correction
When you notice these signs:
- Stop - Don’t continue down the wrong path
- Assess - What’s going wrong?
- Break down - Make tasks smaller
- Add context - Be more specific
- Review incrementally - Check each step
Key Takeaways
- Small tasks beat large autonomous requests - 15-minute chunks are optimal
- Context and constraints improve output - Vague prompts get vague results
- Review and verify incrementally - Catch problems before they compound
- Track costs and adjust strategy - Token budgets are real constraints
- AI accelerates good developers - It doesn’t replace judgment
The Reddit user’s $10 lesson is valuable. They could have built the same feature with:
- 30 minutes of planning
- 10 focused prompts (~5000 tokens)
- 1 hour of development
- Better code, lower cost, faster delivery
The key insight: AI is a force multiplier for developers who know how to use it. It amplifies your process - whether that process is good or bad. Fix the process first.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments