🎯 The goal: research → writing → sending
It’s time to apply the previous four modules in an end-to-end build: an automation for newsletter (a periodic email with updates on a topic) that researches a subject, drafts a message, and prepares it to send. It’s a small enough example to fit in one session, yet complete enough to practice workflow, agent, and tools together.
New here? Draft it’s the working version of a text—not the final product, but material that someone (you) will still review before considering it ready. In this build, the agent never delivers a “final” email: it always delivers a draft, because that’s what the workflow in topic 2 says to do. The difference between “the agent wrote an email” and “the agent wrote an email draft” may seem small, but it’s what separates a safe build from one that sends the wrong thing to real people.
💡 Main Concept
- •Research: find 3-5 recent developments on a topic.
- •Writing: turn it into concise text with a defined tone.
- •Sending: prepare (or send) the final email.
🔍 Why this build and not another
A newsletter combines the three problems that come up in almost every text automation: finding information beyond what the agent already knows (research), turning raw information into something someone wants to read (writing), and handling an action with real-world consequences outside the computer (sending). If you can build this safely, the same pattern works for a weekly report, sales summary, internal team bulletin — anything in the format “gather data → write → deliver.”
📋 Designing the workflow (the recipe)
Before asking the agent to do anything, write the recipe—even as a simple draft. This prevents exactly the first common mistake in module 1.4 (a vague recipe). A good workflow for this build:
## Workflow: newsletter semanal sobre <seu tema aqui>
1. Buscar 3 a 5 novidades da última semana sobre o tema
2. Para cada uma, escrever 2-3 frases resumindo (tom direto, sem jargão)
3. Montar um e-mail com título + as novidades numeradas
4. Salvar como rascunho em "newsletter/rascunho-AAAA-MM-DD.md"
5. Não enviar de verdade sem eu revisar e aprovar antes
🔍 Inside each line
- Line 1 (quantity): "3 to 5" isn’t a random number — it’s small enough for the agent to research each item properly (instead of making things up to meet the quota) and large enough to feel like a newsletter, not a standalone post.
- Line 2 (summary length): "2-3 sentences" is there because without a limit, the agent tends to copy entire paragraphs from the source — which not only makes the result long, but can also be a direct copy of someone else’s text.
- Line 4 (where to save): a fixed, predictable file path ("newsletter/draft-...") makes it easier to review it in the same place every time, instead of hunting for where the agent decided to save it.
- Step 5 is intentional: a "brake" that prevents automatic sending before your review—recommended practice for the first build of any new automation.
💡 Practical Tip
Write the workflow in an actual file (e.g., newsletter/workflow.md) instead of just pasting it into the chat. That way it survives across sessions, and you can point the agent to it (“follow workflow.md”) without rewriting everything.
▶️ Copy-run: the prompt ready for Claude Code
With the workflow written, the next step is to paste a request into Claude Code that references this recipe. Below is a complete prompt, ready to copy, paste, and run—adjust only the marked parts.
Objective: generate the first newsletter draft following the workflow above.
Crie uma pasta "newsletter/" se ainda não existir.
Siga este workflow para montar o rascunho de uma newsletter sobre
:
1. Busque de 3 a 5 novidades reais e recentes sobre o tema (últimos 7 dias)
2. Para cada uma, escreva 2-3 frases resumindo em tom direto, sem jargão
3. Monte um e-mail com título chamativo + as novidades numeradas
4. Salve como "newsletter/rascunho-.md"
5. NÃO envie nada de verdade — pare aqui e me mostre o rascunho para eu revisar
Ao terminar, me diga quais fontes você usou para cada novidade.
How to verify: check that the file "newsletter/rascunho-....md" was created, contains between 3 and 5 items, and cites sources that really exist (open at least one link).
🔍 Under the hood: what the agent does in those seconds
- Reading: The agent uses a web search tool (search) to find real pages about the topic — it isn’t “remembering” anything; it’s consulting live sources, exactly as you would in a browser tab.
- Deciding: it picks the 3–5 results that seem most recent and relevant, then decides how to summarize each in 2–3 sentences without losing the main fact — that's the "creative" part of the work, and the part most worth checking afterward.
- Recording: it creates the "newsletter/" folder (if it doesn't exist) and saves a Markdown file with the date in its name — Markdown (.md extension) is a plain-text format with lightweight markup (# for a heading, - for a list) that any text editor can open.
- Costing: this task uses a few web searches and a handful of tokens for reading and writing — on your Claude Code plan, that’s a fraction of what fits in a normal session; it’s nothing to worry about for a build this size.
✓ Specific prompt
Specifies the topic, quantity, tone, where to save it, and that it should not actually send anything. The agent doesn't have to guess.
✗ "Write a good newsletter"
Without a theme, quantity, or file destination, the agent decides everything for you, and “good” isn’t a verifiable criterion.
🔁 Testing and reviewing the result
Run the prompt from the previous section and read the generated draft carefully — this is the module 1.3 build phase, where it’s worth having the agent try again until it gets it right. If the tone isn’t right, or something new seems made up (this can happen — always check sources), it’s time to apply self-correction guided by you: give specific feedback and ask it to redo only the part that failed.
Objective: fix a specific item in the draft without redoing everything.
O item 2 do rascunho está com tom formal demais e a fonte não parece
confiável. Reescreva só o item 2: tom mais direto, e busque uma fonte
diferente e mais recente. Mantenha os outros itens como estão.
How to verify: reopen the file and confirm that only item 2 changed, the tone is consistent with the others, and the new source can be verified.
Notice that this cycle—run, read, fix one specific point, run again—is exactly the sequence this entire build follows, from scratch to the final draft. It helps to picture the steps you just went through (and may go through again if you review more than once):
Caption: steps 3 and 4 form a loop — you return to them as many times as needed before considering the draft ready. There is no right number of rounds; the standard is “good enough for me to approve.”
⚠️ Common errors in this build
This specific build tends to stumble over the same three points as module 1.4 — worth reviewing before you try.
✗ Asking without a recipe
"Make me a newsletter" — no topic, no number of items, no place to save it. The agent will guess everything, and probably get it wrong.
✗ Vague recipe
"Find good AI news" — "good" and "AI" (a huge topic) without a specific focus don’t provide clear enough direction.
✗ Tool without a key
If step 5 grows to include “actually sending” (outside this initial build), you’ll need an email tool configured with credentials—without it, the agent will stop at that step. This is covered in more depth in Track 2 (MCP) and Track 4 (Secrets). New here? Credential it’s the key/password that authorizes a tool to act on your behalf—without it, the agent may know what to do, but it doesn’t have permission to do it.
✗ Invented source
The agent cites something "new" without actually searching for anything, or generalizes something it read in another context as if it were recent news about your topic. It’s the same hallucination risk as in module 1.3 — the defense is always the same: you open the link and check before approving.
🚀 Publish / schedule: what comes next
What you built here runs inside Claude Code, under your supervision — the module’s build phase 1.3. To turn it into a newsletter that goes out automatically every week, without you opening Claude Code manually, two pieces are missing, and this course covers them in the next tracks: giving the agent a real email-sending tool (Track 2, MCP) and setting the workflow to run on a fixed schedule after publishing (Tracks 4 and 6, about deployment and scheduling).
Caption: today’s manual draft is the first step — the next tracks add the real sending tool and the scheduling that gets you out of the critical path.
New here? Scheduling means configuring the computer (or a server) to run this automation on its own at a set time, without anyone opening Claude Code manually — like an alarm clock for tasks. Until then, today’s build is already useful as it is: whenever you want a new newsletter, open Claude Code and run the same prompt from topic 3. It’s manual work, but much faster than writing it from scratch.
✓ Today's build: you pull the trigger
You open Claude Code, run the prompt, review, and approve. Nothing happens unless you’re there at the time.
→ Future build: the trigger is the clock
With Track 2 (sending tool) and Tracks 4/6 (deployment and scheduling), the same recipe runs automatically every week—but the review checkpoint in step 5 can still remain, if you want.
💡 Practical Tip
Save the workflow you wrote in this module — you can reuse it almost unchanged when it’s time to publish in Track 4.
Quick check (optional): Why is step 5 of the workflow ("don’t send without review") a good practice?