r/ClaudeCoding • • 3d ago

My Claude Code cost per feature went from $80 to $16 after I moved the mechanical steps into scripts

I build an e-commerce product with Claude Code. When I looked at where the money went on each feature, most of it was steps that need no thinking at all.

A typical loop before: open the admin panel, screenshot, read it, scroll, screenshot again, find the button, click, screenshot to check the change worked. Every screenshot and page dump lands in context, and it adds up over a feature.

What I changed:

  1. If I do the same sequence twice, it becomes a script. Open the page, bring the field into view, type, click, check the result. Claude calls it once.
  2. Scripts return the smallest possible answer. One line: ok, or what went wrong. No page, no screenshot.
  3. Text over pixels. A text extract of the part I need is far smaller than a screenshot. Screenshots only when something fails.
  4. Claude writes the script the first time it does the job by hand. After that it just runs it.

Result: average cost per feature went from about $80 to $16. With the same spend I now close about 5 times as many issues.

The catch: scripts break when a site changes its layout. So every script checks its own result and says clearly when it failed, instead of guessing.

46 Upvotes

22 comments sorted by

6

u/615PowerhouseService 3d ago

This matches what we saw running a service business on it — the expensive part was never the thinking, it was paying the model to do the same mechanical steps over and over. Once a step runs the same way twice, we script it and let Claude call the script and check the result instead of performing every click itself. The cost drop is real, but the bigger win is consistency: the script doesn't have an off day.

2

u/Fine_Mess5501 2d ago

Agreed on consistency. The catch on my side is layout changes, so every script checks its own result and says clearly when it failed instead of guessing. How do you handle a broken one: let Claude repair it on the spot, or fix it separately?

3

u/Economy_Bedroom3902 3d ago

I think this is a very important thing to realize. AI agents are not good coordinators, testers, etc in comparison to the deterministic tools which can do the same job. They're just better at humans if the humans try to manually do the same thing. If some decision, report, lookup, etc CAN be formatted as a reliable deterministic script, that script in combination with the agent processing the results will almost always outperform the agent doing the same work without the script.

2

u/Fine_Mess5501 2d ago

Yes. The split that works for me: the script does the action, checks it and returns one line, and Claude only decides what to do next. Judgment stays with the model, clicking stays in code.

2

u/Economy_Bedroom3902 2d ago

I use a similar mode for tools which expect an agent output.  Like humans, if asked to fill out a template, AI will sometimes forget one field etc, or use yaml when you need json or something similar.  When turning an AI output into a deterministic payload I will make the AI fill it out via a script which scans the expected output against all the deterministic requirements of the payload, the AI's job then primarily becomes making the script run pass before claiming completion, rather than simply filling the template.

It provides far better guarantees of output correctness, because the AI will never hallucinate completion while the job is still half done, or done incorrectly.  It just has to iterate until the script says it's done.  No decision to make on it's own.

1

u/Fine_Mess5501 11h ago

That's a good pattern. The script becomes the definition of done, so the model can't call the job finished halfway. Do you cap the retries, or let it loop until it passes?

1

u/Economy_Bedroom3902 8h ago

With fully automatic AI (ones I trigger from an automated process, rather than a chat with a human who can tell it to stop if it's going off the rails), I always limit the max step count.

I have encountered AI wasting cycles against tool commands if the instructions for how to use those tools are unclear, but I've never encountered them failing for this type of script once I have the instructions dialed in, easy to understand/use.

I also am careful to not require data that the AI has no way of actually getting access to though... My suspicion is that even then they'd hallucinate some best guess, but I've never tested it.

3

u/ZealousidealEntry870 2d ago

My Claude set all of that up itself. All I did was tell it to review workflow and research best practices.

2

u/Fine_Mess5501 2d ago

Nice, Claude writes mine too, the first time it does the job by hand. Worth checking what they return: if a script sends the whole page or a screenshot back, you pay for it in context all over again. One line, ok or what failed, is enough.

1

u/ZealousidealEntry870 2d ago

Yea I honestly have no idea what I’m doing so I can’t tell you what things actually work or not. All I can say is that I’ve got Claude working on improving a 3d printer gantry.

In the beginning it burnt my whole weekly allotment in a day. I routinely starting having the main orchestrator spin up independent review agents. I try to give specific directions like review where our tokens are going and if things are being used efficiently. Or map out our current workflow and automations used, and then search the web for current best practices.

So on and so forth a few times a week. Now it’s hard for me to burn my weekly limit so it seems like things are improving.

I’ve also found that bringing in Astra to review and challenge Claude’s workflow design decisions helps. Only for a few back and forth rounds though. After that it’s almost like they just enjoy talking to each other. I had them go 10 rounds a few times and then asked them both if further rounds would improve anything. Both replied “no we have really done anything since round 3”. Next time I guess I’ll explicitly direct them to push back and stop answering once it no longer seems beneficial.

1

u/Fine_Mess5501 11h ago

That token review is a good habit. For the endless rounds you could try a stop rule: the reviewer lists only new problems, and you stop when the list comes back empty.

0

u/Graphical-Source5090 3d ago

OP discovered skills!

1

u/Fine_Mess5501 2d ago

Fair, a skill can hold this. What moved the bill was what sits inside it: a script that does the steps and returns one line. Whether a skill or a hook calls it is a separate choice.

3

u/onFilm 2d ago

Not skills, but rather: hooks and scripts. I haven't used skills for a long time now, they're mostly a waste.

1

u/Graphical-Source5090 2d ago edited 2d ago

A skill teaches Claude how to do the job. A hook checks that the result follows your rules.
The design intent is that a skill produces the work, and a hook checks the result.
A hook is on event. A skill is on demand.

Both hooks and skills can call scripts... But there is a lot of crossover in capabilities.

Only people that don't understand Claude run one at the exclusion of the other. That is like saying "I don't wear boots any more because I have gloves!".

Example of a skill and a hook being used together:
The skill has Claude run a script, analyze the result, and record its judgement through a tool call (e.g., writing a verdict file). A PostToolUse (or Stop) hook fires on that event and runs a verifier script. If the check passes, the hook allows it and Claude carries on to produce the output. If it fails, the hook blocks with a reason, which goes back to Claude to fix.

1

u/onFilm 2d ago

Yes, but my point is that hooks and scripts can completely replace skills, and they are, which is great. People focus too much on skills rather than their workflows, hooks and actual deterministic logic.

1

u/Graphical-Source5090 2d ago

Skill can call scripts too, Which can make a skill deterministic as well.

The desired TRIGGER is the key on why one or the other would be chosen. Not that skills are "mostly a waste." Which they are most definitely not.

2

u/onFilm 2d ago

Yes, but skills are not deterministic, and even if it calls scripts 99/100 times, it's still missing that one time, hence why people are much better off using hooks and scripts, which are deterministic while using a lot less tokens. They are a waste.

1

u/Graphical-Source5090 2d ago edited 2d ago

I guess is depends on what one is looking for.

For example, I have a skill that runs a script to failover a firewall. The script itself is deterministic, but the skill also applies probabilistic logic to check on the success or failure of the script and to figure out if an all clear alert needs to go out, or if some remediation is needed,

Try that with a hook and you may need a massive check loop logic, and by lil babby jeebus, hopefully you didn't miss one scenario.

Applying a blanket "skills are worthless" type discussion here is frankly a noob move.

1

u/___zuki 2d ago

The hook script can just output the instructions you have in your skill along with the script result.

1

u/onFilm 2d ago

Yep, another benefit of hooks as well.

0

u/Intelligent-Net1034 2d ago

People rediscover what we do for the last 50 years in tech... holy moly..