Skip to content

cd .. && $ cat less-magic-fewer-layers.md

Less magic, fewer layers: what agents and humans both gain from explicit frontend code

Why coding agents trip over implicit reactivity and deep build chains, and what explicit state, import maps and a dependency-only tool like Nudeps change about that.

---
commit
a48714c
date
tags
[ ai-agents , frontend , javascript , build-tools , react ]
stats
+1,594 words, 7 min read
---

Frontend tooling has spent a decade making code shorter by moving behaviour out of sight. Reactivity tracks itself, the compiler memoizes for you, the bundler decides what a bare import "vue" means. For an experienced human that is convenience. For a model that predicts code from what is in front of it, every one of those moves is a fact it has to guess. Two recent pieces attack the problem from opposite ends: Matteo Antony Mistretta on the runtime magic inside frameworks (Why AI hates modern web frameworks (and loves web standards)), and Lea Verou on the build layers between source and browser (Nudeps bundler-like imports, none of the baggage • Lea Verou).

The thesis here is simple: what is not written down cannot be read, by a model or by the colleague who opens the file in six months. Less magic and fewer layers help both, and the cost is real but smaller than it used to be.

1. What the model cannot see, it guesses

Mistretta’s point is not that models are bad at syntax. They are bad at behaviour that lives outside the file. His Vue example is the classic one:

const state = reactive({ count: 0 })
const { count } = state            // silently stops updating
const count2 = computed(() => state.count)  // works

Destructuring is harmless in 99% of JavaScript, so a model writes it with confidence. Vue’s proxy makes it a silent bug: no error, no warning, just a number that never changes again. The same family includes React’s useEffect dependency arrays (forget one, stale data; add one too many, a render loop) and composed signals in Solid or Angular, where an effect tracks at runtime whatever it happened to read. The propagation graph exists, it is just not written anywhere. It is reconstructed by executing the code, which is exactly what a model does not do.

This is not only an argument from taste. Agents follow the build, not the prompt looked at 30 agent-built apps, and the single largest loss on the Angular side came from exactly this: in two runs an effect() indirectly read and wrote the same signal, looped forever and took down the checkout page. Those two runs account for 32 of Angular’s 38 failed tests (Angular vs React in AI Development Which One Do AI Agents Build Better?). No build, typecheck or lint step caught it, because the bug was in a graph no tool could see either. Schrödinger’s dependency: tracked and untracked until someone clicks “Buy”.

2. Boilerplate is noise, not context

Mistretta adds a second complaint about Angular: decorators, providers and DI configuration spread a small amount of logic over a lot of lines. The usual counter is that context windows are huge now. His answer is that the problem is density, not room. The more ceremony around the line that matters, the less attention that line gets, the same “lost in the middle” effect that long prompts suffer from.

Here the two pieces of evidence pull in different directions, and that is worth saying out loud. Angular’s ceremony is also explicit. The same experiment found zero TypeScript errors in all 15 Angular runs, against 6 of 15 React runs, because Angular’s build runs the typechecker and Vite’s does not. Verbose but checked beat terse but unchecked. So the useful distinction is not “short versus long”. It is “written down and verified” versus “implied and hoped for”. A decorator that the compiler validates is fine. A dependency that only exists at runtime is not.

3. Every layer between source and browser is one more thing to guess

The second kind of magic is the build. You write import { createApp } from "vue", and it works only because a bundler resolves "vue" to a file in node_modules/, rewrites the import, and emits something else. Verou’s complaint is that bundlers process every file and stack several abstractions between what you wrote and what ships, and those abstractions leak: things that work in the browser break in the build. State of JS 2025 ranked managing dependencies the third biggest pain point and build tools the sixth.

For agents the leak has a specific shape. The previous article’s React type errors came from a build that quietly did not typecheck. The agent saw “build succeeded”, which was true, and incomplete. About two thirds of those errors came from MUI v9 API changes the model’s training data did not know about. The bundler happily packed the outdated code anyway. It is a very efficient machine for shipping your misunderstandings.

Nudeps is Verou’s answer, and its design is the interesting part:

  • It only touches dependencies. Your own code is never transformed, so there is no watcher and no rewritten output to debug.
  • It uses the platform. It copies what is needed from node_modules/ into a deployable client_modules/, puts the version in the directory name (vue@3.5.45), and generates an import map via JSPM’s tracing engine. Import maps are Baseline Widely Available.
  • It hooks into npm itself. Install adds dependencies and prepare scripts to package.json, so the map regenerates on every npm install or fresh clone. There is no command to remember.

Setup is npx nudeps install plus one <script src="/importmap.js"> before your modules. One tester assumed they had missed a step because there was nothing left to do. The code you write is the code the browser runs, which is the most explicit build there is.

The goal is explicitly light-build, not no-build. If you compile JSX, TypeScript or single-file components, you still need a tool for that, just a smaller one that no longer also owns dependency resolution.

4. Even the light tool has one invisible piece

The most honest section of Verou’s post is the one about agents. Claude handled Nudeps from the start, with harmless but telling mistakes: adding .gitignore entries the generated folder already contains, running npx nudeps by hand, wiring it into npm run build, and treating dependencies as a custom script. It did not know npm runs a dependencies lifecycle hook and insisted it does not exist.

So the one piece of implicit behaviour left in the design, an npm hook most humans have never heard of either, is exactly where the agent guessed wrong. The fix was not more magic. The package now ships a SKILL.md, and once the agent is told to use it, those mistakes go away. That fits the pattern from the earlier article: text is the right tool for facts no machine checks, and an npm lifecycle hook is such a fact. The less implicit behaviour a tool has, the shorter that file can be.

5. Where this argument stops

  • No numbers yet. Mistretta’s piece is reasoning and experience, not measurement. Nudeps has no benchmarks; Verou says bundlers may be significantly faster or slightly slower depending on package structure. Many tiny ESM modules can load slower without bundling.
  • Interest is declared, not hidden. Mistretta works on Inglorious Web, an explicit-state framework, so his conclusion and his project point the same way. The argument holds up without it, but weigh it.
  • Not every package cooperates. Nudeps is ESM-first, CJS support is very experimental, and packages that reach for process.env need stubs or a bundled override. npm only for now; pnpm and yarn are on the roadmap. CSS dependencies need real URLs because browsers cannot import stylesheets by specifier yet, and workers do not support import maps.
  • Cache busting for your own code is still yours. Versioned directories handle dependencies. Your own files are served as written, so you need your own strategy. Hashed bundles have the opposite problem, stale chunks after a deploy (Handling React.lazy Chunk Load Errors After Deployment), so neither side gets this for free.
  • Frameworks still earn their keep. Neither author wants a return to document.write. Large teams get real productivity from React, Vue or Angular, and for many the trade-off still pays. The point is to add a criterion, not to swap one dogma for another.

What to do with it

Instead of Do Example
Trusting implicit reactivity in agent output Review it first, test the flows it drives effect writes to a signal it reads → e2e test
Destructuring reactive state Derive explicitly computed(() => state.count)
A bundler only to make bare imports work Import maps for dependencies npx nudeps install
“Build succeeded” as the done signal A build that also typechecks vite build && tsc --noEmit
Explaining a tool’s hidden hooks in every prompt Ship the explanation with the tool SKILL.md in the package
Asking “is it convenient?” Also ask “can I explain it from this file?” the six-months colleague test

Mistretta’s test is a good one to steal: ask the agent to explain why a piece of code does what it does. If the explanation needs behaviour that is not in the file, you have found a fragile spot. Not only for the model, but for whoever reads it next.

Frameworks and bundlers made complex things possible. The agent era makes it worth checking which of that complexity your project actually needs. Code that says what it does, and a build that ships what you wrote, can be read by a model without guessing. A human gets the same benefit, and also gets to delete a config file.

Sources