About apply-tweaks
A skill for applying queued design tweaks from YAML state files to source HTML, intended for workflows that use Claude to edit files. It validates values against the page's tweak schema, records applied changes, clears the queue, and provides a revert path.
Key features
- 01Reads tweak session and pending state
- 02Validates keys and values against schema
- 03Applies changes to HTML markers or CSS variables
- 04Logs changes and clears pending tweaks
- 05Supports reverting the latest changes
Use cases
- 01Applying queued visual adjustments to an HTML page
- 02Rejecting invalid tweak values before editing
- 03Keeping a record of design changes
- 04Reverting the most recently applied tweaks
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ bluzir/ claude-code-design --skill apply-tweaksAfter installing, type/apply-tweaksin Claude Code to confirm it loaded.
Details
From the project READMEApply Tweaks
Persist queued tweak changes (in pending.yaml) back to the source HTML via Edit. Pattern from claude-pipe: files are state, Claude is the writer.
Session lookup
session-id for <html-path> = tweaks-{slugify(basename html-path without ext)}-{today YYYYMMDD}.
Session dir: artifacts/tweaks/<session-id>/.
If skipping date match (e.g. resume from yesterday), Bash(ls artifacts/tweaks/) and find the most recent matching prefix.
Pipeline
-
Read session state:
Read artifacts/tweaks/<session-id>/state.yaml Read artifacts/tweaks/<session-id>/pending.yamlIf
pending.yamlis missing or empty — report "no pending tweaks" and stop. -
Read HTML + schema:
Readthe target HTML (path from state.yaml or$0)- Extract the
__tweak_schemablock (JSON inside<script id="__tweak_schema">)
-
Validate each pending key:
- Every key in
pending.yamlmust exist in schema - Value type must match schema (color = hex, number = in [min..max], boolean)
- If any key invalid: report which + stop (do not partially apply)
- Every key in
-
Apply: for each key → value in pending:
- Primary pattern — CSS var on
:root: find--tweak-<key>: <old>;andEditto new value - Secondary pattern — marker block: find
<!-- tweak:<key> -->...<!-- /tweak:<key> -->andEditthe content inside - If neither marker found → fail loudly (HTML didn't use
/make-tweakablepattern)
- Primary pattern — CSS var on
-
Atomic write via Edit: each
Editis already atomic in Claude Code, so no tmp-rename dance needed. -
Append to log:
ts=$(date -u +%Y%m%dT%H%M%SZ) Write artifacts/tweaks/<session-id>/applied/$ts.yaml: applied_at: $ts changes: <copy of pending.yaml> -
Clear pending:
Write artifacts/tweaks/<session-id>/pending.yamlwith empty content (or{}) -
Update state:
Edit artifacts/tweaks/<session-id>/state.yaml: phase: idle → idle (no-op but bump timestamp) last_applied_at: <ts> -
Verify:
/done <html-path>— confirms file still renders, new values visible in preview. -
Report: "Applied N tweaks. Logged to
artifacts/tweaks/<session-id>/applied/<ts>.yaml. Pending cleared."
Revert path
If user says "revert last tweaks":
Bash(ls -t artifacts/tweaks/<session-id>/applied/)— get most recentReadthat file — get the delta- Reverse each change (find current value in HTML, restore previous)
- Append a new applied entry with
type: revertand reference to reverted file /done