Trail content
8 minEnglish narration, Portuguese subtitlesPodcast (RSS)
Chapters
  1. 0:00Opening
  2. 0:56The idea
  3. 1:37How it works
  4. 2:26A real case
  5. 3:38A challenge
  6. 4:21A smell is not a bug
  7. 5:18Finding your way
  8. 6:13Try it
  9. 7:13Wrap-up
Transcript

Opening

Picture your first week on a new team. You inherited an assistant that answers customers on WhatsApp, looks up orders, and sometimes calls a person.

It works. But every prompt change is scary, the provider bill went up, and nobody can explain why the bot said something absurd yesterday.

You open the code. The first thing you see is a system prompt with forty paragraphs.

Then a loop that keeps calling the model until it decides it's done, with no counter.

And no tests. You can tell something is off. The hard part is saying what, deciding what comes first, and fixing it without breaking everything else.

You don't need another tutorial on how to call an API. You need words for what's wrong, and a safe path to fix it. That's what this catalog is for, and in this lesson you'll learn how to use it.

The idea

The catalog organizes the engineering of language model systems into five pillars. Each one answers a different question.

Fundamentals answer: what do I need to know before designing anything? Tokens, cost, how the model picks words.

Smells answer: what's wrong with my system? That giant prompt has a name. It's called prompt bloat.

Refactorings answer: how do I fix it without breaking it?

Patterns answer: what's the right shape for this kind of problem? And the fifth pillar, real-world scenarios, shows all of that inside a complete system.

How it works

The pillars are not separate boxes. They form a path, and you'll walk it again and again.

It starts with a smell. A smell is a sign that something will hurt later. The system works today, but it's getting expensive, fragile, or unsafe.

The smell points to a refactoring. A refactoring changes the structure without changing what users get. And every refactoring starts and ends with an eval, a test for what the model produces.

The refactoring leads to a design pattern, the proven way to solve that kind of problem.

And the pattern shows up in real-world scenarios. Each scenario starts with a naive first version. That first version has the smells from step one, and the cycle starts again.

A real case

Let's go back to the assistant you inherited and follow that path with its two most visible problems.

First, the loop with no counter. One single run cost dozens of times more than a normal one. That smell is called unbounded loop.

The fix is a refactoring called add loop budget: a limit on steps, tokens and time.

And where you land is a pattern called stop conditions, where the agent knows exactly when it has to stop.

Second, the forty paragraph prompt, where every bug that got fixed became one more paragraph. That's what we call prompt bloat.

The refactoring pulls one job out into its own smaller prompt. It's called extract subprompt.

And the target is prompt chaining: a few short steps, each one easy to test.

Now notice the order. You don't jump from the symptom straight to rewriting everything with the right pattern. The refactoring is the small, measured path between what exists today and the final shape. Measure first, change the structure, then measure again.

A challenge

Here's one for you. A teammate applied extract subprompt to the ticket classifier, and tells you it got much better. Based on what you just heard, what's missing before you accept that change?

What's missing is the eval, run before and after, with the numbers side by side. Without the before number, better is just an impression. And a drop in some other category would go completely unnoticed.

Switching to a bigger model wouldn't answer the question either. It mixes two changes and makes everything more expensive. The guarantee that nothing got worse comes from measuring.

A smell is not a bug

The word smell comes from classic code refactoring. And there's a difference worth holding on to. A bug breaks today. A smell works today and charges you later.

It charges on the bill.

In the time your team spends maintaining it.

And sometimes in a security incident.

That's why every smell in the catalog has a section called when to ignore. A big prompt in a prototype with ten users may be fine. The same prompt in a support channel with thousands of conversations a day is money leaving every month.

The catalog gives you the diagnosis. The decision of when to fix stays with you.

And the most common beginner mistake is the opposite one: reading the list of smells and trying to fix all of them at once. Start with what hurts most. Usually, that's what shows up on the bill, or in this week's incident.

Finding your way

Every page in a pillar has the same sections in the same order. Learn the format once and you'll find anything without hunting. And the numbers in the diagrams match the comments in the code. If step three in the diagram is classify, the code also says step three, classify. When you get lost in the code, go back to the diagram by number.

Along the way you'll find short questions. Every option has an explanation, including the wrong ones, because the most useful mistake is the one you understand.

And if you came from a search, reading out of order is fine. Every page ends with a read next, pointing to the most useful step from there. If you want an order, follow the trails. They form one course: foundations, evals, RAG and context, agents, security, and production.

Try it

Now pick a system you know and answer four questions. Write the answers down, even if the answer is I don't know.

One. How many tokens is the system prompt today? If the answer is several thousand, or no idea, read prompt bloat.

Two. If someone changes one line of the prompt, how do you know nothing got worse? If the answer is we try a few questions by hand, read untested prompt.

Three. If the model does something wrong in production, where do you look? If you can't tell, read no tracing.

Four. What was the most expensive run this month, and how much did it cost? If nobody tracks that, read no cost budget.

Most teams answer at least two of these badly. That's normal, and it's a good place to start. You just built your priority list, with names the rest of your team can look up.

Wrap-up

That's the real value of a shared vocabulary. Saying this agent has tool sprawl tells your team more than saying the agent gets confused sometimes. The name carries the diagnosis, the tested fix, and the shape you're aiming for.

In the next lesson, we start with the model itself: four properties every engineer needs to know, and that almost every pattern here tries to control. See you there.

Fundamental

How to read this catalog

Como ler este catálogo

How to read this catalog is an AI engineering fundamental for people who work with LLMs. The five pillars, how pages connect, and where to start for your role.

Element
01/13
Level
Beginner
Read
6 min
Updated
On this page 5
  1. 01The situation
  2. 02The concept
  3. 03Try it
  4. 04What this changes
  5. 05Check your understanding
  6. ··Quick answers

The situation

You inherited an LLM assistant. It answers customers on WhatsApp, looks up orders, and sometimes calls a person. It works, but every prompt change is scary, the provider bill went up, and nobody can explain why the bot said that nonsense yesterday.

You open the code and find a 40-paragraph system prompt, a while True loop with no counter, and no tests. You can tell something is off. The hard part is saying what, deciding what comes first, and fixing it without breaking everything else.

You do not need another “how to call the API” tutorial. You need a vocabulary to name what is wrong and a safe path to fix it. That is what this catalog is for.

The concept

ai-guru organizes LLM systems engineering into five pillars. Each one answers a different question.

Pillar Question it answers Example
0. Fundamentals What do I need to know before designing? Tokens and the context window
1. Smells What is wrong with my system? Prompt Bloat
2. Refactorings How do I fix it without breaking it? Extract Subprompt
3. Patterns What is the right shape for this? Routing
4. Real-world scenarios What does it look like in a full system? Support bot with human escalation

The pillars are not separate boxes. They form a graph:

flowchart LR
  S(["1. Smell: the symptom"]):::io --> R["2. Refactoring: the fix"]:::tool
  R --> P(["3. Pattern: the final shape"]):::llm
  P --> C[("4. Scenario: the real system")]:::store
  C -.->|"version 1"| S
  1. You recognize a smell, a sign that something will hurt later. The system works, but it gets expensive, fragile, or unsafe.
  2. The smell points to one or more refactorings. Each one changes structure without changing what users get, and starts and ends with an eval (a test for model output).
  3. The refactoring leads to a design pattern, the proven way to solve that kind of problem.
  4. The pattern shows up in real-world scenarios, systems told from the naive version to the final architecture. The naive version of every scenario has the smells from step 1, and the cycle starts again.

One example, from symptom to system

Go back to the assistant you inherited and follow the graph with its two most visible problems.

Step Problem 1: the loop Problem 2: the prompt
What you see while True with no counter; one run cost dozens of times the median 40-paragraph system prompt; every fixed bug became one more
Smell Unbounded Loop Prompt Bloat
Refactoring Add Loop Budget Extract Subprompt
Target pattern Stop Conditions Prompt Chaining

Notice the order. You do not jump from the symptom to “rewrite everything with the right pattern”. The refactoring is the small, measured path between what exists today and the final shape. First you measure current behavior with an eval, then you change the structure, then you measure again.

Check +20 XP on first tryA teammate applied the Extract Subprompt refactoring to the ticket classifier and says it 'got much better'. Given how the catalog defines a refactoring, what is missing before you accept the change?

A smell is not a bug

Smell is a term borrowed from classic code refactoring. A bug breaks today. A smell works today and charges you later: on the bill, in maintainer time, in the security incident.

That is why every smell has a “When to ignore” section. A large prompt in a prototype with ten users may be fine. The same prompt in a support channel with thousands of conversations a day is money leaving every month. The catalog gives you the diagnosis; the decision of when to fix stays with you.

The common beginner mistake is the opposite: reading the smell list and trying to fix all of them at once. Start with what hurts most. Usually that is what shows up on the bill or in this week’s incident.

The fixed page format

Every page in a pillar has the same sections in the same order. You learn the format once and find anything without hunting.

  • Fundamentals open with a concrete situation, explain the concept with a diagram, and include a 5-minute experiment.
  • Smells show how to recognize them, why they happen, what ignoring them costs, and a quiz to confirm the diagnosis.
  • Refactorings show before and after, safe step-by-step mechanics, and risks.
  • Patterns have intent, the problem told as a story, a numbered diagram, pseudocode, cost, failure modes, how to evaluate, and code.
  • Scenarios cover the business, what broke, the refactorings applied, and the numbers.

Diagram numbers match the pseudocode comments and the code sections. If step 3 in the diagram is “classify”, the code also has # 3. classify. When you get lost in the code, go back to the diagram by number.

The checks along the way

Pages have short questions in the middle of the text and a block at the end. Each one tests one idea from the page with a situation close to your daily work. Every option has an explanation, including the wrong ones, because the most useful mistake is the one you understand.

Each question you get right on the first try is worth points. A track’s points add up on that track’s certificate. If you miss one, read the explanation, go back to the passage, and move on: the question is there so you know what you already understand.

Where to start

You are Start with
Starting out with LLMs Trail 1: LLM foundations for engineers
Shipping an LLM feature you need to trust Trail 2: Evals and reliability
Building search or chat over your documents Trail 3: RAG and context
Building agents Trail 4: Building agents
Responsible for security Trail 5: Securing AI systems
A tech lead or running it in production Trail 6: Production: cost, latency, and operations

If you came from a search, reading out of order is fine. Every page ends with “Read next”, pointing to the most useful next step from there.

Try it

Pick an LLM system you know and answer four questions in 5 minutes. Write the answer down, even if it is “I don’t know”.

1. How many tokens is the system prompt today?
2. If someone changes one line of the prompt, how do you know nothing got worse?
3. If the model does something wrong in production, where do you look to find out why?
4. What was the most expensive run this month, and how much did it cost?

Each bad answer points to a page:

If the answer was Read
1: “several thousand” or “no idea” Prompt Bloat
2: “we try a few questions by hand” Untested Prompt
3: “we can’t tell” No Tracing
4: “nobody tracks that” No Cost Budget

Most teams answer at least two of these badly. That is normal and a good starting point: you just built your priority list, with names the rest of the team can look up.

Check +20 XP on first tryFor question 2 of the exercise, your team answers: 'before deploying, we try about five questions by hand and check that the answers look good'. Which page do you open first?

What this changes

With names for the problems, team conversations get shorter. “This agent has Tool Sprawl” says more than “the agent gets confused sometimes”. The name carries the diagnosis, the tested fix, and the target pattern, and anyone on the team can open the same page.

Names also help you prioritize. A backlog item called “Unbounded Loop in the invoice agent” has a known cost and a known fix. “Improve the agent” has neither.

If you are reading in order, the next step is LLMs for engineers, which explains the four model properties that almost every pattern in this catalog tries to control.

Shortcuts that help: / opens search, t toggles the theme, l switches language, j and k move through a track.

Check your understanding

Check +20 XP on first tryYour team's internal bot has a 5,000-token system prompt. It is a prototype with 10 users and nobody complains. You recognize the Prompt Bloat smell. What is the right move?

Check +20 XP on first tryYou read the Support bot with human escalation scenario and found its 'Version 1' very close to the system you maintain. What does that part of the scenario give you?

Check +20 XP on first tryIn a review, someone says: 'this agent has Tool Sprawl'. Why does that help more than saying 'the agent gets confused sometimes'?

Check +20 XP on first tryYou are a backend engineer about to add a model to an existing API, and you found this catalog through a search. What is the most efficient way to use the site?

Quick answers

What is How to read this catalog?

How to read this catalog is an AI engineering fundamental for people who work with LLMs. The five pillars, how pages connect, and where to start for your role.

Go further

Relations

Part of the tracks 1
Search