Architecture Before Prompting

AI ArchitectureMarch 2026
Darryl Mack
Darryl MackAI Architecture Consultant

Every AI-assisted development project hits the same wall. A company adopts AI coding tools. The team is talented. The first week feels like a breakthrough — features ship fast, prototypes appear overnight, demos impress stakeholders. The tools are doing what they promised.

Then week three arrives.

A routine change — adding a field, connecting a new data source, refactoring a shared component — takes four days instead of four hours. The codebase has become a patchwork of conflicting patterns. Functions that were generated independently now need to work together, and they can’t, because nobody defined the rules they should have followed.

Why Week Three

AI coding tools are optimized for the immediate prompt. Ask for a function, get a function. Ask for a component, get a component. Each output is locally correct — it does what you asked, and it does it well.

The problem is that software isn’t a collection of independent functions. It’s a system of interconnected decisions. How are IDs generated? How do async operations get handled? How does data flow between components? What happens when an API call fails? What patterns do error boundaries follow?

In traditional development, these decisions emerge gradually through code review, team conventions, and accumulated experience. AI tools don’t have that shared understanding. Each prompt is a fresh start. The function generated at 2pm has no awareness of the decisions made at 10am.

format_quote

"Week three is when the accumulation becomes visible. A change in one file breaks three others because they each assumed different patterns for the same operation."

What Architecture Means Here

When I say “architecture before prompting,” I’m not talking about a 50-page design document that nobody reads. I’m talking about four specific artifacts:

schema

Data model

The foundational structure that every component, every API call, and every AI-generated function builds on. When the data model is defined, the AI tool doesn’t have to invent how entities relate to each other.

rule

Coding standards

The rules that make generated code consistent. File organization, naming conventions, error handling patterns. These become the CLAUDE.md, the Cursor rules, the PR review checklist.

dashboard_customize

Component patterns

How the UI is structured so new features compose cleanly. When the pattern is defined, the AI tool generates components that fit the system instead of fighting it.

api

API contracts

How services communicate. What does a request look like? What does a response look like? When the contracts are defined, both sides of an integration can be generated independently and still connect.

These four artifacts don’t take months to create. On most projects, they take a couple of weeks. But those weeks determine whether the next three months of AI-assisted development produce a coherent system or a spaghetti code mess.

A Real Example

On a recent client engagement — an enterprise platform where inconsistency has real-world safety consequences — I designed a six-layer error handling architecture before any implementation code was generated.

Six-Layer Error Architecture

Layer 1
Error Classifier
Pure function → structured classification
Layer 2
Typed Responses
Discriminated union interfaces
Layer 3
Standard Wrapper
try/catch + classify + context
Layer 4
Data Access Layer
Per-service domain DAL functions
Layer 5
Error Navigation
Contextual redirect URLs
Layer 6
Error Pages
Dynamic server-rendered pages

Implementation Scope

94Story Points

Across 7 service modules

Pattern Consistency

100%Every DAL function

Follows the same wrapper pattern

When the AI tools started generating implementation code, every function followed the same patterns. The error classifier is a pure function that returns a specific shape. The wrapper function accepts a specific interface. The DAL functions provide a specific ErrorContext structure.

Without the architecture, the same AI tools would have produced functional code with different error shapes in different files, different redirect patterns, different monitoring approaches. The code would work in isolation and fail at every integration point. The architecture didn’t slow down the AI tools. It made their output usable without rewriting.

The Workflow

The principle extends beyond error handling. Here’s how it applies to an entire project:

edit_documentBefore opening any AI tool

Define the data model and entity relationships. Establish coding standards and file organization. Design component patterns and state management. Specify API contracts and error handling conventions. Document these as markdown files that travel between tools.

codeWhen using AI tools

Reference the architecture in every prompt context. Use the coding standards as rules files (CLAUDE.md, .cursorrules). Validate generated code against the patterns, not just against “does it work.” Treat the architecture documents as living artifacts — update them when decisions change.

The architectural artifacts serve double duty. They’re not just design documents for humans. They’re context files for AI tools. The same markdown that a new engineer reads to understand the system is the same markdown that Claude Code reads to generate consistent output.

This is why I call it architecture before prompting. The architecture is the prompt context. Without it, every AI interaction starts from zero.

The Objection

The most common pushback I hear: “But defining architecture up front slows us down. The whole point of AI tools is speed.”

This confuses two kinds of speed. There’s the speed of generating code (fast) and the speed of shipping a working system (the only speed that matters). AI tools maximize the first kind of speed. Architecture maximizes the second.

A team that generates code fast without architecture spends weeks three through twelve debugging integration issues, reconciling conflicting patterns, and rewriting code that was generated correctly in isolation but incorrectly in context. The time “saved” in week one gets spent three times over in month two.

Three days of architecture saves three months of rework. That’s not slowing down. That’s the fastest path to a system that actually ships.

The Principle

Architecture before prompting is a simple idea: define the foundational decisions before asking AI tools to generate code.

It’s not about documentation for its own sake. It’s not about perfection before progress. It’s about giving your team and your AI tools a shared foundation that makes fast output coherent instead of chaotic.

The teams seeing real results from AI-assisted development aren’t the ones with the best prompts. They’re the ones who defined the architecture first.

Darryl Mack

About Darryl Mack

AI architecture consultant helping engineering teams build software with AI development tools on proper foundations. 20+ years across product management, UX design, and full-stack development. Founder of Venture Maker.

Ready to Build Your AI Vision?

A 30-minute conversation will tell us both whether this is the right fit. No pitch — just an honest look at where you are and what would actually help.

Book a Free Consultation

Not ready for a call? Follow along for AI architecture insights.

LinkedIn