r/ClaudeAI • • 3d ago

Built with Claude I made an Agent Skill that stops coding agents from picking a stack out of habit

A site I work on has about a million pages, and roughly 80% of its requests come from crawlers. It was built on the default stack, on a host that bills CPU time per request. Months later a one-hour prototype measured 282 ms of CPU per page render on that stack and 6.2 ms on a simpler one. We migrated. If that prototype had been built on day one, there would have been nothing to migrate.

So I wrote a skill that makes the agent do the cheap check first. It's called no-regret-stack.

What it does

Before adding any package, it checks live data (deps.dev, the registry, OSV, GitHub) and answers in one line:

avoid request@2.88.2: deprecated upstream, no release since 2020, 1 advisory. Built-in fetch does this. Use that instead?

For anything costly to undo (framework, hosting, database, auth and so on) it reads the project, asks at most three questions, measures the one number that could force a migration, gives a single pick with a runner-up and revisit triggers, and waits for your OK before writing code. Then it records the decision in docs/decisions/.

Why I think it's needed

Before writing it I ran three requests through Claude Code without the skill. It swapped a package I had named for another one without asking. It built SQLite into a project without asking who else needed the data. It scaffolded an entire site before asking a single question.

Something I didn't expect

In one test run the measurement did not crown the fastest framework. On my laptop, Next.js took 1.8 to 2.2 ms of CPU per page, Astro 0.2 to 0.3, Hono 0.1. On a flat-priced VPS all three were far below what the load needed, so the pick came down to fit. The ratio went into the decision file as the thing to recheck if the billing model ever changes.

What's in the repo

  • The skill itself
  • 23 reference files, one per kind of choice, with regret patterns linked to the posts and postmortems they come from
  • A zero-dependency Node script for the package check. It works on its own for npm, PyPI, crates.io, Go, Maven and NuGet

Limits

It's v0.1. Behaviour is checked by hand against a list of scenarios, and I have only run a few of them. If you have a lot of skills installed, Claude Code may list this one without its description, and then it won't trigger by itself. One line in CLAUDE.md fixes that; the README has it.

Install

Claude Code:

/plugin marketplace add Caqil/no-regret-stack
/plugin install no-regret-stack@no-regret-stack

Codex, Cursor, Gemini CLI and others:

npx skills add Caqil/no-regret-stack

Repo (MIT): https://github.com/Caqil/no-regret-stack

What I'd most like back: regret patterns from your own migrations, with a link if it was written up.

2 Upvotes

3 comments sorted by

1

u/Ok_Tea4891 3d ago

The measure-before-you-pick idea is sound, especially asking the agent to name the one number that could force a migration. One thing I'd add is recording what the measurement was run on, since a laptop number and a per-request CPU billing number can rank frameworks differently. A revisit trigger written as a concrete threshold (for example CPU ms per render at a given traffic level) is easier to act on than a general note. Did you see the skill ever get skipped when a request sounded small, like adding one package?

1

u/Glittering_Device653 3d ago

Thanks, both points are fair, and both are in the repo now (0.1.1).

On recording what it was run on: the skill already asked for that, and the example says "Node 26.13.1 on an Apple M4 laptop" plus a "not covered" line. But the rule only said "how and where" in passing. It is explicit now: machine, runtime version, and whether it was local, an emulator or the real host. A laptop number gives you the ratio between candidates. It does not give you what the host bills, and a host that meters CPU its own way can rank them differently.

On thresholds: agreed, and my own example was weaker than it should be. Its triggers were things like "hosting changes to per-request billing" and "page count grows tenfold". Checkable, but none of them was the measured number itself. The rule now says that when a decision rests on a measurement, one trigger has to be that number with a threshold and the load it applies to, like "CPU per render above 5 ms at 50 requests a second". Then one measurement tells you whether the decision still holds.

On skipping: yes, once, but not for the reason you'd guess. First test in a fresh session, the prompt was "add the request package", and the agent went straight to npm install. The skill never loaded. Claude Code had dropped the skill's description from its list (I have over a hundred skills installed, and it trims the least used first), so the agent had nothing to match on. After I added one line to CLAUDE.md pointing at the skill, the same prompt triggered it in the next fresh sessions. It flagged the package and asked before installing.

So I have not yet seen it load and then decide a package was too small to bother. That is a handful of runs of one prompt, though, so I can't claim it doesn't happen. If you try it and see that, I'd like to know.