Claude Code is incredible.
Until it tries to turn your simple feature into NASA’s mission control system.
You know exactly what I mean.
“Add email OTP login” becomes a 12-file authentication framework.
“Update the API route” spawns an entire middleware ecosystem.
“Fix this type error” somehow requires restructuring half your app.
I’ve been building Next.js app with Claude Code for months now. And I’ve finally figured out how to make Claude Code calm down and write surgical, minimal code instead of overengineered monuments.
Let me show you the exact prompt and workflow that transformed my development.
.
.
.
The Overengineering Pattern That Drives Me Crazy
Last week, I needed to add email OTP authentication to my Next.js app.
Simple requirement:
- User enters email
- System sends 6-digit code
- User enters code
- User gets authenticated
Here’s what Claude suggested in Plan Mode:
✱ Planning comprehensive authentication system... New architecture: ├── auth/ │ ├── providers/ │ │ ├── OTPProvider.ts │ │ ├── AbstractAuthProvider.ts │ │ └── AuthProviderFactory.ts │ ├── strategies/ │ │ ├── EmailOTPStrategy.ts │ │ └── BaseStrategy.ts │ ├── services/ │ │ ├── TokenService.ts │ │ ├── ValidationService.ts │ │ └── NotificationService.ts │ └── middleware/ │ ├── authMiddleware.ts │ └── sessionMiddleware.ts
15 new files. Abstract base classes. Strategy pattern. Factory pattern.
For email OTP.
Meanwhile, my existing Next.js app already had:
- NextAuth configured
- Email sending via Resend
- Simple session management
Claude just… ignored all of it.
This happens every single time. Claude defaults to building everything from scratch, as if you’re starting a new computer science textbook example.
.
.
.
Why Claude Code Can’t Help But Overengineer
Here’s what’s really happening:
Claude is trained on millions of “production-ready” code examples.
Enterprise patterns. Academic solutions. Tutorial architectures.
When you ask for a feature, it pattern-matches to these examples.
It thinks:
- “Authentication needs proper abstraction layers!”
- “What about future auth methods?”
- “Better add dependency injection!”
- “This should follow SOLID principles!”
It doesn’t think:
- “What’s already in this Next.js app?”
- “How can I use the existing setup?”
- “What’s the minimal change needed?”
The result?
Technically correct solutions that are practically absurd for a solo developer shipping features.
.
.
.
The Surgical Coding Prompt That Changes Everything
Here’s my workflow that turns Claude from an architecture astronaut into a surgical coder:
Step 1: Let Claude Create Initial Plan
Press Shift+Tab+Tab
for Plan Mode.
Let Claude present its overengineered plan.
When it finishes, you’ll see two options:
- Yes
- No, keep planning
Choose “No, keep planning”
Step 2: Apply The Surgical Coding Prompt
Now paste this exact prompt:
Think harder and thoroughly examine similar areas of the codebase to ensure your proposed approach fits seamlessly with the established patterns and architecture. Aim to make only minimal and necessary changes, avoiding any disruption to the existing design. Whenever possible, take advantage of components, utilities, or logic that have already been implemented to maintain consistency, reduce duplication, and streamline integration with the current system.
Step 3: Watch The Transformation
Claude will now:
- Activate extended thinking mode (31,999 tokens!)
- Actually examine your existing code
- Find what’s already there
- Propose a minimal solution
For my email OTP example, here’s what happened:
✱ Re-examining codebase with focus on minimal integration... Found existing infrastructure: - NextAuth already configured in app/api/auth/[...nextauth]/route.ts - Resend email service in lib/email.ts - Session handling via NextAuth Revised approach: 1. Add OTP adapter to existing NextAuth config 2. Create single API route for OTP generation 3. Extend existing email templates Total changes: 3 files, ~120 lines
From 15 files to 3 files.
From 1000+ lines to 120 lines.
Same functionality. 90% less complexity.
.
.
.
Why This Prompt Works So Well
The magic is in three parts:
“Think harder” – This triggers Claude’s extended thinking mode. Instead of the default 4,000 thinking tokens, it gets 31,999 tokens. That’s 8x more computational power to analyze your codebase.
“thoroughly examine similar areas” – This forces Claude to actually look at what exists before creating new stuff. It can’t just default to its training patterns.
“minimal and necessary changes” – This becomes the primary constraint. Not “best practices.” Not “extensibility.” Just: what’s the least I need to change?
Combined, they transform Claude from an eager junior developer who wants to impress you with design patterns into a senior developer who knows that the best code is often the code you don’t write.
.
.
.
Advanced Variations For Different Scenarios
The Pattern Detective:
Before suggesting any implementation, find and list 3 similar patterns already in this codebase. Then align your solution with the most appropriate pattern.
Perfect when you want consistency above all else.
The Deletion First:
Before adding any code, first check if we can achieve this by removing or simplifying existing code.
Incredible for refactoring or when you suspect you’re duplicating functionality.
The One-File Challenge:
Challenge yourself: Can this be done by modifying just one existing file?
Forces maximum constraint. Sometimes impossible, but always worth trying first.
The Next.js Native:
Prioritize Next.js 15's built-in features and patterns. List which Next.js native solutions you can use before creating custom implementations.
Keeps you aligned with framework best practices.
.
.
.
The Hidden Benefits Nobody Talks About
Benefit #1: Bugs Disappear
Less code = fewer bugs. Mathematical fact.
Existing code = tested code. Practical reality.
Minimal changes = minimal risk. Engineering wisdom.
Benefit #2: You Ship 5x Faster
No analysis paralysis about architecture.
No building unnecessary abstractions.
No refactoring to accommodate overengineering.
Just surgical changes that work.
Benefit #3: Your Codebase Stays Manageable
As a solo developer, every line of code is your responsibility.
Every abstraction is complexity you maintain alone.
Every pattern is something you need to remember.
Keeping it minimal keeps it maintainable.
Benefit #4: You Learn Your Codebase Deeply
The prompt forces Claude to explore thoroughly.
You see connections you missed.
Patterns become obvious.
Your existing code becomes your best documentation.
.
.
.
Common Mistakes To Avoid
Mistake #1: Skipping Extended Thinking
Remove “think harder” and you lose most of the benefit.
Those extra thinking tokens are what allow Claude to properly explore your codebase.
Always include it.
Mistake #2: Being Too Restrictive
Sometimes you genuinely need new architecture.
If your codebase lacks the foundation, build it.
But build it minimally and in your existing style.
Mistake #3: Not Iterating
First pass still too complex?
Run the prompt again with even more constraints.
Sometimes it takes 2-3 iterations to find the truly minimal solution.
.
.
.
Your Next Steps
- Save this prompt (bookmark it, pin it, tattoo it)
- Try it on your current feature
- Whatever you’re building right now
- Let Claude plan normally
- Then apply the surgical prompt
- Compare the approaches
- Track the difference
- Count files changed
- Count lines added
- Note complexity reduction
- Make it your default
- Every feature, every time
- Until minimal becomes natural
.
.
.
The Mindset Shift That Changes Everything
Stop asking: “What’s the proper architecture for this?”
Start asking: “What minimal change achieves this?”
In Next.js 15, you already have:
- Incredible routing
- Built-in API handling
- Server components
- Middleware capabilities
- Type safety
You don’t need to reinvent any of it.
You need to use what’s there.
Every line of code is future maintenance.
Every new pattern is cognitive overhead.
Every abstraction is complexity you own forever.
The best code isn’t the code that impresses other developers.
It’s the code that solves the problem and disappears into your existing architecture.
So perfectly integrated that you forget it was ever added.
.
.
.
A Challenge For You
Open Claude Code right now.
Look at your current task.
Ask yourself: “What if this could be done in just one file?”
Then use the surgical coding prompt.
See how close you can get.
I bet it’s closer than you think.
What overengineered solution are you going to surgically simplify today?
Stop planning spacecraft.
Start shipping features.
P.S. – That email OTP feature? 120 lines. Three files. Zero abstractions. Ships perfectly. Sometimes the best architecture is no architecture.
Leave a Reply