d146d2084b Stop the design hook lying about findings it already reported (#391)
* Stop the design hook lying about findings it already reported

Three fixes, all aimed at the hook being trustworthy enough that an agent
keeps reading it.

1. The session cache was append-only, so the hook lied and then went blind.

`rememberFindings` unioned new keys into the remembered set and nothing ever
removed them, and the pending ack took its count from that set rather than
from the live scan. Fixing two of three findings produced:

    Still has 3 finding(s) flagged earlier this session
    (overused-font:1:inter, overused-font:2:roboto, overused-font:3:geist)

with roboto and geist already gone. Worse, a finding that was fixed and then
reintroduced was deduped against the stale memory and never re-reported, so
the hook was permanently blind to that regression for the rest of the session.

The cache now syncs to the complete current scan on every scan, so the count
shrinks as work lands and a reintroduced finding reads as fresh. Dedup within
a session still works, because it compares against the previous scan rather
than against all history. A detector failure leaves the remembered set alone
instead of recording an empty scan as truth.

2. The size ceiling, for generated files that do not live under dist/.

`GENERATED_PATH` covered dist, build, out, .next, .cache, coverage and
.min., but repos commit browser bundles and vendored detector copies next to
source. The hook was reading and scanning a 215KB generated bundle, and
reporting findings in it. Added `generated` as a path segment, matched with
separators on both sides so authored names such as generated-utils.ts and
CodeGenerator.tsx still get scanned, plus a `limits.maxFileBytes` ceiling
defaulting to 128KB. In this codebase authored files top out at 86KB while
the bundles start at 215KB, so the gap is comfortable.

3. The clean ack repeated on every clean edit.

It carries no finding, only the standing steer that a silent hook is not a
verdict on the design. That steer is worth saying, but not dozens of times
per session. It now fires once per file per session and reports
`clean-ack-deduped` in the audit log so suppressed noise stays visible. The
pending ack is deliberately untouched: it names real unresolved work, and the
comment explaining why it must repeat still holds.

Verified end-to-end against the built hook: three findings, fix two and the
count drops to one naming only the survivor, fix the last and it goes clean,
edit again and it stays silent, reintroduce and it fires as fresh.

Generated provider output is deliberately left out; the sync workflow owns it.

Prepared with AI assistance (Claude Code).

Co-Authored-By: Claude <noreply@anthropic.com>

* Address review: three clean-ack and audit bugs in the dedupe change

All three were introduced by this PR and all three are fair catches.

Quiet mode spent the ack (bugbot). A clean scan marked cleanAcked and
persisted it even when quiet suppressed all output, so a later non-quiet run
in the same session never got the steer. The quiet decision is now hoisted
above the scan loop and quiet leaves the ack unspent.

Multi-file events lost the ack (copilot). The first clean target became
cleanWinner unconditionally; if that file was already acked, cleanAckDeduped
went true and the `!cleanWinner` guard meant a later target that had never
been acked could never win. A raw apply_patch touching two files would drop
the second file's ack entirely. The loop now keeps looking for a target that
is actually owed an ack.

audit.bytes leaked across targets (copilot). It was set when a file was
skipped as too-large and never cleared, so in a multi-file event a later
emitted result carried the skipped file's byte count. Cleared per iteration.

The tests use a raw apply_patch payload rather than MultiEdit, because
MultiEdit in this harness is single-file ({ file_path, edits: [] }) and would
not have exercised the multi-target paths at all. Verified the three tests
fail against the pre-fix code and pass after, so they are not passing for the
wrong reason.

Prepared with AI assistance (Claude Code).

Co-Authored-By: Claude <noreply@anthropic.com>

* Address review: font-size waivers silently did nothing

Two more review findings, both real.

Specific-value font-size waivers were dead config (greptile). The rule emits an
ignoreValue, and the hook's own directive footer tells the agent to waive
value-specific findings with `hooks ignore-value <rule> <value>`, but
`design-system-font-size` was missing from the direct-value rule set in
`extractFindingIgnoreValue`. The extracted value came back empty, so any
waiver naming an actual size was compared against nothing and silently
dropped. Only the `*` wildcard worked, which is why the framework-viz waiver
earlier in this branch appeared to function.

Reproduced against the built hook: with a `0.82rem` waiver the finding still
fired; it now goes clean, while a waiver naming a different size correctly
still fires, so this is not over-matching.

Wrong audit skip reason (bugbot). In a mixed multi-target run, an earlier UI
file whose ack was already spent set `cleanAckDeduped`, and a later non-UI
clean file became the winner. The tail then reported `clean-ack-deduped` when
the honest reason was `non-ui-ack`. Audit-label only, no behavior change.
Reordered so the winner is described first and dedupe is reported only when it
is genuinely why nothing was emitted.

Prepared with AI assistance (Claude Code).

Co-Authored-By: Claude <noreply@anthropic.com>

* Mirror the font-size waiver fix into the CLI's config reader

Bugbot caught that the previous commit only fixed one of two copies.
`extractFindingIgnoreValue` exists twice, in skill/scripts/hook-lib.mjs and in
cli/lib/impeccable-config.mjs, and the direct-value rule list is duplicated in
both. Adding design-system-font-size to the hook alone meant the same
.impeccable/config.json filtered differently depending on the entry point: a
size waiver was honored by the hook and ignored by `npx impeccable detect`.

The two functions are otherwise byte-identical, so this restores parity rather
than changing CLI behavior independently. The new test notes the duplication so
the next person knows the pair has drifted once already.

Prepared with AI assistance (Claude Code).

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix the audit byte-count leak properly, not just one scan order

My earlier fix cleared audit.bytes at the top of each iteration, which was
wrong twice over, and bugbot caught both.

The clear sat below the sensitive, generated, extension, ignore-file and
file-missing continues, so a later target exiting through any of those never
reached it and kept the oversized file's size while audit.file pointed
somewhere else. It also only handled the bundle-scanned-first order; when the
oversized file came last, the byte count was set after the emitting file had
already been decided and rode along on its audit entry regardless.

The root problem was keeping per-file state on the shared audit object. The
size is now held in a local and attached only when the oversized skip is the
run's actual outcome, so it cannot describe a file other than the one being
reported. Tests cover both scan orders, an early-continue target after the
skip, and the single-oversized-file case where the count should still appear.

Prepared with AI assistance (Claude Code).

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-19 20:40:32 -07:00
2026-07-20 03:40:22 +00:00
2026-06-30 23:56:06 -07:00
2026-07-20 03:40:22 +00:00
2026-07-20 03:40:22 +00:00
2026-07-20 03:40:22 +00:00

Impeccable

Design guidance for AI coding agents. 1 skill, 23 commands, live browser iteration, and 46 deterministic detector rules for AI-generated frontend design.

Quick start: From your project root, run npx impeccable install, then run /impeccable init inside your AI coding tool. Full docs: impeccable.style.

Why Impeccable?

Anthropic's frontend-design was the first widely-used design skill for Claude. Impeccable started from there.

Every model trained on the same SaaS templates. Skip the guidance and you get the same handful of tells on every project: Inter for everything, purple-to-blue gradients, cards nested in cards, gray text on colored backgrounds, the rounded-square icon tile above every heading.

Impeccable adds:

  • One setup flow. /impeccable init writes PRODUCT.md and offers DESIGN.md, so later commands know the audience, brand/product lane, voice, anti-references, colors, type, and components.
  • 23 commands. A shared design vocabulary with your AI: polish, audit, critique, distill, animate, bolder, quieter, and more.
  • 46 deterministic detector rules plus LLM-only critique checks. The CLI and browser extension run the deterministic rules with no LLM and no API key.

What's Included

The Skill: impeccable

The skill installs as one command:

/impeccable <command> <target>

Start every new project with:

/impeccable init

init asks whether the surface is brand (marketing, landing, portfolio) or product (app UI, dashboard, tool), then writes design context that every later command reads.

23 Commands

All commands are accessed through /impeccable:

Command What it does
/impeccable craft Full shape-then-build flow with visual iteration
/impeccable init One-time setup: gather design context, write PRODUCT.md and DESIGN.md, configure live mode, recommend next steps
/impeccable document Generate root DESIGN.md from existing project code
/impeccable extract Pull reusable components and tokens into the design system
/impeccable shape Plan UX/UI before writing code
/impeccable critique UX design review: hierarchy, clarity, emotional resonance
/impeccable audit Run technical quality checks (a11y, performance, responsive)
/impeccable polish Final pass, design system alignment, and shipping readiness
/impeccable bolder Amplify boring designs
/impeccable quieter Tone down overly bold designs
/impeccable distill Strip to essence
/impeccable harden Error handling, i18n, text overflow, edge cases
/impeccable onboard First-run flows, empty states, activation paths
/impeccable animate Add purposeful motion
/impeccable colorize Introduce strategic color
/impeccable typeset Fix font choices, hierarchy, sizing
/impeccable layout Fix layout, spacing, visual rhythm
/impeccable delight Add moments of joy
/impeccable overdrive Add technically extraordinary effects
/impeccable clarify Improve unclear UX copy
/impeccable adapt Adapt for different devices
/impeccable optimize Performance improvements
/impeccable live Visual variant mode: iterate on elements in the browser

Use /impeccable pin <command> to create standalone shortcuts (e.g., pin audit creates /audit).

Usage Examples

/impeccable audit blog           # Audit blog hub + post pages
/impeccable critique landing     # UX design review
/impeccable polish settings      # Final pass before shipping
/impeccable harden checkout      # Add error handling + edge cases

Or use /impeccable directly with a description:

/impeccable redo this hero section

Anti-Patterns

The skill includes explicit guidance on what to avoid:

  • Don't use overused fonts (Arial, Inter, system defaults)
  • Don't use gray text on colored backgrounds
  • Don't use pure black/gray (always tint)
  • Don't wrap everything in cards or nest cards inside cards
  • Don't use bounce/elastic easing (feels dated)

See It In Action

Visit the Neo Mirai case study to see a before/after case study of a real project transformed with Impeccable commands.

Installation

From the root of your project, run:

npx impeccable install

This shows the harness folders it detected (for example ~/.claude, ~/.codex, or project-local .cursor), lets you keep the detected set or customize providers, then asks whether to install into the current project or globally. Use --providers=claude,codex,cursor and --scope=project|global to skip those choices in scripts. On Claude Code, Cursor, and Codex, it also installs the provider-native hook manifest for the current project. Works with Cursor, Claude Code, Gemini CLI, Codex CLI, Grok Build, and every other supported tool. Reload your harness afterward.

To refresh an existing install, run:

npx impeccable update

Codex users should open /hooks after install or update and approve the project hook when prompted. Codex tracks trust by hook definition, so updates that change .codex/hooks.json can require approval again.

Option 2: Git Submodule

For teams that want to keep Impeccable vendored and updated through Git, add this repo as a submodule and link the compiled provider build into your harness folders:

git submodule add https://github.com/pbakaus/impeccable .impeccable
npx impeccable link --source=.impeccable --providers=claude,cursor
git add .gitmodules .impeccable .claude .cursor
git commit -m "Add Impeccable skills"

Use the providers your project needs, for example claude, cursor, gemini, codex, github, opencode, pi, qoder, trae, trae-cn, or rovo-dev. The command links individual skill folders from .impeccable/dist/universal/ and leaves existing real skill directories untouched unless you pass --force.

To update later:

git submodule update --remote .impeccable
npx impeccable link --source=.impeccable --providers=claude,cursor

Option 3: Plugin install

Claude Code:

/plugin marketplace add pbakaus/impeccable

Claude Code only. After adding the marketplace, open /plugin and install Impeccable from the list.

Grok Build:

grok plugin install pbakaus/impeccable --trust

Grok Build only. Then run /impeccable init in a Grok session.

Option 4: Download from Website

Visit impeccable.style, download the ZIP for your tool, and extract to your project.

Option 5: Copy from Repository

Cursor:

cp -r dist/cursor/.cursor your-project/

Note: Cursor skills require setup:

  1. Switch to Nightly channel in Cursor Settings → Beta
  2. Enable Agent Skills in Cursor Settings → Rules

Learn more about Cursor skills

Claude Code:

# Project-specific
cp -r dist/claude-code/.claude your-project/

# Or global (applies to all projects)
cp -r dist/claude-code/.claude/* ~/.claude/

OpenCode:

cp -r dist/opencode/.opencode your-project/

Pi:

cp -r dist/pi/.pi your-project/

Gemini CLI:

cp -r dist/gemini/.gemini your-project/

Note: Gemini CLI skills require setup:

  1. Install preview version: npm i -g @google/gemini-cli@preview
  2. Run /settings and enable "Skills"
  3. Run /skills list to verify installation

Learn more about Gemini CLI skills

Codex CLI:

# Project-local
cp -r dist/agents/.agents your-project/
mkdir -p your-project/.codex
cp dist/codex/.codex/hooks.json your-project/.codex/hooks.json

# Or install the skill user-wide. Copy .codex/hooks.json into each project
# where you want the design hook to run.
mkdir -p ~/.agents/skills
cp -r dist/agents/.agents/skills/* ~/.agents/skills/

The asset-producer subagent ships nested inside the skill's own agents/ folder, which Codex auto-discovers. No separate .codex/agents/ copy is needed. The hook is project-local because Codex discovers hooks from .codex/hooks.json next to trusted project config.

GitHub Copilot:

cp -r dist/github/.github your-project/

Trae:

# Trae China (domestic version)
cp -r dist/trae/.trae-cn/skills/* ~/.trae-cn/skills/

# Trae International
cp -r dist/trae/.trae/skills/* ~/.trae/skills/

Note: Trae has two versions with different config directories:

  • Trae China: ~/.trae-cn/skills/
  • Trae International: ~/.trae/skills/

After copying, restart Trae IDE to activate the skills.

Rovo Dev:

# Project-specific
cp -r dist/rovo-dev/.rovodev your-project/

# Or global (applies to all projects)
cp -r dist/rovo-dev/.rovodev/skills/* ~/.rovodev/skills/

Qoder:

# Project-specific
cp -r dist/qoder/.qoder your-project/

# Or global (applies to all projects)
cp -r dist/qoder/.qoder/skills/* ~/.qoder/skills/

Usage

Once installed, every command runs through the single /impeccable skill:

/impeccable audit        # Find issues
/impeccable polish       # Final cleanup
/impeccable distill      # Remove complexity
/impeccable critique     # Full design review

Type /impeccable alone to see the full command list.

Most commands accept an optional argument to focus on a specific area:

/impeccable audit the header
/impeccable polish the checkout form

If you reach for one command often, pin it with /impeccable pin audit to get /audit as a standalone shortcut.

Note: Codex uses skills here, not /prompts: commands. Open /skills or type $impeccable. Repo-local installs live in .agents/skills/; user-wide installs live in ~/.agents/skills/. GitHub Copilot uses .github/skills/. Restart the tool if a newly installed skill does not appear.

Keeping .impeccable out of git

As you run commands, Impeccable writes working files under .impeccable/: critique and polish screenshots, live-mode session and preview state, runtime caches, and per-developer config. Most of it is ephemeral and should not be committed, while a few files are shared project artifacts that belong in the repo. Add this block to your project's .gitignore:

# impeccable-ignore-start
# Ephemeral output, runtime state, and per-dev overrides.
# Unanchored: .impeccable may sit at the repo root or under a nested
# workspace (apps/web/.impeccable/...); anchored patterns would miss it.
# Shared artifacts stay tracked: config.json, live/config.json,
# design.json, critique/*.md.
.impeccable/config.local.json
.impeccable/hook.cache.json
.impeccable/hook.pending.json
.impeccable/*.png
.impeccable/live/server.json
.impeccable/live/sessions/
.impeccable/live/previews/
.impeccable/live/annotations/
.impeccable/live/cache/
.impeccable/live/manual-edit-apply-transaction.json
.impeccable/live/manual-edit-events.jsonl
.impeccable/live/manual-edit-evidence/
.impeccable/live/pending-manual-edits.json
.impeccable/live/deferred-svelte-component-accepts.json
.impeccable/live/*.png
# impeccable-ignore-end

The block is wrapped in # impeccable-ignore-start / # impeccable-ignore-end markers so you can recognize and refresh it later. Patterns are unanchored on purpose: in a monorepo the active project (and its .impeccable/ directory) often lives under a nested workspace path like apps/web/, and a root-anchored pattern would miss it.

Keep these tracked (they are shared project artifacts, do not add them to .gitignore):

  • .impeccable/config.json (unified shared config)
  • .impeccable/live/config.json (live-mode framework wiring)
  • .impeccable/design.json (shared design spec)
  • .impeccable/critique/*.md (review reports)

If an ephemeral file (a screenshot, config.local.json) was committed before you added the block, .gitignore will not untrack it automatically. Run git rm --cached <path> to stop tracking it without deleting your local copy.

Design hook

On Claude Code, GitHub Copilot, Codex, and Cursor, npx impeccable install and npx impeccable update install a provider-native hook manifest along with the skill payload. The hook runs the Impeccable design detector on direct UI file edits and surfaces findings back into the agent flow. Claude Code, GitHub Copilot, and Codex surface findings after the edit. Cursor blocks bad proposed writes before they land.

Installed hook surfaces:

  • Claude Code: .claude/settings.local.json (gitignored, machine-local) runs ${CLAUDE_PROJECT_DIR}/.claude/skills/impeccable/scripts/hook.mjs. A hook moved into the shared settings.json is honored in place.
  • GitHub Copilot: .github/hooks/impeccable.json (committed, shared by the Copilot CLI and the cloud agent) runs .github/skills/impeccable/scripts/hook.mjs. The Copilot CLI activates it once the file is on the repository's default branch and the folder is trusted.
  • Cursor: .cursor/hooks.json runs .cursor/skills/impeccable/scripts/hook-before-edit.mjs.
  • Codex: .codex/hooks.json runs .agents/skills/impeccable/scripts/hook.mjs.

The installer preserves unrelated hook entries and settings. If a hook manifest is malformed, install/update aborts by default; rerun with --force to back up the malformed file as .bak and replace it.

On an interactive install/update, Impeccable explains the hook and offers to install it (default yes). Your choice is remembered per-developer in the gitignored .impeccable/config.local.json, so you are not asked again; --no-hooks skips it for that run without recording anything. Hook lifecycle settings live under the hook key of .impeccable/config.json; detector ignores live under detector, shared by /impeccable hooks and npx impeccable detect.

For debugging, set hook.auditLog in .impeccable/config.json to a path (or the legacy IMPECCABLE_HOOK_LOG env var) to write one NDJSON line per hook invocation. Leave it unset for normal use.

Codex requires one platform step that Impeccable cannot safely skip: open /hooks after install or update and approve the project hook. There is no Codex marketplace/plugin install flow for this hook.

Full hook docs: impeccable.style/docs/hooks.

Manual copy commands are fallback/debug instructions. The normal path is:

npx impeccable install
npx impeccable update

CLI

Impeccable includes a standalone CLI for detecting anti-patterns without an AI harness:

npx impeccable detect src/                   # scan a directory
npx impeccable detect index.html             # scan an HTML file
npx impeccable detect https://example.com    # scan a URL (Puppeteer)
npx impeccable detect --json .               # CI-friendly JSON output
npx impeccable detect --no-config src/       # raw scan, ignoring project config/context
npx impeccable ignores list                  # show detector ignores
npx impeccable ignores add-file "src/legacy/**"
npx impeccable ignores add-value overused-font Inter --reason "Brand font"

The detector catches 46 deterministic issues across AI slop (side-tab borders, purple gradients, bounce easing, dark glows) and general design quality (line length, cramped padding, small touch targets, skipped headings, and more).

By default, detect respects the same .impeccable/config.json and .impeccable/config.local.json detector config as the design hook: detector.ignoreRules, detector.ignoreFiles, detector.ignoreValues, and detector.designSystem.enabled. Hook lifecycle settings such as hook.enabled only affect automatic hook execution.

For a waiver that should travel with one file instead of the repo config, add an inline comment in the file: <!-- impeccable-disable overused-font: exported brand doc -->. The marker works in any comment syntax, scopes to the whole file (or one line with impeccable-disable-line / impeccable-disable-next-line), and is bypassed by --no-inline-ignores or --no-config.

Full detector docs: impeccable.style/docs/detector.

Supported Tools

Community & Ecosystem

Join the community and ecosystem conversations:

  • GitHub Discussions: file bugs, request features, and help newcomers.
  • Impeccable on npm: grab the CLI, follow releases, and star the package.
  • Follow @pbakaus on Twitter for release notes, sample lint reports, and video highlights of new rules.

Contributing

See DEVELOP.md for contributor guidelines and build instructions.

License

Apache 2.0. See LICENSE.


Created by Paul Bakaus

S
Description
No description provided
Readme
381 MiB
Languages
JavaScript 75.7%
Rust 22.1%
Shell 0.9%
Batchfile 0.9%
CSS 0.2%
Other 0.1%