<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Páblo Santos on Medium]]></title>
        <description><![CDATA[Stories by Páblo Santos on Medium]]></description>
        <link>https://medium.com/@pablovitor20?source=rss-fe814f653bbd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6Yr_2Mm0aOFvtZpf7WvxOg.jpeg</url>
            <title>Stories by Páblo Santos on Medium</title>
            <link>https://medium.com/@pablovitor20?source=rss-fe814f653bbd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:13:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pablovitor20/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[When to Use Generative AI (and When Not To)]]></title>
            <link>https://medium.com/@pablovitor20/when-to-use-generative-ai-and-when-not-to-3af961a6ac4d?source=rss-fe814f653bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/3af961a6ac4d</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Páblo Santos]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 14:00:59 GMT</pubDate>
            <atom:updated>2026-11-23T14:00:59.767Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Dark code editor with a file named before-adding-ai.md, listing four unchecked questions: Is the input open-ended and variable? Is there one answer you can calculate? How much does a mistake cost? Is there a simpler alternative?" src="https://cdn-images-1.medium.com/max/1024/1*dQSerTtV1ML4fCXuFFFC8g.png" /></figure><p>Generative AI solves some problems very well, and solves many others poorly or expensively. These days it is common to hear “let’s add AI to this” before anyone asks whether the task needs it. The result is often a solution that is slower, costlier, and less predictable than a simple rule would have been.</p><p>In this article I propose four questions you can ask, before writing any code, to decide whether generative AI is the right tool. To show how they work, I will use an invented scenario: a fictional online store that sells coffee subscriptions.</p><p>This is the first article in a short series about when and why to use AI tools in software projects. Every article uses the same fictional store, so you can read them in order or on their own.</p><h3>The scenario: a coffee subscription store</h3><p>Imagine a small online store that sells monthly coffee subscriptions. The support team is overwhelmed, and management asks: “Where can we use AI?” Four ideas come up:</p><ol><li>Calculating the shipping cost and delivery time for each order.</li><li>Answering customer questions about products, subscriptions, and the return policy.</li><li>Sorting incoming complaints by topic.</li><li>Automatically deciding whether a refund request should be approved.</li></ol><p>All four look like good candidates for AI. We will see that only one of them is a strong case for generative AI.</p><h3>The four questions</h3><p>Before choosing a model or a library, answer these questions about the task:</p><p><strong>1. Is the input open-ended and variable?</strong> Generative AI shines when the input is natural language, with many ways to say the same thing. If the input is structured (numbers, dates, codes), a rule or a query is usually the better choice.</p><p><strong>2. Is there a single correct answer that can be calculated?</strong> If so, calculate it. A language model produces likely answers, not guaranteed ones. For math, fixed rules, and database lookups, a traditional program is hard to beat.</p><p><strong>3. How much does a mistake cost?</strong> If a wrong answer causes only a minor inconvenience and someone can fix it, the risk is acceptable. If it causes financial loss, legal trouble, or lost trust, the AI needs clear limits, validation, or a human making the final decision.</p><p><strong>4. Is there a simpler alternative?</strong> A rule, a search, a form, or a lighter classification model may do the job with lower cost, lower latency, and more predictability. Choose generative AI only when it does the job clearly better than the alternative.</p><p>There is also a fifth point to check: <strong>cost, response time, and data privacy.</strong> Decide on purpose whether customer data can go to an external API.</p><h3>Applying the questions to the store</h3><p>Running the store’s four ideas through the questions, only the second is a clear case for generative AI. The others call for simpler or more cautious solutions.</p><ul><li><strong>Calculate shipping and delivery time:</strong> the input is structured and there is a single answer that can be calculated. <strong>Use a rule or a traditional calculation, without AI.</strong></li><li><strong>Answer questions about products and returns:</strong> the questions are open-ended, the answers come from the store’s documents, and the cost of a mistake is low to medium. <strong>Use generative AI with search over the store’s documents (RAG), cite sources, and hand off to a person when unsure.</strong></li><li><strong>Sort complaints by topic:</strong> the text is free-form, but the categories are fixed and the results are easy to measure. <strong>Use a classification model, or a simple LLM call with a closed list of categories, validated on samples.</strong></li><li><strong>Approve refunds:</strong> the decision has a financial cost and affects the customer. <strong>Use explicit rules, with AI at most summarizing the case and a person deciding.</strong></li></ul><p>For customer questions, the gain comes from the AI understanding questions written in many different ways and replying in natural language. But it should answer only from the store’s documents, not from memory, to reduce made-up answers. Most of the safety in this case comes from that design.</p><h3>Common mistakes</h3><ul><li><strong>Starting with the tool, not the problem.</strong> Picking the model or framework before defining the task leads to solutions looking for a use.</li><li><strong>Not measuring quality.</strong> Without a set of test questions and a clear idea of what a good answer looks like, you cannot tell whether a change made things better or worse.</li><li><strong>Trusting answers without limits.</strong> Answers with no source, no validation, and no path to a human tend to fail in the cases where a wrong answer costs the most.</li><li><strong>Ignoring cost and latency.</strong> Calling a large model for something a rule solves in milliseconds hurts both the bill and the user experience.</li><li><strong>Treating data as a detail.</strong> Sending personal or confidential data to an external service without checking privacy requirements (such as GDPR or Brazil’s LGPD) is a risk that usually shows up late.</li></ul><h3>Wrap-up</h3><p>Generative AI does not need to be everywhere. It is worth using when the input is open-ended, mistakes are tolerable or controllable, and no simpler alternative does the job equally well. Here is a quick checklist for any new idea:</p><ul><li>Is the input natural language or highly variable?</li><li>Does the task lack a single answer that a program could calculate?</li><li>Is the cost of a mistake acceptable, or is there validation and a human in the loop?</li><li>Does generative AI do the job better than a rule, a search, or a lighter model?</li><li>Have cost, response time, and data privacy been considered?</li></ul><p>If you can answer “yes” to all of these, generative AI is probably a good fit. In the next article in this series, I will dig into the customer-questions case: how search over documents (RAG) works, when it pays off, and how to evaluate whether the answers are any good.</p><p>What criteria do you use to decide where to apply AI? Let me know in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3af961a6ac4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 regras para o Claude Code não complicar seu código]]></title>
            <link>https://medium.com/@pablovitor20/5-regras-para-o-claude-code-n%C3%A3o-complicar-seu-c%C3%B3digo-d9d733fe62b0?source=rss-fe814f653bbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9d733fe62b0</guid>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[good-practices]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Páblo Santos]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 13:44:43 GMT</pubDate>
            <atom:updated>2026-11-23T13:44:43.606Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Editor de código escuro com o arquivo coding-guidelines.md aberto, mostrando os títulos das cinco regras. A regra 5, Blast Radius, aparece destacada como nova." src="https://cdn-images-1.medium.com/max/1024/1*wuhaTGrTVeHH3GwzxZMGBw.png" /></figure><p>Você pede para um agente de código corrigir um bug e ele corrige. No caminho, também renomeia variáveis, reformata o arquivo, cria uma classe “para facilitar no futuro” e trata um erro que nunca vai acontecer. O diff que devia ter cinco linhas chega com cento e cinquenta.</p><p>Em janeiro de 2026, o Andrej Karpathy <a href="https://x.com/karpathy/status/2015883857489522876">escreveu sobre esses vícios</a>. Segundo ele, os modelos assumem coisas sem confirmar, complicam o código e as APIs e mexem em trechos que não entendem bem, mesmo quando eles não têm relação com a tarefa. Logo depois, o forrestchang transformou essas observações num arquivo CLAUDE.md com quatro regras e publicou no repositório <a href="https://github.com/forrestchang/andrej-karpathy-skills">andrej-karpathy-skills</a>, com licença MIT.</p><p>Uso uma versão desse arquivo em todas as sessões do Claude Code, com algumas regras que fui acrescentando.</p><h3>Onde essas regras ficam</h3><p>O Claude Code lê o CLAUDE.md no início de cada sessão, e o conteúdo vale como instrução para a conversa toda. Pode haver um CLAUDE.md na raiz de cada projeto e um global, em ~/.claude/CLAUDE.md, que vale para todos os projetos.</p><p>Deixo as diretrizes num arquivo separado, o ~/.claude/coding-guidelines.md. O global só importa esse arquivo, com uma linha:</p><pre>@coding-guidelines.md</pre><p>O @ faz o Claude Code carregar o arquivo indicado junto com o CLAUDE.md (a <a href="https://code.claude.com/docs/en/memory">documentação</a> tem os detalhes). Com as regras num arquivo só delas, fica mais fácil editar e compartilhar.</p><p>O arquivo está em inglês, como o original, por isso mantive os nomes das regras em inglês.</p><h3>As quatro regras originais</h3><h3>1. Think Before Coding</h3><p>Pense antes de codar. A IA não deve assumir nada em silêncio. Quando o pedido permite mais de uma leitura, ela mostra as opções em vez de escolher uma sozinha. Também avisa se existe um caminho mais simples e, se algo não está claro, para e pergunta.</p><h3>2. Simplicity First</h3><p>Simplicidade primeiro: o mínimo de código que resolve o problema. Nada de funcionalidade que ninguém pediu, abstração para código usado uma única vez, configuração “para o futuro” ou tratamento de erro para cenário impossível. O arquivo traz uma régua de que eu gosto: se você escreveu 200 linhas e dava para fazer em 50, reescreva. E uma pergunta de controle: um engenheiro sênior acharia isso complicado demais?</p><h3>3. Surgical Changes</h3><p>Mudanças cirúrgicas. A IA mexe só no que precisa. Nada de “melhorar” código, comentário ou formatação ao lado, nem de refatorar o que não está quebrado, e o estilo do arquivo vale mesmo quando ela faria diferente. Um import que ficou sem uso por causa da mudança dela, ela remove. Código morto que já estava lá, ela só aponta. O teste é este: cada linha alterada precisa ter ligação direta com o pedido.</p><h3>4. Goal-Driven Execution</h3><p>Execução guiada por objetivo. A tarefa vira algo que dá para verificar. “Adicione validação” vira “escreva testes para entradas inválidas e faça eles passarem”. “Corrija o bug” vira “escreva um teste que reproduz o bug e faça ele passar”. Em tarefas com vários passos, a IA escreve um plano curto com uma checagem por passo. Com um critério claro, ela itera sozinha até a checagem passar. Com um critério fraco, como “faz funcionar”, precisa perguntar o tempo todo.</p><h3>O que eu acrescentei</h3><h3>Discordar com honestidade</h3><p>Na regra 1, incluí uma linha: se a abordagem que eu pedi parece errada, a IA deve dizer, sem bajulação. Modelos tendem a concordar com quem pede. Prefiro ouvir que a ideia é ruim antes de vê-la implementada com capricho.</p><h3>Uma ordem antes de escrever código novo</h3><p>Na regra 2, a IA passa a seguir uma ordem e para na primeira opção que resolve:</p><ol><li>código que já existe no repositório (uma função utilitária, um componente, um padrão);</li><li>um recurso da biblioteca padrão ou da plataforma;</li><li>uma dependência que o projeto já tem instalada;</li><li>só então, código novo.</li></ol><p>A regra também proíbe adicionar uma dependência por causa de poucas linhas. Sem essa ordem, a IA escreve com facilidade uma função de formatar datas que o projeto já tinha numa pasta utils.</p><h3>Mínimo não é cortar o que protege</h3><p>Levada ao pé da letra, a regra de simplicidade faz a IA cortar demais. Por isso deixei escrito que mínimo nunca significa tirar validação de dados que vêm de fora, tratamento de erro que evita perda de dados, segurança ou acessibilidade. “Não trate erro impossível” continua valendo, só que entrada errada de usuário não é um erro impossível.</p><h3>5. Blast Radius</h3><p>Esta regra é toda nova e nasceu de um efeito colateral da mudança mínima. Antes dela, meu arquivo só pedia a menor mudança possível, como no original. Com o tempo, notei que, para mudar o mínimo, o Claude às vezes não lia todo o código que usava a linha alterada. A mudança ficava pequena e quebrava outras partes do sistema. Escrevi a regra 5 para deixar claro que toda mudança, mesmo mínima, precisa verificar tudo o que está ligado a ela.</p><p>A frase que abre a regra resume o problema: um diff pequeno não garante uma mudança pequena de comportamento. Ela pede o seguinte:</p><ul><li>Para cada valor, flag, condição ou assinatura alterada, a IA procura todos os lugares que leem aquilo (com grep) e diz o que muda em cada um. Se um valor cumpre mais de um papel, ela separa os papéis antes de mudar.</li><li>A IA diz quais invariantes a mudança precisa manter e testa também os caminhos que não pretendia tocar, além do que corrigiu.</li><li>Um teste que só confere que uma ação foi negada não diz nada sobre o que acontece quando ela é aprovada. A IA testa o caminho aprovado e o efeito real dele.</li></ul><p>Um exemplo inventado: uma constante TIMEOUT = 30 é usada no cliente HTTP e também para expirar a sessão do usuário. Você pede para resolver requisições lentas, a IA muda o valor para 120 e o diff tem uma linha. As requisições param de falhar, e as sessões passam a durar quatro vezes mais. Com a regra, a IA procura quem lê TIMEOUT antes de mexer, encontra os dois usos e cria uma constante para cada um.</p><p>Outro, também inventado: uma tela de exclusão pede confirmação. O teste confere que, sem confirmar, nada é apagado, e passa. Ninguém testou o que acontece quando a pessoa confirma, e é nesse caminho que o código apaga o registro errado.</p><h3>Como saber se está funcionando</h3><p>Mantive o critério do arquivo original. As regras estão funcionando se os diffs têm menos mudanças desnecessárias, se há menos retrabalho por excesso de complexidade e se as perguntas aparecem antes da implementação, e não depois do erro.</p><p>Para ver como isso fica na prática, imagine o pedido “adicione validação de e-mail no formulário de cadastro”. O exemplo é inventado.</p><p>Sem as regras, é comum a IA criar uma classe EmailValidator cheia de opções, instalar uma biblioteca de validação e, de quebra, reformatar o arquivo do formulário.</p><p>Com as regras, a IA deve primeiro perguntar se a validação vale só na tela ou também na API. Depois procura no projeto, encontra a função isValidEmail que já existia em utils e propõe um plano curto:</p><pre>1. Escrever testes com e-mails inválidos no cadastro → verificar: os testes falham<br>2. Chamar isValidEmail no envio do formulário → verificar: os testes passam<br>3. Procurar outros lugares que usam o formulário de cadastro → verificar: nada muda fora dele</pre><p>O diff final tem poucas linhas no formulário e um arquivo de teste novo.</p><h3>Como usar</h3><ol><li>Salve o arquivo do Gist abaixo como ~/.claude/coding-guidelines.md.</li><li>Adicione a linha @coding-guidelines.md ao ~/.claude/CLAUDE.md. Se ele não existir, crie.</li><li>Abra uma sessão nova do Claude Code.</li></ol><p>Se quiser só a versão original, o repositório do forrestchang explica como instalar como plugin.</p><p><a href="https://gist.github.com/pablovfds/98cc3756884affe5001efa5b8ba6f23c">https://gist.github.com/pablovfds/98cc3756884affe5001efa5b8ba6f23c</a></p><p>As regras 1 a 4 e o critério de sucesso vêm do arquivo do forrestchang, baseado nas observações do Karpathy, sob licença MIT. As adições são minhas.</p><h3>Para fechar</h3><p>Se você usa um agente de código, teste o arquivo por uma semana e compare os diffs. E me conta: que regra você colocou no seu arquivo de instruções e fez diferença?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9d733fe62b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>