<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<title>Blog</title>
	<subtitle>The personal blog of Jean-François Moy.</subtitle>
	<link rel="self" type="application/atom+xml" href="https://www.moystard.com/blog/feed.xml"/>
  <link rel="alternate" type="text/html" href="https://www.moystard.com/blog/"/>
  
	<updated>2026-08-21T00:00:00+00:00</updated>
	
	<id>https://www.moystard.com/blog/feed.xml</id>
	<entry xml:lang="en">
		<title>How juniors learn the trade when an agent writes the code</title>
		<published>2026-08-21T00:00:00+00:00</published>
		<updated>2026-08-21T00:00:00+00:00</updated>
		<link rel="alternate" type="text/html" href="https://www.moystard.com/blog/ai-native-juniors/"/>
		<id>https://www.moystard.com/blog/ai-native-juniors/</id>
    
    <summary>&lt;p&gt;In &lt;a href=&quot;&#x2F;blog&#x2F;ai-native-delivery&quot;&gt;my last post&lt;&#x2F;a&gt; I described how we structure delivery so that human judgement is spent where it matters, and I left one problem open: that model assumes seasoned judgement at the gates, and I could not say how a junior grows it inside a system that shields them from the grind that used to build it.&lt;&#x2F;p&gt;
&lt;p&gt;I still would not call it solved. AI-native is a young way of working, and, as far as I know, nobody has grown a whole cohort of engineers inside it yet. But I am confident in the approach, because most of it was already there in how juniors learnt the craft before any of this existed. This is where my thinking stands today.&lt;&#x2F;p&gt;</summary>
    
		<content type="html" xml:base="https://www.moystard.com/blog/ai-native-juniors/">&lt;p&gt;In &lt;a href=&quot;&#x2F;blog&#x2F;ai-native-delivery&quot;&gt;my last post&lt;&#x2F;a&gt; I described how we structure delivery so that human judgement is spent where it matters, and I left one problem open: that model assumes seasoned judgement at the gates, and I could not say how a junior grows it inside a system that shields them from the grind that used to build it.&lt;&#x2F;p&gt;
&lt;p&gt;I still would not call it solved. AI-native is a young way of working, and, as far as I know, nobody has grown a whole cohort of engineers inside it yet. But I am confident in the approach, because most of it was already there in how juniors learnt the craft before any of this existed. This is where my thinking stands today.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;h1 id=&quot;the-mechanic-is-older-than-it-looks&quot;&gt;The mechanic is older than it looks&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-mechanic-is-older-than-it-looks&quot; aria-label=&quot;Anchor link for: the-mechanic-is-older-than-it-looks&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;Juniors never learnt the trade by inventing everything from scratch. For the last fifteen years a large part of the job was reading: Stack Overflow, a library&#x27;s source, a colleague&#x27;s pull request. The snippet was rarely the hard part. The hard part was deciding whether it was correct for the problem actually in front of you, and what it would cost you in six months.&lt;&#x2F;p&gt;
&lt;p&gt;How much a junior learnt from that depended on how much they put in. Copy, paste, run, move on taught nothing; the code worked, or it did not, and the engineer was no wiser. Design was the same story. Most juniors mimicked whatever the codebase already did. The ones who grew asked why the pattern had been chosen in the first place, and noticed when it did not fit their case.&lt;&#x2F;p&gt;
&lt;p&gt;An AI agent is the same mechanic with the friction removed. Pressing enter until the tests go green is copy-paste without reading, at a hundred times the volume. Accepting whatever structure the agent proposes is mimicking the codebase without asking why, except that now the agent does the mimicking too. The result is familiar: working code, and an engineer no wiser for it.&lt;&#x2F;p&gt;
&lt;p&gt;I have watched it happen with juniors I coached through the arrival of these tools. One junior turned in an IPv4 and IPv6 parser with subnet and mask matching, several hundred lines, neat and complete. They could walk me through parts of it, but not why we were writing our own parser at all, nor what most of those lines were for. It was plainly agent work. A few questions in, they saw it themselves: the understanding was too shallow to justify the implementation, and once we read it together, it had bugs. That conversation, and what came out of it, is the loop later in this post, in miniature.&lt;&#x2F;p&gt;
&lt;p&gt;What has changed is that the mistakes got quieter. A Stack Overflow snippet that did not fit your problem usually failed loudly. An agent&#x27;s implementation that does not fit your problem passes every test and is wrong in the one edge case that matters. The reading was always the job. Writing the code by hand used to force a minimum of it on you; now nothing does, and it is the one part of the job the agent cannot do for you: it can review the code, it cannot understand it on your behalf.&lt;&#x2F;p&gt;
&lt;p&gt;There is one thing reading never gave a junior. Writing the code yourself meant being wrong in public, quickly: the build broke, the test failed, the design collapsed under the first real use, and you learnt what your mental model had missed. Agent code that passes every test carries no such signal, so any answer to how juniors learn now has to say where that feedback comes from. Mine is in the human loop below.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;it-is-not-only-a-junior-problem&quot;&gt;It is not only a junior problem&lt;a class=&quot;zola-anchor&quot; href=&quot;#it-is-not-only-a-junior-problem&quot; aria-label=&quot;Anchor link for: it-is-not-only-a-junior-problem&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;I should say where my evidence comes from. I have coached juniors through every generation of these tools since the first Copilot, and experienced engineers into working this way before the structure in the previous post existed.&lt;&#x2F;p&gt;
&lt;p&gt;The pattern was clearest in the experienced engineers. Engineers with a decade or more of reading code behind them, who would never have approved a colleague&#x27;s PR unread, quietly stopped reading the agent&#x27;s. The output looked right and the tests were green, so the habit went. Some of them stopped one step further upstream and let the agent make the design call as well, then defended it in review without being able to say why it was the right one.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;uncle-bob-not-reading-agent-code.png&quot; alt=&quot;Tweet by Uncle Bob Martin: &amp;quot;I&amp;#39;m significantly older than you. I started coding in the late 60s. My current strategy is to not read any of the code written by my agents. That&amp;#39;s the only way I can take advantage of their productivity. What I do instead is to surround the agents with extreme constraints. Unit tests, gherkin tests, QA procedures, quality metrics, mutation testing, test coverage, and a plethora of others. In the end, I have very high confidence in the code they produce because they&amp;#39;ve had to run the gauntlet of all of my constraints and tests.&amp;quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;One of the most experienced voices in our community says he does not read the agent&#x27;s code at all. Uncle Bob Martin, who started coding in the late sixties, &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https:&#x2F;&#x2F;x.com&#x2F;unclebobmartin&#x2F;status&#x2F;2080257779395154409&quot;&gt;wrote recently&lt;&#x2F;a&gt; that not reading is the only way to take advantage of the productivity, and that he surrounds his agents with constraints instead.&lt;&#x2F;p&gt;
&lt;p&gt;I read that as an invoice, not a permission slip. He stopped reading and paid for it with a gauntlet that took him sixty years of judgement to know how to build. The engineers I watched stop reading did not pay; they built nothing in its place.&lt;&#x2F;p&gt;
&lt;p&gt;Those are people with the muscle. A junior who has never built it will not find the pull easier to resist, and cannot pay the invoice either, because the constraints are the judgement and they do not have it yet. So the question in this post is not really &quot;how do juniors learn&quot; but &quot;how does anyone keep thinking when the tool makes not thinking so comfortable&quot;, and juniors are simply the case with no muscle to fall back on. Watching experienced engineers stop reading is what led to the delivery structure in the previous post: it is &lt;a href=&quot;&#x2F;blog&#x2F;ai-native-delivery#why-this-keeps-judgement-sharp&quot;&gt;my answer for the team as a whole&lt;&#x2F;a&gt;, and it exists because attention alone did not hold. What follows is the part specific to people who are still building the judgement that structure relies on.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;the-real-upside-is-the-pair&quot;&gt;The real upside is the pair&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-real-upside-is-the-pair&quot; aria-label=&quot;Anchor link for: the-real-upside-is-the-pair&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;I have spent a lot of words on the risk; the gain is real too. Juniors never lacked code to read. What they lacked was someone to read it with: a senior who could take any part of the system and explain what a pattern is for, why this design fits its constraints, and what would break if you changed it. Most juniors got a few hours of that a week, if they were lucky, from someone with their own deadlines. The rest of the time they were on their own with a search engine, which only helps if you already understand enough to know what you are looking at.&lt;&#x2F;p&gt;
&lt;p&gt;That is a large part of what the agent now provides, on demand. A junior can point it at any module and ask why it is shaped that way, or take the implementation it has just produced and ask what the alternatives were and what each would have cost. Asking an agent to justify its own decision is the wrong question: it will rationalise fluently and the junior will learn to accept the rationalisation. Asking for the alternatives, or asking a fresh agent to pick the implementation apart, produces something worth disagreeing with.&lt;&#x2F;p&gt;
&lt;p&gt;The same goes for adversarial review: an agent asked to find problems will always find some, and deciding which of them matter is the reader&#x27;s job, not the agent&#x27;s. Used like that, the tool is a patient pair, and a junior who works with it that way can see more explained patterns in a month than many of us did in our first year.&lt;&#x2F;p&gt;
&lt;p&gt;It does not replace the senior, for two reasons. The agent can explain what a design does and why it is sound in general. It cannot explain why this team chose it, or which constraint forced the odd-looking decision, unless that was written down somewhere it can read, and in most codebases it was not. And the agent will explain anything. A junior does not yet know which explanations to trust, or when a confident answer is wrong for their context. Judging that is still the senior&#x27;s job, and it has not moved at all. So what does the senior&#x27;s part actually look like?&lt;&#x2F;p&gt;
&lt;h1 id=&quot;the-human-loop&quot;&gt;The human loop&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-human-loop&quot; aria-label=&quot;Anchor link for: the-human-loop&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;The loop is the one I ran with juniors long before agents, with one adjustment. Juniors own tickets of growing complexity, and a senior keeps asking them the same question about the work: what did you decide, and what else did you consider? Sometimes that is a live coaching conversation. Most of the time it is a comment on a pull request, which means seniors have to review juniors&#x27; PRs themselves and not hand that to an agent too. That is where the time the pipeline saves should go: the grind that used to fill a senior&#x27;s review queue is handled by the gates, and the attention freed is spent here.&lt;&#x2F;p&gt;
&lt;p&gt;It is not a return to the old convention that review means another engineer reading your code for you; that does not scale to the volume agents produce. Nobody can read everything; you can read yours. A gauntlet of tests and constraints defends the codebase, but it says nothing about whether the right problem was solved, and it does nothing for the engineer. So my position from the previous post stands: on a product where failures are costly, a change on a critical path is read by the engineer who ships it, because that reading, with the validation behind it, is what ownership means.&lt;&#x2F;p&gt;
&lt;p&gt;The senior&#x27;s review of a junior&#x27;s PR is a different thing: the junior&#x27;s own reading and the gates are the quality control, and the senior&#x27;s pass is coaching. That is why it can taper as the junior&#x27;s judgement shows, and why it follows risk rather than covering everything: a change on a payment path gets read closely for a long time; a copy change in an admin screen does not. Knowing which change warrants a second pair of eyes, and being able to call on a colleague for it, is a skill juniors should be given explicitly, not one they should have to earn.&lt;&#x2F;p&gt;
&lt;p&gt;Growing complexity means more ownership, not bigger tickets: a whole customer problem instead of a slice of one, more of the design decisions left to them, and eventually a problem the codebase has not solved before, where there is nothing to mimic, such as a new piece of tooling or, later and with supervision, a buy-or-build call.&lt;&#x2F;p&gt;
&lt;p&gt;Alongside that, some problems a junior should implement by hand, with the agents demoted to review and test, because being wrong yourself is the lesson, and the demo and live validation from the previous post are where a junior watches their own design meet a real user rather than a green test. That is the failure signal reading cannot provide.&lt;&#x2F;p&gt;
&lt;p&gt;The adjustment is that the work is still theirs even if an agent wrote the implementation. The agent is a tool. How it was used and what it produced belong to the engineer who shipped it, at every level of seniority, and that question in review is where the ownership shows. Sometimes the honest answer is &quot;I don&#x27;t know&quot;. That is the most valuable moment in the whole loop: the junior has just found the edge of their understanding, with a more senior peer right there, or one reply away, to work through it with them. The agent made the question askable at any hour. The senior is still the one who tells you whether you asked the right one.&lt;&#x2F;p&gt;
&lt;p&gt;Both of the agent&#x27;s limits above come back to the same gap: neither the agent&#x27;s coaching nor the senior&#x27;s is better than the recorded intent they can read. Which brings me to the one skill I think has to be taught on purpose.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;recording-the-why&quot;&gt;Recording the why&lt;a class=&quot;zola-anchor&quot; href=&quot;#recording-the-why&quot; aria-label=&quot;Anchor link for: recording-the-why&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;Writing down why a decision was taken is not a new idea. Architecture decision records, commit messages that explain the reasoning: the advice has been around for twenty years and most teams have ignored it for twenty years. Two things have changed. Agents do not do it unprompted; they are excellent at describing what was done, and almost never capture why this approach and not the obvious alternative, or what was tried and abandoned. And humans do it less than they used to, because the moment of decision is exactly the moment they delegated to the agent. Agents will write a why if asked, but it will be a plausible why, not the real one, unless the engineer supplies it.&lt;&#x2F;p&gt;
&lt;p&gt;It is also more achievable than it was, for two reasons. An engineer&#x27;s day has a fixed length, and the hours that used to go into typing the implementation now go upstream, into the thinking, which is precisely the part the why records; there is finally time for it. And, as with everything else in the previous post, it should not rely on discipline: a PR that does not carry its reasoning does not merge, and a review agent checks that the reasoning is present and matches the diff.&lt;&#x2F;p&gt;
&lt;p&gt;That is why I would have juniors practise it deliberately, and why I hold my own team to it. Before a change is shared, the why goes wherever the next reader will look for it, in the engineer&#x27;s own words: the objective in the ticket, the reasoning in the PR and not just the diff. You cannot write down why a decision was taken without having made one. For an engineer working with agents, this is how you take the decision back. It turns &quot;the agent did it&quot; into &quot;I decided this, and here is the reasoning&quot;, and a junior who cannot finish that sentence has just discovered exactly what they need to go and understand.&lt;&#x2F;p&gt;
&lt;p&gt;It also closes the gap from the previous section. An agent reading a codebase where every non-obvious decision carries its why can tell the junior what the code does and why this team chose it here, and the answer is the real one, not a plausible one. The same record makes the agent a better implementer: one that can read why a constraint exists is far less likely to build around it. Every why written down today is one less guess for the next person who asks, human or not.&lt;&#x2F;p&gt;
&lt;p&gt;Long term, this is what keeps a codebase maintainable. I have inherited monoliths carrying years of technical debt where the history was a list of ten-word commits, each one landing a significant change in business logic or a new pattern with no trace of why. In a tightly coupled codebase like that, an odd-looking piece of logic is rarely an accident: something upstream or downstream has come to rely on it, and nobody can tell you what, so a clean-looking fix breaks the system in ways that make no sense until you find the dependency. Code tells you what the system does; only the recorded intent tells you what will happen if you change it. A team that delegates implementation but keeps the why will be able to evolve its systems for years. A team that delegates both will end up with the archaeology dig I described last time, only faster. Where intent should live, and how agents consume and build on it, deserves its own post.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;why-we-still-hire-juniors&quot;&gt;Why we still hire juniors&lt;a class=&quot;zola-anchor&quot; href=&quot;#why-we-still-hire-juniors&quot; aria-label=&quot;Anchor link for: why-we-still-hire-juniors&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;There is a question behind all of this that I hear more and more: if seniors must review by hand and juniors must sometimes build by hand, why hire juniors into an agent-first team at all?&lt;&#x2F;p&gt;
&lt;p&gt;The economic objection is real and I will not wave it away: a junior costs senior attention, and agents now do the work juniors used to be hired for. But the strongest reason is new. The engineers I watched stop reading were seniors unlearning fifteen years of habit. A junior who learns this way of working from day one carries none of those habits, and this way of working is young enough that they may well end up teaching the rest of us something about it. The older reasons still hold too: juniors bring ideas the rest of us have stopped having, because they have not yet learnt which ones are supposed to be impossible, and every senior on the team was once a junior somebody chose to grow. That last one is an argument for the profession rather than for any one company, and I hold it anyway.&lt;&#x2F;p&gt;
&lt;p&gt;My confidence in the loop does not come from results yet, because a handful of juniors is not a cohort. It comes from the fact that it is the loop that grew engineers before agents, and the adjustment to it is small. How much hand-built struggle it needs, and whether explanation, critical reading and the demo can fully replace the scar tissue of having built things, is the part only practice will settle.&lt;&#x2F;p&gt;
&lt;p&gt;So the leader&#x27;s job, as I see it today, comes down to this. Make reading and understanding the agent&#x27;s output the expected way of working, not a personal virtue. Keep a senior in the loop to hear decisions defended. Teach the habit of writing down the why, on purpose, because nothing in the tooling encourages it. And apply all of it to the seniors too, starting with yourself, because the engineers I have watched stop reading were not only the juniors.&lt;&#x2F;p&gt;
&lt;p&gt;If you are growing engineers in an AI-native team and have found something that works, or something that clearly does not, I would like to hear about it.&lt;&#x2F;p&gt;
</content>
	</entry>
	<entry xml:lang="en">
		<title>Spending judgement where it matters: how we structure AI-native delivery</title>
		<published>2026-07-23T00:00:00+00:00</published>
		<updated>2026-07-23T00:00:00+00:00</updated>
		<link rel="alternate" type="text/html" href="https://www.moystard.com/blog/ai-native-delivery/"/>
		<id>https://www.moystard.com/blog/ai-native-delivery/</id>
    
    <summary>&lt;p&gt;A few weeks ago &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https:&#x2F;&#x2F;www.moystard.com&#x2F;blog&#x2F;ai-cognitive-debt&quot;&gt;I wrote about cognitive debt&lt;&#x2F;a&gt;: the slow loss of judgement that comes from letting a model think in your place. The natural question that follows: how do you use these tools seriously, at full speed, without paying that price?&lt;&#x2F;p&gt;
&lt;p&gt;Here is my answer, after a year of building a production fintech this way. It isn&#x27;t using the tools less. It isn&#x27;t trying harder to stay alert, because attention will fade when deadlines loom closer. It&#x27;s structure: a delivery pipeline where human judgement focuses on the thinking and decisions that deserve it. Everything else is enforced by gates that don&#x27;t depend on anyone&#x27;s attention surviving a deadline.&lt;&#x2F;p&gt;</summary>
    
		<content type="html" xml:base="https://www.moystard.com/blog/ai-native-delivery/">&lt;p&gt;A few weeks ago &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https:&#x2F;&#x2F;www.moystard.com&#x2F;blog&#x2F;ai-cognitive-debt&quot;&gt;I wrote about cognitive debt&lt;&#x2F;a&gt;: the slow loss of judgement that comes from letting a model think in your place. The natural question that follows: how do you use these tools seriously, at full speed, without paying that price?&lt;&#x2F;p&gt;
&lt;p&gt;Here is my answer, after a year of building a production fintech this way. It isn&#x27;t using the tools less. It isn&#x27;t trying harder to stay alert, because attention will fade when deadlines loom closer. It&#x27;s structure: a delivery pipeline where human judgement focuses on the thinking and decisions that deserve it. Everything else is enforced by gates that don&#x27;t depend on anyone&#x27;s attention surviving a deadline.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;AI-native does not mean AI-autonomous. It means the delivery system is designed from first principles around what agents do well and what only humans can do, the way cloud-native never meant nobody runs infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;The division of labour is strict, and worth stating up front. Humans own the product thinking, the thin breakdown of work, the architecture and the design: every ticket carries those decisions before an agent sees it. Agents own the implementation inside those constraints, and the gates verify it. Every line an agent writes is read by its engineer before anyone else sees it: the change itself, not an agent&#x27;s summary of it. Nothing in this system asks a model what to build, or how the system should be shaped.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;the-scarce-resource-has-changed&quot;&gt;The scarce resource has changed&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-scarce-resource-has-changed&quot; aria-label=&quot;Anchor link for: the-scarce-resource-has-changed&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;For my whole career, engineering capacity was the constraint. Roadmaps were shaped around what the teams could carry. With agentic tooling, that constraint has clearly shifted: a small team can now produce what used to take a department.&lt;&#x2F;p&gt;
&lt;p&gt;What hasn&#x27;t moved is the supply of judgement. Someone still has to say: we are solving the wrong problem; this technical design will not scale and hurt us in a year; this edge case is the one that matters.&lt;&#x2F;p&gt;
&lt;p&gt;I think that is now the real job of an engineering leader. It is not adopting AI; everyone has. It is about deciding where human attention goes, and building the system that encourages it and protects it.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;the-initial-lag-can-fool-you&quot;&gt;The initial lag can fool you&lt;a class=&quot;zola-anchor&quot; href=&quot;#the-initial-lag-can-fool-you&quot; aria-label=&quot;Anchor link for: the-initial-lag-can-fool-you&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;The dangerous thing about uncontrolled usage is that it feels great. The tools are impressive, output pours out, velocity charts point up. Nothing seems wrong.&lt;&#x2F;p&gt;
&lt;p&gt;The bill comes later, and it compounds quietly: vicious bugs in code nobody truly read; confident implementations of acceptance criteria that were invalid, or misunderstood, because nobody challenged them before building; a team that no longer knows its own codebase, because everything was delegated and stamped. By the time the symptoms show, you don&#x27;t have a bug. You have an archaeology dig, run by people who have lost the fluency to dig.&lt;&#x2F;p&gt;
&lt;p&gt;Cognitive debt and technical debt end up collapsing into the same debt. The cost is simply deferred, invisible as it grows, and due all at once. &quot;It&#x27;s working fine so far&quot; is not evidence. This initial lag is the trap.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;what-the-structure-looks-like&quot;&gt;What the structure looks like&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-the-structure-looks-like&quot; aria-label=&quot;Anchor link for: what-the-structure-looks-like&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;The pipeline our team runs replicates the roles of a delivery team, sequenced so work flows from ticket to implementation to released change, with a quality gate at each handoff. Every engineer runs it the same way, each owning the judgement calls on their own tickets. They are ultimately accountable for the outcome.&lt;&#x2F;p&gt;
&lt;p&gt;It starts before any code is written. Tickets are authored as user stories that state the customer problem being solved and how we intend to solve it, with acceptance criteria covering the edge cases and the non-functional requirements. A good ticket is a good ticket, whatever the audience; agents didn&#x27;t change what clarity looks like, they raised the price of skipping it. Each ticket is then challenged: the system&#x27;s first job is to argue with the scope, highlight misalignment with the existing system, surface the gaps, and openly ask the contentious questions. In the meantime, the engineer shapes the ticket and the technical design. Anything diagnostic follows a data-first rule: metrics, logs and data records before hypotheses.&lt;&#x2F;p&gt;
&lt;p&gt;The implementation starts with a test-first approach against the acceptance criteria: the behaviour is pinned before a single line of production code exists. Once the implementation is complete, a suite of reviews runs in parallel, each an independent lens: one checks the change against the ticket acceptance criteria, one against the project&#x27;s architecture and conventions, one for API-contract stability, one for security and the supply chain, and finally, a simplification pass whose only job is to remove complexity that doesn&#x27;t pay rent. None of this depends on someone remembering to run it.&lt;&#x2F;p&gt;
&lt;p&gt;The final brick is the live validation: an agent runs the change against a real environment, driving the actual UI, checking database side effects, and checking logs. It walks the happy path, but also pokes at the unhappy ones. The acceptance criteria are proven on a running system, beyond code testing.&lt;&#x2F;p&gt;
&lt;p&gt;Before any of it is shared, the engineer reads the whole change and iterates on it. The rule is old and simple: don&#x27;t put in front of others what you haven&#x27;t read yourself. The gates argue with the code; deciding what to do about their findings is human work, and this reading loop is where the engineer makes the change their own.&lt;&#x2F;p&gt;
&lt;p&gt;Then the engineer demos the finished feature themselves, recording a video walkthrough in which every acceptance criterion is exercised by hand. The demo is more than a check: it is a feedback loop, for the engineer, who feels the rough edges the moment they drive the product as a user would, and for everyone watching, who can challenge the result and improve it. Live validation is an agent&#x27;s evidence; the demo is the engineer standing behind the user&#x27;s experience, and it is never delegated.&lt;&#x2F;p&gt;
&lt;p&gt;By that time, a rich PR is opened and merge-gated on clean re-review by a separate agent, green CI and explicit human sign-off. That sign-off means what it has always meant: accountability. The engineer read and shaped every line before the PR existed; signing off says this change is mine, its behaviour and its consequences included. What the pipeline removes from review is the grind, not the ownership.&lt;&#x2F;p&gt;
&lt;p&gt;Our &quot;kickoff&quot; command carries a ticket from scope-challenge to merged PR. During that time, human attention is spent at exactly two points: shaping the work at product and engineering level before it starts, and the contentious calls the gates escalate along the way. The tiny implementation details that used to eat whole review cycles never reach a person.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;why-this-keeps-judgement-sharp&quot;&gt;Why this keeps judgement sharp&lt;a class=&quot;zola-anchor&quot; href=&quot;#why-this-keeps-judgement-sharp&quot; aria-label=&quot;Anchor link for: why-this-keeps-judgement-sharp&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;Cognitive debt grows when you fully delegate your judgement and the model does your thinking. Your role is to stamp its output. Our methodology reverses that twice.&lt;&#x2F;p&gt;
&lt;p&gt;First, it concentrates the thinking that stays human. Nobody reviews boilerplate or formatting, so the judgement each engineer does exercise, on scope, design and the genuine hard calls, gets full attention. The skill you keep is the skill you use.&lt;&#x2F;p&gt;
&lt;p&gt;Second, the gates are structural, not optional. Speed and safety stop competing the moment quality checks are steps the next stage depends on, rather than qualities someone must remember to practise. A pipeline that cannot merge without independent review, passing tests and live validation doesn&#x27;t get lazier as the people get faster. This rigour pays off.&lt;&#x2F;p&gt;
&lt;p&gt;There&#x27;s a compounding layer too. The system remembers the team&#x27;s conventions; lessons are taught and documented once. Preferences become guardrails instead of tribal knowledge. Every mistake and inefficiency becomes a rule, exactly once.&lt;&#x2F;p&gt;
&lt;p&gt;These gates do not slow us down: they spend machine time, not human attention, running in parallel while we shape the next piece of work. Working this way, three engineers took a new product from concept to public launch in six weeks, on a platform that processes millions of financial events a month, in software where a wrong number in front of a customer is unacceptable. I don&#x27;t believe that pace, at that bar, is reachable for a team this size any other way.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;what-it-costs&quot;&gt;What it costs&lt;a class=&quot;zola-anchor&quot; href=&quot;#what-it-costs&quot; aria-label=&quot;Anchor link for: what-it-costs&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;None of this is free. The harness took real time to build and tune; the gates encode our conventions and, more importantly, our architecture, and encoding them was work. That last point matters: the codebase has a purposeful shape, decided by people, and the pipeline defends it on every change. A model without that constraint will happily grow you a system with no shape at all. The whole system lives or dies on well-formed acceptance criteria: feed it vague or ambiguous scope and it will confidently build the wrong thing. That&#x27;s why the scope-challenge stage exists, and why it&#x27;s the one stage I would never automate away. The live-validation environment is infrastructure that needs an owner, like any other.&lt;&#x2F;p&gt;
&lt;p&gt;There is a limit that belongs in every engineer&#x27;s mental model. These models remain probabilistic: the likelihood of the next token being the correct one rests on how well the problem is represented in the training data and in the context you have laid out. Well-trodden problems implement beautifully. A complex problem with little public precedent will often come back subtly wrong, however sound the design that framed it. Part of the judgement this system asks of engineers is anticipating that boundary: knowing what problem they are actually solving, how much context they have really provided, and when the honest call is to write the implementation themselves with the agents demoted to review and test. Delegation is a decision made per problem, not a default.&lt;&#x2F;p&gt;
&lt;p&gt;And one problem I won&#x27;t pretend to have solved: this model assumes seasoned judgement at the gates. How a junior grows that judgement inside a system that shields them from the grind that used to build it is, I think, the hardest problem in this new AI-era engineering leadership. This is a problem we need to collectively tackle: the future of our discipline and our companies depends on this new generation of software engineers developing their judgement.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;a-message-to-engineering-leaders-and-engineers-out-there&quot;&gt;A message to engineering leaders and engineers out there&lt;a class=&quot;zola-anchor&quot; href=&quot;#a-message-to-engineering-leaders-and-engineers-out-there&quot; aria-label=&quot;Anchor link for: a-message-to-engineering-leaders-and-engineers-out-there&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;Adoption of agentic programming is not a question any more; the tools are everywhere, and their impact is undeniable. The divide that matters is between teams that use them under control and teams quietly accumulating the lag-hidden debt above while their dashboards look great. The second group may not feel wrong yet. That&#x27;s the point.&lt;&#x2F;p&gt;
&lt;p&gt;For leaders, the path that works takes more design effort than either enthusiasm or caution. Decide which decisions deserve human judgement in your context and domain. Build the structure that routes those decisions to people. Make every other quality property a gate. The result is the combination everyone assumes is a trade-off: faster delivery, less debt, and engineers whose judgement sharpens with use, because it&#x27;s the only thing they spend all day exercising.&lt;&#x2F;p&gt;
&lt;p&gt;For engineers, the gates are just skills: plain files that encode what your team knows (the domain, the conventions, the architecture, the strategy behind the codebase). Anyone can write one. Champion the framework, own it, improve it, add the rule you would have needed yesterday. It isn&#x27;t your manager&#x27;s system; it&#x27;s the team&#x27;s shared memory, and everyone can contribute to it.&lt;&#x2F;p&gt;
&lt;p&gt;One boundary worth stating plainly: everything here is about building things right. Whether you&#x27;re building the right things is a different discipline, and no pipeline answers it for you.&lt;&#x2F;p&gt;
&lt;p&gt;As the tools keep improving, the structure decides whether they make your team more capable or just more prolific.&lt;&#x2F;p&gt;
</content>
	</entry>
	<entry xml:lang="en">
		<title>We are trading productivity for cognitive debt</title>
		<published>2026-06-25T00:00:00+00:00</published>
		<updated>2026-06-25T00:00:00+00:00</updated>
		<link rel="alternate" type="text/html" href="https://www.moystard.com/blog/ai-cognitive-debt/"/>
		<id>https://www.moystard.com/blog/ai-cognitive-debt/</id>
    
    <summary>&lt;p&gt;We are trading productivity for cognitive debt, and most of us have not noticed the bill.&lt;&#x2F;p&gt;</summary>
    
		<content type="html" xml:base="https://www.moystard.com/blog/ai-cognitive-debt/">&lt;p&gt;We are trading productivity for cognitive debt, and most of us have not noticed the bill.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;I have been thinking about this a lot as the recent models have grown genuinely impressive. The MIT Media Lab put a name to it this year: writers who leaned on LLMs showed measurably lower neural engagement. Cognitive debt.&lt;&#x2F;p&gt;
&lt;p&gt;For software engineers and architects, the choice between deep and shallow understanding is not new. It used to be StackOverflow or a blog post, copy-pasted in haste, versus the slower work of understanding the problem space well enough to build something strong and context-aware.&lt;&#x2F;p&gt;
&lt;p&gt;LLMs raise the same choice, but with a twist: their solutions always look credible and optimal. Only a seasoned engineer can specify a problem properly and judge a solution against the criteria that are specific to their company, domain, project and timing.&lt;&#x2F;p&gt;
&lt;p&gt;And as we hand more of that thinking to the machine, the skill quietly erodes. Not overnight, but through a slow loss of comprehension, tooling instinct and programmatic and design fluency that is hard to notice until you need it and find it gone.&lt;&#x2F;p&gt;
&lt;p&gt;So the reminder I keep giving myself: think, evaluate, challenge whatever you introduce into your systems. Keep the mind sharp and the decisions deliberate.&lt;&#x2F;p&gt;
&lt;p&gt;This post was inspired by a great read from Igor Roztropiński: &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https:&#x2F;&#x2F;binaryigor.com&#x2F;the-joy-and-power-of-understanding.html&quot;&gt;The Joy and Power of Understanding&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Follow-up: &lt;a href=&quot;&#x2F;blog&#x2F;ai-native-delivery&quot;&gt;Spending judgement where it matters: how we structure AI-native delivery&lt;&#x2F;a&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
</content>
	</entry>
	<entry xml:lang="en">
		<title>Extra robustness in your Koa projects with Typescript</title>
		<published>2021-02-05T00:00:00+00:00</published>
		<updated>2021-02-05T00:00:00+00:00</updated>
		<link rel="alternate" type="text/html" href="https://www.moystard.com/blog/koa-typings/"/>
		<id>https://www.moystard.com/blog/koa-typings/</id>
    
    <summary>&lt;p&gt;With a bit of Typescript magic, it is possible to add strict typing to the body of Koa requests and responses.&lt;&#x2F;p&gt;</summary>
    
		<content type="html" xml:base="https://www.moystard.com/blog/koa-typings/">&lt;p&gt;With a bit of Typescript magic, it is possible to add strict typing to the body of Koa requests and responses.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;
&lt;p&gt;Typescript and Koa users know how loose the Typescript typing is for the requests and responses of the Koa contexts. Indeed, Koa (and &lt;a rel=&quot;nofollow noreferrer external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;dlau&#x2F;koa-body&quot;&gt;Koa-Body&lt;&#x2F;a&gt;) default types use &lt;code&gt;any&lt;&#x2F;code&gt; for the request and response body type.&lt;&#x2F;p&gt;
&lt;p&gt;This short blog post will show how you can add more robustness to your controllers by typing your bodies thanks to a simple generic interface.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;sparkling-koa-with-genericity&quot;&gt;Sparkling Koa with Genericity&lt;a class=&quot;zola-anchor&quot; href=&quot;#sparkling-koa-with-genericity&quot; aria-label=&quot;Anchor link for: sparkling-koa-with-genericity&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h1&gt;
&lt;p&gt;We want to be able to provide the types of the request and the response body, whilst keeping the built-in flexibility. That&#x27;s easy to achieve with Typescript generics as demonstrated below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Context&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Request&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;koa&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KoaRequest&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;RequestBody&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Request&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    body&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;?&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RequestBody&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;export&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KoaContext&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;RequestBody&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResponseBody&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; any&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; Context&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KoaRequest&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;RequestBody&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    body&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResponseBody&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;export&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KoaResponseContext&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;ResponseBody&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; extends&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt; KoaContext&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;any&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ResponseBody&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Having typed bodies should not prevent you from runtime checking the request bodies to ensure that you were provided with a valid input. If you are composing middlewares, you probably runtime check up the chain, and having typed bodies downstream where you know the input has been validated prevents you from duplicating the checks.&lt;&#x2F;p&gt;
&lt;p&gt;For assembling responses, having type safety at the compiler level should prove enough.&lt;&#x2F;p&gt;
&lt;p&gt;I am actually surprised that those are not the original type definitions in &lt;code&gt;@types&#x2F;koa&lt;&#x2F;code&gt; and &lt;code&gt;@types&#x2F;koa-body&lt;&#x2F;code&gt; but I am sure they had their reasons.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;examples&quot;&gt;Examples&lt;a class=&quot;zola-anchor&quot; href=&quot;#examples&quot; aria-label=&quot;Anchor link for: examples&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;Let&#x27;s put our new interfaces in practice with a couple of examples.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Router&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;koa-router&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; koaBody&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;koa-body&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HelloWorldRequestDto&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    name&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HelloWorldResponseDto&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    message&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; helloRouter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Router&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;helloRouter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;post&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; koaBody&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ctx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KoaContext&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HelloWorldRequestDto&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HelloWorldResponseDto&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Request body is now typed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;res&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;body&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ctx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;res&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;statusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 200&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Response body is also typed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ctx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;body&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Hello &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The compiler will error if we try to access properties not defined in the body types. Using the same DTO types, the code below would not compile:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;helloRouter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;post&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; koaBody&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; async&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;ctx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KoaContext&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HelloWorldRequestDto&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; HelloWorldResponseDto&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The compiler will fail as lastName is not defined in `HelloWorldRequestDto`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; name&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; lastName&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; ctx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;res&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;body&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ctx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;res&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;statusCode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 200&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The compiler would also fail here because we are defining a property absent from `HelloWorldResponseDto`, and `message` is absent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    ctx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;body&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        msg&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; `&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Hello &lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;!&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;`&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;KoaContext&lt;&#x2F;code&gt; interface uses default value for the generics; this allows specifying the request body type without the response&#x27;s: &lt;code&gt;KoaContext&amp;lt;RequestBodyType&amp;gt;&lt;&#x2F;code&gt; will assume that the response body type is &lt;code&gt;any&lt;&#x2F;code&gt;. The &lt;code&gt;KoaResponseContext&lt;&#x2F;code&gt; allows you to specify the response body type without the request&#x27;s for extra convenience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;a class=&quot;zola-anchor&quot; href=&quot;#conclusion&quot; aria-label=&quot;Anchor link for: conclusion&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;&#x2F;a&gt;
&lt;&#x2F;h2&gt;
&lt;p&gt;Leveraging Typescript and generics, we were able to add stricter typing to Koa. This should help you when composing middlewares, and assembling your response bodies. Happy coding!&lt;&#x2F;p&gt;
</content>
	</entry>
</feed>
