React PlumberInstall package

Guides

Agents

Coding agents make up values like p-[13px] when they don't know your tokens. Plumber gives an agent your tokens and their reasons before it writes, then checks its edits and either names the change to make or tells it to stop and ask you.

Set it up

sh
npx plumber install --agent claude

For Claude Code this writes two files, and keeps what is already in your settings:

json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write|MultiEdit",
        "hooks": [{ "type": "command", "command": "npx --no-install plumber check --changed --agent --strict-ledger" }]
      }
    ]
  }
}

Other agents get instructions in the place they read them:

Agent--agentWritesHook after edits
Claude Codeclaude.claude/skills/plumber/SKILL.mdyes
Cursorcursor.cursor/rules/plumber.mdcyes
Codex, and any othercodex, generica block in AGENTS.mdno
Copilotcopilota block in .github/copilot-instructions.mdno
Gemini CLIgeminia block in GEMINI.mdno
Windsurfwindsurf.windsurf/rules/plumber.mdno

To add only the hooks for Claude Code and Cursor, run npx plumber install --hooks. Pass --agent more than once to set up several agents. npx plumber install --list shows what it would write without writing it.

The loop

  1. Before writing styles, the agent looks up your tokens (npx plumber decisions --family spacing), and can try a snippet without touching a file:

    sh
    echo '<div className="gap-10 text-gray-500" />' | npx plumber try --agent
    
  2. After each edit, plumber check --changed --agent lists only new problems in the files it changed, each as one instruction. It repeats until the output is 0 new.

Here's that output for a 13px gap:

text
1 new
## 1 of 1  gap 13px isn't on your spacing scale
Rule: provenance/spacing
Why: Off-scale spacing makes layouts drift apart and can't be changed from the theme.
Tokens:
- 8px: use gap-related or gap: var(--spacing-related); why: Related items use eight pixels.
- 16px: use gap-group or gap: var(--spacing-group); why: (no reason recorded)
Sites: src/new.css:1:8
- src/new.css:1:8  `gap: 13px`
  Compiles to: gap: 13px (via stylesheet)
  Choose a token using its reason, then edit at src/new.css:1:8:
    replace `gap: 13px` with `gap: var(--spacing-related)`  (8px)
    replace `gap: 13px` with `gap: var(--spacing-group)`  (16px)

Each site ends in one of four instructions:

InstructionMeans
Editone token fits: make exactly that edit
Choose a token using its reasonseveral fit: pick by the reasons and what the element is for
NEEDS-DECISIONnothing fits: stop and tell you the sites and the value it wanted
Fixa habit or other finding: follow the instruction

The agent uses your why: comments to choose between tokens.

What agents are told not to do

The skill gives agents these limits, and --agent output repeats the main ones:

The hook runs with --strict-ledger, so the check fails if an agent adds to the ledger. A hook runs after the edit and can't undo it.