← back

Loops and skillsAI tools built like components

How I built reusable AI tools for design-system checks, and what the first run cost.

I kept retyping the same instructions: "audit this against my design system," "check this copy is actually clear." A component gives a design file one thing, built once and used everywhere. I wanted the same for how I work with AI.

Skills and loops

A skill is knowledge. A loop is a process.

In Claude Code, a skill is a set of instructions and examples the AI loads when a task needs them: my design principles, my voice rules, my review checklist. A loop is what I call a command that runs a process, like /ds-cleanup. It opens the skills it needs, works through its steps and stops at a clear finish line.

The loop is the worker. The skills are the manuals it opens while it works.

/ds-cleanupAuditFixReport
AssetValue
Global equity48,200 €
Bonds21,900 €
Cash6,400 €
Rebalance
1#1a73e8→ primarySkill: design-tokens
2padding: 13px→ p-3Skill: design-tokens
3<div onClick>→ <Button>Skill: components
3 found, 3 fixed. It stops and reports.
The audit reads the table and names each problem. The fix swaps every value for the system's own. The table looks the same.
Every project

Written once, used in every project

Claude Code reads skills from two places: the project you're in and your own machine. I write them in one repo and link them to my machine, so one edit reaches every project.

That's how the team's repeat work became skills: the audit that checks a design system is built from its own parts, the setup for a design canvas in the format the team expects, and re-skinning a product with a new bank's brand. Nobody has to remember every small formatting rule or keep prompting until it's right. The rule lives in the skill.

First run

The first real run cost 102,000 tokens

An AI loop normally keeps going until the job is done. Mine kept fixing until it ran out of things to fix, and cleaning up one table in a wealth-management product burned about 102,000 tokens. So I changed it: now it does one pass, reports back, and I decide whether it runs again.

Audit
Fix
Build
Tokens0still fixing
Before, the loop fixed until nothing was left. Now it makes one pass and asks.
Two meters

Two meters, not one

Running out of tokens taught me there are two kinds of cost. The work a helper agent does in its own session is paid once. Anything left in the main conversation is paid again on every message, because Claude rereads the whole conversation each time.

Think of hiring someone to read a 500-page pile in another room and hand you one page. You pay for the reading once, and your desk only ever holds one page. My loop was putting the 500 pages on its own desk: it reread files the reviewer had already summarized and pasted full build logs into the main conversation, so every later step paid for them again.

What changed

What changed

  • One pass by default, then a report. Another pass only when I ask.
  • The build only runs when asked, and its log is cut down to errors.
  • Skills load only when the task needs them.
  • The reviewer's report is complete enough that the loop never rereads the files itself.
  • The checking runs on Sonnet, a cheaper model, because matching code against a rulebook doesn't need the most capable one.
Second run

The second run cost a third less

I ran it again on another table, in a fresh conversation. The audit and the fix together used about 70,000 tokens, where the fix alone had used 102,000 before.

It also worked better. It asked which table instead of guessing, deleted code nobody used, and stopped at a real design decision, an old mobile layout, to leave that call to me.

First run, the fix alone0 tokens
Second run, audit and fix0 tokens
The second run did more, an audit and a fix, for about a third fewer tokens.

Before you build a loop, understand what the AI pays for. Every fix came from that, not from guessing.

More from the blog

See all →