<?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"><channel><title><![CDATA[Maximiliano Contieri - Software Design]]></title><description><![CDATA[I am Maximiliano Contieri
I've been working as a software engineer and teaching for about 25 years.
I write about software design, refactoring, test driven development, clean code and code smells.]]></description><link>https://maximilianocontieri.com</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1695814671171/qMChtqJmW.jpg</url><title>Maximiliano Contieri - Software Design</title><link>https://maximilianocontieri.com</link></image><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 14:11:47 GMT</lastBuildDate><atom:link href="https://maximilianocontieri.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[AI Coding Tip 016 - Feed Your PR Lessons into the AI Brain]]></title><description><![CDATA[TL;DR: Improve the AI tools, rules, skills, and workflows you use in every pull request so your team and future agents can learn, reproduce, and improve on every change.

Common Mistake ❌
You write cl]]></description><link>https://maximilianocontieri.com/ai-coding-tip-016-feed-your-pr-lessons-into-the-ai-brain</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-016-feed-your-pr-lessons-into-the-ai-brain</guid><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Wed, 15 Apr 2026 03:10:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5f456a23b9870f18f59a8793/6ba7ad04-957e-4514-bb64-e1570d7615ba.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Improve the AI tools, rules, skills, and workflows you use in every pull request so your team and future agents can learn, reproduce, and improve on every change.</p>
</blockquote>
<h1>Common Mistake ❌</h1>
<p>You write clean code.</p>
<p>The AI helps you ship fast after it understands <a href="https://maxicontieri.substack.com/p/ai-coding-tip-009-compact-your-context">all your context</a>, and you merge the PR.</p>
<p>You write "Fix bug" as the description.</p>
<p>Two weeks later, nobody knows what prompt produced that fix, which <a href="https://maxicontieri.substack.com/p/ai-coding-tip-004-use-modular-skills">SKILL.md</a> was active, or why you chose that approach over the alternative.</p>
<p>Not your teammates.</p>
<p>Not a new AI agent.</p>
<p>Not you.</p>
<p>The AI's reasoning evaporates the moment you close the chat.</p>
<h1>Problems Addressed 😔</h1>
<ul>
<li><p>You lose the exact prompt that produced a working solution and can't reproduce it.</p>
</li>
<li><p>Future <a href="https://maxicontieri.substack.com/p/ai-coding-tip-014-use-nested-agentsmd">agents</a> start from zero on every PR instead of building on past decisions.</p>
</li>
<li><p>AGENTS.md, SKILL.md, and rules stay generic because nobody tracks which ones actually worked.</p>
</li>
<li><p>Onboarding new developers (or new agents) takes longer because context lives nowhere.</p>
</li>
<li><p>You repeat the same debugging cycles because you never wrote down what failed first.</p>
</li>
<li><p>The team can't measure whether AI assistance improves over time.</p>
</li>
<li><p>Code reviews become guesswork when reviewers can't see the AI's reasoning.</p>
</li>
<li><p>You miss chances to promote a one-off good prompt into a permanent SKILL.md.</p>
</li>
</ul>
<h1>How to Do It 🛠️</h1>
<ol>
<li><p><strong>Add an "AI Context" section to every PR description:</strong> Write which agent or tool you used (Claude Code, Copilot, Cursor, Windsurf) and the model version.</p>
</li>
<li><p><strong>Paste or link the key prompt:</strong> You don't need the full conversation.</p>
<p>Include the decisive prompt that unlocked the solution.</p>
</li>
<li><p><strong>List the active configuration files:</strong> Name every SKILL.md, AGENTS.md section, RULES file, or WORKFLOW.md that shaped the output.</p>
</li>
<li><p><strong>Note what the AI got wrong first:</strong> Write one line about the failed attempt before the correct solution.</p>
<p>This is the most valuable information your future self will read.</p>
</li>
<li><p><strong>Flag any manual correction you applied:</strong> If you edited the AI output, say so and say why.</p>
<p>This is feedback your team can turn into a new rule.</p>
</li>
<li><p><strong>Update AGENTS.md as part of the PR:</strong> If the code change revealed a missing rule or a better workflow step, add it immediately, while context is still fresh.</p>
</li>
<li><p><strong>Update or create SKILL.md entries:</strong> If you invented a reusable prompt pattern, extract it into a skill file so every future agent can use it.</p>
</li>
<li><p><strong>Tag the PR with an "ai-assisted" label:</strong> This lets you filter and audit AI-assisted changes later for quality review.</p>
</li>
<li><p><strong>Review AI-trace PRs in retros:</strong> Once a sprint, pick two PRs with rich AI context and ask what rule or skill you should add.</p>
</li>
<li><p><strong>Ask the LLM to update what it learned:</strong> Write a final prompt for the AI to update its own knowledge.</p>
</li>
</ol>
<h1>Benefits 🎯</h1>
<ol>
<li><p><strong>Reusable learning units:</strong> Every PR becomes a lesson agents can read and reuse.</p>
</li>
<li><p><strong>Living AGENTS.md:</strong> Your rules file grows richer with each merged change instead of staying a static document nobody updates.</p>
</li>
<li><p><strong>Shorter feedback loop:</strong> You compress the gap between a good prompt and a reusable <a href="https://maxicontieri.substack.com/p/ai-coding-tip-004-use-modular-skills">skill</a>.</p>
</li>
<li><p><strong>Clearer onboarding:</strong> New developers understand <em>why</em> code looks the way it does, not just <em>what</em> it does.</p>
</li>
<li><p><strong>Built-in audit trail:</strong> You track AI-assisted decisions without extra tooling.</p>
</li>
<li><p><strong>Measurable AI effectiveness:</strong> Teams can see which skills produce the fewest corrections.</p>
</li>
<li><p><strong>Smarter future agents:</strong> Every agent inherits your project's accumulated knowledge instead of starting blind.</p>
</li>
<li><p><strong>Faster code reviews:</strong> Reviewers read explicit context instead of guessing.</p>
</li>
</ol>
<h1>Context 🧠</h1>
<p>AI agents don't share memory across sessions by default.</p>
<p>Every new task starts with a blank slate unless you give them written context.</p>
<p>AGENTS.md, SKILL.md, and WORKFLOW.md files solve this for project-level knowledge.</p>
<p>Pull requests solve it for <em>change-level</em> knowledge.</p>
<p>Think of a PR as a commit message for your AI reasoning.</p>
<p>A commit message records <em>what</em> changed.</p>
<p>An AI-trace PR description records <em>how</em> and <em>why</em> the AI reached that solution.</p>
<p>Teams that treat PRs as AI learning artifacts get better over time: each merged change makes the next AI session smarter.</p>
<p>This matches the continuous improvement loop from lean manufacturing (kaizen) applied to AI-assisted development.</p>
<p>You inspect every unit of work, identify waste (bad prompts, missing rules), and standardize the improvement (new skill, updated workflow).</p>
<h1>Prompt Reference 📝</h1>
<h3>Bad PR Description:</h3>
<pre><code class="language-markdown">Fixed the payment bug

[x] Fixed the null check
[x] Tests pass
</code></pre>
<ul>
<li>if ($payment !== null) {</li>
</ul>
<pre><code class="language-plaintext">$payment-&gt;process();
</code></pre>
<ul>
<li><p>}</p>
</li>
<li><p>if (\(payment !== null &amp;&amp; \)payment-&gt;isValid()) {</p>
</li>
</ul>
<pre><code class="language-plaintext">$payment-&gt;process();
</code></pre>
<ul>
<li>}</li>
</ul>
<pre><code class="language-plaintext">
// No AI context. No prompt. No record of what failed first.
// The next agent reads this diff and learns nothing.
</code></pre>
<h3>Good PR Description:</h3>
<pre><code class="language-markdown">Fixed PaymentProcessor null check with Null Object pattern

**AI Context**
Tool    : Claude Code (claude-sonnet-4-20250514)
Skill   : /skills/php-clean-code.md §3
Rules   : /AGENTS.md#error-handling
Workflow: /workflows/refactor-feature.md
Prompt  : "Refactor PaymentProcessor using the
           Null Object pattern instead of null
           checks. Follow AGENTS.md conventions."

**What the AI tried first**
Inline null guard. Rejected — violates AGENTS.md
rule on conditionals.

**Manual correction applied**
Renamed NullPayment to NullPaymentMethod to match
the domain vocabulary. Added to AGENTS.md#naming.

payment.ts
</code></pre>
<ul>
<li>if ($payment !== null) {</li>
</ul>
<pre><code class="language-plaintext">$payment-&gt;process();
</code></pre>
<ul>
<li><p>}</p>
</li>
<li><p>$payment-&gt;process();</p>
</li>
</ul>
<pre><code class="language-plaintext">
AGENTS.md
</code></pre>
<h2>error-handling</h2>
<ul>
<li><p>Don't use null checks inline.</p>
</li>
<li><p>Use guard clauses only at system boundaries.</p>
</li>
<li><p>Replace null checks with Null Object pattern.</p>
</li>
<li><p>Null Objects live in /src/NullObjects/.</p>
</li>
<li><p>Null Object class names follow NullX convention.</p>
</li>
</ul>
<pre><code class="language-plaintext">
skills/clean-code.md
</code></pre>
<h2>§3 Null Handling</h2>
<ul>
<li><p>Avoid null returns when possible.</p>
</li>
<li><p>Never check for null inside domain logic.</p>
</li>
<li><p>Inject a Null Object instead.</p>
</li>
<li><p>Example: NullPaymentMethod implements PaymentMethod.</p>
</li>
<li><p>Prompt: "Replace null check in X with a Null Object</p>
</li>
<li><p>that implements the same interface."</p>
</li>
</ul>
<h1>Considerations ⚠️</h1>
<p>Keep the AI Context section short.</p>
<p>Three to five lines are enough.</p>
<p>You document it, not transcribe it.</p>
<p>Sensitive business logic in prompts needs the same care as any other PR content.</p>
<p>Your repo's access policy applies.</p>
<p>Not every PR needs full AI tracing.</p>
<p>A one-line typo fix doesn't.</p>
<p>A non-trivial refactor or new feature always does.</p>
<p>Don't paste the entire conversation.</p>
<p>Extract the signal: the decisive prompt and the first failed attempt.</p>
<p>AGENTS.md updates from PR traces should go through review like any other code change.</p>
<h1>Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1>Limitations ⚠️</h1>
<ul>
<li><p>This practice requires team discipline.</p>
</li>
<li><p>One developer skipping it breaks the knowledge chain.</p>
</li>
<li><p>AI tools that don't expose prompt history make extraction harder.</p>
</li>
<li><p>Use tools that let you copy the context.</p>
</li>
<li><p>Large monorepos with many SKILL.md files need a naming convention so PR references stay unambiguous.</p>
</li>
<li><p>You can't retroactively trace PRs merged before you adopted this practice.</p>
</li>
<li><p>Start from today and move forward.</p>
</li>
</ul>
<h1>Tags 🏷️</h1>
<ul>
<li>Standards</li>
</ul>
<h1>Level 🔋</h1>
<p>[X] Intermediate</p>
<h1>Related Tips 🔗</h1>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-004-use-modular-skills">https://maxicontieri.substack.com/p/ai-coding-tip-004-use-modular-skills</a></p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line">https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line</a></p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-011-initialize-agentsmd">https://maxicontieri.substack.com/p/ai-coding-tip-011-initialize-agentsmd</a></p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-014-use-nested-agentsmd">https://maxicontieri.substack.com/p/ai-coding-tip-014-use-nested-agentsmd</a></p>

<h1>Conclusion 🏁</h1>
<p>Pull requests aren't just code snapshots.</p>
<p>They're the cheapest knowledge transfer mechanism your team has.</p>
<p>When you log the prompt, the active skills, the rules, and the first failure alongside the final diff, you turn every merged change into a lesson.</p>
<p>Your AGENTS.md improves.</p>
<p>Your SKILL.md library grows.</p>
<p>Your next AI session starts smarter than the last.</p>
<p>Stop letting AI reasoning disappear at merge time. 🧠</p>
<h1>More Information ℹ️</h1>
<p><a href="https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/getting-started/best-practices-for-pull-requests">GitHub: Writing good pull request descriptions</a></p>
<p><a href="https://www.conventionalcommits.org/">Conventional Commits: Structured commit messages</a></p>
<p><a href="https://adr.github.io/">ADR: Architecture Decision Records as a model for AI traces</a></p>
<p><a href="https://research.google/pubs/">Google's AI-assisted code review research</a></p>
<p><a href="https://trunkbaseddevelopment.com/">Trunk-based development and AI-assisted PRs</a></p>
<h1>Also Known As 🎭</h1>
<ul>
<li><p>AI-Aware-Pull-Requests</p>
</li>
<li><p>Prompt-Traced Code Reviews</p>
</li>
<li><p>AI-Knowledge-Commits</p>
</li>
</ul>
<h1>Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans.</p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tips">https://maxicontieri.substack.com/p/ai-coding-tips</a></p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 015 - Force the AI to Obey You]]></title><description><![CDATA[Don't let your most important instructions drown in context noise

TL;DR: Bury critical rules and AI models ignore them. Use explicit markers to force compliance.

Common Mistake ❌
You write a long sk]]></description><link>https://maximilianocontieri.com/ai-coding-tip-015-force-the-ai-to-obey-you</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-015-force-the-ai-to-obey-you</guid><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Mon, 13 Apr 2026 11:16:55 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5f456a23b9870f18f59a8793/27ab8f45-afc9-457f-ae2e-3a7e4e3d201f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Don't let your most important instructions drown in context noise</em></p>
<blockquote>
<p>TL;DR: Bury critical rules and AI models ignore them. Use explicit markers to force compliance.</p>
</blockquote>
<h1>Common Mistake ❌</h1>
<p>You write a long <a href="https://maxicontieri.substack.com/p/ai-coding-tip-004-use-modular-skills">skill</a> file with dozens of rules.</p>
<p>You bury the most critical ones somewhere in the middle, polluting the context.</p>
<p>The lazy AI follows the easy instructions and skips the hard ones.</p>
<p>You never notice until the output is already wrong, and you are frustrated.</p>
<h1>Problems Addressed 😔</h1>
<ul>
<li><p>AI models suffer from <strong>attention dilution</strong>. The longer the context, the weaker the focus on any single rule</p>
</li>
<li><p>Critical constraints buried mid-file get ignored <strong>silently</strong></p>
</li>
<li><p>The AI doesn't tell you it skipped a rule. It just doesn't follow it</p>
</li>
<li><p>Large skills consume so much context that late instructions compete with early ones</p>
</li>
<li><p>You waste time debugging outputs instead of trusting your skill</p>
</li>
<li><p>Re-running the same prompt gives inconsistent results</p>
</li>
</ul>
<h1>How to Do It 🛠️</h1>
<ol>
<li><p><strong>Start with a MANDATORY block</strong>. Put your non-negotiable rules at the very top, before any context or explanation</p>
</li>
<li><p><strong>Use explicit severity markers</strong>. Prefix rules with <code>MANDATORY</code>, <code>CRITICAL</code>, or <code>IMPORTANT</code> in ALL CAPS</p>
</li>
<li><p><strong>Apply progressive disclosure</strong>. Start with the strictest rules, then reveal nuance and context only after anchoring the constraints</p>
</li>
<li><p><strong>Repeat key rules at the end</strong>. Models give extra weight to what they read first <em>and</em> last (primacy and recency effect)</p>
</li>
<li><p><strong>Split large skills into focused modules</strong>. One file per concern beats one giant file every time</p>
</li>
<li><p><strong>Use structural separators</strong>. Use <code>---</code>, <code>===</code>, or explicit headers like <code>## RULES (READ FIRST)</code> to visually isolate critical sections</p>
</li>
<li><p><strong>Prefer numbered rules over prose</strong>. "Rule 1: Never do X" is harder to skip than "you should avoid doing X in most cases"</p>
</li>
<li><p><strong>Write a short TL;DR at the top</strong>. A one-line summary of the skill's purpose acts as a memory anchor for the whole file</p>
</li>
<li><p><strong>Add a violation example</strong>. Show explicitly what breaking the rule looks like so the model has a concrete anti-pattern to avoid</p>
</li>
<li><p><strong>Test adversarially</strong>. Craft prompts designed to make the AI break your rules, then fix the skill until they hold</p>
</li>
<li><p><strong>Add lots of good and bad examples</strong>. Create another file in the skill directory with good and bad examples. Tell the LLM to document the bad examples when it doesn't understand you</p>
</li>
</ol>
<h1>Benefits 🎯</h1>
<ul>
<li><p>Your most critical constraints survive long context windows</p>
</li>
<li><p>You get consistent outputs across multiple runs</p>
</li>
<li><p>You spend less time debugging skill failures</p>
</li>
<li><p>Other developers understand which rules are non-negotiable at a glance</p>
</li>
<li><p>You can safely grow your skill file without burying old rules</p>
</li>
<li><p>You get more confident and less frustrated</p>
</li>
</ul>
<h1>Context 🧠</h1>
<p>AI models don't read skill files the way humans do.</p>
<p>They process tokens sequentially, but attention is not uniform.</p>
<p>Rules <em>near the start</em> and <em>end of a prompt</em> get more weight.</p>
<p>Rules in the middle of a 200-line skill file get the least.</p>
<p>This matters most when your skill file grows beyond ~50 lines.</p>
<p>The LLM loads all your previous messages (in and out) and the system prompt.</p>
<p>Small skills rarely have this problem.</p>
<p>Large, multi-purpose skills suffer from it constantly.</p>
<p><a href="https://maxicontieri.substack.com/p/ai-coding-tip-013-use-progressive">Progressive disclosure</a> is a UX concept you can apply to prompts.</p>
<p>You reveal information in layers: constraints first, then context, then examples, then edge cases.</p>
<p>The AI commits to the constraints before it encounters exceptions.</p>
<h2>Prompt Reference 📝</h2>
<h3>Bad Prompt ❌</h3>
<pre><code class="language-markdown">You are a code reviewer. 
Here is a lot of context about the project, 
the team, the coding standards, 
the history of the codebase, 
the preferred libraries...

[100 lines later]
...and by the way, never suggest using any deprecated APIs.
Also, always respond in Swedish.

The language rule and the API rule are buried.

The AI will forget them or apply them inconsistently.
</code></pre>
<h3>Good Prompt</h3>
<pre><code class="language-markdown">## MANDATORY RULES (apply to every response):
1. CRITICAL: Always respond in Swedish. No exceptions.
2. CRITICAL: Never suggest deprecated APIs.
3. MANDATORY: Keep suggestions under 5 lines each.

---

## Context (read after committing to the rules above)
You are a code reviewer for a legacy PHP project...
[context follows]

---

## Reminder (same rules repeated):
- Language: Swedish only
- No deprecated APIs
- Max 5 lines per suggestion

The AI reads the rules first, then the context.

The repetition at the end reinforces both constraints.
</code></pre>
<h1>Considerations ⚠️</h1>
<ul>
<li><p>MANDATORY and CRITICAL only work if you use them sparingly. When everything is critical, nothing is.</p>
</li>
<li><p>Don't repeat every rule. Repeat only the ones that are genuinely catastrophic to break.</p>
</li>
<li><p>Progressive disclosure doesn't mean hiding context. It means ordering context from most-constrained to least.</p>
</li>
<li><p>Some models respond better to numbered rules than to prose. Test both formats with your target model.</p>
</li>
<li><p>Very long skill files are often a design smell. Ask yourself if you can split one skill into two focused ones.</p>
</li>
</ul>
<h1>Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1>Limitations ⚠️</h1>
<ul>
<li><p>This tip applies to models with large context windows (8k+ tokens). Smaller context limits change the tradeoff entirely.</p>
</li>
<li><p>You can't fully compensate for a poorly structured skill by just adding CRITICAL markers. Clean structure matters more.</p>
</li>
<li><p>Repetition helps, but too much repetition wastes tokens and can confuse the model with contradictory-looking rewrites.</p>
</li>
<li><p>This doesn't replace testing. Always validate your skill with adversarial prompts before trusting it in production.</p>
</li>
</ul>
<h1>Tags 🏷️</h1>
<ul>
<li>Context Window</li>
</ul>
<h1>Level 🔋</h1>
<p>[X] Intermediate</p>
<h1>Related Tips 🔗</h1>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-013-use-progressive">https://maxicontieri.substack.com/p/ai-coding-tip-013-use-progressive</a></p>

<ul>
<li><p>Tip: Keep your skill files focused on a single concern</p>
</li>
<li><p>Tip: Use TL;DR anchors at the top of every long prompt</p>
</li>
<li><p>Tip: Test your prompts adversarially before shipping</p>
</li>
<li><p>Tip: Prefer explicit rules over implicit conventions in skills</p>
</li>
<li><p>Tip: Split skills by domain, not by file size</p>
</li>
</ul>
<h1>Conclusion 🏁</h1>
<p>A long skill file doesn't enforce itself.</p>
<p>You need to structure it so the AI can't ignore the parts that matter.</p>
<p>Put critical rules first.</p>
<p>Mark them explicitly.</p>
<p>Repeat the non-negotiables at the end.</p>
<p>When you apply progressive disclosure, you guide the AI the same way you guide a human reader.</p>
<p>From constraints to context, not the other way around.</p>
<h1>More Information ℹ️</h1>
<p><a class="embed-card" href="https://arxiv.org/abs/2307.03172">https://arxiv.org/abs/2307.03172</a></p>

<p><a href="https://arxiv.org/abs/1706.03762">Attention Is All You Need (original Transformer paper)</a></p>
<p><a class="embed-card" href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview">https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview</a></p>

<p><a href="https://platform.openai.com/docs/guides/prompt-engineering">OpenAI Best Practices for Prompt Engineering</a></p>
<p><a class="embed-card" href="https://learnprompting.org/docs/intermediate/review">https://learnprompting.org/docs/intermediate/review</a></p>

<p><a href="https://www.nngroup.com/articles/progressive-disclosure/">Progressive Disclosure (UX principle)</a></p>
<p><a class="embed-card" href="https://arxiv.org/abs/2109.01652">https://arxiv.org/abs/2109.01652</a></p>

<p><a href="https://arxiv.org/abs/2302.12173">Prompt Injection and Instruction Hierarchy</a></p>
<p><a class="embed-card" href="https://arxiv.org/abs/2212.10535">https://arxiv.org/abs/2212.10535</a></p>

<p><a href="https://arxiv.org/abs/2404.02060">Context Length and Model Attention Patterns</a></p>
<h1>Also Known As 🎭</h1>
<ul>
<li><p>Instruction anchoring</p>
</li>
<li><p>Constraint-first prompting</p>
</li>
<li><p>Rule salience in prompts</p>
</li>
<li><p>Attention-aware skill design</p>
</li>
</ul>
<h1>Tools 🧰</h1>
<ul>
<li><p>Claude.ai (skill/system prompt editor)</p>
</li>
<li><p>Cursor rules (<code>.cursorrules</code> file)</p>
</li>
<li><p>GitHub Copilot instructions (<code>.github/copilot-instructions.md</code>)</p>
</li>
<li><p>Continue.dev (custom system prompts)</p>
</li>
<li><p>LangChain PromptTemplate</p>
</li>
<li><p>OpenAI Playground (system message editor)</p>
</li>
</ul>
<h1>Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans.</p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tips">https://maxicontieri.substack.com/p/ai-coding-tips</a></p>
]]></content:encoded></item><item><title><![CDATA[Code Smell 319 - Hardcoded Stateless Properties]]></title><description><![CDATA[TL;DR: You should avoid storing stateless utility classes as instance variables initialized with new.

Problems 😔

Hardcoded dependencies

Testing difficulties

High coupling

Hidden side effects

Ri]]></description><link>https://maximilianocontieri.com/code-smell-319-hardcoded-stateless-properties</link><guid isPermaLink="true">https://maximilianocontieri.com/code-smell-319-hardcoded-stateless-properties</guid><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Wed, 08 Apr 2026 01:40:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5f456a23b9870f18f59a8793/bf173921-44da-465d-9db1-6d5b3a9cc83d.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: You should avoid storing stateless utility classes as instance variables initialized with new.</p>
</blockquote>
<h1>Problems 😔</h1>
<ul>
<li><p>Hardcoded dependencies</p>
</li>
<li><p>Testing difficulties</p>
</li>
<li><p>High coupling</p>
</li>
<li><p>Hidden side effects</p>
</li>
<li><p>Rigid design</p>
</li>
<li><p>Misleading intent</p>
</li>
<li><p>Premature Optimization</p>
</li>
<li><p>Stack clutter</p>
</li>
</ul>
<h1>Solutions 😃</h1>
<ol>
<li><p>Use dependency injection</p>
</li>
<li><p>Pass as parameter</p>
</li>
<li><p>Use static methods</p>
</li>
<li><p>Inline the logic</p>
</li>
<li><p>Use local variables</p>
</li>
<li><p>Inline object creation</p>
</li>
</ol>
<h1>Refactorings ⚙️</h1>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/refactoring-024-replace-global-variables">https://maxicontieri.substack.com/p/refactoring-024-replace-global-variables</a></p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/refactoring-030-inline-attributes">https://maxicontieri.substack.com/p/refactoring-030-inline-attributes</a></p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/refactoring-007-extract-class-5b0b5960d0e7">https://maxicontieri.substack.com/p/refactoring-007-extract-class-5b0b5960d0e7</a></p>

<h1>Context 💬</h1>
<p>Hardcoding a stateless class in the constructor creates permanent coupling.</p>
<p>Even if the class is cheap to instantiate, you lose the ability to swap it.</p>
<p>Stateless objects shouldn't be part of the object's internal state.</p>
<p>You confuse readers by making a tool look essential to the object's identity.</p>
<p>It makes testing harder because you can't mock the hardcoded dependency.</p>
<h1>Sample Code 💻</h1>
<h2>Wrong 🚫</h2>


<pre><code class="language-typescript">class UserProcessor {
  private provider: MockDataProvider;

  constructor() {
    // You hardcode the dependency here.
    // This makes the class harder to test.
    this.provider = new MockDataProvider();
  }

  process(data: any) {
    return this.provider.format(data);
  }
}
</code></pre>
<h2>Right 👉</h2>


<pre><code class="language-typescript">interface DataProvider {
  format(data: any): any;
}

class UserProcessor {
  // You inject the dependency via constructor.
  // Now you can swap it or mock it easily.
  constructor(private readonly provider: DataProvider) {}

  process(data: any) {
    return this.provider.format(data);
  }
}
</code></pre>


<pre><code class="language-typescript">// Simpler but coupled
 class UserProcessor {
    constructor() {
      // Empty
    }
  
    process(data: any) {
      return new MockDataProvider().format(data);
    }
  }
</code></pre>
<h2>Detection 🔍</h2>
<p>Look for the <code>new</code> keyword inside constructors.</p>
<p>Watch for private properties instantiated directly in the constructor rather than passed as parameters.</p>
<p>Most linters flag this pattern automatically when you create instances and assign them to private fields without dependency injection.</p>
<h2>Tags 🏷️</h2>
<ul>
<li>Premature Optimization</li>
</ul>
<h2>Level 🔋</h2>
<p>[X] Beginner</p>
<h2>Why the Bijection Is Important 🗺️</h2>
<p>Software should mimic a <a href="https://maxicontieri.substack.com/p/what-is-software-9a78c1172cf9">MAPPER</a> of the real world.</p>
<p>In reality, a worker might use a tool to complete a task.</p>
<p>The tool is not a permanent physical attachment to the worker.</p>
<p>When you refactor to use dependency injection, you respect the <a href="https://maxicontieri.substack.com/p/the-one-and-only-software-design-principle-5328420712af">bijection</a> by treating collaborators as external entities, not internal state.</p>
<p>This keeps your simulation flexible and accurate.</p>
<h2>AI Generation 🤖</h2>
<p>AI generators frequently create this smell.</p>
<p>They often suggest code that just works by instancing dependencies directly in the constructor to save time.</p>
<h2>AI Detection 🧲</h2>
<p>AI can easily detect this smell without explicit instructions.</p>
<p>When you show AI a class with <code>new</code> keywords in the constructor, it recognizes the pattern as hardcoded coupling.</p>
<p>AI identifies that stateless utility classes should be injected rather than instantiated internally.</p>
<p>The detection is straightforward because the pattern is syntactically obvious and semantically harmful.</p>
<h2>Try Them! 🛠</h2>
<p><em>Remember: AI Assistants make lots of mistakes</em></p>
<blockquote>
<p>Suggested Prompt: remove the cached attribute</p>
</blockquote>
<table>
<thead>
<tr>
<th>Without Proper Instructions</th>
<th>With Specific Instructions</th>
</tr>
</thead>
<tbody><tr>
<td><a href="https://chat.openai.com/?q=Correct+and+explain+this+code%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">ChatGPT</a></td>
<td><a href="https://chat.openai.com/?q=remove+the+cached+attribute%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">ChatGPT</a></td>
</tr>
<tr>
<td><a href="https://claude.ai/new?q=Correct+and+explain+this+code%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">Claude</a></td>
<td><a href="https://claude.ai/new?q=remove+the+cached+attribute%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">Claude</a></td>
</tr>
<tr>
<td><a href="https://www.perplexity.ai/?q=Correct+and+explain+this+code%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">Perplexity</a></td>
<td><a href="https://www.perplexity.ai/?q=remove+the+cached+attribute%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">Perplexity</a></td>
</tr>
<tr>
<td><a href="https://www.bing.com/chat?showconv=1&amp;sendquery=1&amp;q=Correct+and+explain+this+code%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">Copilot</a></td>
<td><a href="https://www.bing.com/chat?showconv=1&amp;sendquery=1&amp;q=remove+the+cached+attribute%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">Copilot</a></td>
</tr>
<tr>
<td><a href="https://you.com/search?q=Correct+and+explain+this+code%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">You</a></td>
<td><a href="https://you.com/search?q=remove+the+cached+attribute%3A+%60%60%60typescript%0D%0Aclass+UserProcessor+%7B%0D%0A++private+provider%3A+MockDataProvider%3B%0D%0A%0D%0A++constructor%28%29+%7B%0D%0A++++%2F%2F+You+hardcode+the+dependency+here.%0D%0A++++%2F%2F+This+makes+the+class+harder+to+test.%0D%0A++++this.provider+%3D+new+MockDataProvider%28%29%3B%0D%0A++%7D%0D%0A%0D%0A++process%28data%3A+any%29+%7B%0D%0A++++return+this.provider.format%28data%29%3B%0D%0A++%7D%0D%0A%7D%0D%0A%60%60%60">You</a></td>
</tr>
<tr>
<td><a href="https://gemini.google.com/">Gemini</a></td>
<td><a href="https://gemini.google.com/">Gemini</a></td>
</tr>
<tr>
<td><a href="https://chat.deepseek.com/">DeepSeek</a></td>
<td><a href="https://chat.deepseek.com/">DeepSeek</a></td>
</tr>
<tr>
<td><a href="https://www.meta.ai/chat">Meta AI</a></td>
<td><a href="https://www.meta.ai/">Meta AI</a></td>
</tr>
<tr>
<td><a href="https://grok.com/">Grok</a></td>
<td><a href="https://grok.com/">Grok</a></td>
</tr>
<tr>
<td><a href="https://chat.qwen.ai/">Qwen</a></td>
<td><a href="https://chat.qwen.ai/">Qwen</a></td>
</tr>
</tbody></table>
<h2>Conclusion 🏁</h2>
<p>Storing stateless dependencies as instance variables makes your code rigid.</p>
<p>When you inject these dependencies instead, you improve testability and keep your objects focused on their true purpose.</p>
<h2>Relations 👩‍❤️‍💋‍👨</h2>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/code-smell-06-too-clever-programmer-bffec35daf0b">https://maxicontieri.substack.com/p/code-smell-06-too-clever-programmer-bffec35daf0b</a></p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/code-smell-20-premature-optimization-60409b7f90ec">https://maxicontieri.substack.com/p/code-smell-20-premature-optimization-60409b7f90ec</a></p>

<h1>Disclaimer 📘</h1>
<p>Code Smells are my <a href="https://maximilianocontieri.com/i-wrote-more-than-90-articles-on-2021-here-is-what-i-learned">opinion</a>.</p>
<h1>Credits 🙏</h1>
<p>Photo by <a href="https://unsplash.com/es/@possessedphotography">Possessed Photography</a> on <a href="https://unsplash.com/">Unsplash</a></p>
<hr />
<blockquote>
<p>Coupling is the enemy of change</p>
</blockquote>
<p><em>Rich Hickey</em></p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/software-engineering-great-quotes-3af63cea6782">https://maxicontieri.substack.com/p/software-engineering-great-quotes-3af63cea6782</a></p>

<hr />
<p>This article is part of the CodeSmell Series.</p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/how-to-find-the-stinky-parts-of-your-code-fa8df47fc39c">https://maxicontieri.substack.com/p/how-to-find-the-stinky-parts-of-your-code-fa8df47fc39c</a></p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 014 - Use Nested AGENTS.md Files]]></title><description><![CDATA[TL;DR: Split your AGENTS.md into layered files so your AI loads only the rules that matter for the code you touch.

Common Mistake ❌
You put a single massive AGENTS.md at your project root and cram ev]]></description><link>https://maximilianocontieri.com/ai-coding-tip-014-use-nested-agents-md-files</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-014-use-nested-agents-md-files</guid><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Sat, 04 Apr 2026 18:43:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5f456a23b9870f18f59a8793/f3f06e34-ff58-4e3e-951a-1ccf8cbc859d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Split your AGENTS.md into layered files so your AI loads only the rules that matter for the code you touch.</p>
</blockquote>
<h1>Common Mistake ❌</h1>
<p>You put a single massive <code>AGENTS.md</code> at your project root and cram everything into it.</p>
<p>Framework rules, database patterns, frontend conventions, and continuous integration configuration—all loaded at once.</p>
<p>Your AI reads rules that have nothing to do with what you're actually working on.</p>
<p>This wastes context and weakens the guidance that matters.</p>
<h1>Problems Addressed 😔</h1>
<ul>
<li><p>Your AI follows rules meant for other parts of the codebase</p>
</li>
<li><p>Irrelevant context crowds out the rules you actually need</p>
</li>
<li><p>Updating one big file can break guidance for unrelated areas</p>
</li>
<li><p>Teammates get confused by your personal preferences</p>
</li>
</ul>
<h1>How to Do It 🛠️</h1>
<ol>
<li><p>Create a root <code>AGENTS.md</code> with global rules: coding standards, commit format, architecture overview, and general gotchas</p>
</li>
<li><p>Add subdirectory <code>AGENTS.md</code> files in each major area (<code>model/</code>, <code>tests/</code>, <code>api/</code>) with area-specific rules</p>
</li>
<li><p>Create <code>AGENTS.local.md</code> for personal preferences and add it to <code>.gitignore</code></p>
</li>
<li><p>Keep files short, opinionated, and actionable—three bullets over three paragraphs</p>
</li>
<li><p>Trust the loading system: most tools load root files at startup and subdirectory files only when you touch files there</p>
</li>
</ol>
<pre><code class="language-plaintext">FermiCalculator/
├── AGENTS.md          ← loaded at startup (always) with general
│                    rules
├── model/
│   └── AGENTS.md      ← loaded when you make changes to your
│                    model/, model conventions
├── tests/
│   └── AGENTS.md      ← loaded when you change your tests/,
│                    mocking rules
├── ui/
│   └── AGENTS.md      ← loaded when you make changes to ui/,
│                    UI code standards
└── api/
│   └── AGENTS.md      ← loaded when you make changes to api/,
│                    OpenApi formatting
└── database/
│   └── AGENTS.md      ← loaded when you make changes to the
│                    persistence/ DDL Rules
</code></pre>
<h1>Benefits 🎯</h1>
<ul>
<li><p>The AI reads only rules relevant to what you're working on</p>
</li>
<li><p>You reduce context waste in every session</p>
</li>
<li><p>Each team area owns its own guidance independently</p>
</li>
<li><p>Personal preferences stay personal — they don't pollute shared files</p>
</li>
<li><p>Smaller files are easier to review and maintain</p>
</li>
</ul>
<h1>Context 🧠</h1>
<p>AI coding assistants load context files to understand your project.</p>
<p>Tools like Claude Code, Cursor, and Copilot support instruction files (<code>AGENTS.md</code>, <code>CLAUDE.md</code>, <code>.cursorrules</code>).</p>
<p>When you put everything in one file, your assistant can't filter what's relevant.</p>
<p>The layered approach works like good software: separation of concerns.</p>
<p>The root file sets foundations.</p>
<p>Subdirectory files add specifics.</p>
<p>Local files hold personal quirks.</p>
<p>This helps any project with multiple distinct areas—monorepos benefit most.</p>
<p>Remember, you always need to <a href="https://maxicontieri.substack.com/p/ai-coding-tip-005-keep-context-fresh">manage your context</a> wisely.</p>
<h2>Prompt Reference 📝</h2>
<h3>Bad Prompt:</h3>
<pre><code class="language-markdown">Here are all the conventions for my project:

[pastes 200 lines of mixed rules for backend, frontend, 
mobile, and CI]

Now help me fix this React component.
</code></pre>
<h3>Good Prompt:</h3>
<pre><code class="language-markdown">I'm working in UI/. My AGENTS.md for this area says: 

use functional components, no class components,

Tailwind only for styling, 

test with React Testing Library.

Help me fix this component.
</code></pre>
<h1>Considerations ⚠️</h1>
<ul>
<li><p>Not all tools support lazy loading of subdirectory files—check your tool first</p>
</li>
<li><p>A short bad <code>AGENTS.md</code> hurts less than a long one. Vague rules get ignored or misapplied</p>
</li>
<li><p>Consider adding <code>AGENTS.md</code> when you create new subdirectories</p>
</li>
<li><p>Review your root file regularly. Outdated rules mislead more than good guidance. See <a href="https://maxicontieri.substack.com/p/code-smell-183-obsolete-comments-db946fffc766">Outdated Documentation</a></p>
</li>
<li><p>Avoid <a href="https://maxicontieri.substack.com/p/code-smell-306-ai-external-comments">AI external comments</a></p>
</li>
</ul>
<h1>Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1>Limitations ⚠️</h1>
<ul>
<li><p>Works best with tools that support hierarchical context loading (Claude Code, Cursor, some Copilot)</p>
</li>
<li><p>Single-file projects don't need this structure</p>
</li>
<li><p>You still need good rules—the hierarchy only helps if the content is solid</p>
</li>
<li><p><code>AGENTS.local.md</code> support varies by tool; check your documentation</p>
</li>
</ul>
<h1>Tags 🏷️</h1>
<ul>
<li>Standards</li>
</ul>
<h1>Level 🔋</h1>
<p>[X] Intermediate</p>
<h1>Related Tips 🔗</h1>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-005-keep-context-fresh">https://maxicontieri.substack.com/p/ai-coding-tip-005-keep-context-fresh</a></p>

<ul>
<li><p>Use examples in your AGENTS.md, not just descriptions</p>
</li>
<li><p>Version-control your AGENTS.md alongside your code</p>
</li>
</ul>
<h1>Conclusion 🏁</h1>
<p>You don't need one perfect <code>AGENTS.md</code>.</p>
<p>You need the right rules in the right place.</p>
<p>Split context by area, keep files tight, and let tools load only what's relevant.</p>
<p>Your AI works better with less noise. 🗂️</p>
<h1>More Information ℹ️</h1>
<p><a href="https://craftbettersoftware.com/p/stop-using-claude-code-like-a-chatbot">Stop Using Claude Code as a ChatBot</a></p>
<p><a href="https://docs.anthropic.com/en/docs/claude-code/memory">Claude Code CLAUDE.md documentation</a></p>
<p><a href="https://docs.cursor.com/context/rules-for-ai">Cursor Rules documentation</a></p>
<p><a href="https://docs.github.com/en/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot">GitHub Copilot custom instructions</a></p>
<p><a href="https://openai.com/blog/custom-instructions-for-chatgpt">OpenAI ChatGPT custom instructions</a></p>
<p><a href="https://docs.continue.dev/customization/context-providers">Continue.dev context files</a></p>
<p><a href="https://aider.chat/docs/usage/conventions.html">Aider conventions file</a></p>
<p><a href="https://sourcegraph.com/docs/cody">Cody context and instructions</a></p>
<p><a href="https://nx.dev/concepts/mental-model">Monorepo tooling with Nx</a></p>
<p><a href="https://www.anthropic.com/research/claude-character">Context window management in LLMs</a></p>
<p><a href="https://www.promptingguide.ai/">Prompt engineering guide</a></p>
<h1>Also Known As 🎭</h1>
<ul>
<li><p>Hierarchical context files</p>
</li>
<li><p>Layered instructions</p>
</li>
<li><p>Nested AI rules</p>
</li>
<li><p>Scoped assistant configuration</p>
</li>
</ul>
<h1>Tools 🧰</h1>
<ul>
<li><p>Claude Code (<code>CLAUDE.md</code>)</p>
</li>
<li><p>Cursor (<code>.cursorrules</code> / <code>.cursor/rules</code>)</p>
</li>
<li><p>GitHub Copilot (<code>.github/copilot-instructions.md</code>)</p>
</li>
<li><p>Aider (<code>CONVENTIONS.md</code>)</p>
</li>
<li><p>Continue.dev (<code>.continuerc.json</code>)</p>
</li>
</ul>
<h1>Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans.</p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tips">https://maxicontieri.substack.com/p/ai-coding-tips</a></p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 013 - Use Progressive Disclosure]]></title><description><![CDATA[TL;DR: You reduce token usage when you trigger conditional loading instead of loading all files at once.

Common Mistake ❌
You load a complex skill with 20 associated files into your context window al]]></description><link>https://maximilianocontieri.com/ai-coding-tip-013-use-progressive-disclosure</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-013-use-progressive-disclosure</guid><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Sun, 29 Mar 2026 15:17:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5f456a23b9870f18f59a8793/3fd6fed2-3ce0-4950-a90d-136a9bb44dd4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: You reduce token usage when you trigger conditional loading instead of loading all files at once.</p>
</blockquote>
<h1>Common Mistake ❌</h1>
<p>You load a complex skill with 20 associated files into your <a href="https://maxicontieri.substack.com/p/ai-coding-tip-005-keep-context-fresh">context window</a> all at once.</p>
<p>Your context window fills up immediately.</p>
<p>You waste tokens on irrelevant file content and cases that don't match what you're asking.</p>
<p>The AI gets lost in noise and disobeys your commands. </p>
<p>You can't ask follow-up questions because there's no space left, and hallucinations happen.</p>
<h1>Problems Addressed 😔</h1>
<ul>
<li>You waste tokens loading skill files you don't need</li>
<li>The AI reads case definitions that don't apply to your input</li>
<li>Context window fills up before you can iterate or ask follow-ups</li>
<li>Response time slows down because the AI is overwhelmed</li>
<li>You lose precision when the AI picks the wrong file or rule</li>
</ul>
<h1>How to Do It 🛠️</h1>
<ol>
<li>Split your skill into multiple files (one per concern)</li>
<li>Write a smart description with clear conditional triggers</li>
<li>Define keywords that trigger file loading</li>
<li>Create conditional rules: "If input contains X, load file Y"</li>
<li>Include response templates so the AI knows how to structure answers</li>
<li>Nest file references only when needed (e.g., array.md loads nested.md only for nested arrays)</li>
<li>Test your keywords to ensure the AI picks them up correctly</li>
</ol>
<h1>Benefits 🎯</h1>
<p>The AI loads only the files it needs. </p>
<p>You save 90% of tokens on irrelevant skill content. </p>
<p>Response times stay fast even with complex skills.</p>
<p>Your context window stays clean for follow-up questions. </p>
<p>Each request is precise because the AI only sees rules that matter.</p>
<h1>Context 🧠</h1>
<p>Agentic skills can be massive.</p>
<p>A syntax validator might have files for declarations, arrays, nested arrays, function calls, and scripts.</p>
<p>If you load all of them, the AI wastes tokens reading rules that don't apply.</p>
<p>Progressive disclosure in skills works by defining keywords that trigger file loading.</p>
<p>When you write "DECLARE 123", the skill recognizes the DECLARE keyword and loads declaration.md.</p>
<p>The AI only reads what matters.</p>
<p>You write descriptions using "What," "When," or "How" patterns.</p>
<p>You create conditional rules in your main skill file.</p>
<p>You include response templates so answers stay consistent.</p>
<p>The AI requests what it needs using keywords, so you don't have to guess.</p>
<h2>How Skills Work 🔄</h2>
<p>Skills implement progressive disclosure at three stages:</p>
<p><strong>Discovery</strong>: At startup, agents load only the name and description of each available skill.</p>
<p>Just enough information to know when a skill might be relevant.</p>
<p>No full instructions, no referenced files, no code—only the metadata.</p>
<p><strong>Activation</strong>: When a task matches a skill's description, the agent reads the full SKILL.md instructions into context.</p>
<p>Now the agent has the complete instructions and knows what to do.</p>
<p>Still no unnecessary files or code loaded yet.</p>
<p><strong>Execution</strong>: The agent follows the instructions, optionally loading referenced files or executing bundled code as needed.</p>
<p>Only when the AI detects it needs something does it load that file or run that script.</p>
<p>This approach keeps agents fast while giving them access to more context when they actually need it.</p>
<p>Each step is triggered by actual need, not preloaded upfront.</p>
<h2>Prompt Reference 📝</h2>
<h3>Bad Prompt:</h3>




<pre><code class="language-markdown">
# SKILL.md (15,000 tokens - Monolithic)



Validates DECLARE, arrays, nested arrays,

function calls, loops, all in one file.



DECLARE Rules:

- First char uppercase

- Can't start with a number



Array Rules:

- Use square brackets [item]

- Examples: [foo], [bar]



Function Call Rules:

- Parentheses required: func()

- Parameters separated by commas



Loop Rules:

- FOR, WHILE, DO keywords

- Body must be indented
</code></pre>
<p>When you ask, "Is DECLARE 123 valid?" the AI loads all 15,000 tokens covering every rule.</p>
<p>Context window fills up fast.</p>
<h3>Good Prompt:</h3>




<pre><code class="language-markdown">
# SKILL.md (800 tokens - Modular)



Validates foo syntax: DECLARE, arrays,

nested arrays, function calls, loops.



Rules:

- DECLARE detected → load declaration.md

- [ detected → load array.md

- ( detected → load function-call.md



Template: [input] valid?

[YES/NO]. Reason: [rule].
</code></pre>
<p><strong>declaration.md</strong> (1,200 tokens):</p>
<pre><code>
First character must be uppercase.

Cannot start with a number.

Examples: DECLARE x, DECLARE foo
</code></pre>
<p><strong>array.md</strong> (1,500 tokens):</p>
<pre><code>
Must use brackets: [item]

References nested-array.md for [x]

Examples: [foo], [bar], [123]
</code></pre>
<pre><code>
When you ask "Is DECLARE 123 valid?", the AI loads only SKILL.md (800) + declaration.md (1,200) = 2,000 tokens.

Context stays clean for follow-up questions.

# Considerations ⚠️

Define your keywords upfront so the AI recognizes them consistently. 

Each file should handle one concern (declarations, arrays, etc.).

Don't create too many nested references, or the loading chain becomes confusing. 

Test your keyword patterns to make sure the AI recognizes them.

If your skill includes scripts, review them carefully. 

Scripts can create security risks if they run without review.

# Type 📝

[X] Semi-Automatic

# Limitations ⚠️

Progressive disclosure works best when keywords are distinctive. 

Generic words like "function" might trigger too often and load the wrong file.

Deeply nested file structures (3+ levels) are confusing to maintain. 

External scripts need a security review before you share skills from online repositories. 

Keywords must be clear, or the AI loads files unpredictably.

# Tags 🏷️

- Standards

# Level 🔋

[X] Intermediate

# Related Tips 🔗
&lt;p&gt;&lt;a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-001-commit-before-prompt"&gt;https://maxicontieri.substack.com/p/ai-coding-tip-001-commit-before-prompt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-005-keep-context-fresh"&gt;https://maxicontieri.substack.com/p/ai-coding-tip-005-keep-context-fresh&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-009-compact-your-context"&gt;https://maxicontieri.substack.com/p/ai-coding-tip-009-compact-your-context&lt;/a&gt;&lt;/p&gt;

# Conclusion 🏁

Progressive disclosure in skills means splitting files by concern and using keywords to trigger conditional loading. 

You define what the AI needs to see, not dump everything.

Include templates so responses stay consistent.

When you get good at this pattern, even complex skills stay fast, efficient, and focused. 🎯

# More Information ℹ️

[Agent skills progressive disclosure](https://agentskills.io/what-are-skills#how-skills-work)

[Claude Token Counting Guide](https://docs.anthropic.com/en/docs/build-a-bot)

[Context Windows and Token Limits](https://docs.anthropic.com/en/docs/about-claude/models/overview)

[Prompt Engineering Patterns](https://docs.anthropic.com/en/docs/build-a-bot)

[UX Progressive Disclosure](https://en.wikipedia.org/wiki/Progressive_disclosure)

[Information Architecture Best Practices](https://www.nngroup.com/articles/ia-basics/)

[Cognitive Load Theory](https://www.nngroup.com/articles/cognitive-load-estimation/)

[Efficient Prompt Design](https://platform.openai.com/docs/guides/prompt-engineering)

[API Cost Optimization](https://docs.anthropic.com/en/docs/about-claude/models/overview)

[Code Context Patterns](https://arxiv.org/abs/2304.08134)
&lt;p&gt;&lt;a class="embed-card" href="https://www.youtube.com/watch?v=DQHFow2NoQc"&gt;https://www.youtube.com/watch?v=DQHFow2NoQc&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="embed-card" href="https://www.youtube.com/watch?v=hTKhLgRcAys"&gt;https://www.youtube.com/watch?v=hTKhLgRcAys&lt;/a&gt;&lt;/p&gt;

# Also Known As 🎭

- Layered context disclosure
- Just-in-time information architecture
- Context-on-demand

# Tools 🧰

- Windsurf with [progressive disclosure](https://docs.windsurf.com/windsurf/cascade/skills)
- GitHub Copilot with skills
- Claude with custom skills
- VS Code Copilot Chat
- Agentic frameworks
- Token counter tools

# Disclaimer 📢

The views expressed here are my own.



I am a human who writes as best as possible for other humans. 



I use AI proofreading tools to improve some texts.



I welcome constructive criticism and dialogue.



I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.

***

This article is part of the *AI Coding Tip* series.
&lt;p&gt;&lt;a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tips"&gt;https://maxicontieri.substack.com/p/ai-coding-tips&lt;/a&gt;&lt;/p&gt;
</code></pre>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 012 - Understand All Your Code]]></title><description><![CDATA[TL;DR: Never ship AI-generated code you don't understand — ask until you do.

Common Mistake ❌
You ask an AI agent to implement a feature.
It returns 200 lines of code.
You run the tests. They pass. Y]]></description><link>https://maximilianocontieri.com/ai-coding-tip-012-understand-all-your-code</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-012-understand-all-your-code</guid><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Mon, 23 Mar 2026 15:17:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5f456a23b9870f18f59a8793/be121c5e-0293-47a3-825d-06516cfbe48c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Never ship AI-generated code you don't understand — ask until you do.</p>
</blockquote>
<h1>Common Mistake ❌</h1>
<p>You ask an AI agent to implement a feature.</p>
<p>It returns 200 lines of code.</p>
<p>You run the tests. They pass. You commit and push.</p>
<p>You think you are the best 'agentic-coder' in the world.</p>
<p>But you never read the code.</p>
<p>Three weeks later, a security issue appears in production.</p>
<p>The AI introduced subtle <a href="https://maxicontieri.substack.com/p/stop-calling-them-bugs-370db4691360">bugs</a> you could have caught in two minutes.</p>
<p>You didn't catch it because you never looked.</p>
<p>You're accountable but don't understand what the code does, and you can't explain it to others.</p>
<p>There are lots of fancy video tutorials about using agents without reviewing code.</p>
<p>Remember, there must always be a human in the loop.</p>
<h1>Problems Addressed 😔</h1>
<ul>
<li><p>You lose control of your own codebase.</p>
</li>
<li><p>You can't debug code you don't understand.</p>
</li>
<li><p>You ship vulnerabilities without knowing they exist.</p>
</li>
<li><p>You can't explain your own code in a code review.</p>
</li>
<li><p>You build a dependency on AI that makes you a worse engineer over time.</p>
</li>
<li><p>You take legal and professional responsibility for code you never vetted.</p>
</li>
</ul>
<p>[<a href="https://maxicontieri.substack.com/p/code-smell-313-workslop-code%5D">https://maxicontieri.substack.com/p/code-smell-313-workslop-code]</a></p>
<h1>How to Do It 🛠️</h1>
<ol>
<li>Read every code line the AI generates or modifies before you accept it.</li>
<li>Ask the AI to explain any part you don't understand.</li>
<li>Ask follow-up questions until the explanation is clear to you.</li>
<li>Identify the assumptions the AI made and verify them.</li>
<li>Check edge cases the AI might have missed. </li>
<li><a href="https://maxicontieri.substack.com/p/how-to-improve-your-code-with-easy-refactorings-fe80b60e6a8e">Refactor</a> and polish any part that you would not have written that way yourself.</li>
<li>Make the code yours before you <a href="https://maxicontieri.substack.com/p/ai-coding-tip-001-commit-before-prompt">commit</a> it.</li>
</ol>
<h1>Benefits 🎯</h1>
<ul>
<li>You stay as the author of your codebase, not just a curator of AI output.</li>
<li>You catch <a href="https://maxicontieri.substack.com/p/stop-calling-them-bugs-370db4691360">defects</a> before they reach production.</li>
<li>You learn from what the AI generates.</li>
<li>You build trust with your team because you can explain your code.</li>
<li>You make better prompts over time because you understand what went wrong.</li>
</ul>
<h1>Context 🧠</h1>
<p>AI agents are fast. That speed creates pressure.</p>
<p>You feel like slowing down to read breaks the momentum.</p>
<p>It doesn't. It saves you.</p>
<p>The AI doesn't know your system. It doesn't know your constraints.</p>
<p>It doesn't know what happened last quarter when you made a similar change.</p>
<p>You do. That context is irreplaceable.</p>
<p>When you skip reading, you hand off judgment to a tool that has no judgment. You outsource the one thing only you can do.</p>
<p>Asking questions is not a sign of weakness. </p>
<p>It is how you stay in control.</p>
<p>The AI won't judge you for asking.</p>
<p>It will give you a better answer.</p>
<h2>Prompt Reference 📝</h2>
<h2>Bad Prompt:</h2>


<pre><code class="language-markdown">Implement user authentication,

add it to the project,

commit and push to the main branch.

*This prompt gives the AI full authority over a critical system. *

*You get a blob of code with no checkpoint for understanding.*
</code></pre>
<h2>Good Prompt:</h2>


<pre><code class="language-markdown">Implement a login function using JWT.

Use RS256 signing.

After you write it, ask me questions about each step.

I'd like to understand what you did on every line of code

*This prompt sets expectations.*

*You get code AND an explanation.*

*You know what to verify.*
</code></pre>
<h1>Considerations ⚠️</h1>
<ul>
<li>The AI can write completely wrong, confident-sounding code.</li>
<li>Passing tests doesn't mean you wrote correct logic.</li>
<li>The AI optimizes for plausible output, not correct output.</li>
<li>You are responsible for what you deploy, not the AI.</li>
<li>Some AI mistakes are subtle. You only catch them when you read carefully.</li>
</ul>
<h1>Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1>Limitations ⚠️</h1>
<ul>
<li>For very large generated files, break your review into sections.</li>
</ul>
<h1>Tags 🏷️</h1>
<ul>
<li>Readability</li>
</ul>
<h1>Level 🔋</h1>
<p>[X] Beginner</p>
<h1>Related Tips 🔗</h1>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line">https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line</a></p>

<ul>
<li><p>AI Coding Tip - Ask the AI to Explain Its Own Code</p>
</li>
<li><p>AI Coding Tip - Use AI as a Pair Programmer, Not a Replacement</p>
</li>
</ul>
<h1>Conclusion 🏁</h1>
<p>The AI writes fast. You think too slowly. That is not a flaw.</p>
<p>That is the division of labor that makes the combination work.</p>
<p>Speed without understanding is just faster mistakes.</p>
<p>Ask questions. Read the code. Own what you ship. 🏁</p>
<h1>More Information ℹ️</h1>
<p><a class="embed-card" href="https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/">https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/</a></p>
<p><a class="embed-card" href="https://owasp.org/www-project-top-ten/">https://owasp.org/www-project-top-ten/</a></p>
<p><a class="embed-card" href="https://google.github.io/eng-practices/review/">https://google.github.io/eng-practices/review/</a></p>
<p><a class="embed-card" href="https://martinfowler.com/bliki/CodeSmell.html">https://martinfowler.com/bliki/CodeSmell.html</a></p>
<p><a class="embed-card" href="https://arxiv.org/abs/2211.03622">https://arxiv.org/abs/2211.03622</a></p>
<p><a class="embed-card" href="https://www.acm.org/code-of-ethics">https://www.acm.org/code-of-ethics</a></p>
<p><a class="embed-card" href="https://stackoverflow.blog/2023/04/17/how-ai-changes-code-ownership/">https://stackoverflow.blog/2023/04/17/how-ai-changes-code-ownership/</a></p>
<p><a class="embed-card" href="https://www.ieee.org/education/standards/index.html">https://www.ieee.org/education/standards/index.html</a></p>
<p><a class="embed-card" href="https://cwe.mitre.org/">https://cwe.mitre.org/</a></p>

<h1>Also Known As 🎭</h1>
<ul>
<li>"Trust but verify."</li>
<li>"AI-generated code review."</li>
<li>"Responsible AI coding."</li>
<li>"Developer accountability"</li>
</ul>
<h1>Tools 🧰</h1>
<ul>
<li>Any AI coding assistant (GitHub Copilot, Claude, Cursor, Codeium)</li>
<li>Your language's linter and static analysis tool</li>
<li>Code review tools (GitHub PRs, GitLab MRs, Gerrit)</li>
</ul>
<h1>Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans. </p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tips">https://maxicontieri.substack.com/p/ai-coding-tips</a></p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 011 - Initialize Agents.md
]]></title><description><![CDATA[TL;DR: When you use the /init command, you create a context file that saves you from repeating instructions in every new session.

Common Mistake ❌
You waste time copying and pasting the same project ]]></description><link>https://maximilianocontieri.com/ai-coding-tip-011-initialize-agents-md</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-011-initialize-agents-md</guid><category><![CDATA[AI]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[clean code]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Wed, 18 Mar 2026 20:32:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5f456a23b9870f18f59a8793/f07eefde-a363-41be-9a95-d3fe31a72f11.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: When you use the /init command, you create a context file that saves you from repeating instructions in every new session.</p>
</blockquote>
<h1>Common Mistake ❌</h1>
<p>You waste time copying and pasting the same project rules into every new chat. </p>
<p>You forgot to tell the AI about your specific test commands. </p>
<p>When you start a fresh session, the AI loses all previous context about your coding style or architecture.</p>
<p>Create your own <em>system prompts</em>, persist them and keep an eye on them regularly.</p>
<h1>Problems Addressed 😔</h1>
<ul>
<li>Repetitive and manual meta-prompting</li>
<li>Inconsistent <a href="https://maxicontieri.substack.com/p/code-smell-48-code-without-standards-60c9e0905627">code styles</a> across sessions</li>
<li>High token usage from redundant instructions</li>
<li>AI hallucinations about build or test commands</li>
<li>Onboarding new projects</li>
</ul>
<h1>How to Do It 🛠️</h1>
<ol>
<li>Open your terminal in your project root directory.</li>
<li>Type <a href="https://opencode.ai/docs/rules/"><code>/init</code></a> if you use Claude Code or OpenCode.</li>
<li>Review the generated <code>CLAUDE.md</code> or <code>AGENTS.md</code> file.</li>
<li>Add specific "landmines" or things the AI can't see in the code.</li>
<li>Save the file, <a href="https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line">review the commit diffs</a>, and start your next coding task.</li>
<li>You can do it again when you have new rules.</li>
</ol>
<h1>Benefits 🎯</h1>
<p>When you initialize (/Init) your project, the AI reads all the repository immediately. </p>
<p>You get consistent results without extra effort. </p>
<p>You save tokens because you don't have to describe your stack every time.</p>
<h1>Context 🧠</h1>
<p>AI assistants start every session with a blank slate. </p>
<p>They don't remember what you told them yesterday. </p>
<p>Tools like Claude Code look for a specific file to understand your project. </p>
<p>When you provide this saved file, you close the gap between separate AI sessions.</p>
<h2>Prompt Reference 📝</h2>
<p><strong>Bad Prompt:</strong></p>


<pre><code class="language-markdown">Remember to use 2 spaces for indentation 
and always run 'npm run test:unit' 
before you finish the task.
</code></pre>
<p><strong>Good Prompt:</strong></p>


<pre><code class="language-markdown">git clone https://github.com/torvalds/linux.git

/Init
</code></pre>
<h1>Considerations ⚠️</h1>
<p>Keep the generated file short. </p>
<p>When you add too much text, the AI might get confused. </p>
<p>Don't include information that the AI can already find in your <code>package.json</code> or <code>README.md</code>.</p>
<h1>Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1>Limitations ⚠️</h1>
<p>You can only use this tip with AI tools that support persistent context files. </p>
<p>If you change your build tools, you can update the Markdown file manually, run /init again, or do both.</p>
<p>In Windsurf, there is no literal /init terminal command that automatically generates a configuration file, as Claude Code or OpenCode does.</p>
<p>Windsurf uses a more agentic approach where the AI (Cascade) either discovers your rules automatically or creates them when you ask.</p>
<blockquote>
<p>Cascade, initialize a .windsurfrules file for this project. Include my tech stack, coding standards, and build commands.</p>
</blockquote>
<h1>Tags 🏷️</h1>
<ul>
<li>Standards</li>
</ul>
<h1>Level 🔋</h1>
<p>[X] Beginner</p>
<h1>Related Tips 🔗</h1>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line">https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line</a></p>

<ul>
<li><p>Use <em>.cursorrules</em> for local preferences</p>
</li>
<li><p>Create modular <em>AGENTS.md</em> files for monorepos</p>
</li>
<li><p>Keep your <em>README.md</em> updated for better AI indexing</p>
</li>
</ul>
<h1>Conclusion 🏁</h1>
<p>When you use <code>/init</code>, you turn your AI from a temporary contributor into a permanent team member.</p>
<h1>More Information ℹ️</h1>
<p><a class="embed-card" href="https://opencode.ai/docs/rules/">https://opencode.ai/docs/rules/</a></p>

<p><a class="embed-card" href="https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview%23claudemd-guide">https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview%23claudemd-guide</a></p>
<p><a class="embed-card" href="https://docs.cursor.com/context/rules-for-ai">https://docs.cursor.com/context/rules-for-ai</a></p>
<p><a class="embed-card" href="https://docs.windsurf.com/windsurf/cascade/memories">https://docs.windsurf.com/windsurf/cascade/memories</a></p>

<h1>Also Known As 🎭</h1>
<ul>
<li><p>Project-AI-Onboarding</p>
</li>
<li><p>Context-Bootstrapping</p>
</li>
</ul>
<h1>Tools 🧰</h1>
<ul>
<li><p>Claude Code</p>
</li>
<li><p>*OpenCode</p>
</li>
<li><p>Cursor (via .cursorrules)</p>
</li>
</ul>
<h1>Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans. </p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tips">https://maxicontieri.substack.com/p/ai-coding-tips</a></p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 010 - Access All Your Code]]></title><description><![CDATA[TL;DR: Use terminal-based AI tools to give your assistant direct access to your local files and test suites.

Common Mistake ❌
You copy code snippets into a web browser chat like ChatGPT, Claude, or G]]></description><link>https://maximilianocontieri.com/ai-coding-tip-010-access-all-your-code</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-010-access-all-your-code</guid><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Tue, 10 Mar 2026 18:38:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5f456a23b9870f18f59a8793/8c07ae4f-d473-45e5-bdc9-422ea0b31b5f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Use terminal-based AI tools to give your assistant direct access to your local files and test suites.</p>
</blockquote>
<h1>Common Mistake ❌</h1>
<p>You copy code snippets into a web browser chat like <a href="https://maxicontieri.substack.com/p/chatgpt-is-amazing-and-it-is-free-5dd3cb037226">ChatGPT</a>, Claude, or Grok.</p>
<p>You manually move code back and forth and give small chunks of code, filling up the context window.</p>
<p>You lose the context of your folder structure, relations among modules, and the whole architecture.</p>
<p>The AI often (wrongly) guesses your project layout and hallucinates.</p>
<p>When you do this, you get inconsistent code and outdated logic.</p>
<h1>Problems Addressed 😔</h1>
<p>Context Tax: Manual copying wastes your focus.</p>
<p>Hallucinations: The AI suggests libraries you don't actually have.</p>
<p>Isolated logic: The assistant doesn't know if your code even builds.</p>
<p>Manual effort: You have to run every test and fix every error yourself.</p>
<p>You're basically playing assistant to the AI, running around doing the busywork.</p>
<h1>How to Do It 🛠️</h1>
<p>Download a <strong>CLI</strong> or <em>IDE</em> tool like Claude Code, OpenCode, Windsurf, or similar, and let it access <em>ALL</em> your codebase.</p>
<p>(You'll need to check compliance, set up safeguards, and respect any NDAs).</p>
<p>Open your terminal and start an interactive session. Let the agent navigate through all your code.</p>
<p>Describe what you want to accomplish at a high level and delegate to the orchestrator agent.</p>
<p>Review the <a href="https://maxicontieri.substack.com/p/ai-coding-tip-003-force-read-only">proposed plan</a> in the terminal.</p>
<p>Approve the changes to update your local files.</p>
<p>Let the agent run your tests and fix failures automatically.</p>
<h1>Benefits 🎯</h1>
<p>Full project context through local AST and RAG indexing.</p>
<p>Self-healing code through automated shell feedback loops.</p>
<p>Multi-file edits in a single prompt.</p>
<p>Parallel development using multiple agent instances.</p>
<p>Iterative incremental learning and experimentation. Baby steps.</p>
<h1>Context 🧠</h1>
<p>We were all blown away when ChatGPT came out.</p>
<p>I <a href="https://maxicontieri.substack.com/p/chatgpt-is-amazing-and-it-is-free-5dd3cb037226">wrote an article 2 days after its release</a>, understanding it was a <strong>game-changer</strong>.</p>
<p>Even people like me who had been working with earlier GPT models.</p>
<p>Four years later, you still see many developers coding this way.</p>
<p>It works for small algorithms and functions, but falls apart for real software engineering.</p>
<h1>Prompt Reference 📝</h1>
<p>Bad Prompt:</p>
<pre><code class="language-javascript">// Please fix the login bug in this snippet:

async function loginUser(email, password) {
  const url = 'https://api.penrosebrain.com/login';

  try {
    const response = await fetch(url, {
      method: 'PUT',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ email, password }),
    });
    
  } catch (error) {
    console.error('There was an error:', error.message);
    alert(error.message);
  }
}
</code></pre>
<p>Good Prompt:</p>
<pre><code class="language-javascript">// opencode: "Create a failing text, fix the login bug, run tests, 
// Ensure it passes the new test and all the previous ones
// Create a Pull Request so I can review it

async function loginUser(email, password) {
  const url = 'https://api.penrosebrain.com/login';

  try {
    const response = await fetch(url, {
      method: 'PUT',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ email, password }),
    });
    
  } catch (error) {
    console.error('There was an error:', error.message);
    alert(error.message);
  }
}
</code></pre>
<h1>Considerations ⚠️</h1>
<p>CLI agents have a learning curve.</p>
<p>Always <a href="https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line">review all changes</a> before <a href="https://maxicontieri.substack.com/p/ai-coding-tip-001-commit-before-prompt">commiting</a> them.</p>
<p>Use a sandbox environment if you run untrusted code.</p>
<h1>Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1>Limitations ⚠️</h1>
<p>Don't use this for tiny, one-off scripts.</p>
<p>Web chats work better for creative brainstorming or generating images.</p>
<p>High token usage in long sessions can drive up your API costs.</p>
<h1>Tags 🏷️</h1>
<p>#CLI-Agents #Productivity #Codebase-Context #Automation</p>
<h1>Level 🔋</h1>
<p>[X] Intermediate</p>
<h1>Related Tips 🔗</h1>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-003-force-read-only">https://maxicontieri.substack.com/p/ai-coding-tip-003-force-read-only</a></p><p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line">https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line</a></p>
Connect external data using the Model Context Protocol (MCP).

<p>Run local models if you need 100% privacy.</p>
<h1>Conclusion 🏁</h1>
<p>Move your AI assistant to the terminal.</p>
<p>You'll work faster and make fewer mistakes.</p>
<p>When you delegate the boring parts, you can focus on architecture and high-level design.</p>
<h1>More Information ℹ️</h1>
<p><a class="embed-card" href="https://www.firecrawl.dev/blog/why-clis-are-better-for-agents">https://www.firecrawl.dev/blog/why-clis-are-better-for-agents</a></p>
[How Cursor Actually Indexes Your Codebase](https://towardsdatascience.com/how-cursor-actually-indexes-your-codebase/)

<p><a href="https://aider.chat/">Aider - AI Pair Programming in your Terminal</a></p>
<p><a class="embed-card" href="https://code.claude.com/docs/en/overview">https://code.claude.com/docs/en/overview</a></p><p><a class="embed-card" href="https://www.builder.io/blog/opencode-vs-claude-code">https://www.builder.io/blog/opencode-vs-claude-code</a></p>
[AI Coding Assistants for Large Codebases: A Complete Guide](https://www.augmentcode.com/tools/ai-coding-assistants-for-large-codebases-a-complete-guide)

<p><a href="https://blog.marcnuri.com/boosting-developer-productivity-ai-2025">Boosting My Developer Productivity with AI in 2025</a></p>
<p><a href="https://opencode.ai/docs/">OpenCode Documentation</a></p>
<p><a href="https://www.anthropic.com/engineering/advanced-tool-use">Introducing Advanced Tool Use on the Claude Developer Platform</a></p>
<p><a href="https://milvus.io/ai-quick-reference/what-is-opencode">What is OpenCode? - AI Quick Reference</a></p>
<h1>Also Known As 🎭</h1>
<p>Agentic Coding</p>
<p>Terminal Agents</p>
<p>Autonomous Coding Loops</p>
<h1>Tools 🧰</h1>
<p>Claude Code, OpenCode, Aider, Codex CLI.</p>
<h1>Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans.</p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the AI Coding Tip series.</p>
<p><a class="embed-card" href="https://maxicontieri.substack.com/p/ai-coding-tips">https://maxicontieri.substack.com/p/ai-coding-tips</a></p>]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 009 - Compact Your Context]]></title><description><![CDATA[TL;DR: You can keep your AI sharp by forcing it to summarize and prune what it remembers (a.k.a. compacting).

Common Mistake ❌
You keep a single, long conversation open for hours.
You feed the AI wit]]></description><link>https://maximilianocontieri.com/ai-coding-tip-009-compact-your-context</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-009-compact-your-context</guid><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Tue, 03 Mar 2026 01:53:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/5f456a23b9870f18f59a8793/2ec9a923-d970-4b8f-812f-8006e8309d41.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: You can keep your AI sharp by forcing it to summarize and prune what it remembers (a.k.a. compacting).</p>
</blockquote>
<h1>Common Mistake ❌</h1>
<p>You keep a single, long conversation open for hours.</p>
<p>You feed the AI with every error log and every iteration of your code.</p>
<p>Eventually, the AI starts to ignore your early instructions or hallucinate functions that do not exist.</p>
<h1>Problems Addressed 😔</h1>
<ul>
<li><p><strong>Context Decay:</strong> The AI loses track of your original goals in the middle of a long chat.</p>
</li>
<li><p><strong>Hallucinations:</strong> The model fills memory gaps with hallucinations or outdated logic.</p>
</li>
<li><p><strong>Token Waste:</strong> You pay for the AI to re-read useless error logs from three hours ago.</p>
</li>
<li><p><strong>Reduced Reasoning:</strong> A bloated context makes the AI less "smart" and more prone to simple mistakes.</p>
</li>
</ul>
<h1>How to Do It 🛠️</h1>
<ol>
<li><p><strong>Restart often:</strong> You can start a new chat once you finish a sub-task.</p>
</li>
<li><p><strong>Request a State Summary:</strong> Before you close a conversation, ask the AI to summarize the current decisions and <a href="https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning">plan</a>.</p>
</li>
<li><p><strong>Add Human Checkpoints:</strong> After the summary, confirm you are still on track.</p>
</li>
<li><p><strong>Use Markdown Docs:</strong> Keep a small <code>context.md</code> file with your current stack and rules.</p>
</li>
<li><p><strong>Prune the Logs:</strong> You should only paste the relevant 5 lines of a stack trace instead of the whole irrelevant 200-line output.</p>
</li>
<li><p><strong>Divide and conquer</strong> Break large tasks into smaller ones, invoking their own skills with local tokens.</p>
</li>
<li><p><strong>Divide the responsibility:</strong> A General doesn't need to know what every soldier is doing.</p>
</li>
<li><p><strong>Create and persist as Skill:</strong> After you have taught the AI, you should refactor the knowledge.</p>
</li>
<li><p><strong>Keep and Eye on the Context Size:</strong> Most tools have visual indicators of the window consumption.</p>
</li>
<li><p><strong>Use Local Persistence:</strong> Some tools allow sharing memory among agents and sub-agents.</p>
</li>
</ol>
<h1>Benefits 🎯</h1>
<ul>
<li><p>You get more accurate code suggestions.</p>
</li>
<li><p>You avoid divergences</p>
</li>
<li><p>You follow the AI's train of thought.</p>
</li>
<li><p>You spend less time correcting the AI's hallucinations.</p>
</li>
<li><p>The AI follows your project constraints more strictly and keeps focused on your tasks</p>
</li>
</ul>
<h1>Context 🧠</h1>
<p>Large Language Models have limited attention.</p>
<p>Long context windows are a trap.</p>
<p>Many modern models offer a very large context window.</p>
<p>In practice, they ignore a lot of them to your frustration.</p>
<p>Even with huge context windows, they prioritize and focus on the beginning and the end of the prompt.</p>
<h2>Prompt Reference 📝</h2>
<h3>Bad Prompt</h3>
<pre><code class="language-markdown">Here is the 500-line log of my failed build. 

Also, remember that we changed the database schema 

Three hours ago in this chat.

Add the unit tests as I described above.

Now, refactor the whole component.
</code></pre>
<h3>Good Prompt</h3>
<pre><code class="language-markdown">I am starting a new session. Here is the current state: 

We use *PostgreSQL* with the 'Users' table schema [ID, Email]. 

The AuthService`interface is [login(), logout()]. 

Refactor the LoginComponent` to use these.
</code></pre>
<h1>Considerations ⚠️</h1>
<p>You must ensure you don't purge <a href="https://maximilianocontieri.com/no-silver-bullet"><em>essential</em></a> context.</p>
<p>If you prune too much, the AI might suggest libraries that conflict with your current setup.</p>
<p>Review the compacted information.</p>
<h1>Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1>Limitations ⚠️</h1>
<p>You can use this tip manually in any chat interface.</p>
<p>If you use advanced agents like Claude Code or Cursor, they might handle some of this automatically, but manual pruning is still more reliable.</p>
<h1>Tags 🏷️</h1>
<ul>
<li>Context</li>
</ul>
<h1>Level 🔋</h1>
<p>[X] Intermediate</p>
<h1>Related Tips 🔗</h1>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills">https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills</a></p>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-005-keep-context-fresh">https://maximilianocontieri.com/ai-coding-tip-005-keep-context-fresh</a></p>
<p>AI Coding Tip 010 - Create Skill from Conversation</p>
<h1>Conclusion 🏁</h1>
<p>You are the curator of the AI's memory.</p>
<p>If you let the context rot, the code will rot too. Keep it clean and compact. 🧹</p>
<h1>More Information ℹ️</h1>
<p><a href="https://arxiv.org/abs/2307.03172">https://arxiv.org/abs/2307.03172</a>  </p>
<p><a href="https://llmlingua.com/">https://llmlingua.com/</a>  </p>
<p><a href="https://www.cursor.com/blog/context">https://www.cursor.com/blog/context</a></p>
<p><a href="https://www.ibm.com/topics/ai-hallucinations">https://www.ibm.com/topics/ai-hallucinations</a>  </p>
<p><a href="https://www.promptingguide.ai/">https://www.promptingguide.ai/</a></p>
<p><a href="https://openai.com/blog/custom-instructions-for-chatgpt/">https://openai.com/blog/custom-instructions-for-chatgpt/</a>  </p>
<p><a href="https://docs.anthropic.com/claude/docs/long-context-tips">https://docs.anthropic.com/claude/docs/long-context-tips</a></p>
<h1>Also Known As 🎭</h1>
<ul>
<li><p>Context Pruning</p>
</li>
<li><p>Token Management</p>
</li>
<li><p>Prompt Compression</p>
</li>
</ul>
<h1>Tools 🧰</h1>
<ul>
<li><p>Claude Code</p>
</li>
<li><p>Cursor</p>
</li>
<li><p>Windsurf</p>
</li>
</ul>
<h1>Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans.</p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
<p><a href="https://maximilianocontieri.com/ai-coding-tips">https://maximilianocontieri.com/ai-coding-tips</a></p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 008 - Use Spec-Driven Development with AI]]></title><description><![CDATA[TL;DR: Use AI to understand requirements and build a shared mental model while you write the code.

Common Mistake ❌
You jump directly to code generation with a vague, wishful prompt.
The AI seems to ]]></description><link>https://maximilianocontieri.com/ai-coding-tip-008-use-spec-driven-development-with-ai</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-008-use-spec-driven-development-with-ai</guid><category><![CDATA[AI]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[clean code]]></category><category><![CDATA[software development]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Fri, 20 Feb 2026 02:58:02 GMT</pubDate><enclosure url="https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/covers/5f456a23b9870f18f59a8793/680d61a1-7d2c-4c30-8c3c-d125d41aef35.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Use AI to understand requirements and build a shared mental model while you write the code.</p>
</blockquote>
<h1>Common Mistake ❌</h1>
<p>You jump directly to code generation with a vague, wishful prompt.</p>
<p>The AI seems to understand your specific business logic, but is condescending with you.</p>
<p>The problem creates a spaghetti mess that is difficult to maintain later.</p>
<p>The AI is not a magic button for lazy people. It is a senior pair programmer and a learning companion.</p>
<p>You follow the <a href="https://martinfowler.com/articles/exploring-gen-ai/sdd-3-tools.html">Spec-Driven Development</a> trend and work in a taylorist cascading way failing into analysis paralysis and unrealistic plans.</p>
<h1>Problems Addressed 😔</h1>
<p>Hallucinations: The AI guesses details when you don't provide specific context.</p>
<p>Technical Debt: You build complex systems that collapse under logical errors and don't simulate the real-world <a href="https://maximilianocontieri.com/what-is-wrong-with-software">MAPPER</a>.</p>
<p>Context Fragmentation: The AI loses track of your goals in long sessions.</p>
<p>Logic Drift: The code "works". Yet it doesn't solve the <a href="https://maximilianocontieri.com/the-one-and-only-software-design-principle">actual problem</a>.</p>
<h1>How to Do It 🛠️</h1>
<p>Ask the AI to interview you.</p>
<p>You state the high-level idea and have the AI ask questions to uncover edge cases.</p>
<p>Work together in learning mode. Dave Farley tells us to be <a href="https://modernsoftwareengineering.co.uk/">experts at learning</a>.</p>
<p>Draft a <a href="http://spec.md">spec.md</a> file. You and the AI collaborate on a document that defines the architecture, data models, and goals.</p>
<p>Use the <a href="https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning">Plan Mode</a>.</p>
<p>Keep the AI in a read-only environment to explore your codebase and verify the plan as you execute it.</p>
<p>Plan as you go with the goal in mind without making assumptions about a rigid roadmap.</p>
<p>Always validate the <a href="https://maximilianocontieri.com/the-one-and-only-software-design-principle">bijection</a> against the real-world requirements.</p>
<p>Turn the live spec into a simple checklist of atomic implementation steps.</p>
<p>The backlog will grow and shrink as you learn the domain. It is a live artifact.</p>
<p>Set up a persistent context while you learn.</p>
<p>Create a <em>.md</em> file to store project rules that the AI cannot guess.</p>
<h1>Benefits 🎯</h1>
<p>You learn about the domain faster because the AI can serve as an encyclopedic mentor.</p>
<p>You stay proudly accountable for the architecture.</p>
<p>You eliminate boilerplate while maintaining system stability.</p>
<p>You close the Human 30% gap by focusing on system coordination.</p>
<h1>Context 🧠</h1>
<p>These tools are high-velocity coders, but they are very innocent.</p>
<p>They perform best when you instruct with a clear mission and modular instructions.</p>
<p>This "waterfall in 15 minutes" way favors you and the AI to be on the same page before you trigger the first code diff.</p>
<h1>Prompt Reference 📝</h1>
<h2>Bad Prompt:</h2>
<pre><code class="language-markdown">Build me a task management app with React and Node.

Create a behavior specification and a Gantt project
</code></pre>
<h2>Good Prompt:</h2>
<pre><code class="language-markdown">You are a Senior Software Engineer. I want to build a task app.

Ask me 10 clarifying questions about the architecture, security, 
and data model. 

After I answer, help me draft a spec.md.

Let's build it together with TDD and contract tests.
</code></pre>
<h1>Considerations ⚠️</h1>
<p>AI can write bugs with complete conviction.</p>
<p>You must review every change.</p>
<h1>Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1>Tags 🏷️</h1>
<ul>
<li>Complexity</li>
</ul>
<h1>Level 🔋</h1>
<p>[X] Intermediate</p>
<h1>Related Tips 🔗</h1>
<p>Use <a href="http://CLAUDE.md">CLAUDE.md</a> for project memory.</p>
<p>Set up MCP servers for live documentation.</p>
<p>Run parallel agents for large refactors.</p>
<h1>Conclusion 🏁</h1>
<p>You should invest <a href="https://harper.blog/2025/04/10/waterfall-in-15-minutes-or-your-money-back/">15 minutes</a> in planning with the AI instead of rushing. It will save you hours of debugging.</p>
<p>Use the copilot to improve your design with your approval, and let it handle the hard accidental typing.</p>
<h1>More Information ℹ️</h1>
<iframe></iframe><iframe></iframe><iframe></iframe><iframe></iframe>

<ul>
<li><p>Start with a clear path (<a href="https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning">specs before code</a>)</p>
</li>
<li><p>Break work into small, iterative chunks</p>
</li>
<li><p>Provide extensive <a href="https://maximilianocontieri.com/ai-coding-tip-005-keep-context-fresh">context</a> and guidance</p>
</li>
<li><p>Choose the right model (and use multiple when needed)</p>
</li>
<li><p>Leverage AI coding across the lifecycle</p>
</li>
<li><p>Keep a human in the loop - verify, test, and review everything</p>
</li>
<li><p><a href="https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt">Commit often</a> and use version control as a safety net. <a href="https://maximilianocontieri.com/ai-coding-tip-006-review-every-line-before-commit">Never commit code you can’t explain</a>.</p>
</li>
<li><p>Customize the AI’s behavior with rules and examples</p>
</li>
<li><p>Embrace testing and automation as force multipliers</p>
</li>
<li><p>Continuously learn and adapt (AI amplifies your skills)</p>
</li>
</ul>
<iframe src="https://www.youtube.com/watch?v=Xahv9nMegXA"></iframe>

<h1>Also Known As 🎭</h1>
<p>Spec-Driven Development</p>
<p>Waterfall in 15 Minutes</p>
<p>Vibe Coding with Discipline</p>
<h1>Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans.</p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the AI Coding Tip series.</p>
<p><a href="https://maximilianocontieri.com/ai-coding-tips">https://maximilianocontieri.com/ai-coding-tips</a></p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 007 - Avoid Malicious Skills]]></title><description><![CDATA[TL;DR: Treat AI agent skills like dangerous executable code and read the instructions carefully.

Common Mistake ❌
You install community skills for your AI assistant based on popularity or download counts. 
You trust "proactive" agents when they ask ...]]></description><link>https://maximilianocontieri.com/ai-coding-tip-007-avoid-malicious-skills</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-007-avoid-malicious-skills</guid><category><![CDATA[AI]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Security]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Tue, 17 Feb 2026 04:12:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1771300458418/3245d08d-3ab4-40da-8ba1-de73a00e2a01.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Treat AI agent skills like dangerous executable code and read the instructions carefully.</p>
</blockquote>
<h1 id="heading-common-mistake">Common Mistake ❌</h1>
<p>You install community <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills">skills</a> for your AI assistant based on popularity or download counts. </p>
<p>You trust "proactive" agents when they ask you to run "setup" commands or install "AuthTool" prerequisites.</p>
<p>You grab exciting skills from public registries and install them right away. </p>
<p>You skip <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-006-review-every-line-before-commit">code reviews</a> or scans because the docs <em>look</em> clean.</p>
<p>You are lazy and careless.</p>
<h1 id="heading-problems-addressed">Problems Addressed 😔</h1>
<p>Information stealers raid your SSH keys, browser cookies, and <a target="_blank" href="https://maximilianocontieri.com/code-smell-258-secrets-in-code">.env files</a>.</p>
<p>Supply chain attacks exploit naming confusion (ClawdBot vs. MoltBot vs. OpenClaw).</p>
<p><a target="_blank" href="https://maximilianocontieri.com/code-smell-263-squatting">Typosquatting</a> pushes you into installing malicious packages like clawhubcli.</p>
<p>Your adversaries invoke Remote Code Execution (RCE) through unvalidated WebSocket connections.</p>
<h1 id="heading-how-to-do-it">How to Do It 🛠️</h1>
<p>Run your AI agent inside a dedicated isolated Virtual Machine or Docker container. </p>
<p>This isolation prevents the agent from accessing your primary filesystem.</p>
<p>Review the <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills">SKILL.md</a> and source code of every new skill.</p>
<p>You can spot hidden curl commands or Base64-encoded strings that reach out to malicious IPs like 91.92.242.30.</p>
<p>Use security scanners like Clawdex or Koi Security's tool. </p>
<p>The tools check your skills against a database of known malicious signatures.</p>
<p>Bind your agent's gateway strictly to 127.0.0.1. When you bind to 0.0.0.0, you expose your administrative dashboard to the public internet.</p>
<p>Limit the agent's permissions to <strong>read-only</strong> for sensitive directories.</p>
<p>This is also excellent for <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning">reasoning and planning</a></p>
<p>You can prevent the agent from modifying system files or stealing your keychain.</p>
<h1 id="heading-benefits">Benefits 🎯</h1>
<p>You protect your production API keys and cloud credentials, protecting the <a target="_blank" href="https://maximilianocontieri.com/code-smell-258-secrets-in-code">secrets in your code</a>.</p>
<p>You stop lateral movement inside your corporate network.</p>
<p>You reduce the risk of identity theft through session hijacking.</p>
<p>You avoid <a target="_blank" href="https://maximilianocontieri.com/code-smell-300-packet-hallucination">Package Hallucination</a></p>
<h1 id="heading-context">Context 🧠</h1>
<p>AI Agents like <a target="_blank" href="https://openclaw.ai/">OpenClaw</a> have deep administrative system access. They can run shell commands and manage files. </p>
<p>Attackers now flood registries with "skills" that look like helpful tools for YouTube, Solana, or Google Workspace.</p>
<p>When you install these, you broaden your attack surface and grant an attacker a direct shell on your machine.</p>
<h1 id="heading-prompt-reference">Prompt Reference 📝</h1>
<h2 id="heading-bad-prompt">Bad prompt 🚫</h2>

<pre><code class="lang-markdown">Install the top-rated Solana wallet tracker skill 
and follow the setup instructions in the documentation.
</code></pre>
<h2 id="heading-good-prompt">Good prompt 👉</h2>

<pre><code class="lang-markdown">Download the source code for the Solana tracker skill
to my sandbox folder.

Wait until y review it line by line
</code></pre>
<p>Good Prompt:
"Download the source code for the Solana tracker skill to my sandbox folder. </p>
<p>Let's analyze the scripts together for any external network calls before we install it."</p>
<h1 id="heading-considerations">Considerations ⚠️</h1>
<p>OpenClaw often stores secrets in <a target="_blank" href="https://maximilianocontieri.com/code-smell-258-secrets-in-code">plaintext .env files</a>. </p>
<p>If you grant an agent access to your terminal, any malicious skill can read these secrets and exfiltrate them to a webhook in seconds.</p>
<h1 id="heading-type">Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1 id="heading-limitations">Limitations ⚠️</h1>
<p>Use this strategy when you host "agentic" AI platforms like OpenClaw or MoltBot locally. </p>
<p>This tip doesn't replace traditional endpoint protection but adds a necessary layer for AI-specific <a target="_blank" href="https://maximilianocontieri.com/code-smell-284-encrypted-functions">supply chain risks</a>.</p>
<h1 id="heading-tags">Tags 🏷️</h1>
<ul>
<li>Security</li>
</ul>
<h1 id="heading-level">Level 🔋</h1>
<p>[X] Intermediate</p>
<h1 id="heading-related-tips">Related Tips 🔗</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills">https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills</a></div>
<p>Isolate LLM tool execution with Kernel-enforced sandboxes.</p>
<p>Audit prompt injection risks in web-scraping agents.</p>
<p>Encrypt local configuration files for AI assistants.</p>
<h1 id="heading-conclusion">Conclusion 🏁</h1>
<p>Your AI assistant is a powerful tool, but it can also become a high-impact control point for attackers. </p>
<p>When you verify <em>every skill</em>, understand it, and isolate the runtime, you keep the "keys to your kingdom" safe. 🛡️</p>
<h1 id="heading-more-information">More Information ℹ️</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.bleepingcomputer.com/news/security/malicious-moltbot-skills-used-to-push-password-stealing-malware/">https://www.bleepingcomputer.com/news/security/malicious-moltbot-skills-used-to-push-password-stealing-malware/</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-258-secrets-in-code">https://maximilianocontieri.com/code-smell-258-secrets-in-code</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-284-encrypted-functions">https://maximilianocontieri.com/code-smell-284-encrypted-functions</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-263-squatting">https://maximilianocontieri.com/code-smell-263-squatting</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning">https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-300-packet-hallucination">https://maximilianocontieri.com/code-smell-300-packet-hallucination</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.brodersendarknews.com/p/moltbook-riesgos-vibe-coding">https://www.brodersendarknews.com/p/moltbook-riesgos-vibe-coding</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://securityscorecard.com/blog/beyond-the-hype-moltbots-real-risk-is-exposed-infrastructure-not-ai-superintelligence/">https://securityscorecard.com/blog/beyond-the-hype-moltbots-real-risk-is-exposed-infrastructure-not-ai-superintelligence/</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.bitdefender.com/en-us/blog/labs/helpful-skills-or-hidden-payloads-bitdefender-labs-dives-deep-into-the-openclaw-malicious-skill-trap">https://www.bitdefender.com/en-us/blog/labs/helpful-skills-or-hidden-payloads-bitdefender-labs-dives-deep-into-the-openclaw-malicious-skill-trap</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://thehackernews.com/2026/02/researchers-find-341-malicious-clawhub.html">https://thehackernews.com/2026/02/researchers-find-341-malicious-clawhub.html</a></div>
<h1 id="heading-also-known-as">Also Known As 🎭</h1>
<p>Agentic Supply Chain Poisoning</p>
<p>ClickFix AI Attacks</p>
<h1 id="heading-tools">Tools 🧰</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://openclaw.ai/">https://openclaw.ai/</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.clawdex.io/">https://www.clawdex.io/</a></div>
<h1 id="heading-disclaimer">Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans. </p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the AI Coding Tip series.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tips">https://maximilianocontieri.com/ai-coding-tips</a></div>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 006 - Review Every Line Before Commit]]></title><description><![CDATA[TL;DR: If you can't explain all your code, don't commit it.

Common Mistake ❌
You prompt and paste AI-generated code directly into your project without thinking twice.
You trust the AI without verification and create workslop that someone else will h...]]></description><link>https://maximilianocontieri.com/ai-coding-tip-006-review-every-line-before-commit</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-006-review-every-line-before-commit</guid><category><![CDATA[AI]]></category><category><![CDATA[clean code]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[claude.ai]]></category><category><![CDATA[chatgpt]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Thu, 12 Feb 2026 16:03:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1770912070078/1e33c962-fbb8-4fd3-bc66-c96fd0359936.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: If you can't explain all your code, don't commit it.</p>
</blockquote>
<h1 id="heading-common-mistake">Common Mistake ❌</h1>
<p>You prompt and paste AI-generated code directly into your project without thinking twice.</p>
<p>You trust the AI without verification and create <a target="_blank" href="https://maximilianocontieri.com/code-smell-313-workslop-code">workslop</a> that someone else will have to clean up later.</p>
<p>You assume the code works because it <em>looks</em> correct (or complicated enough to impress anyone).</p>
<p>You skip manual review when the AI assistant generates large blocks because, well, it's a lot of code.</p>
<p>You treat AI output as production-ready code and ship it without a second thought.</p>
<p>If you're making code reviews, you get tired of large pull requests (probably generated by AI) that feel like reviewing a novel.</p>
<p>Let's be honest: AI isn't accountable for your mistakes—you are.</p>
<h1 id="heading-problems-addressed">Problems Addressed 😔</h1>
<ul>
<li><strong>Security vulnerabilities and flaws</strong>: AI generates code with <a target="_blank" href="https://maximilianocontieri.com/code-smell-189-not-sanitized-input">Not sanitized inputs</a> SQL injection, XSS, <a target="_blank" href="https://maximilianocontieri.com/code-smell-300-packet-hallucination">Packages Hallucination</a>, or hardcoded credentials</li>
<li><strong>Logic errors</strong>: The AI misunderstands your requirements and solves the wrong problem</li>
<li><strong>Technical debt</strong>: Generated code uses <a target="_blank" href="https://maximilianocontieri.com/refactoring-018-replace-singleton">outdated patterns</a> or creates <a target="_blank" href="https://maximilianocontieri.com/code-smell-148-todos">maintenance nightmares</a></li>
<li><strong>Lost accountability</strong>: You cannot explain code you didn't review</li>
<li><strong>Hidden <a target="_blank" href="https://maximilianocontieri.com/stop-calling-them-bugs">defects</a></strong>: Issues that appear in production cost 30-100x more to fix</li>
<li><strong>Knowledge gaps</strong>: You miss learning opportunities when you blindly accept solutions</li>
<li><strong>Team friction</strong>: Your reviewers waste time catching issues you should have found</li>
<li><strong>Productivity Paradox</strong>: AI shifts the bottleneck from writing to <a target="_blank" href="https://medium.com/@mozaman/the-productivity-paradox-of-ai-why-commits-and-prs-dont-tell-the-story-ceb68a453f54">integration</a></li>
<li><strong>Lack of Trust</strong>: The team's trust erodes when unowned code causes failures</li>
<li><strong>Noisier Code</strong>: AI-authored PRs contained <a target="_blank" href="https://www.coderabbit.ai/blog/state-of-ai-vs-human-code-generation-report">1.7x more issues</a> than human-only PRs. </li>
</ul>
<h1 id="heading-how-to-do-it">How to Do It 🛠️</h1>
<ol>
<li>Ask the AI to generate the code you need using <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-002-prompt-in-english">English</a> language</li>
<li>Read every single line the AI produced, understand it, and challenge it if necessary</li>
<li>Check that the solution matches your actual requirements</li>
<li>Verify the code handles edge cases and errors</li>
<li>Look for security issues (<a target="_blank" href="https://maximilianocontieri.com/code-smell-189-not-sanitized-input">injection</a>, auth, data exposure)</li>
<li>Test the code locally with real scenarios</li>
<li>Run your <a target="_blank" href="https://maximilianocontieri.com/code-smell-48-code-without-standards">linters</a>, prettifiers and security scanners</li>
<li>Remove any <a target="_blank" href="https://maximilianocontieri.com/code-smell-106-production-dependent-code">debug code</a> or <a target="_blank" href="https://maximilianocontieri.com/code-smell-05-comment-abusers">comments</a> you don't need</li>
<li>Refactor the code to match <a target="_blank" href="https://maximilianocontieri.com/refactoring-032-apply-consistent-style-rules">your team's style</a></li>
<li>Add or update tests for the new functionality (ask the AI for help)</li>
<li>Write a clear commit message explaining what changed</li>
<li>Only then <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt">commit the code</a></li>
<li>You are not going to lose your job (by now)</li>
</ol>
<h1 id="heading-benefits">Benefits 🎯</h1>
<p>You catch defects before they reach production.</p>
<p>You understand the code you commit.</p>
<p>You maintain accountability for your changes.</p>
<p>You learn from your copilot's approach and become a better developer in the process.</p>
<p>You build personal accountability. </p>
<p>You build better human team collaboration and trust.</p>
<p>You prevent <a target="_blank" href="https://maximilianocontieri.com/code-smell-311-plain-text-passwords">security breaches</a> like the <a target="_blank" href="https://www.brodersendarknews.com/p/moltbook-riesgos-vibe-coding">Moltbook incident</a>.</p>
<p>You avoid long-term maintenance costs.</p>
<p>You keep your reputation and accountability intact.</p>
<p>You're a professional who shows respect for your human code reviewers.</p>
<p>You are not disposable.</p>
<h1 id="heading-context">Context 🧠</h1>
<p>AI assistants like GitHub Copilot, ChatGPT, and Claude help you code faster.</p>
<p>These tools generate code from natural language prompts and <a target="_blank" href="https://maximilianocontieri.com/explain-in-5-levels-of-difficulty-vibe-coding">vibe coding</a>.</p>
<p>AI models are probabilistic, not logical. </p>
<p>They predict the next token based on patterns. </p>
<p>When you work on complex systems, the AI might miss a specific edge case that only a human knows.</p>
<p>Manual review is the only way to close the gap between "code that looks good" and "code that is correct."</p>
<p>The AI doesn't understand your business logic or the <a target="_blank" href="https://maximilianocontieri.com/the-one-and-only-software-design-principle">real world bijection</a> between your <a target="_blank" href="https://maximilianocontieri.com/what-is-wrong-with-software">MAPPER</a> and your model.</p>
<p>The AI cannot know your security requirements (unless you are explicit or execute a skill).</p>
<p>The AI cannot test the code against your specific environment.</p>
<p>You remain <strong>responsible</strong> for every line in your codebase.</p>
<p>Production <a target="_blank" href="https://maximilianocontieri.com/stop-calling-them-bugs">defects</a> from unreviewed AI code cost companies millions.</p>
<p>Code review catches many security risks that automated tools miss.</p>
<p>Your organization holds you accountable for the code you commit.</p>
<p>This applies whether you write code manually or use AI assistance.</p>
<h2 id="heading-prompt-reference">Prompt Reference 📝</h2>
<p><strong>Bad Prompts</strong> ❌ </p>

<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DatabaseManager</span>:</span>
    _instance = <span class="hljs-literal">None</span> <span class="hljs-comment"># Singleton Anti Pattern</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__new__</span>(<span class="hljs-params">cls</span>):</span>
        <span class="hljs-keyword">if</span> cls._instance <span class="hljs-keyword">is</span> <span class="hljs-literal">None</span>:
            cls._instance = super().__new__(cls)
        <span class="hljs-keyword">return</span> cls._instance
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_data</span>(<span class="hljs-params">self, id</span>):</span>
        <span class="hljs-keyword">return</span> eval(<span class="hljs-string">f"SELECT * FROM users WHERE id=<span class="hljs-subst">{id}</span>"</span>) 
        <span class="hljs-comment"># SQL injection!</span>

    <span class="hljs-comment">## 741 more cryptic lines</span>
</code></pre>
<p><strong>Good Prompts</strong> ✅ </p>

<pre><code class="lang-python"><span class="hljs-keyword">from</span> typing <span class="hljs-keyword">import</span> Optional
<span class="hljs-keyword">import</span> sqlite3

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DatabaseManager</span>:</span>
  <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, db_path: str</span>):</span>
    self.db_path = db_path

  <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_user</span>(<span class="hljs-params">self, user_id: int</span>) -&gt; Optional[dict]:</span>
    <span class="hljs-keyword">try</span>:
      <span class="hljs-keyword">with</span> sqlite3.connect(self.db_path) <span class="hljs-keyword">as</span> conn:
        conn.row_factory = sqlite3.Row
        cursor = conn.cursor()
        cursor.execute(<span class="hljs-string">"SELECT * FROM users WHERE id = ?"</span>, (user_id,))
        row = cursor.fetchone()
        <span class="hljs-keyword">return</span> dict(row) <span class="hljs-keyword">if</span> row <span class="hljs-keyword">else</span> <span class="hljs-literal">None</span>
    <span class="hljs-keyword">except</span> sqlite3.Error <span class="hljs-keyword">as</span> e:
        print(<span class="hljs-string">f"Database error: <span class="hljs-subst">{e}</span>"</span>)
        <span class="hljs-keyword">return</span> <span class="hljs-literal">None</span>

db = DatabaseManager(<span class="hljs-string">"app.db"</span>)
user = db.get_user(<span class="hljs-number">123</span>)
</code></pre>
<h1 id="heading-considerations">Considerations ⚠️</h1>
<p>You cannot blame the AI when defects appear in production.</p>
<p>The human is accountable, not the AI.</p>
<p>AI-generated code might violate your company's licensing policies.</p>
<p>The AI might use deprecated libraries or outdated patterns.</p>
<p>Generated code might not follow your team's conventions.</p>
<p>You need to understand the code to maintain it later.</p>
<p>Other developers will review your AI-assisted code just like any other.</p>
<p>Some AI models train on public repositories and might leak patterns.</p>
<h1 id="heading-type">Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1 id="heading-limitations">Limitations ⚠️</h1>
<p>You should use this tip for <strong>every</strong> code change. You should not skip it even for "simple" refactors. </p>
<h1 id="heading-tags">Tags 🏷️</h1>
<p>-Readability</p>
<h1 id="heading-level">Level 🔋</h1>
<p>[X] Beginner</p>
<h1 id="heading-related-tips">Related Tips 🔗</h1>
<ul>
<li>Self-Review Your Code Before Requesting Peer Review</li>
<li>Write Tests for AI-Generated Functions</li>
<li>Document AI-Assisted Code Decisions</li>
<li>Use Static Analysis on Generated Code</li>
<li>Understand Before You Commit</li>
</ul>
<h1 id="heading-conclusion">Conclusion 🏁</h1>
<p>AI assistants accelerate your coding speed.</p>
<p>You still own <strong>every line</strong> you commit.</p>
<p>Manual review and <a target="_blank" href="https://en.wikipedia.org/wiki/Fagan_inspection">code inspections</a> catch what automated tools miss.</p>
<p>Before AI code generators became mainstream, a very good practice was to make a <a target="_blank" href="https://learning.oreilly.com/library/view/perform-code-reviews/9781098172657/ch01.html">self review</a> of the code before requesting a peer review.</p>
<p>You learn more when you question the AI's choices and understand the 'why' behind them.</p>
<p>Your reputation depends on code quality, not how fast you can churn out code.</p>
<p>Take responsibility for the code you ship—your name is on it.</p>
<p>Review everything. Commit nothing blindly. Your future self will thank you. 🔍</p>
<p>Be incremental, make very small commits and <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-005-keep-context-fresh">keep your content fresh</a>. </p>
<h1 id="heading-more-information">More Information ℹ️</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-313-workslop-code">https://maximilianocontieri.com/code-smell-313-workslop-code</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-189-not-sanitized-input">https://maximilianocontieri.com/code-smell-189-not-sanitized-input</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-300-packet-hallucination">https://maximilianocontieri.com/code-smell-300-packet-hallucination</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://martinfowler.com/articles/code-review.html">https://martinfowler.com/articles/code-review.html</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://learning.oreilly.com/library/view/perform-code-reviews/9781098172657/ch01.html">https://learning.oreilly.com/library/view/perform-code-reviews/9781098172657/ch01.html</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.coderabbit.ai/blog/state-of-ai-vs-human-code-generation-report">https://www.coderabbit.ai/blog/state-of-ai-vs-human-code-generation-report</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://medium.com/@mozaman/the-productivity-paradox-of-ai-why-commits-and-prs-dont-tell-the-story-ceb68a453f54">https://medium.com/@mozaman/the-productivity-paradox-of-ai-why-commits-and-prs-dont-tell-the-story-ceb68a453f54</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://google.github.io/eng-practices/review/">https://google.github.io/eng-practices/review/</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.atlassian.com/agile/software-development/code-reviews">https://www.atlassian.com/agile/software-development/code-reviews</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/">https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://standards.ieee.org/standard/1028-2008.html">https://standards.ieee.org/standard/1028-2008.html</a></div>
<h1 id="heading-also-known-as">Also Known As 🎭</h1>
<ul>
<li>Human-in-the-Loop Code Review</li>
<li>AI Code Verification</li>
<li>AI-Assisted Development Accountability</li>
<li>LLM Output Validation</li>
<li>Copilot Code Inspection</li>
</ul>
<h1 id="heading-tools">Tools 🧰</h1>
<ul>
<li>SonarQube (static analysis)</li>
<li>Snyk (security scanning)</li>
<li>ESLint / Pylint (linters)</li>
<li>GitLab / GitHub (code review platforms)</li>
<li>Semgrep (pattern-based scanning)</li>
<li>CodeRabbit / AI-assisted code reviews</li>
</ul>
<h1 id="heading-disclaimer">Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans. </p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tips">https://maximilianocontieri.com/ai-coding-tips</a></div>
]]></content:encoded></item><item><title><![CDATA[Refactoring 038 - Reify Collection]]></title><description><![CDATA[TL;DR: Wrap primitive collections into dedicated objects to ensure type safety and encapsulate business logic.

Problems Addressed 😔

Type safety violations
Logic duplication
Primitive obsession
Weak encapsulation
Strong coupling avoiding collection...]]></description><link>https://maximilianocontieri.com/refactoring-038-reify-collection</link><guid isPermaLink="true">https://maximilianocontieri.com/refactoring-038-reify-collection</guid><category><![CDATA[refactoring]]></category><category><![CDATA[clean code]]></category><category><![CDATA[software development]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Thu, 05 Feb 2026 23:56:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1770335699255/9fdec895-c53d-4ec8-9193-534a9bf77842.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Wrap primitive collections into dedicated objects to ensure type safety and encapsulate business logic.</p>
</blockquote>
<h1 id="heading-problems-addressed">Problems Addressed 😔</h1>
<ul>
<li>Type safety violations</li>
<li>Logic duplication</li>
<li>Primitive obsession</li>
<li>Weak encapsulation</li>
<li>Strong coupling avoiding collection type changes</li>
<li>Hidden business rules</li>
</ul>
<h1 id="heading-related-code-smells">Related Code Smells 💨</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-01-anemic-models">https://maximilianocontieri.com/code-smell-01-anemic-models</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-122-primitive-obsession">https://maximilianocontieri.com/code-smell-122-primitive-obsession</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-63-feature-envy">https://maximilianocontieri.com/code-smell-63-feature-envy</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-40-dtos">https://maximilianocontieri.com/code-smell-40-dtos</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-143-data-clumps">https://maximilianocontieri.com/code-smell-143-data-clumps</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-134-specialized-business-collections">https://maximilianocontieri.com/code-smell-134-specialized-business-collections</a></div>
<h1 id="heading-context">Context 💬</h1>
<p>You find yourself passing around generic lists, arrays, or dictionaries as if they were just <a target="_blank" href="https://maximilianocontieri.com/code-smell-01-anemic-models">anemic</a> "bags of data." like <a target="_blank" href="https://maximilianocontieri.com/code-smell-40-dtos">DTOs</a> or <a target="_blank" href="https://maximilianocontieri.com/code-smell-143-data-clumps">Data Clumps</a>. </p>
<p>These primitive structures are convenient to iterate.</p>
<p>But they are also anonymous and lack a voice in the business domain. </p>
<p>When you use a raw array to represent a group of specific entities—like ActiveSubscribers, PendingInvoices, or ValidationErrors—you are essentially forcing every part of your system to re-learn how to handle that data, leading to scattered logic and "primitive obsession."</p>
<p>When you reify the collection, you improve the model and create technical implementation into a first-class citizen of your domain model. </p>
<p>This doesn't just provide a home for validation and filtering; it makes the invisible concepts in your business requirements visible in your code.</p>
<h1 id="heading-steps">Steps 👣</h1>
<ol>
<li><p>Create a new class to represent the specific collection.</p>
</li>
<li><p>Define a private collection property within this class using the appropriate collection type.</p>
</li>
<li><p>Implement a constructor that accepts only elements of the required type.</p>
</li>
<li><p>Add type-hinted methods to add, remove, or retrieve elements.</p>
</li>
<li><p>Move collection-specific logic (like sorting or filtering) from the outside into this new class.</p>
</li>
</ol>
<h1 id="heading-sample-code">Sample Code 💻</h1>
<h2 id="heading-before">Before 🚨</h2>

<pre><code class="lang-php"><span class="hljs-meta">&lt;?</span>

<span class="hljs-comment">/** <span class="hljs-doctag">@var</span> User[] $users */</span>
<span class="hljs-comment">// this is a static declaration used by many IDEs but not the compiler</span>
<span class="hljs-comment">// Like many comments it is useless, and possible outdated</span>

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">notifyUsers</span>(<span class="hljs-params"><span class="hljs-keyword">array</span> $users</span>) </span>{
    <span class="hljs-keyword">foreach</span> ($users <span class="hljs-keyword">as</span> $user) {
        <span class="hljs-comment">// You have no guarantee $user is actually a User object</span>
        <span class="hljs-comment">// The comment above is </span>
        <span class="hljs-comment">// just a hint for the IDE/Static Analysis</span>
        $user-&gt;sendNotification();
    }
}

$users = [<span class="hljs-keyword">new</span> User(<span class="hljs-string">'Anatoli Bugorski'</span>), <span class="hljs-keyword">new</span> Product(<span class="hljs-string">'Laser'</span>)]; 
<span class="hljs-comment">// This array is anemic and lacks runtime type enforcement</span>
<span class="hljs-comment">// There's a Product in the collection and will show a fatal error</span>
<span class="hljs-comment">// unless it can understand #sendNotification() method</span>

notifyUsers($users);
</code></pre>
<h2 id="heading-after">After 👉</h2>

<pre><code class="lang-php"><span class="hljs-meta">&lt;?</span> 

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">UserDirectory</span> </span>{
<span class="hljs-comment">// 1. Create a new class to represent the specific collection</span>
<span class="hljs-comment">// This is a real world concept reified  </span>
<span class="hljs-comment">// 2. Define a private property</span>
<span class="hljs-keyword">private</span> <span class="hljs-keyword">array</span> $elements = [];

    <span class="hljs-comment">// 3. Implement a constructor that accepts only User types</span>
    <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">__construct</span>(<span class="hljs-params">User ...$users</span>) </span>{
        <span class="hljs-keyword">$this</span>-&gt;elements = $users;
    }

    <span class="hljs-comment">// 4. Add type-hinted methods to add elements</span>
    <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params">User $user</span>): <span class="hljs-title">void</span> </span>{
        <span class="hljs-keyword">$this</span>-&gt;elements[] = $user;
    }

    <span class="hljs-comment">// 5. Move collection-specific logic inside</span>
    <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">notifyAll</span>(<span class="hljs-params"></span>): <span class="hljs-title">void</span> </span>{
        <span class="hljs-keyword">foreach</span> (<span class="hljs-keyword">$this</span>-&gt;elements <span class="hljs-keyword">as</span> $user) {
            $user-&gt;sendNotification();
        }
    }
}
</code></pre>
<h1 id="heading-type">Type 📝</h1>
<p>[X] Manual</p>
<h1 id="heading-safety">Safety 🛡️</h1>
<p>This refactoring is very safe.</p>
<p>You create a new structure and gradually migrate references. </p>
<p>Since you add strict type hints in the new class, the compiler engine catches any incompatible data at runtime, preventing silent failures.</p>
<h1 id="heading-why-is-the-code-better">Why is the Code Better? ✨</h1>
<p>You transform a generic, "dumb" array into a specialized object that understands its own rules. You stop repeating validation logic every time you handle the list. The code becomes self-documenting because the class name explicitly tells you what the collection contains.</p>
<h1 id="heading-how-does-it-improve-the-bijection">How Does it Improve the Bijection? 🗺️</h1>
<p>In the <a target="_blank" href="https://maximilianocontieri.com/what-is-wrong-with-software">real world</a>, a "List of Users" or a "Staff Directory" is a distinct concept with specific behaviors. </p>
<p>An anonymous array is a technical implementation detail, not a real-world entity. </p>
<p>By reifying the collection, you create a <a target="_blank" href="https://maximilianocontieri.com/the-one-and-only-software-design-principle">one-to-one correspondence</a> between the business concept and your code.</p>
<h1 id="heading-limitations">Limitations ⚠️</h1>
<p>You might encounter slight performance overhead when dealing with millions of objects compared to raw arrays.</p>
<p>For most business applications, the safety gains far outweigh the millisecond costs and prevents you from being a premature optimizator.</p>
<p>Remember to avoid hollow <a target="_blank" href="https://maximilianocontieri.com/code-smell-134-specialized-business-collections">Specialized Business collections</a> that don't exist in the real world.</p>
<p>Many languages support typed collections:</p>
<ul>
<li><p>C# achieves typed collections through reified <em>generics</em> in the CLR, preserving type information at runtime for types like <em>List</em>.</p>
</li>
<li><p>C++ achieves typed collections through <em>templates</em> like blueprints instantiated at compile time for each concrete type.</p>
</li>
<li><p>Clojure achieves typed collections through optional static typing libraries such as core.typed.</p>
</li>
<li><p>Dart achieves typed collections through <em>reified generics</em> with runtime type checks in sound null safety mode.</p>
</li>
<li><p>Elixir achieves typed collections through <em>typespecs</em> analyzed by Dialyzer for static verification.</p>
</li>
<li><p>Go achieves typed collections through <em>parametric generics</em> introduced in Go 1.18 with type parameters and constraints.</p>
</li>
<li><p>Haskell achieves typed collections through <em>parametric polymorphism</em> and type classes resolved at compile time.</p>
</li>
<li><p>Java achieves typed collections through generics with type erasure, enforcing type constraints at compile time on classes like <em>List</em> and <em>Map</em>.</p>
</li>
<li><p>JavaScript achieves typed collections through TypeScript or Flow, which add static generic typing on top of the dynamic language (see below).</p>
</li>
<li><p>Kotlin achieves typed collections through <em>JVM generics</em> with variance annotations and null-safety integrated into the type system.</p>
</li>
<li><p>Objective-C achieves typed collections through <em>lightweight generics</em> that provide compile-time checks without full runtime enforcement.</p>
</li>
<li><p>PHP achieves typed collections through <em>docblock-based generics</em> enforced by static analyzers like Psalm or PHPStan.</p>
</li>
<li><p>Python achieves typed collections through type hints like <em>list[T]</em> and <em>dict[K, V]</em> checked by static analyzers such as mypy.</p>
</li>
<li><p>Ruby achieves typed collections through <em>external type systems</em> like Sorbet or RBS layered on top of the dynamic runtime.</p>
</li>
<li><p>Rust achieves typed collections through <em>parametric types</em> and trait bounds checked at compile time with monomorphization.</p>
</li>
<li><p>Scala achieves typed collections through a powerful <em>generic type system</em> with variance and higher-kinded types.</p>
</li>
<li><p>Swift achieves typed collections through <em>generics</em> with value semantics and protocol constraints.</p>
</li>
<li><p>TypeScript achieves typed collections through <em>structural typing</em> and <em>generics</em> enforced at compile time and erased at runtime since JavaScript doesn't support them.</p>
</li>
</ul>
<p>In all the above cases, reifying a real business object (if exists in the <a target="_blank" href="https://maximilianocontieri.com/the-one-and-only-software-design-principle">MAPPER</a>) gives you a good extra abstraction layer.</p>
<h1 id="heading-tags">Tags 🏷️</h1>
<ul>
<li>Primitive Obsession</li>
</ul>
<h1 id="heading-level">Level 🔋</h1>
<p>[X] Intermediate</p>
<h1 id="heading-related-refactorings">Related Refactorings 🔄</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/refactoring-012-reify-associative-arrays">https://maximilianocontieri.com/refactoring-012-reify-associative-arrays</a></div>
<h1 id="heading-refactor-with-ai">Refactor with AI 🤖</h1>
<p>Ask your AI assistant to: "Identify where I am passing arrays of objects and suggest a Typed Collection class for them." </p>
<p>You can also provide the base class and ask: "Find a real business object and generate a boilerplate for a type-safe collection for this entity."</p>
<h1 id="heading-credits">Credits 🙏</h1>
<p>Image by <a target="_blank" href="https://pixabay.com/users/maky_orel-436253/">Markéta Klimešová</a> on <a target="_blank" href="https://pixabay.com/">Pixabay</a></p>
<p>Inspired by the "Collection Object" pattern in clean architecture and the ongoing quest for type safety in dynamic languages.</p>
<hr />
<p>This article is part of the Refactoring Series.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/how-to-improve-your-code-with-easy-refactorings">https://maximilianocontieri.com/how-to-improve-your-code-with-easy-refactorings</a></div>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 005 - Keep Context Fresh]]></title><description><![CDATA[TL;DR: Clear your chat history to keep your AI assistant sharp.

Common Mistake ❌
You keep a single chat window open for hours. 
You switch from debugging a React component to writing a SQL query in the same thread. 
The conversation flows, and the a...]]></description><link>https://maximilianocontieri.com/ai-coding-tip-005-keep-context-fresh</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-005-keep-context-fresh</guid><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[clean code]]></category><category><![CDATA[code smell ]]></category><category><![CDATA[claude.ai]]></category><category><![CDATA[chatgpt]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Tue, 03 Feb 2026 13:24:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1770126816281/25829ede-b9ef-4a54-9f67-e06183434293.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Clear your chat history to keep your AI assistant sharp.</p>
</blockquote>
<h1 id="heading-common-mistake">Common Mistake ❌</h1>
<p>You keep a single chat window open for hours. </p>
<p>You switch from debugging a React component to writing a SQL query in the same thread. </p>
<p>The conversation flows, and the answers seems accurate enough. </p>
<p>But then something goes wrong. </p>
<p>The AI tries to use your old JavaScript context to help with your database schema. </p>
<p>This creates "context pollution."</p>
<p>The assistant gets confused by irrelevant data from previous tasks and starts to hallucinate.</p>
<h1 id="heading-problems-addressed">Problems Addressed 😔</h1>
<ul>
<li><strong>Attention Dilution</strong>: The AI loses focus on your current task.</li>
<li><strong>Hallucinations</strong>: The model makes up subtle facts based on old, unrelated prompts .</li>
<li><strong>Token Waste</strong>: You pay for "noise" in your history.</li>
<li><strong>Illusion of Infinite Context</strong>: Today, context windows are huge. But you need to stay focused.</li>
<li><strong>Stale Styles</strong>: The AI keeps using old instructions you no longer need.</li>
<li><strong>Lack of Reliability</strong>: Response quality decreases as the context window fills up.</li>
</ul>
<h1 id="heading-how-to-do-it">How to Do It 🛠️</h1>
<ol>
<li>You need to identify when a specific microtask is complete. <em>(Like you would when coaching a new team member)</em>.</li>
<li>Click the "New Chat" button immediately and <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt">commit the partial solution</a>.</li>
<li>If the behavior will be reused, You save it as a new skill <em>(Like you would when coaching a new team member)</em>.</li>
<li>You provide a clear, isolated instruction for the new subject. <em>(Like you would when coaching a new team member)</em>.</li>
<li>Place your most important instructions at the beginning or end</li>
<li>Limit your prompts to 1,500-4,000 tokens for best results. (Most tools show the content usage).</li>
</ol>
<h1 id="heading-benefits">Benefits 🎯</h1>
<ul>
<li>You get more accurate code suggestions.</li>
<li>You reduce the risk of the AI repeating past errors.</li>
<li>You save time and tokens because the AI responds faster with less noise.</li>
<li>Response times stay fast</li>
<li>You avoid cascading failures in complex workflows</li>
<li>You force yourself to write down agents.md or <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills">skills.md</a> for the next task</li>
</ul>
<h1 id="heading-context">Context 🧠</h1>
<p>Large Language Models use an "Attention" mechanism. </p>
<p>When you give them a massive history, they must decide which parts matter. </p>
<p>Just like a "God Object" in clean code, a "God Chat" violates the Single Responsibility Principle. </p>
<p>When you keep it fresh and hygienic, you ensure the AI's "working memory" stays pure.</p>
<h2 id="heading-prompt-reference">Prompt Reference 📝</h2>
<p><strong>Bad Prompt (Continuing an old thread):</strong></p>

<pre><code class="lang-markdown">Help me adjust the Kessler Syndrome Simulator
in Python function to sort data. 

Also, can you review this JavaScript code? 

And I need some SQL queries tracking crashing satellites, too. 

Use camelCase. 

Actually, use snake<span class="hljs-emphasis">_case instead. Make it functional. 

No, wait, use classes.

Change the CSS style to support
dark themes for the orbital pictures.</span>
</code></pre>
<h2 id="heading-good-prompt-in-a-fresh-thread">Good Prompt (In a fresh thread):</h2>

<pre><code class="lang-markdown">Sort the data from @kessler.py#L23.

Update the tests using the skill run-tests.
</code></pre>
<h2 id="heading-considerations">Considerations ⚠️</h2>
<p>You must extract <em>agents.md</em> or <em>skills.md</em> before starting the new chat. <em>(Like you would when coaching a new team member)</em></p>
<p>Use metacognition: <em>Write down what you have learned</em>. <em>(Like you would when coaching a new team member)</em></p>
<p>The AI will not remember them across threads. <em>(Like you would when coaching a new team member)</em></p>
<h2 id="heading-type">Type 📝</h2>
<p>[X] Semi-Automatic</p>
<h2 id="heading-level">Level 🔋</h2>
<p>[X] Intermediate</p>
<h2 id="heading-related-tips">Related Tips 🔗</h2>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt">https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt</a></div>
<p>Place the most important instructions at the beginning or end</p>
<h2 id="heading-conclusion">Conclusion 🏁</h2>
<p>Fresh context leads to incrementalism and small solutions, <a target="_blank" href="https://maximilianocontieri.com/fail-fast">Failing Fast</a>. </p>
<p>When you start over, you win back the AI's full attention and fresh tokens.</p>
<p><strong>Pro-Tip 1</strong>: This is not <em>just</em> a coding tip. If you use Agents or Assistants for <em>any</em> task, you should use this advice.</p>
<p><strong>Pro-Tip 2</strong>: Humans need to <a target="_blank" href="https://simple.wikipedia.org/wiki/Sleep_deprivation">sleep to consolidate</a> what we have learned in the day; bots need to write down <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills">skills</a> to start fresh a new day.</p>
<h2 id="heading-more-information">More Information ℹ️</h2>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arxiv.org/abs/1706.03762">https://arxiv.org/abs/1706.03762</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arxiv.org/abs/2307.03172">https://arxiv.org/abs/2307.03172</a></div>
<p><a target="_blank" href="https://www.promptingguide.ai/">Full Prompt Engineering Guide: Context Management</a> </p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://jaykmody.com/blog/gpt-from-scratch/">https://jaykmody.com/blog/gpt-from-scratch/</a></div>
<p><a target="_blank" href="https://zapier.com/blog/ai-hallucinations/">Avoiding AI Hallucinations</a> </p>
<p><a target="_blank" href="https://docs.anthropic.com/claude/docs/long-context-window-tips">Anthropic Context Window Best Practices</a> </p>
<p><a target="_blank" href="https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them">Token Economy in Large Language Models</a> </p>
<h2 id="heading-also-known-as">Also Known As 🎭</h2>
<p>Context Reset</p>
<p>Thread Pruning</p>
<p>Session Hygiene</p>
<h2 id="heading-disclaimer">Disclaimer 📢</h2>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans. </p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<p>This article is part of the AI Coding Tip series.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tips">https://maximilianocontieri.com/ai-coding-tips</a></div>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 004 - Use Modular Skills]]></title><description><![CDATA[TL;DR: Create small, specialized files with specific rules to keep your AI focused, accurate and preventing hallucinations.

Common Mistake ❌
You know the drill - you paste your entire project documentation or every coding rule into a single massive ...]]></description><link>https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills</guid><category><![CDATA[AI]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[coding]]></category><category><![CDATA[clean code]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Mon, 26 Jan 2026 20:01:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769457639863/85fa092c-58f1-46bf-a2f1-1f51f9f5e589.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Create small, specialized files with specific rules to keep your AI focused, accurate and preventing hallucinations.</p>
</blockquote>
<h1 id="heading-common-mistake">Common Mistake ❌</h1>
<p>You know the drill - you paste your entire project documentation or every coding rule into a single massive <a target="_blank" href="https://en.wikipedia.org/wiki/README">Readme.md</a> or <a target="_blank" href="https://agents.md/">Agents.md</a></p>
<p>Then you expect the AI to somehow remember everything at once.</p>
<p>This overwhelms the model and leads to "hallucinations" or ignored instructions.</p>
<h1 id="heading-problems-addressed">Problems Addressed 😔</h1>
<ul>
<li><p>Long prompts consume the token limit quickly leading to context exhaustion.</p>
</li>
<li><p>Large codebases overloaded with information for agents competing for the short attention span.</p>
</li>
<li><p>The AI gets confused by rules and irrelevant noise that do not apply to your current task.</p>
</li>
<li><p>Without specific templates, the AI generates non standardized code that doesn't follow your team's unique standards.</p>
</li>
<li><p>The larger the context you use, the more likely the AI is to generate hallucinated code that doesn't solve your problem.</p>
</li>
<li><p>Multistep workflows can confuse your next instruction.</p>
</li>
</ul>
<h1 id="heading-how-to-do-it">How to Do It 🛠️</h1>
<ol>
<li><p>Find repetitive tasks you do very often, writing unit tests, creating React components, adding coverage, formatting Git commits.</p>
</li>
<li><p>Write a small Markdown file (a.k.a. skill) for each task. Keep it <strong>between 20 and 50 lines</strong>.</p>
</li>
<li><p>Follow the <a target="_blank" href="https://agentskills.io/home">Agent Skills format</a>.</p>
</li>
<li><p>Add a "trigger" at the top of the file. This tells the AI <strong>when</strong> to use these specific rules.</p>
</li>
<li><p>Include the technology (e.g., Python, PHP) and the goal of the skill in the metadata.</p>
</li>
<li><p>Give the files to your AI assistant (Claude, Cursor, or Windsurf) only when you need them restricting context to cheaper subagents (Junior AIS) invoking them from a more intelligent orchestrator.</p>
</li>
<li><p>Have many very short agents.md for specific tasks following the <a target="_blank" href="https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt">divide-and-conquer</a> principle .</p>
</li>
<li><p>Put the relevant skills on <em>agents.md</em>.    </p>
</li>
</ol>
<h1 id="heading-benefits">Benefits 🎯</h1>
<ul>
<li><p><strong>Higher Accuracy:</strong> The AI focuses on a narrow set of rules.</p>
</li>
<li><p><strong>Save Tokens:</strong> You only send the context that matters for the specific file you edit.</p>
</li>
<li><p><strong>Portability:</strong> You can share these "skills" with your team across different AI tools.</p>
</li>
</ul>
<h1 id="heading-context">Context 🧠</h1>
<p>Modern AI models have a limited "attention span.".</p>
<p>When you dump too much information on them, the model literally loses track of the middle part of your prompt.</p>
<p>Breaking instructions into "skills" mimics how human experts actually work: they pull specific knowledge from their toolbox only when a specific problem comes up.</p>
<p><em>Skills.md</em> is an open standardized format for packaging procedural knowledge that agents can use.</p>
<p>Originally developed by Anthropic and now adopted across multiple agent platforms.</p>
<p>A <em>SKILL.md file</em> contains instructions in a structured format with <a target="_blank" href="https://en.wikipedia.org/wiki/YAML">YAML</a>.</p>
<p>The file also has progressive disclosure. Agents first see only the skill name and description, then load full instructions only when relevant (when the trigger is pulled).</p>
<h2 id="heading-prompt-reference">Prompt Reference 📝</h2>
<p>Bad prompt 🚫</p>
<pre><code class="lang-markdown">Here are 50 pages of our company coding standards and business rules. 

Now, please write a simple function to calculate taxes.
</code></pre>
<p>Good prompt 👉</p>
<p>After you install your skill:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769457277271/121e8dfa-9a79-46e0-9283-0d90722d1f10.gif" alt class="image--center mx-auto" /></p>
<p><strong>Good Prompt</strong></p>
<pre><code class="lang-markdown">Use the PHP-Clean-Code skill. 

Create a tax calculator function 
from the business specification taxes.md

Follow the 'Early Return' rule defined in that skill.
</code></pre>
<h1 id="heading-considerations">Considerations ⚠️</h1>
<p>Using skills for small projects is an overkill.</p>
<p>If all your code fits comfortably in your context window, you're wasting time writing agents.md or skills.md files.</p>
<p>You also need to keep your skills updated regularly.</p>
<p>If your project architecture changes, your skill files must change too, or the AI will give you outdated advice.</p>
<p>Remember <a target="_blank" href="https://maximilianocontieri.com/code-smell-183-obsolete-comments">outdated documentation</a> is much worse than no documentation at all.</p>
<h1 id="heading-type">Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1 id="heading-limitations">Limitations ⚠️</h1>
<p>Don't go crazy creating too many tiny skills.</p>
<p>If you have 100 skills for one project, you'll spend more time managing files than actually coding.</p>
<p>Group related rules into logical sets.</p>
<h1 id="heading-tags">Tags 🏷️</h1>
<p>#Architecture #Productivity #AI-Agents</p>
<h1 id="heading-level">Level 🔋</h1>
<p>[X] Intermediate</p>
<h1 id="heading-related-tips">Related Tips 🔗</h1>
<ul>
<li><p>Keep a file like <em>AGENTS.md</em> for high-level project context.</p>
</li>
<li><p>Create scripts to synchronize skills across different IDEs.    </p>
</li>
</ul>
<h1 id="heading-conclusion">Conclusion 🏁</h1>
<p>Modular skills turn a generic AI into a specialized engineer that knows exactly how you want your code written.</p>
<p>When you keep your instructions <em>small</em>, incremental and sharp, you get better results.</p>
<h1 id="heading-more-information">More Information ℹ️</h1>
<p><a target="_blank" href="https://skills.sh/">Skills Repository</a></p>
<p><a target="_blank" href="https://agentskills.io/home">Agent Skills Format</a></p>
<h1 id="heading-also-known-as">Also Known As 🎭</h1>
<ul>
<li><p>Instruction-Sets</p>
</li>
<li><p>Prompt-Snippets    </p>
</li>
</ul>
<h1 id="heading-tools">Tools 🧰</h1>
<p>Most skills come in different flavors for:</p>
<ul>
<li><p>Cursor</p>
</li>
<li><p>Windsurf</p>
</li>
<li><p>GitHub Copilot    </p>
</li>
</ul>
<h1 id="heading-disclaimer">Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans.</p>
<p>I use AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tips">https://maximilianocontieri.com/ai-coding-tips</a></div>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tips]]></title><description><![CDATA[A series of practical advice on how to use the AI to code

TL;DR: Master the balance between AI speed and code with professional craftsmanship.

In this series, you will learn practical state-of-the-a]]></description><link>https://maximilianocontieri.com/ai-coding-tips</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tips</guid><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Wed, 21 Jan 2026 12:42:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768999287609/82e1ad91-7add-4162-bc2c-26de155d278d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>A series of practical advice on how to use the AI to code</em></p>
<blockquote>
<p>TL;DR: Master the balance between AI speed and code with professional craftsmanship.</p>
</blockquote>
<p>In this series, you will learn practical state-of-the-art advice to use AI to code.</p>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt">https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt</a></p>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-002-prompt-in-english">https://maximilianocontieri.com/ai-coding-tip-002-prompt-in-english</a></p>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning">https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning</a></p>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills">https://maximilianocontieri.com/ai-coding-tip-004-use-modular-skills</a></p>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-005-keep-context-fresh">https://maximilianocontieri.com/ai-coding-tip-005-keep-context-fresh</a></p>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-006-review-every-line-before-commit">https://maximilianocontieri.com/ai-coding-tip-006-review-every-line-before-commit</a></p>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-007-avoid-malicious-skills">https://maximilianocontieri.com/ai-coding-tip-007-avoid-malicious-skills</a></p>
<p><a href="https://maximilianocontieri.com/ai-coding-tip-008-use-spec-driven-development-with-ai">https://maximilianocontieri.com/ai-coding-tip-008-use-spec-driven-development-with-ai</a> </p>
<p><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tip-009-compact-your-context">https://maximilianocontieri.com/ai-coding-tip-009-compact-your-context</a></p>
<p><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tip-010-access-all-your-code">https://maximilianocontieri.com/ai-coding-tip-010-access-all-your-code</a></p>
<p><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tip-011-initialize-agents-md">https://maximilianocontieri.com/ai-coding-tip-011-initialize-agents-md</a></p>
<p><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tip-012-understand-all-your-code">https://maximilianocontieri.com/ai-coding-tip-012-understand-all-your-code</a></p>
<p><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tip-013-use-progressive-disclosure">https://maximilianocontieri.com/ai-coding-tip-013-use-progressive-disclosure</a></p>
<p><a class="embed-card" href="https://maximilianocontieri.com/ai-coding-tip-014-use-nested-agents-md-files">https://maximilianocontieri.com/ai-coding-tip-014-use-nested-agents-md-files</a></p>

<p>... more coming soon!</p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 003 - Force Read-Only Planning]]></title><description><![CDATA[TL;DR: Set your AI code assistant to read-only state before it touches your files.

Common Mistake ❌
You paste your failing call stack to your AI assistant without further instructions.
The copilot immediately begins modifying multiple source files.
...]]></description><link>https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-003-force-read-only-planning</guid><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[AI]]></category><category><![CDATA[Developer]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Sat, 17 Jan 2026 01:38:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768613740696/b5d7d616-41a7-4f9c-ba0f-c3b34d685897.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Set your AI code assistant to read-only state before it touches your files.</p>
</blockquote>
<h1 id="heading-common-mistake">Common Mistake ❌</h1>
<p>You paste your failing call stack to your AI assistant without further instructions.</p>
<p>The copilot immediately begins modifying multiple source files.</p>
<p>It creates new <a target="_blank" href="https://maximilianocontieri.com/stop-calling-them-bugs">issues</a> because it doesn't understand your full architecture yet.</p>
<p>You spend the next hour undoing its messy changes.</p>
<h1 id="heading-problems-addressed">Problems Addressed 😔</h1>
<p>The AI modifies code that doesn't need changing.</p>
<p>The copilot starts typing before it reads the relevant functions.</p>
<p>The AI hallucinates when assuming a library exists without checking your <em>package.json</em>.</p>
<p>Large changes make code reviews and diffs a nightmare.</p>
<h1 id="heading-how-to-do-it">How to Do It 🛠️</h1>
<p>Enter Plan Mode: Use "Plan Mode/Ask Mode" if your tool has it.</p>
<p>If your tool doesn't have such a mode, you can add a meta-prompt</p>
<blockquote>
<p>Read this and wait for instructions / Do not change any files yet.</p>
</blockquote>
<p>Ask the AI to read specific files and explain the logic there.</p>
<p>After that, ask for a <em>step-by-step</em> implementation plan for you to approve.</p>
<p>When you like the plan, tell the AI: "Now apply step 1."</p>
<h1 id="heading-benefits">Benefits 🎯</h1>
<p>Better Accuracy: The AI reasons better when focusing only on the "why."</p>
<p>Full Control: You catch logic errors before they enter your codebase.</p>
<p>Lower Costs: You use fewer tokens when you avoid "trial and error" coding loops.</p>
<p>Clearer Mental Model: You understand the fix as well as the AI does.</p>
<h1 id="heading-context">Context 🧠</h1>
<p>AI models prefer "doing" over "thinking" to feel helpful. This is called <em>impulsive coding</em>.</p>
<p>When you force it into a read-only phase, you are simulating a Senior Developer's workflow.</p>
<p>You deal with the Artificial Intelligence first as a consultant and later as a developer.</p>
<h1 id="heading-prompt-reference">Prompt Reference 📝</h1>
<p>Bad prompt 🚫</p>

<pre><code class="lang-markdown">Fix the probabilistic predictor
in the Kessler Syndrome Monitor component 
using this stack dump.
</code></pre>
<p>Good prompt 👉</p>

<pre><code class="lang-markdown">Read @Dashboard.tsx and @api.ts. Do not write code yet.
Analyze the stack dump.
When you find the problem, explain it to me.
Then, write a Markdown plan to fix it, restricted to the REST API.
[Activate Code Mode]
Create a failing test representing the error.
Apply the fix and run the tests until all are green
</code></pre>
<h1 id="heading-considerations">Considerations ⚠️</h1>
<p>Some simple tasks do not need a plan.</p>
<p>You must actively read the plan the AI provides.</p>
<p>The AI might still hallucinate the plan, so verify it.</p>
<h1 id="heading-type">Type 📝</h1>
<p>[X] Semi-Automatic</p>
<h1 id="heading-limitations">Limitations ⚠️</h1>
<p>You can use this for refactoring and complex features.</p>
<p>You might find it too slow for simple CSS tweaks or typos.</p>
<p>Some AIs go the other way around, being <em>too confirmative</em> before changing anything. Be patient with them.</p>
<h1 id="heading-tags">Tags 🏷️</h1>
<ul>
<li>Complexity</li>
</ul>
<h1 id="heading-level">Level 🔋</h1>
<p>[X] Intermediate</p>
<h1 id="heading-related-tips">Related Tips 🔗</h1>
<p>Request small, atomic commits.</p>
<h1 id="heading-conclusion">Conclusion 🏁</h1>
<p>You save time when you think.</p>
<p>You must force the AI to be your architect before letting it be your builder.</p>
<p>This simple strategy prevents hours of debugging later. 🧠</p>
<h1 id="heading-more-information">More Information ℹ️</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.blog/ai-and-ml/github-copilot/copilot-ask-edit-and-agent-modes-what-they-do-and-when-to-use-them/">https://github.blog/ai-and-ml/github-copilot/copilot-ask-edit-and-agent-modes-what-they-do-and-when-to-use-them/</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.thepromptwarrior.com/p/windsurf-vs-cursor-which-ai-coding-app-is-better">https://www.thepromptwarrior.com/p/windsurf-vs-cursor-which-ai-coding-app-is-better</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://aider.chat/docs/usage/modes.html">https://aider.chat/docs/usage/modes.html</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://opencode.ai/docs/modes/">https://opencode.ai/docs/modes/</a></div>
<h1 id="heading-also-known-as">Also Known As 🎭</h1>
<p>Read-Only Prompting</p>
<p>Consultant Mode</p>
<h1 id="heading-tools">Tools 🧰</h1>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Tool</td><td>Read-Only Mode</td><td>Write Mode</td><td>Mode Switching</td><td>Open Source</td><td>Link</td></tr>
</thead>
<tbody>
<tr>
<td><strong>Windsurf</strong></td><td>Chat Mode</td><td>Write Mode</td><td>Toggle</td><td>No</td><td>https://windsurf.com/</td></tr>
<tr>
<td><strong>Cursor</strong></td><td>Normal/Ask</td><td>Agent/Composer</td><td>Context-dependent</td><td>No</td><td>https://www.cursor.com/</td></tr>
<tr>
<td><strong>Aider</strong></td><td>Ask/Help Modes</td><td>Code/Architect</td><td><code>/chat-mode</code></td><td>Yes</td><td>https://aider.chat/</td></tr>
<tr>
<td><strong>GitHub Copilot</strong></td><td>Ask Mode</td><td>Edit/Agent Modes</td><td>Mode selector</td><td>No</td><td>https://github.com/features/copilot</td></tr>
<tr>
<td><strong>Cline</strong></td><td>Plan Mode</td><td>Act Mode</td><td>Built-in</td><td>Yes (extension)</td><td>https://cline.bot/</td></tr>
<tr>
<td><strong>Continue.dev</strong></td><td>Chat/Ask</td><td>Edit/Agent Modes</td><td>Config-based</td><td>Yes</td><td>https://continue.dev/</td></tr>
<tr>
<td><strong>OpenCode</strong></td><td>Plan Mode</td><td>Build Mode</td><td>Tab key</td><td>Yes</td><td>https://opencode.ai/</td></tr>
<tr>
<td><strong>Claude Code</strong></td><td>Review Plans</td><td>Auto-execute</td><td>Settings</td><td>No</td><td>https://code.claude.com/</td></tr>
<tr>
<td><strong>Replit Agent</strong></td><td>Plan Mode</td><td>Build/Fast/Full</td><td>Mode selection</td><td>No</td><td>https://replit.com/agent3</td></tr>
</tbody>
</table>
</div><h1 id="heading-disclaimer">Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I am a human who writes as best as possible for other humans. </p>
<p>I used AI proofreading tools to improve some texts.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 002 - Prompt in English]]></title><description><![CDATA[TL;DR: When you prompt in English, you align with how AI learned code and spend fewer tokens>

Disclaimer: You might have noticed English is not my native language. This article targets people whose native language is different from English.
Common M...]]></description><link>https://maximilianocontieri.com/ai-coding-tip-002-prompt-in-english</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-002-prompt-in-english</guid><category><![CDATA[AI]]></category><category><![CDATA[code smell ]]></category><category><![CDATA[AI Assistants ]]></category><category><![CDATA[copilot]]></category><category><![CDATA[clean code]]></category><category><![CDATA[cursor]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Sat, 10 Jan 2026 15:43:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1767984712342/69cc3c34-faab-49e7-bc2f-bcca630e249c.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: When you prompt in English, you align with how AI learned code and spend fewer tokens&gt;</p>
</blockquote>
<p><em>Disclaimer: You might have noticed English is not my native language. This article targets people whose native language is different from English.</em></p>
<h1 id="heading-common-mistake">Common Mistake ❌</h1>
<p>You write your prompt in your native language (other than English) for a technical task. </p>
<p>You ask for complex <em>React hooks</em> or <em>SQL optimizations</em> in Spanish, French, or Chinese.</p>
<p>You follow your train of thought in your native language. </p>
<p>You assume the AI processes these languages with the same technical depth as English.</p>
<p>You think modern AI handles all languages equally for technical tasks.</p>
<h1 id="heading-problems-addressed">Problems Addressed 😔</h1>
<p>The AI copilot misreads intent. </p>
<p>The AI mixes language and syntax.</p>
<p>The AI assistant generates weaker solutions.</p>
<p>Non-English languages use <a target="_blank" href="https://denyslinkov.medium.com/why-is-gpt-3-15-77x-more-expensive-for-certain-languages-2b19a4adc4bc">more tokens</a>. You <a target="_blank" href="https://arxiv.org/pdf/2305.15425">waste</a> your context window.</p>
<p>The translation uses part of the available tokens in an intermediate prompt besides your instructions.</p>
<p>The AI might misinterpret technical terms that lack a direct translation.</p>
<p>For example: "<a target="_blank" href="https://en.wikipedia.org/wiki/Callback_(computer_programming)">Callback</a>" becomes "<a target="_blank" href="https://es.wikipedia.org/wiki/Retrollamada_(inform%C3%A1tica)">Retrollamada</a>" or "<a target="_blank" href="https://es.wikipedia.org/wiki/R%C3%A1pel">Rappel</a>". The AI misunderstands your intent or wastes context tokens to disambiguate the instruction.</p>
<h1 id="heading-how-to-do-it">How to Do It 🛠️</h1>
<ol>
<li>Define the problem clearly.</li>
<li>Translate intent into simple English.</li>
<li>Use short sentences.</li>
<li>Keep business names in <a target="_blank" href="https://maximilianocontieri.com/code-smell-128-non-english-coding">English</a> to favor polymorphism.</li>
<li>Never mix languages inside one prompt (e.g., "Haz una función que fetchUser()…").</li>
</ol>
<h1 id="heading-benefits">Benefits 🎯</h1>
<p>You get more accurate code.  </p>
<p>You fit more instructions into the same message. </p>
<p>You reduce hallucinations.  </p>
<h1 id="heading-context">Context 🧠</h1>
<p>Most AI coding models are trained mostly on English data.  </p>
<p>English accounts for over 90% of AI training sets.</p>
<p>Most libraries and docs use English.  </p>
<p>Benchmarks show higher accuracy with English prompts.</p>
<p>While models are polyglots, their reasoning paths for code work best in English. </p>
<h2 id="heading-prompt-reference">Prompt Reference 📝</h2>
<p>Bad prompt 🚫</p>

<pre><code class="lang-markdown">Mejorá este código y hacelo más limpio
</code></pre>
<p>Good prompt 👉</p>

<pre><code class="lang-markdown">Refactor this code and make it cleaner
</code></pre>
<h1 id="heading-considerations">Considerations ⚠️</h1>
<p>You should avoid slang.  </p>
<p>You should avoid long prompts.  </p>
<p>You should avoid mixed languages.</p>
<p>Models seem to understand mixed languages, but it is not the best practice.</p>
<p>Some English terms vary by region. "Lorry" vs "truck". Stick to American English for programming terms.</p>
<h1 id="heading-type">Type 📝</h1>
<p>[X] Semi-Automatic</p>
<p>You can ask your model to warn you if you use a different language, but this is overkill.</p>
<h1 id="heading-limitations">Limitations ⚠️</h1>
<p>You can use other languages for explanations.  </p>
<p>You should prefer <a target="_blank" href="https://maximilianocontieri.com/code-smell-128-non-english-coding">English for code generation</a>.<br />You must review the model reasoning anyway.</p>
<p>This tip applies to Large Language Models like GPT-4, Claude, or Gemini. </p>
<p>Smaller, local models might only understand English reliably.</p>
<h1 id="heading-tags">Tags 🏷️</h1>
<ul>
<li>Standards</li>
</ul>
<h1 id="heading-level">Level 🔋</h1>
<p>[x] Beginner   </p>
<h1 id="heading-related-tips">Related Tips 🔗</h1>
<ul>
<li><p>Commit Before You Prompt</p>
</li>
<li><p>Review Diffs, Not Code  </p>
</li>
</ul>
<h1 id="heading-conclusion">Conclusion 🏁</h1>
<p>Think of English as the language of the machine and your native tongue as the language of the human. </p>
<p>When you use both correctly, you create better software.</p>
<h1 id="heading-more-information">More Information ℹ️</h1>
<p><a target="_blank" href="https://commoncrawl.org/">Common Crawl Language Statistics</a> </p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arxiv.org/abs/2402.16694">https://arxiv.org/abs/2402.16694</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://arxiv.org/abs/2408.09701">https://arxiv.org/abs/2408.09701</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://pureai.com/blogs/mind-the-prompt/2025/12/prompting-in-english-not-that-ideal-after-all.aspx">https://pureai.com/blogs/mind-the-prompt/2025/12/prompting-in-english-not-that-ideal-after-all.aspx</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-128-non-english-coding">https://maximilianocontieri.com/code-smell-128-non-english-coding</a></div>
<h1 id="heading-also-known-as">Also Known As 🎭</h1>
<p>English-First Prompting  </p>
<p>Language-Aligned Prompting  </p>
<h1 id="heading-disclaimer">Disclaimer 📢</h1>
<p>The views expressed here are my own.</p>
<p>I welcome constructive criticism and dialogue.</p>
<p>These insights are shaped by 30 years in the software industry, 25 years of teaching, and authoring over 500 articles and a book.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> series.</p>
]]></content:encoded></item><item><title><![CDATA[AI Coding Tip 001 - Commit Before Prompt]]></title><description><![CDATA[A safety-first workflow for AI-assisted coding

TL;DR: Commit your code before asking an AI Assistant to change it.

Common Mistake ❌
Developers ask AI assistant to "refactor this function" or "add error handling" while they have uncommitted changes ...]]></description><link>https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt</link><guid isPermaLink="true">https://maximilianocontieri.com/ai-coding-tip-001-commit-before-prompt</guid><category><![CDATA[AI]]></category><category><![CDATA[AI Code Assistant]]></category><category><![CDATA[clean code]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[copilot]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Sun, 04 Jan 2026 22:32:34 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1767565557382/8e0c73c6-7e78-41cb-85ab-800fba6b06df.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>A safety-first workflow for AI-assisted coding</em></p>
<blockquote>
<p>TL;DR: Commit your code before asking an AI Assistant to change it.</p>
</blockquote>
<h1 id="heading-common-mistake">Common Mistake ❌</h1>
<p>Developers ask AI assistant to "refactor this function" or "add error handling" while they have uncommitted changes from their previous work session. </p>
<p>When the AI makes its changes, the git diff shows everything mixed together—their manual edits plus the AI's modifications. </p>
<p>If something breaks, they can't easily separate what they did from what the AI did and make a safe revert.</p>
<h1 id="heading-problems-addressed">Problems Addressed 😔</h1>
<ul>
<li><p>You mix your previous code changes with AI-generated code. </p>
</li>
<li><p>You lose track of what you changed.</p>
</li>
<li><p>You struggle to revert broken suggestions.</p>
</li>
</ul>
<h1 id="heading-how-to-do-it">How to Do It 🛠️</h1>
<ol>
<li><p>Finish your manual task.</p>
</li>
<li><p>Run your tests to ensure everything passes.</p>
</li>
<li><p>Commit your work with a clear message like "feat: manual implementation of X".</p>
</li>
<li><p>You don't need to push your changes. </p>
</li>
<li><p>Send your prompt to the AI assistant.</p>
</li>
<li><p>Review the changes using your IDE's diff tool.</p>
</li>
<li><p><strong>Accept or revert</strong>: Keep the changes if they look good, or run <code>git reset --hard HEAD</code> to instantly revert</p>
</li>
<li><p>Run the tests again to verify AI changes didn't break anything.</p>
</li>
<li><p>Commit AI changes separately with a message like <em>refactor: AI-assisted improvement of X</em>.</p>
</li>
</ol>
<h1 id="heading-benefits">Benefits 🎯</h1>
<p>Clear Diffing: You see the AI's "suggestions" in isolation.</p>
<p>Easy Revert: You can undo a bad AI hallucination instantly.</p>
<p>Context Control: You ensure the AI is working on your latest, stable logic.</p>
<p>Tests are always green: You are not breaking existing functionality.</p>
<h1 id="heading-context">Context 🧠</h1>
<p>When you ask an AI to change your code, it might produce unexpected results. </p>
<p>It might delete a crucial logic gate or change a variable name across several files. </p>
<p>If you have uncommitted changes, you can't easily see what the AI did versus what you did manually.</p>
<p>When you commit first, you create a safety net. </p>
<p>You can use <code>git diff</code> to see exactly what the AI modified. </p>
<p>If the AI breaks your logic, you can revert to your clean state with one command.</p>
<p>You work in <a target="_blank" href="https://www.davefarley.net/?p=202">very small increments</a>.</p>
<p>Some assistants are not very good at <strong>undoing</strong> their changes.</p>
<h2 id="heading-prompt-reference">Prompt Reference 📝</h2>
<p>+<code>bash
.git status              # Check for uncommitted changes
.git add .               # Stage all changes
.git commit -m "msg"     # Commit with message
.git diff                # See AI's changes
.git reset --hard HEAD   # Revert AI changes
.git log --oneline       # View commit history
+</code></p>
<h1 id="heading-considerations">Considerations ⚠️</h1>
<p>This is only necessary if you work in <em>write mode</em> and your assistant is allowed to change the code.</p>
<h1 id="heading-type">Type 📝</h1>
<p>[X] Semi-Automatic</p>
<p>You can enforce the rules of your assistant to check the repository status before making changes.</p>
<h1 id="heading-limitations">Limitations ⚠️</h1>
<p>If your code is not under a source control system, you need to make this manually.</p>
<h1 id="heading-tags">Tags 🏷️</h1>
<ul>
<li>Complexity</li>
</ul>
<h1 id="heading-level">Level 🔋</h1>
<p>[X] Beginner</p>
<h1 id="heading-related-tips">Related Tips 🔗</h1>
<ul>
<li><p>Use TCR</p>
</li>
<li><p>Use Vibe Test Driven Development</p>
</li>
<li><p>Break Large Refactorings into smaller prompts</p>
</li>
<li><p><a target="_blank" href="https://learning.oreilly.com/library/view/clean-code-cookbook/9781098144715/ch08.htm">Git Bisect</a> for AI Changes**: Using <code>git bisect</code> to identify which AI-assisted commit introduced a defect</p>
</li>
<li><p>Reverting Hallucinations</p>
</li>
</ul>
<h1 id="heading-conclusion">Conclusion 🏁</h1>
<p>Treating AI as a pair programmer requires the same safety practices you'd use with a human collaborator: version control, code review, and testing.</p>
<p>When you commit before making a prompt, you create clear checkpoints that make AI-assisted development safer and more productive.</p>
<p>This simple habit transforms AI from a risky black box into a powerful tool you can experiment with confidently, knowing you can always return to a working state.</p>
<p>Commit early, commit often, and don't let AI touch uncommitted code.</p>
<h1 id="heading-more-information">More Information ℹ️</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/explain-in-5-levels-of-difficulty-git">https://maximilianocontieri.com/explain-in-5-levels-of-difficulty-git</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.infoq.com/articles/test-commit-revert/">https://www.infoq.com/articles/test-commit-revert/</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://x.com/KentBeck/status/1237433065334435845">https://x.com/KentBeck/status/1237433065334435845</a></div>
<h1 id="heading-tools">Tools 🧰</h1>
<p><a target="_blank" href="https://maximilianocontieri.com/explain-in-5-levels-of-difficulty-git">GIT</a> is an industry standard, but you can apply this technique to any other version control software.</p>
<hr />
<p>This article is part of the <em>AI Coding Tip</em> Series.</p>
]]></content:encoded></item><item><title><![CDATA[Code Smell 318 - Refactoring Dirty Code]]></title><description><![CDATA[TL;DR: Don't waste time refactoring code that never changes; focus on frequently modified problem areas.

Problems 😔

Wasted effort
Wrong priorities
Missed real issues
Team productivity drop
Resource misallocation
False progress feeling

Solutions �...]]></description><link>https://maximilianocontieri.com/code-smell-318-refactoring-dirty-code</link><guid isPermaLink="true">https://maximilianocontieri.com/code-smell-318-refactoring-dirty-code</guid><category><![CDATA[clean code]]></category><category><![CDATA[software development]]></category><category><![CDATA[code smell ]]></category><category><![CDATA[Programming Tips]]></category><category><![CDATA[refactoring]]></category><dc:creator><![CDATA[Maxi Contieri]]></dc:creator><pubDate>Sun, 28 Dec 2025 13:15:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/mzfiko3Uehs/upload/2b783d66421f6e6096317f535c1ae406.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>TL;DR: Don't waste time refactoring code that never changes; focus on frequently modified problem areas.</p>
</blockquote>
<h1 id="heading-problems">Problems 😔</h1>
<ul>
<li>Wasted effort</li>
<li>Wrong priorities</li>
<li>Missed real issues</li>
<li>Team productivity drop</li>
<li>Resource misallocation</li>
<li>False progress feeling</li>
</ul>
<h1 id="heading-solutions">Solutions 😃</h1>
<ol>
<li>Analyze change frequency</li>
<li>Identify code hotspots</li>
<li>Use version control data</li>
<li>Focus on active areas</li>
<li>Measure code churn</li>
</ol>
<h1 id="heading-refactorings">Refactorings ⚙️</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/refactoring-021-remove-dead-code">https://maximilianocontieri.com/refactoring-021-remove-dead-code</a></div>
<h1 id="heading-context">Context 💬</h1>
<p>This is the anti code smell.</p>
<p>You come across ugly code with complex conditionals, long functions, and poor naming.</p>
<p>You remember Uncle Bob's motto of leaving the campsite better than when you found it.</p>
<p>Your refactoring instinct kicks in, and you spend days cleaning it up.</p>
<p>You feel productive, but you've wasted your time.</p>
<p>Bad code is only problematic when <strong>you need to change it</strong>.</p>
<p>Stable code, even when poorly written, doesn't hurt your productivity.</p>
<p>The real technical debt lies in code hotspots: areas that are both problematic and frequently modified.</p>
<p>Most codebases follow an extreme distribution where <a target="_blank" href="https://refactoring.fm/p/everything-as-code-hotspots-and-process">5% of the code receives 90% of the changes</a>.</p>
<p>Without analyzing version control history, you cannot identify which messy code actually matters.</p>
<p>You end up fixing the wrong things while the real problems remain untouched.</p>
<p>You need to address the technical debt by prioritizing code with poor quality and high change frequency.</p>
<p>Everything else is premature optimization disguised as craftsmanship.</p>
<h1 id="heading-sample-code">Sample Code 📖</h1>
<h2 id="heading-wrong">Wrong ❌</h2>

<pre><code class="lang-python"><span class="hljs-comment"># This authentication module hasn't changed in 3 years</span>
<span class="hljs-comment"># It's deprecated and will be removed next quarter</span>
<span class="hljs-comment"># But you spend a week "improving" it</span>

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LegacyAuthenticator</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">authenticate</span>(<span class="hljs-params">self, user, pwd</span>):</span>
        <span class="hljs-comment"># Original messy code from 2019</span>
        <span class="hljs-keyword">if</span> user != <span class="hljs-literal">None</span>:
            <span class="hljs-keyword">if</span> pwd != <span class="hljs-literal">None</span>:
                <span class="hljs-keyword">if</span> len(pwd) &gt; <span class="hljs-number">5</span>:
                    <span class="hljs-comment"># Complex nested logic...</span>
                    result = self.check_db(user, pwd)
                    <span class="hljs-keyword">if</span> result == <span class="hljs-literal">True</span>:
                        <span class="hljs-keyword">return</span> <span class="hljs-literal">True</span>
                    <span class="hljs-keyword">else</span>:
                        <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
        <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>

<span class="hljs-comment"># After your "refactoring" (that nobody asked for):</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LegacyAuthenticator</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">authenticate</span>(<span class="hljs-params">self, user: str, pwd: str</span>) -&gt; bool:</span>
        <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> self._is_valid_input(user, pwd):
            <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
        <span class="hljs-keyword">return</span> self._verify_credentials(user, pwd)

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">_is_valid_input</span>(<span class="hljs-params">self, user: str, pwd: str</span>) -&gt; bool:</span>
        <span class="hljs-keyword">return</span> user <span class="hljs-keyword">and</span> pwd <span class="hljs-keyword">and</span> len(pwd) &gt; <span class="hljs-number">5</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">_verify_credentials</span>(<span class="hljs-params">self, user: str, pwd: str</span>) -&gt; bool:</span>
        <span class="hljs-keyword">return</span> self.check_db(user, pwd)

<span class="hljs-comment"># Meanwhile, the actively developed payment module</span>
<span class="hljs-comment"># (modified 47 times this month) remains a mess</span>
</code></pre>
<h2 id="heading-right">Right 👉</h2>

<pre><code class="lang-python"><span class="hljs-comment"># You analyze git history first:</span>
<span class="hljs-comment"># git log --format=format: --name-only | </span>
<span class="hljs-comment"># grep -E '\.py$' | sort | uniq -c | sort -rn</span>

<span class="hljs-comment"># Results show PaymentProcessor changed 47 times this month</span>
<span class="hljs-comment"># And it does not have good enough coverage</span>
<span class="hljs-comment"># LegacyAuthenticator: 0 changes in 3 years</span>

<span class="hljs-comment"># Focus on the actual hotspot:</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">PaymentProcessor</span>:</span>
    <span class="hljs-comment"># This gets modified constantly and is hard to change</span>
    <span class="hljs-comment"># REFACTOR THIS FIRST</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">process_payment</span>(<span class="hljs-params">self, amount, card, user, promo_code,
                       installments, currency, gateway</span>):</span>
        <span class="hljs-comment"># 500 lines of tangled logic here</span>
        <span class="hljs-comment"># Changed 47 times this month</span>
        <span class="hljs-comment"># Every change takes 2+ days due to complexity</span>
        <span class="hljs-keyword">pass</span>

<span class="hljs-comment"># Ignore stable legacy code</span>
<span class="hljs-comment"># But you can use IA to cover existing functionality</span>
<span class="hljs-comment"># With acceptance tests validated by a Human product owner</span>

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">LegacyAuthenticator</span>:</span>
    <span class="hljs-comment"># Leave this ugly code alone</span>
    <span class="hljs-comment"># It works, it's stable, it's being deprecated</span>
    <span class="hljs-comment"># Your time is better spent elsewhere</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">authenticate</span>(<span class="hljs-params">self, user, pwd</span>):</span>
        <span class="hljs-keyword">if</span> user != <span class="hljs-literal">None</span>:
            <span class="hljs-keyword">if</span> pwd != <span class="hljs-literal">None</span>:
                <span class="hljs-keyword">if</span> len(pwd) &gt; <span class="hljs-number">5</span>:
                    result = self.check_db(user, pwd)
                    <span class="hljs-keyword">if</span> result == <span class="hljs-literal">True</span>:
                        <span class="hljs-keyword">return</span> <span class="hljs-literal">True</span>
        <span class="hljs-keyword">return</span> <span class="hljs-literal">False</span>
</code></pre>
<h1 id="heading-detection">Detection 🔍</h1>
<p>[X] Semi-Automatic</p>
<p>You can detect this smell by analyzing your version control history.</p>
<p>Track which files change most frequently and correlate that with code quality metrics.</p>
<p>Tools like <a target="_blank" href="https://codescene.com/">CodeScene</a>, git log analysis, or custom scripts can show your actual hotspots.</p>
<p>Track your <a target="_blank" href="https://maximilianocontieri.com/stop-calling-them-bugs">defects</a> to the code you change more often.</p>
<h1 id="heading-exceptions">Exceptions 🛑</h1>
<p>Sometimes you must refactor stable code when:</p>
<ul>
<li>New feature development requires adaptive changes</li>
<li>Security vulnerabilities require fixes</li>
<li>Regulatory compliance demands changes</li>
<li>You're about to reactivate dormant features</li>
</ul>
<p>The key is intentional decision-making based on real data, not assumptions.</p>
<h1 id="heading-tags">Tags 🏷️</h1>
<ul>
<li>Technical Debt</li>
</ul>
<h1 id="heading-level">Level 🔋</h1>
<p>[X] Intermediate</p>
<h1 id="heading-why-the-bijection-is-important">Why the Bijection Is Important 🗺️</h1>
<p>While you build a <a target="_blank" href="https://maximilianocontieri.com/what-is-wrong-with-software">MAPPER</a> between your code and real-world behavior, you will notice some parts of your system are more actively changed than others.</p>
<p>Your <a target="_blank" href="https://maximilianocontieri.com/the-one-and-only-software-design-principle">bijection</a> should reflect this reality.</p>
<p>When you refactor stable code, you break the correspondence between development effort and actual business value.</p>
<p>You treat all code equally in your mental model, but the real world shows extreme usage patterns: a small percentage of code handles the vast majority of changes.</p>
<p>You optimize for an imaginary world where all code matters equally.</p>
<h1 id="heading-ai-generation">AI Generation 🤖</h1>
<p>Some code generators suggest refactorings without considering change frequency.</p>
<p>AI tools and linters analyze code statically and recommend improvements based on patterns alone and not usage.</p>
<p>They do not access your version control history to understand which improvements actually matter unless you <em>explicitly</em> tell them to do it.</p>
<p>AI might flag every long function or complex conditional, treating a dormant 500-line legacy method the same as an equally messy function you modify daily.</p>
<h1 id="heading-ai-detection">AI Detection 🧲</h1>
<p>AI can help fix this smell if you provide proper context.</p>
<p>You need to give it version control data showing change frequencies. Without that information, AI will make the same mistakes humans do: recommending refactorings based purely on code structure.</p>
<h2 id="heading-try-them">Try Them! 🛠</h2>
<p><em>Remember: AI Assistants make lots of mistakes</em></p>
<blockquote>
<p>Suggested Prompt: Analyze this codebase's git history to identify files with high change frequency. Then review code quality metrics for those files. Recommend refactoring only the intersection of high-churn and low-quality code. Ignore stable low-quality code."</p>
</blockquote>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Without Proper Instructions</td><td>With Specific Instructions</td></tr>
</thead>
<tbody>
<tr>
<td><a target="_blank" href="https://chat.openai.com/?q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">ChatGPT</a></td><td><a target="_blank" href="https://chat.openai.com/?q=Analyze+this+codebase%27s+git+history+to+identify+files+with+high+change+frequency.+Then+review+code+quality+metrics+for+those+files.+Recommend+refactoring+only+the+intersection+of+high-churn+and+low-quality+code.+Ignore+stable+low-quality+code.%22%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">ChatGPT</a></td></tr>
<tr>
<td><a target="_blank" href="https://claude.ai/new?q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">Claude</a></td><td><a target="_blank" href="https://claude.ai/new?q=Analyze+this+codebase%27s+git+history+to+identify+files+with+high+change+frequency.+Then+review+code+quality+metrics+for+those+files.+Recommend+refactoring+only+the+intersection+of+high-churn+and+low-quality+code.+Ignore+stable+low-quality+code.%22%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">Claude</a></td></tr>
<tr>
<td><a target="_blank" href="https://www.perplexity.ai/?q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">Perplexity</a></td><td><a target="_blank" href="https://www.perplexity.ai/?q=Analyze+this+codebase%27s+git+history+to+identify+files+with+high+change+frequency.+Then+review+code+quality+metrics+for+those+files.+Recommend+refactoring+only+the+intersection+of+high-churn+and+low-quality+code.+Ignore+stable+low-quality+code.%22%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">Perplexity</a></td></tr>
<tr>
<td><a target="_blank" href="https://www.bing.com/chat?showconv=1&amp;sendquery=1&amp;q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">Copilot</a></td><td><a target="_blank" href="https://www.bing.com/chat?showconv=1&amp;sendquery=1&amp;q=Analyze+this+codebase%27s+git+history+to+identify+files+with+high+change+frequency.+Then+review+code+quality+metrics+for+those+files.+Recommend+refactoring+only+the+intersection+of+high-churn+and+low-quality+code.+Ignore+stable+low-quality+code.%22%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">Copilot</a></td></tr>
<tr>
<td><a target="_blank" href="https://you.com/search?q=Correct+and+explain+this+code%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">You</a></td><td><a target="_blank" href="https://you.com/search?q=Analyze+this+codebase%27s+git+history+to+identify+files+with+high+change+frequency.+Then+review+code+quality+metrics+for+those+files.+Recommend+refactoring+only+the+intersection+of+high-churn+and+low-quality+code.+Ignore+stable+low-quality+code.%22%3A+%60%60%60python%0D%0A%23+This+authentication+module+hasn%27t+changed+in+3+years%0D%0A%23+It%27s+deprecated+and+will+be+removed+next+quarter%0D%0A%23+But+you+spend+a+week+%22improving%22+it%0D%0A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%2C+pwd%29%3A%0D%0A++++++++%23+Original+messy+code+from+2019%0D%0A++++++++if+user+%21%3D+None%3A%0D%0A++++++++++++if+pwd+%21%3D+None%3A%0D%0A++++++++++++++++if+len%28pwd%29+%3E+5%3A%0D%0A++++++++++++++++++++%23+Complex+nested+logic...%0D%0A++++++++++++++++++++result+%3D+self.check_db%28user%2C+pwd%29%0D%0A++++++++++++++++++++if+result+%3D%3D+True%3A%0D%0A++++++++++++++++++++++++return+True%0D%0A++++++++++++++++++++else%3A%0D%0A++++++++++++++++++++++++return+False%0D%0A++++++++return+False%0D%0A%0D%0A%23+After+your+%22refactoring%22+%28that+nobody+asked+for%29%3A%0D%0Aclass+LegacyAuthenticator%3A%0D%0A++++def+authenticate%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++if+not+self._is_valid_input%28user%2C+pwd%29%3A%0D%0A++++++++++++return+False%0D%0A++++++++return+self._verify_credentials%28user%2C+pwd%29%0D%0A++++%0D%0A++++def+_is_valid_input%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+user+and+pwd+and+len%28pwd%29+%3E+5%0D%0A++++%0D%0A++++def+_verify_credentials%28self%2C+user%3A+str%2C+pwd%3A+str%29+-%3E+bool%3A%0D%0A++++++++return+self.check_db%28user%2C+pwd%29%0D%0A%0D%0A%23+Meanwhile%2C+the+actively+developed+payment+module%0D%0A%23+%28modified+47+times+this+mon">You</a></td></tr>
<tr>
<td><a target="_blank" href="https://gemini.google.com/">Gemini</a></td><td><a target="_blank" href="https://gemini.google.com/">Gemini</a></td></tr>
<tr>
<td><a target="_blank" href="https://chat.deepseek.com/">DeepSeek</a></td><td><a target="_blank" href="https://chat.deepseek.com/">DeepSeek</a></td></tr>
<tr>
<td><a target="_blank" href="https://www.meta.ai/chat">Meta AI</a></td><td><a target="_blank" href="https://www.meta.ai/">Meta AI</a></td></tr>
<tr>
<td><a target="_blank" href="https://grok.com/">Grok</a></td><td><a target="_blank" href="https://grok.com/">Grok</a></td></tr>
<tr>
<td><a target="_blank" href="https://chat.qwen.ai/">Qwen</a></td><td><a target="_blank" href="https://chat.qwen.ai/">Qwen</a></td></tr>
</tbody>
</table>
</div><h1 id="heading-conclusion">Conclusion 🏁</h1>
<p>You cannot improve productivity by polishing code that never changes.</p>
<p><a target="_blank" href="https://maximilianocontieri.com/code-smell-148-todos">Technical debt</a> only matters when it slows you down, which happens in code you actually modify.</p>
<p>Focus your refactoring efforts where they multiply your impact: the hotspots where poor quality meets frequent change.</p>
<p>Everything else is <strong>procrastination</strong> disguised as engineering excellence.</p>
<p>Let stable ugly code rest in peace.</p>
<p>Your human time is too valuable to waste on problems that don't exist.</p>
<h1 id="heading-relations">Relations 👩‍❤️‍💋‍👨</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-06-too-clever-programmer">https://maximilianocontieri.com/code-smell-06-too-clever-programmer</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-20-premature-optimization">https://maximilianocontieri.com/code-smell-20-premature-optimization</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-148-todos">https://maximilianocontieri.com/code-smell-148-todos</a></div>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/code-smell-60-global-classes">https://maximilianocontieri.com/code-smell-60-global-classes</a></div>
<h1 id="heading-more-information">More Information 📕</h1>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=F5WkftHqexQ">https://www.youtube.com/watch?v=F5WkftHqexQ</a></div>
<h1 id="heading-disclaimer">Disclaimer 📘</h1>
<p>Code Smells are my <a target="_blank" href="https://maximilianocontieri.com/i-wrote-more-than-90-articles-on-2021-here-is-what-i-learned">opinion</a>.</p>
<h1 id="heading-credits">Credits 🙏</h1>
<p>Photo by <a target="_blank" href="https://unsplash.com/@viktorkeri">Viktor Keri</a> on <a target="_blank" href="https://unsplash.com/photos/person-in-black-pants-and-black-hiking-shoes-mzfiko3Uehs">Unsplash</a></p>
<hr />
<blockquote>
<p>The first rule of optimization is: Don't do it. The second rule is: Don't do it yet.</p>
</blockquote>
<p><em>Michael A. Jackson</em></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/software-engineering-great-quotes">https://maximilianocontieri.com/software-engineering-great-quotes</a></div>
<hr />
<p>This article is part of the CodeSmell Series.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://maximilianocontieri.com/how-to-find-the-stinky-parts-of-your-code">https://maximilianocontieri.com/how-to-find-the-stinky-parts-of-your-code</a></div>
]]></content:encoded></item></channel></rss>