AI Coding Anti-Patterns: 6 Mistakes That Waste Tokens and Break Flow
I stared at my terminal. The AI had just produced completely broken code for the third time in a row. I’d been chatting with it for two hours, pasting logs, explaining requirements, re-explaining context. Something was wrong with my workflow.
Turns out, I was making every mistake in the book. Here are the six anti-patterns that were killing my AI coding productivity.
The Six Anti-Patterns
1. The Kitchen Sink Session
I used to dump everything into one chat: requirements discussion, architecture decisions, code changes, debugging, review. All mixed together.
# What I did (anti-pattern)
Me: "I need to add user authentication. The app uses Express and MongoDB.Let me paste the entire user model and all routes... [500 lines of code]...Also don't forget we have a rate limiter and we need to add 2FA support andthe password reset flow should send emails and..."The problem? Requirements and implementation polluted each other. Context bloated. By the time we got to code, the AI had lost track of what mattered.
The Fix: Separate Sessions
Session 1 (Requirements): Define scope, write task brief, DONE.Session 2 (Planning): Read task brief, create plan, DONE.Session 3 (Implementation): Read plan only, code, DONE.Each session has one job. Clean context in, focused work out.
2. The Abstract Principle Dump
I wrote these long, beautiful prompts filled with abstract principles:
# What I did (anti-pattern)
Me: "Always follow SOLID principles. Write clean code. Be DRY but notat the expense of clarity. Ensure backward compatibility. Use defensiveprogramming. Follow the existing patterns. Make it testable. Ensurethe code is maintainable and well-documented..."Sounds comprehensive, right? But it was unverifiable. “Clean code” means nothing to an AI without concrete examples.
The Fix: Externalize + Executable
# task-brief.md (referenced, not pasted)
Constraints:- No changes to src/auth/*- Response format must match docs/api.md
Verification:- Run: npm test (must pass)- Check: curl localhost:3000/health (must return 200)External files. Executable checks. No ambiguity.
3. Pushing Through Context Decay
I could feel it. The AI’s responses were getting worse. It forgot things I’d said earlier. It started making obvious mistakes.
But I kept going. “One more prompt, I can fix this.”
# What happened
Context window: 180K / 200K tokensAI output quality: degradingMe: "Just fix this last thing..."Result: Broken code, wasted time, frustrated restart anywayThe Fix: Restart Discipline
When context hits ~80% capacity or quality drops:
- Create handoff file: current state, remaining tasks, key decisions
- Start fresh session
- Read handoff file only
Fresh context = fresh quality. Always.
4. The Mega-Session
I tried to do everything: explore the codebase, plan the approach, implement the solution, debug issues, review the code. All in one session.
+------------------+| Explore || Plan | <-- All in one session| Implement || Debug || Review |+------------------+ | v Context soup. Roles mixed. Boundaries gone.The Fix: Phase Approach
Phase 1: Explore → Plan (save to file) ↓Phase 2: Implement (new session, clean context) ↓Phase 3: Review (new session, fresh eyes)Each phase gets its own context. Each phase stays focused.
5. Log Vomit
Tests failed. I pasted the entire output. All 2000 lines.
# What I did (anti-pattern)
Me: *pastes 2000 lines of test output*
PASS src/utils/format.test.tsPASS src/utils/date.test.ts... 1900 more lines ...FAIL src/auth/login.test.ts... actual error buried at line 1850 ...The real error was buried. Tokens wasted. Context polluted.
The Fix: Filter First
# Before pasting, filternpm test 2>&1 | grep -A5 "FAIL\|Error" | head -50
# Now paste only the 50 lines that matterOr use a subagent: “Find and fix the test failures” (lets the AI read logs itself).
6. The Verbal Repetition Loop
Every session, I repeated the same rules:
# What I did (anti-pattern)
Me: "Remember, don't touch the auth module. We need backwardcompatibility. Don't upgrade dependencies. Add tests. Matchthe API spec. Use TypeScript strict mode. No console.log..."
# Every. Single. Session.# Expensive. Unstable. Forgotten.The Fix: One-Time Configuration
# CLAUDE.md (project instructions, checked into repo)
## Constraints- No changes to src/auth/*- Preserve API response format
## Testing- Run: npm test- Coverage threshold: 80%AI reads this automatically at session start. No repetition needed.
The Pattern Table
| Anti-pattern | Consequence | Fix |
|---|---|---|
| Mixed-purpose sessions | Context pollution | One session, one job |
| Abstract principles | Unverifiable | Externalize to files |
| Ignoring decay | Quality loss | Restart at 80% capacity |
| Mega-sessions | Role confusion | Phase approach |
| Log dumping | Token explosion | Filter or use subagents |
| Verbal repetition | Expense + instability | One-time file config |
The Why
Every anti-pattern stems from the same misconception: treating AI sessions as unlimited conversation partners.
They’re not.
Context is a resource. Every token costs money. Every mixed message degrades quality. Every restart loses information.
The patterns work because they respect the constraints:
- Separation: Clean context for clean output
- Externalization: Files don’t forget, prompts do
- Discipline: Fresh sessions over struggling through decay
- Phasing: Focused work beats scattered effort
- Filtering: Less noise = better signal
- Automation: Files over verbal repetition
Common Meta-Mistakes
- “One more prompt will fix it” - No, a fresh session will
- “More context is better” - No, clean context is better
- “I’ll just paste the whole thing” - No, filter first or use subagents
- “The AI will remember” - No, it won’t between sessions
The Takeaway
I wasted hours before I understood these patterns. Now my workflow looks like this:
1. Create task brief (separate session)2. Plan implementation (separate session)3. Implement (clean context, read plan only)4. If context bloats → handoff file → restart5. Review (fresh session, fresh eyes)Clean context is productive context. Respect the resource, and the AI will respect your time.
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