Putting AI-Generated Blocks into Your Working System
Source: Dev.to
Part 1: Why Vibe Coding Breaks Down
Last month, I spent an afternoon building a URL shortener with Claude.
The first prompt worked beautifully. Code appeared. Tests passed. I felt like a wizard.
By the fifth prompt, things got weird. The AI added features I did not ask for, changed the database schema twice, and could not remember what the API endpoints were supposed to be.
By the tenth prompt, I was no longer coding—I was negotiating with a machine that had forgotten the conversation we’d had twenty minutes earlier.
This is not a failure of AI. It is a failure of the method.
Most of us use AI the same way we use a search engine: we ask for something, we get an answer, we move on. That works for recipes and trivia, but it does not work for building software.
Why? Because AI has a hidden limit—not a technical limit, but a structural one. Once you see it, you cannot un‑see it.
In this series I will:
- Show you that limit.
- Show you a simple way around it.
The solution is not a better prompt; it is a different way of thinking about the work.
What if the problem was never the AI?
1.1 The Pattern: It Starts So Well
You have felt this. Everyone who has built anything non‑trivial with AI has felt this.
- Start a new project with Claude, GPT, or Copilot.
- The first few exchanges feel like magic.
Prompt: “Build me a URL shortener API.”- Code appears.
- It works.
- You are elated.
Prompt: “Now add analytics so I can see how many times each short link was clicked.”- The AI adds it. Still works. Two features done.
Prompt: “Add user accounts so people can manage their own links.”- The AI adds it, but now things start breaking.
- The database schema from feature 1 does not quite fit.
- The authentication logic from feature 3 conflicts with the analytics query from feature 2.
- The AI tries to fix it, but introduces regressions.
The context window fills up, the AI loses track of earlier decisions, and you’re no longer coding—you’re herding cats with a keyboard.
This is “vibe coding”: casually prompting an AI to generate code, hoping it all holds together. It works for tiny scripts and demos, but for real projects it collapses under its own weight.
Why?
1.2 The Hidden Limit You Have Probably Noticed — But Never Named
Simple experiment
| Task | Description | Expected AI Output | Quality |
|---|---|---|---|
| A (Small & Focused) | Write a Python function that takes a URL string and returns True if it is a valid URL, False otherwise. Handle edge cases like missing protocols, invalid characters, and malformed domains. | Clean, correct, well‑commented function in seconds. | Excellent |
| B (Large & Ambiguous) | Build a complete URL shortener service with a web interface, a REST API, user accounts, click analytics, and a database. Use Python. | Something that runs, but the authentication piece may not integrate cleanly with analytics, the DB schema may be inconsistent, etc. | Poor – Mediocre |
Same AI, same model, same capabilities—the only difference is the size and scope of the task.
LLMs have a context window: a limit to how much information they can hold in working memory at once.
- Small, self‑contained problems stay comfortably inside that window.
- Large system designs spill over the edges: the model forgets earlier decisions, contradicts itself, and produces fragile code.
But there’s a deeper insight.
1.3 The New Design Method That Changes Everything
AI does not think like a system architect. It does not maintain a complete mental model of your project with all its interconnections and trade‑offs.
How AI thinks
- “Given input X, produce output Y.”
- “Validate this string.”
- “Query that database table.”
- “Format this response.”
What AI doesn’t naturally understand
- How the URL validator should coordinate with the key generator.
- Whether the storage manager should be called before or after analytics logging.
- What happens when the redirect handler cannot find a key.
These are integration concerns, and they are not the AI’s strength.
When developers hit AI’s limitations on large tasks they usually:
- Give up – “AI is not ready for real projects.”
- Push harder – “Let me write a longer, more detailed prompt.”
Both miss the point.
The correct response
Don’t ask the AI to build the whole system. Ask the AI to build the functions. You connect the functions into the system.
1.4 What This Unlocks
| Role | AI | Human |
|---|---|---|
| Task | Write an excellent URL validator, key generator, storage manager, redirect handler, etc. (each a functional block). | Define the blocks, specify how they connect, validate that the connections work. |
| Scope | Small, self‑contained units with clear inputs, clear outputs, and no hidden dependencies. | System‑level architecture and integration. |
| Outcome | High‑quality, testable code for each block. | A coherent, maintainable system built from those blocks. |
Before (Vibe Coding) vs. After (Functional‑Block Design)
| Aspect | Vibe Coding | Functional‑Block Design |
|---|---|---|
| Prompt size | One giant prompt for the whole system | Many small prompts, one per block |
| Context handling | AI loses context, contradicts itself | Each block’s context is small and focused |
| Integration | Accidental, fragile | Explicit and designed |
| Debugging | Hard (which block failed?) | Each block can be tested in isolation |
| Changes | Regenerate large portions | Change one block, leave others untouched |
1.5 What Is Coming in Part 2 and Part 3
In Part 2 we will introduce Functional Block Design (FBD)—a simple, repeatable methodology that turns this insight into practice. You will learn:
- How to decompose a system into functional blocks.
- How to write a Block Spec (a description for humans and a prompt for the AI).
- How to orchestrate the blocks into a working application.
Part 3 will dive deeper into testing, versioning, and scaling the block‑based approach, showing you how to keep the AI’s output reliable as your project grows.
Stay tuned!
I) How to Generate Code from the Prompt
How to Store Everything in One .py File
In Part 3, we will build the complete URL shortener — all six blocks, integrated into a working system.
By the end of this series, you will have a repeatable way to turn AI‑generated code into systems that actually work together.
No more herding cats.
