跳到正文
DEV Community· Earl Grey·· 4 小時前AI 評分53

Ponytail 規則讓 Claude Code 生成的應用程式更小,但是否更好?

Lazy Senior Dev Mode Made My App Smaller. Was It Better?

AI 導讀

作者用 Claude Code(Opus 5.5)以相同規格和提示詞生成 Ponytail 關閉及啟用版本;啟用版行數約少一半、檔案大小少約四分之一,且沒有必須修復的問題。

正文

Raise your hand if you've been curious about Ponytail. 🙋 Same spec, same model, same prompt. One build with the rules off, one with them on.

TL;DR: I'd been using Ponytail's principles in my builds and got curious what they really change. So I rebuilt one of my summer apps twice with Claude Code, once with the Ponytail ruleset off and once with it on, and compared both against my original. Ponytail's build came out smaller, a little cheaper, and the only one with no must-fix bugs, though how much smaller depends on how you measure. Whether that made it the better app is a different question.

I had three copies of the same app open in three tabs, and I liked the biggest one best.

All three did the same thing. The app is called Spell It: you type a word, and it builds that word out of periodic table symbols. Type banana and you get Ba · Na · Na, which is barium, sodium, sodium. A fruit, spelled entirely in chemistry. The fun part is typing your own name to see if you're made of elements too. One was the version I shipped last summer. The other two were built that morning by Claude Code, Anthropic's coding agent, from the same spec. One of those had a ruleset called Ponytail switched on. The other didn't.

The Ponytail build was the smallest. It passed every check. When an auditor went through all three, it was the only one with no must-fix problems. And it was the one I'd least want to show someone.

Ponytail x Spell It

Same PRD. Same model. Same prompt. One build with the Ponytail ruleset off, one with it on, both compared against the version I made last summer.

Short version: Ponytail made the app smaller (half the lines, about a quarter less by file size), a little cheaper and faster, with no must-fix bugs. It also took out the parts I liked.

Read the full write-up on dev.to.

The experiment is frozen as it ran on Nov 21, 2026 (tag experiment-2026-11-21). Anything added later is listed in ADDENDUM.md.

Ponytail x Spell It case study card. Same PRD, same model, same prompt. Half the lines, same app, better questions. Line counts: original 989, Ponytail off 416, Ponytail full 206, which is about 79% fewer lines than the original and about 50% fewer than Ponytail off. A tile row spells banana as Ba, Na, Na.


The problem

AI coding agents tend to build more than you asked for. Extra abstractions, extra files, a library where the browser already has the feature. The code works, but it's bigger than it needs to be, and bigger code is harder to read, review, and trust.

Ponytail is an open source ruleset that tries to fix…

Lazy, on purpose

Ponytail is an open source ruleset by Dietrich Gebert that you install into a coding agent. Its pitch is that AI agents over-build: extra files, extra abstractions, a library where the browser already has the feature. Ponytail tells the agent to act like the laziest senior dev in the room and climb a ladder before writing anything. Does this need to exist? Is it already in the codebase? Does the standard library handle it? Does the browser? Can it be one line? Only then, the minimum code that works, plus one small test if the logic is tricky.

The repo's own benchmark reports about 53% less code, 41% less time, and 26% lower cost than the same agent without it.

I wasn't new to it. I'd been using Ponytail's principles in my own builds, not the plugin. In Dead Keys, my typing game for the Kiroween hackathon, Ponytail's rules file rode along unchanged as a steering file for Kiro, AWS's AI coding tool. A steering file is a set of instructions the agent reads on every task. What I'd never done was check what those rules changed. Every app I'd built with them, I'd only ever seen one way. So this one was just to see: same app, rules off, rules on, side by side.

One spec, three builds

I picked Spell It, one of the small apps I built every day in July for Netlify's Hot AR Summer 2026. It's tiny, but it has real logic: finding the spelling that fits the most letters is a little search problem, so Ponytail's "add a test" rule had something to bite on. It also has plenty of room to over-build, and it already had a finished design to compare against.

Claude (Opus 5.5, in chat) read my original and wrote a PRD from it: a one-page spec of what the app must do. Every feature got a label. MUST means build it. STUB means leave a comment for later, don't build it. NEVER means no storage, no network calls, no AI calls. The PRD also had nine acceptance checks, tests the finished app had to pass, plus the original's colors and fonts, and nothing about how to write the code.

Then the setup, kept as boring as possible:

Original A B
Built Last summer Claude Code Claude Code
Model n/a Opus 5.5 Opus 5.5
Ponytail n/a Off Full
Got n/a The PRD and one prompt The PRD and one prompt

Each build ran in a fresh session, in an empty folder holding only the PRD, with no personal rules files. Ponytail was installed for both. For A, I switched it off with its own off command before sending anything. Both got the exact same prompt:

Build the app described in PRD.md. Put it in one index.html in this folder. When you're done, tell me how to check it against the acceptance checks.

My job was to stay out of the way. I'd planned one-line follow-ups for any failed check. Neither build needed one.

Here's the same demo on all three: type banana, click periodic, type jazz.

Original (my summer 2026 version)

Spell It, my summer 2026 version: a dark brass instrument panel with a big gold SPELL IT title. Typing banana shows three element tiles, Ba, Na, Na, and the verdict Fully spellable. Clicking periodic shows seven tiles with D marked No element. Typing jazz shows four letters that could not be placed.

Build A (Claude Code, Ponytail off)

Build A, Claude Code with Ponytail off: the same demo in a simpler brass panel. Banana spells Ba, Na, Na. Periodic shows one letter that could not be placed. Jazz shows four.

Build B (Claude Code, Ponytail full)

Build B, Claude Code with Ponytail full: the same demo with the plainest layout of the three, a left-aligned title and flat panels. Results match the other two builds for banana, periodic and jazz.

Half the lines. Not half the code.

Here's what came back. JavaScript is the logic. CSS is the look.

Original A: off B: full
JavaScript lines 319 151 109
CSS lines 595 227 61
Total lines 989 416 206
File size 28.9 KB 14.1 KB 10.8 KB
Acceptance checks 9 of 9 8 of 9 9 of 9
Build cost n/a $0.85 $0.73
Build time n/a 1m 49s 1m 29s

By lines, B is half the size of A. By file size, it's about a quarter smaller. The gap is real, but part of it is formatting: B packs more onto each line. All 118 elements fit on about 12 lines in B. My original spreads them over 40.

Ponytail also saved a little time and money, but not much:

A: off B: full Saved
Build time 1m 49s 1m 29s 20 seconds
Build cost $0.85 $0.73 12 cents

Why so little? I picked a tiny app on purpose, so the builds were small to begin with, and there wasn't much to save. Every session also costs something just to get started. In one of my audit sessions, turning Ponytail on cost $0.30 before it did any work at all. On a bigger app, the savings would have more room to show up.

Both builds also wrote self-checks, small tests that run the acceptance table every time the page loads. Counting console.assert lines, A has 7 and B has 8. My original has none.

The number that surprised me was A. Plain Claude Code, no Ponytail, came in under half the size of my original. The PRD did a lot of that work before Ponytail ever showed up. When every feature is labeled MUST, STUB or NEVER, there isn't much left to over-build.

The cut came from the look

Look at the CSS row again. B has about a tenth of my original's styling by lines, and about a quarter by file size. Either way, most of it is gone.

That's where the background texture went, and the brass frame with the little screws in the corners, and the big title. Ponytail treats those as things nobody asked for.

And here's the part that's on me: nobody did ask. My PRD listed the colors, the fonts and a thin brass frame. It never mentioned the texture or the screws. Ponytail builds what the spec says, so design that isn't written down disappears. For a utility, that's fair. For a toy, the pizzazz is the point, and next time it goes in the spec.

I gave each build a gut score, one to five, for "would I ship it as is":

Original A: off B: full
5 4 4

A and B are one-shots. They'd get there with a few UI tweaks. They just didn't start there.

The bug went to the build without Ponytail

The one acceptance check that failed was mine to design and A's to miss: paste in a very long word and the page shouldn't freeze. I tested with 10,200 letters.

Time per keystroke
Original 0.03 seconds
A: off 1.1 to 1.8 seconds
B: full about 0.3 seconds

I hadn't set a number for "freeze" before testing. Afterward, I drew the line at one second per keystroke. The gap was wide enough that any line between half a second and a second gives the same answer.

A froze. When it finished building, A had told me a 10,200-letter word "shows results right away." Later, A's own review admitted it had only checked that the word worked, not how fast, and called its earlier claim wrong.

The fix the review suggested was one attribute: cap how many letters the input box takes. My original has done that since July, with an 80-letter limit. Summer me had already solved a bug that a brand-new build shipped.

Fewer lines isn't the score

If you've been building for a while, you might be squinting at that first table. Fewer lines isn't the same as better software. I agree, and this test shows it. Even the line count was misleading.

My original is the longest of the three, and it's the one I'd ship. Most of its extra lines are the background, the frame, and the big title, the parts a person notices. Build B is the smallest, and some of its lines are self-tests my original never had. The one real bug had nothing to do with size; the fix is a single attribute.

I think line count measures what you have to read and maintain. It doesn't measure whether the software is right, fast, accessible, or fun. Ponytail is good at cutting that first cost. The rest is still on me.

The judge needed checking too

Ponytail ships with an audit command that reviews a whole project and ranks what to fix. I ran it on all three.

Original A: off B: full
Must-fix 1 1 0
Should-fix 4 1 2
Nice to have 2 3 3

It found real things. My original still had a placeholder where the social share image should be. All three builds made screen readers read the whole result aloud on every keystroke, which is a gap in my PRD, not in any builder.

It also made things up. It called my sign-off line, "Powered by NLP," a false claim about the code. It described Spell It as a college-affiliated project, which it isn't. And it suggested a test where banana spells as B · A · Na · Na. A isn't an element. That test would fail.

So the audit earned its place, with the same rule I use for everything else: check it against the file.

Who did what

This was a three-way build, like most of mine.

  • Claude Code (Opus 5.5) built A and B from the PRD, in two separate sessions on my computer.
  • Claude (Opus 5.5, in chat) wrote the PRD from my original, ran every acceptance check in an automated browser, timed the long-word freeze, made the GIFs, and caught that it had under-tested the long word the first time.
  • Ponytail ran the reviews and audits.
  • I picked the app, set the rules for a fair test, stayed off the keyboard during the builds, checked the auditor's claims, and scored what I'd ship.

What it can't tell you

  • One small app, one run per build. It's a case study, not a benchmark, and AI builds vary from run to run.
  • Ponytail was installed but switched off for A, not uninstalled.
  • The PRD was written from my original, so the original had a head start on matching it.
  • A and B were audited in the same session that built them. The original got a fresh session.
  • Nobody tested it with a real screen reader or on a real phone.

Try it

Everything is in the repo: the PRD, all three builds, the full scorecard, and the raw audit output. Every build is one HTML file. Download it, double-click it, and type your name.

The repo is frozen as the experiment ran, under a tag. Anything I added later, including scripts that rerun the size, check, and timing numbers in this post, and the screenshots behind the costs, is listed in its addendum.

If you want to repeat the test, the README has the steps. It cost me $2.95 across all three sessions, audits included.

I came in expecting a number. I left with a question I'd like other builders' takes on: when an agent makes your code smaller, how do you tell whether it cut fat or cut flavor?

Mostly by playing with it.


This is my first post as a member of Necoz, a community that builds small, simple, useful tools. Fitting, for a post about small, simple code. Thanks for having me. 🐱

Quick context if you are new here. I work in the California courts, running court operations for the county. I started building with AI in July 2025 and I have been learning in public ever since. I do not write the code. I direct, the agents generate, I validate and decide. I build the Clew Suite, a set of civic tech tools for making complex systems easier to inspect. That is the lens I am writing from.

Built and tested with AI assistance in November 2026. Ponytail's benchmark numbers come from its README. These tools move fast, so check the source before you quote me.

AI Assisted. Human Approved. Powered by NLP.

來源:DEV Community · dev.to