AI Series · 20

AI Coding Fails Without Design First

Same model, two prompts. One leaves every decision to guesswork, the other is a small system design — and that gap is the whole result.

A mirror selfie of two young men in cream shirts in a plain unfinished room, one of them holding a phone up to take the picture.

A lot of AI coding problems start before you ever open the chat. You type "Build a login system for my app", read what comes back, and wonder why it feels generic, why it doesn't fit the project you already have, why it needs so much fixing.

The problem usually isn't the AI. You didn't give it enough to work with.

The Prompt That Guesses

Take a basic one:

Create a user authentication system for my app.

It reads like a finished instruction. It isn't. Every decision that actually shapes the code is missing from it, and the model can't leave those decisions blank — it has to fill them in from the most common patterns it has seen. You get an answer built for an average project, and yours is not the average project.

What The AI Has To Guess

  • Which database. Postgres, MySQL, Mongo — the schema, the queries, and half the error handling change with the answer.
  • Which backend. A Node and Express codebase and a Django one want different shapes for the same feature.
  • How your project is already structured. Where things live, what your modules are called, which conventions the rest of the code already follows.
  • What kind of authentication you want. Sessions, tokens, a hosted provider — three different systems wearing the same word.
  • What your security requirements are. Password hashing, token lifetimes, how strict the login path has to be.
  • What happens at the edges. Refresh tokens, roles, rate limits — the parts that decide whether the thing survives contact with real users.

None of that is exotic. It's just work you hadn't done yet, so the model did it for you, quietly, and you inherited its defaults.

The Same Request, Designed

Now compare it with a prompt written after actually thinking the system through:

Build a JWT-based authentication system for my Node/Express + PostgreSQL app. The users table has email, hashed password, and role (admin/user). Implement signup, login, refresh-token rotation, and rate limiting for login attempts. Follow the existing project structure and keep authentication inside the "/auth" module. Don't use third-party authentication providers.

Same AI. Same model. Completely different result. The second prompt isn't really a request — it's a small system design, written down.

Weak Prompt Versus Designed Prompt

What it settles "Create a user authentication system" The designed version
Stack Left to the model Node/Express and PostgreSQL, stated
Data model Invented Email, hashed password, role
Scope Open-ended Signup, login, refresh rotation, rate limiting
Fit with your code Ignored Existing structure, inside the "/auth" module
Exclusions None No third-party providers

The right-hand column is not longer for the sake of being longer. Every line in it is a decision that would otherwise have been made without you.

How I Approach It Now

  1. Think about the system first. Even a rough sketch is enough. What are the components, how do they talk to each other, where does the data go.
  2. Understand the things you don't know. If you're unsure about something, research how it applies to your specific system, not just the general definition of it.
  3. Give the AI the context. Your stack, your existing structure, your requirements, your constraints, and the things you specifically don't want.
  4. Let the AI build. Then compare what it produced against the design you had in mind, instead of accepting it because it runs.

What You Are Not Building

Before you ask for anything, four questions: What am I building. How should the pieces connect. What are my constraints. And what am I not building.

That last one is underrated. Most of the confusion in an AI-written feature comes from scope nobody bounded — extra abstractions, a provider you never wanted, an admin panel you didn't ask for. Naming the exclusions costs one line and saves an afternoon.

AI can give you incredible speed. It can't know the decisions you never made.

Think through the system first, then let AI handle the execution.

So which one are you doing — designing before you prompt, or prompting and hoping?

Tagsai-codingprompt-engineeringsystem-designarchitectureai-tools

Originally published on LinkedIn.

Comments

No comments yet — first word is yours.

Leave a comment

Comments are read before they appear, so yours will not show up straight away.

Read the series — AI Series

AI Series index
  1. 01AI Gives Everyone New Opportunities
  2. 02What AI Really Is
  3. 03The Power of Prompts
  4. 04Prompt Structure and Real Examples
  5. 05How to Pick the Right AI Tool
  6. 06Combine AI Tools Like a Digital Team
  7. 07Build Your Own AI System (No Coding Needed)
  8. 08Think Like AI
  9. 09Staying Updated in AI
  10. 10The Future of AI and How It Changes Our Work
  11. 11How Small Businesses and Freelancers Can Use AI
  12. 12From ML to Agents: How AI Actually Evolved
  13. 13Build a Website for Free Using AI (Zero Experience Needed)
  14. 14GPT-6 Just Landed. The Model War Isn't About Chatbots
  15. 15AI Agents Are Taking Over Enterprise Workflows
  16. 16$242 Billion Went Into AI in One Quarter
  17. 17AI Now Performs at Expert Level in 44 Professions
  18. 18AI Is Consuming More Power Than Countries
  19. 19From "I Need A Website" To "My Website Is Live" With AI
  20. 20AI Coding Fails Without Design First (this piece)
  21. 21How to Vibe Code Properly in This Era
Muhammed Nasvih V

Muhammed Nasvih V

Lead DevOps Engineer & Technical Lead · Jeddah, Saudi Arabia

Writes The Stack Notes — field notes on infrastructure, AI, money and work. Cloud infrastructure, CI/CD, security and automation at Code7 Information Technology.

Trying to put AI to work inside a stack you already run? That is the kind of review I take on for businesses. Start an IT / cloud enquiry.

Back to The Stack Notes