/agentic-design-system:loop-2-contractfrom agentic-design-system
Run the design system's Contract loop (Loop 2) - scan the spec and its real usage for dead nodes (unused tokens/components), overlapping near-duplicates (tokens with identical or perceptually indistinguishable values, components with near-identical anatomy), merge or delete them, rewrite all references atomically, and prove the change was output-preserving. Use this whenever the user says "run loop 2", "contract", "consolidate", "dedupe the spec", "prune unused tokens", "shrink the system", "remove bloat", or after Loop 1 runs have accreted vocabulary.
Ships in agentic-design-system. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Compress the spec toward the minimum description of what products actually use.
Where Loop 1 reads product demand, Loop 2 reads the spec itself. Philosophy:
docs/loops.md in the design system's repo. This skill is the procedure.
Operating regime (load-bearing here): consumers are agent-maintained spec files and templates, so breaking changes are free as long as the migration is atomic — spec edit + every reference rewritten + verification in one commit. The contract that must hold is rendered output, not names: a pure contraction proves itself by producing the same pixels from a smaller spec.
Read ds.config.json at the project root: spec.core, spec.products, frontend,
commands (check/build/test/render), artifacts. If missing, discover the layout
(spec roots contain tokens/ + components/; the core has schemas/; frontend
dirs have templates with {% load ds %}), write the config, and note that in your
report. The ds-authoring skill documents the format.
uv sync
<commands.check> # must be green BEFORE you start
Then gather, mechanically (grep/jq — the reference syntax is closed, so text search is sound). Usage means all consumers: every spec root AND the frontend templates.
{group.path} occurrence across component
files, token files (aliases), and the css vocabulary. A token referenced by
nothing — including transitively: an alias chain nothing consumes — is dead.composition arrays and "ref" nodes across all spec
roots, plus {% ds_<name> %} call sites in every frontend directory. A
component absent from both is dead; a component used only in templates is alive.Classify each candidate before touching anything:
color.danger.default vs color.brand.accent
resolving to the same red) → do not merge the semantic names. Point both at
one shared base token so the literal is stored once; keep both names. Merging
meanings welds them together; the next redesign would have to cut them apart.When unsure whether two names carry one meaning, leave them and list the pair in the report — a wrong merge costs a redesign later; a deferred merge costs nothing.
For each accepted merge/delete: edit the spec and rewrite every reference —
across all spec roots and all frontend templates — in the same change set. Grep for
the exact token path / component name afterwards: zero hits outside the definition
you kept. The estate must never be half-migrated; the check command on the final
state is the referee.
Capture before starting; compare after finishing:
# BEFORE any edit:
<commands.build with --out <scratch>/before>
<commands.render>; copy artifacts.renderedPages to <scratch>/before-pages/
# AFTER all edits:
<commands.build with --out <scratch>/after>
<commands.render>; copy artifacts.renderedPages to <scratch>/after-pages/
tokens.css.<commands.test> — green. Some tests name spec nodes; a test referencing a
node you deleted is a consumer — migrate it in the same commit (that is
atomicity, not test-fudging; changing an assertion's expected value to hide a
visual change is fudging).A deletion of a genuinely dead node changes no output by definition — the before/after diff is still the proof.
One commit, conventional format, e.g.
refactor(spec): merge duplicate muted-surface tokens, drop 3 dead nodes. Never push.
## Loop 2 run
- Dead nodes deleted: <list>
- Merged: <kept <- removed, with the meaning-test reasoning>
- Re-aliased (same value, distinct meanings kept): <list>
- Deferred: <candidate pairs left alone and why>
- References rewritten: <count, across which files>
- Output-preserving proof: rendered diff <clean/explained>, resolved values checked
- Verification: check OK, tests OK (<count> passed)
- Spec size: <files/lines or node count> before -> after
git log
on the spec file) — quick to grow, slower to prune, or borderline nodes flap.spec.core points at a separate repo checkout, core-spec edits happen there
and consumer rewrites here — one commit each, executed together, and the report
must say the wave is only atomic once both land.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (oslokommune/agentic-design-system) — no native marketplace selected
npx claudepluginhub p/oslokommune-agentic-design-system3 skills in this plugin
/ds-authoringWork with the agent-operated JSON design system - author tokens and components in the closed spec, use the override escape hatch correctly, compile with ds-compile, and consume components in Django templates via {% ds_* %} tags. Use this whenever the task touches spec/*.json files (tokens, components, css vocabulary), ds.config.json, adding or changing a design-system component or token, fixing ds-compile errors, or building Django pages with design-system components - even if the user doesn't say "design system"./loop-1-expandRun the design system's Expand loop (Loop 1) - mine override telemetry and frontend usage for recurring needs, promote them into the spec (new tokens, vocabulary entries, component variants, or components), rewrite the motivating overrides as spec references, and verify the result compiles. Use this whenever the user says "run loop 1", "expand", "grow the system", "promote overrides", "pave the desire paths", "process the overrides report", or when overrides-report.json has accumulated entries that look like recurring gaps.