<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>avadhut.dev</title><description>avadhut&apos;s dev blog. android, backend, and ai engineering.</description><link>https://avadhut.dev/</link><item><title>Prompts are source code — treat them like it</title><link>https://avadhut.dev/deep-dives/prompts-are-source-code/</link><guid isPermaLink="true">https://avadhut.dev/deep-dives/prompts-are-source-code/</guid><pubDate>Sun, 09 Aug 2026 00:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;p&gt;A small note before this starts: the examples here are intentionally generic.&lt;/p&gt;
&lt;p&gt;The actual system that made me think about this has a few implementation details I can’t really get into, so I’m using a simplified fictional setup instead. The architecture and problems are the same; the names and examples are not.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I was recently working on a system where the same LLM behaviour needed to vary depending on a few things.&lt;/p&gt;
&lt;p&gt;Maybe one deployment needs a shorter response style. Another has a different set of tools. One interface supports rich UI, while another only supports plain text. Some workflows need extra instructions that others should never see.&lt;/p&gt;
&lt;p&gt;Initially, prompts are easy to manage.&lt;/p&gt;
&lt;p&gt;You have a string. Maybe two.&lt;/p&gt;
&lt;p&gt;Then the combinations start multiplying.&lt;/p&gt;
&lt;h2 id=&quot;copy-paste-works-until-it-quietly-doesnt&quot;&gt;copy-paste works until it quietly doesn’t&lt;/h2&gt;
&lt;p&gt;The most obvious approach is to maintain separate prompts.&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;prompt-web.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;prompt-chat.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;prompt-client-a.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;prompt-client-b.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is perfectly reasonable when the system is small.&lt;/p&gt;
&lt;p&gt;The problem starts when most of those prompts contain the same instructions with a few small differences.&lt;/p&gt;
&lt;p&gt;You update an important rule in four files but miss a fifth.&lt;/p&gt;
&lt;p&gt;Someone fixes behaviour for one interface but the same bug still exists elsewhere.&lt;/p&gt;
&lt;p&gt;Two prompts that were supposed to be nearly identical slowly stop being nearly identical.&lt;/p&gt;
&lt;p&gt;The annoying part isn’t even the duplication itself.&lt;/p&gt;
&lt;p&gt;It’s that eventually you can’t easily answer:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What exactly is this model being told in this particular configuration?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The opposite approach is usually one giant template full of conditionals.&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;jinja&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt;{% &lt;/span&gt;&lt;span style=&quot;color:#9D0006;--shiki-dark:#FB4934&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color:#076678;--shiki-dark:#83A598&quot;&gt; interface&lt;/span&gt;&lt;span style=&quot;color:#427B58;--shiki-dark:#8EC07C&quot;&gt; ==&lt;/span&gt;&lt;span style=&quot;color:#7C6F64;--shiki-dark:#A89984&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color:#79740E;--shiki-dark:#B8BB26&quot;&gt;chat&lt;/span&gt;&lt;span style=&quot;color:#7C6F64;--shiki-dark:#A89984&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt;{% &lt;/span&gt;&lt;span style=&quot;color:#9D0006;--shiki-dark:#FB4934&quot;&gt;endif&lt;/span&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt;{% &lt;/span&gt;&lt;span style=&quot;color:#9D0006;--shiki-dark:#FB4934&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color:#076678;--shiki-dark:#83A598&quot;&gt; feature_x_enabled&lt;/span&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt;{% &lt;/span&gt;&lt;span style=&quot;color:#9D0006;--shiki-dark:#FB4934&quot;&gt;endif&lt;/span&gt;&lt;span style=&quot;color:#3C3836;--shiki-dark:#EBDBB2&quot;&gt; %}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That removes some duplication, but after enough conditions the prompt becomes difficult to reason about.&lt;/p&gt;
&lt;p&gt;You haven’t really removed the complexity.&lt;/p&gt;
&lt;p&gt;You’ve moved it.&lt;/p&gt;
&lt;h2 id=&quot;prompts-started-looking-more-like-source-code&quot;&gt;prompts started looking more like source code&lt;/h2&gt;
&lt;p&gt;At some point, treating these prompts as strings stopped making much sense to me.&lt;/p&gt;
&lt;p&gt;They had:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;shared modules&lt;/li&gt;
&lt;li&gt;configuration&lt;/li&gt;
&lt;li&gt;conditional behaviour&lt;/li&gt;
&lt;li&gt;variables&lt;/li&gt;
&lt;li&gt;build-time transformations&lt;/li&gt;
&lt;li&gt;multiple final outputs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That sounds much closer to source code than a text file.&lt;/p&gt;
&lt;p&gt;Once I started looking at it that way, the architecture became fairly straightforward:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;┌───────────┐     ┌──────────┐     ┌─────────────────┐&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;│ fragments │ ──▶ │ compiler │ ──▶ │ compiled prompt │&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;└───────────┘     └──────────┘     └─────────────────┘&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Instead of maintaining complete prompts for every combination, you maintain smaller pieces.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;base&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;interface&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;feature&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;deployment&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The compiler picks the relevant fragments, combines them in a defined order, resolves build-time configuration, and produces one flat prompt.&lt;/p&gt;
&lt;p&gt;Something like:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;base&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;+ terminal&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;+ code-review&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;─────────────────────────────&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;compiled/code-review-terminal&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The important part is that the application doesn’t need to understand how this composition works.&lt;/p&gt;
&lt;p&gt;By runtime, it just receives a normal prompt.&lt;/p&gt;
&lt;p&gt;That made the whole thing much easier to reason about.&lt;/p&gt;
&lt;h2 id=&quot;build-time-and-runtime-variables-need-separate-boundaries&quot;&gt;build-time and runtime variables need separate boundaries&lt;/h2&gt;
&lt;p&gt;One small problem appeared quickly.&lt;/p&gt;
&lt;p&gt;There were two completely different kinds of substitution happening.&lt;/p&gt;
&lt;p&gt;Some values should be resolved when generating the prompt:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;{{product_name}}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Others only exist when the actual model call happens:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&amp;lt;&amp;lt;user_request&amp;gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So the distinction became:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;{{...}}   → build time&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&amp;lt;&amp;lt;...&amp;gt;&amp;gt;   → runtime&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;{{...}}&lt;/code&gt; syntax here wasn’t an arbitrary choice.&lt;/p&gt;
&lt;p&gt;The prompts in this setup were stored in Langfuse and pulled through Langfuse, where prompt variables already use that format. Keeping the same representation made the integration much simpler than inventing another syntax around it.&lt;/p&gt;
&lt;p&gt;The second delimiter, &lt;code&gt;&amp;lt;&amp;lt;...&amp;gt;&amp;gt;&lt;/code&gt;, gives runtime variables their own namespace.&lt;/p&gt;
&lt;p&gt;It looks like a tiny distinction, but I like it quite a lot.&lt;/p&gt;
&lt;p&gt;When reading a prompt, you immediately know which stage owns a variable.&lt;/p&gt;
&lt;p&gt;More importantly, the generation step can resolve everything it knows about while deliberately leaving runtime values untouched.&lt;/p&gt;
&lt;p&gt;Undefined values should also fail loudly wherever possible.&lt;/p&gt;
&lt;p&gt;If a required build-time value doesn’t exist, I’d rather fail while generating the prompt than quietly produce something broken and discover it during an actual model call.&lt;/p&gt;
&lt;h2 id=&quot;the-compiled-prompt-is-worth-keeping&quot;&gt;the compiled prompt is worth keeping&lt;/h2&gt;
&lt;p&gt;This was probably the less obvious part for me.&lt;/p&gt;
&lt;p&gt;Generated files are usually things we throw away.&lt;/p&gt;
&lt;p&gt;For prompts, keeping them can actually be useful.&lt;/p&gt;
&lt;p&gt;Suppose you change one shared fragment.&lt;/p&gt;
&lt;p&gt;That might affect fifteen compiled prompt variants.&lt;/p&gt;
&lt;p&gt;If those outputs are treated as golden files, the change becomes much easier to inspect.&lt;/p&gt;
&lt;p&gt;Instead of reviewing:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;changed one shared instruction&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;you’re reviewing:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;these 15 actual prompts changed because of it&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Suddenly the blast radius is visible.&lt;/p&gt;
&lt;p&gt;Reviewers don’t need to mentally execute a template system to figure out what the model will eventually receive.&lt;/p&gt;
&lt;p&gt;They can just read the final prompt.&lt;/p&gt;
&lt;p&gt;And because the output is plain text, normal software tooling works surprisingly well here.&lt;/p&gt;
&lt;p&gt;Diffs. History. Reviews. CI.&lt;/p&gt;
&lt;p&gt;Nothing particularly fancy.&lt;/p&gt;
&lt;h2 id=&quot;a-small-example&quot;&gt;a small example&lt;/h2&gt;
&lt;p&gt;Imagine this base fragment:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;You are a coding assistant.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Explain important assumptions before suggesting changes.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then an interface-specific fragment:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Keep responses concise because this interface has limited space.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And a feature fragment:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;When reviewing code, identify correctness issues before style issues.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Project name: {{project_name}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Current diff:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&amp;lt;&amp;lt;code_diff&amp;gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;During generation, &lt;code&gt;{{project_name}}&lt;/code&gt; is resolved:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes gruvbox-light-soft gruvbox-dark-soft&quot; style=&quot;background-color:#f2e5bc;--shiki-dark-bg:#32302f;color:#3c3836;--shiki-dark:#ebdbb2; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;You are a coding assistant.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Explain important assumptions before suggesting changes.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Keep responses concise because this interface has limited space.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;When reviewing code, identify correctness issues before style issues.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Project name: Example Project&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Current diff:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&amp;lt;&amp;lt;code_diff&amp;gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;&amp;lt;code_diff&amp;gt;&amp;gt;&lt;/code&gt; survives because that value only exists at runtime.&lt;/p&gt;
&lt;p&gt;That’s the final prompt I actually care about.&lt;/p&gt;
&lt;p&gt;So that’s also the thing I want to inspect and test.&lt;/p&gt;
&lt;h2 id=&quot;where-the-generated-prompts-live-is-a-separate-decision&quot;&gt;where the generated prompts live is a separate decision&lt;/h2&gt;
&lt;p&gt;In the system that led me here, the generated prompts were pushed back to Langfuse and organised using labels.&lt;/p&gt;
&lt;p&gt;That worked well for the surrounding setup, but it isn’t really a requirement of this architecture.&lt;/p&gt;
&lt;p&gt;The compiler’s job ends once it produces the final prompt.&lt;/p&gt;
&lt;p&gt;After that, you could store the output in a database, keep it in memory, write static text files, bundle it directly with the application, or push it to whatever prompt management system you’re already using.&lt;/p&gt;
&lt;p&gt;I think separating those two concerns is useful.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How prompts are built&lt;/strong&gt; and &lt;strong&gt;where prompts are stored&lt;/strong&gt; don’t need to be the same problem.&lt;/p&gt;
&lt;h2 id=&quot;this-is-not-really-about-building-a-prompt-framework&quot;&gt;this is not really about building a prompt framework&lt;/h2&gt;
&lt;p&gt;There are obvious tradeoffs.&lt;/p&gt;
&lt;p&gt;Fragment precedence has to be well defined.&lt;/p&gt;
&lt;p&gt;Too many layers can become difficult to follow.&lt;/p&gt;
&lt;p&gt;Some combinations should probably be invalid and rejected during generation.&lt;/p&gt;
&lt;p&gt;And keeping generated outputs around can create some noise.&lt;/p&gt;
&lt;p&gt;But I think that’s acceptable if the alternative is reconstructing the final prompt mentally every time something behaves strangely.&lt;/p&gt;
&lt;p&gt;The useful mental shift for me was fairly simple:&lt;/p&gt;
&lt;p&gt;don’t treat a growing prompt system as a collection of strings.&lt;/p&gt;
&lt;p&gt;Treat it as something that gets built.&lt;/p&gt;
&lt;p&gt;Fragments are source.&lt;/p&gt;
&lt;p&gt;The compiler resolves configuration.&lt;/p&gt;
&lt;p&gt;The compiled prompt is the artifact.&lt;/p&gt;
&lt;p&gt;And the artifact is what you inspect.&lt;/p&gt;
&lt;p&gt;I’m also working on turning the general idea into a small reusable open-source template for similar problems. There are still a few things I want to clean up before that, but if it becomes useful enough outside this specific setup, I might write a follow-up with the actual implementation.&lt;/p&gt;
</content:encoded></item><item><title>Hello World</title><link>https://avadhut.dev/deep-dives/hello-world/</link><guid isPermaLink="true">https://avadhut.dev/deep-dives/hello-world/</guid><pubDate>Sat, 21 Feb 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Writing forces you to actually understand something. You think you know how it works until you try to explain it - then all the gaps show up. So yeah, this is partly to learn better, partly a reference for myself, and partly just to get better at communication.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Documentation is a love letter that you write to your future self.” ~ Damian Conway&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Also got tired of learning things the hard way and then forgetting them. Bugs that ate days, decisions I got wrong, stuff I wish someone had just told me. Might as well write it down so future me (or someone else) doesn’t have to go through the same thing.&lt;/p&gt;
&lt;p&gt;Writing makes everything else better - clearer thinking, better communication. I’m not great at it, so I’m doing this to get better. Simple as that.&lt;/p&gt;
&lt;p&gt;Here’s to writing and learning 🚀&lt;/p&gt;
</content:encoded></item></channel></rss>