Code → Eval → HLD → LLD → Code

Code Eval HLD LLD Code

Why architecture design still matters — even when AI can generate the code

Every System Has a Natural Cell Wall

High-Level Design (HLD)

How the system interacts with the outside world — other services, APIs, teams, and users.

  • What are the system boundaries?
  • What is the global source of truth?
  • How do external consumers integrate?
  • What contracts are we committing to?

HLD answers the "what and where" before any line of code is written.

The Cell Wall Analogy

Most systems have a natural membrane — the boundary between what is internal and what is external. HLD defines that membrane; LLD defines what lives inside it.

Low-Level Design (LLD)

How the system works internally — implementation strategy, component architecture, and content decisions.

  • What is the local source of truth?
  • How should we handle caching?
  • What are the shared component patterns?
  • Where do we enforce clean architecture?
  • Light mode? Privacy policy links? Edge cases?

LLD answers the "how and why" — the decisions that cause scrambling at the last minute when left undefined.

Two Examples, Same Lesson

Project A HLD ✓ LLD ✗

Inter-system integration went smoothly — the external contracts were clear.

But with no LLD, implementation decisions were left undefined. Last-minute scrambling on UI details, content decisions, and cross-team alignment that mocks hadn't covered.

The absence of LLD is invisible until the very end.

Project B HLD ✗ LLD ✗

No HLD meant the broader system's sources of truth were unclear — ongoing churn on what the correct experience should even be.

No LLD meant every implementation decision was made ad hoc — architecture patterns, shared components, caching strategy, edge cases.

The churn wasn't a people problem — it was a missing design problem.

AI Changes the Loop — Not the Need

Vibe-Coded POCs as HLD Discovery

The fastest way to learn what your HLD should be is to let AI help you build a throwaway POC first.

A vibe-coded spike forces decisions into the open quickly — you discover the natural cell wall, the real external dependencies, and the integration friction you didn't know existed.

That is the beginning of your design — not the end of it.

The New Loop

Vibe code a POC  →  Eval  →  extract HLD  →  write LLD  →  build with AI  ↺

Eval gates what you learned from the POC before committing to a design. In theory, an agent team can run this whole cycle autonomously.

What Each Stage Produces

  • POC (vibe code) — fast discovery; reveals real constraints; disposable
  • Eval — assess what the POC revealed; gate the design before committing
  • HLD — system boundaries, external contracts, global source of truth
  • LLD — implementation strategy, component patterns, content decisions, edge cases
  • Final code — built with AI on a defined foundation; loop back via Eval ↺

Skipping HLD or LLD doesn't save time — it defers the cost to the worst possible moment: launch week.

The Loop Also Works on Existing Code

The Refactor Loop

Take an existing codebase. Add solid end-to-end tests. Then run an agent loop repeatedly:

Code Eval HLD LLD Code

Iterate until Eval scores hit a quality threshold. In theory, this is a workflow you can just apply to improve any codebase.

What makes it work

The HLD step is where you steer — you can generate an HLD from the existing code but guide it toward a target architecture. The agent loop does the rest.

Example: Refactoring to a New Architecture

Say you want to move a service from one runtime to another — or restructure it entirely. You don't start from scratch.

  • Extract an HLD from the existing code
  • Rewrite the HLD toward the target architecture
  • Generate an LLD from that new HLD
  • Let the agent loop produce and validate the code
  • Eval gates ensure you don't regress

The tests are the contract. The Eval is the judge. The loop is the engine. The designs are the steering wheel.

The One Rule

Always Do Both

For any important app, service, or feature: write an HLD and an LLD before you build for real.

  • HLD prevents integration surprises
  • LLD prevents implementation churn
  • Together they make AI-generated code far more reliable
  • They are also how you onboard teammates fast

Neither has to be a 20-page doc. A half-page HLD and a one-page LLD are infinitely better than none.

HLD without LLD

System integration works. Last-mile implementation decisions cause scrambling — often right before launch.

Neither HLD nor LLD

Churn at every level: sources of truth unclear, experience undefined, every decision made twice.

Why This Matters More with AI

AI can generate code faster than you can review it. Without an HLD and LLD, it will confidently build the wrong thing — coherently and quickly.

The design work is now the bottleneck. Treat it accordingly.

"Hindsight is 20/20 — but one learning is to always do an HLD and an LLD if it's an important app or service."

1 / 6