agentleFS
crywolfecrywolfe/claude-code-design/.claude/skills/apply-tweaks/SKILL.md

apply-tweaks

Skill0 starsChanged 8 days agoMITView on GitHub

Apply buffered tweaks from pending.yaml to the source HTML file. Invoked when user says "save tweaks", "apply tweaks", "persist panel changes", or runs /apply-tweaks.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If skipping date match (e.g.

    line 17
  2. Very specific:

    If pending.yaml is missing or empty — report "no pending tweaks" and stop.

    line 26
  3. Very specific:

    Validate with code (all or nothing): if the tweaks came from pasted chat text, first Write them to pending.yaml.

    line 32
  4. Very specific:

    If no pattern matches for a key → fail loudly (HTML didn't use /make-tweakable pattern)

    line 44
  5. Distinctive:

    If user says "revert last tweaks":

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Apply 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

  1. Read session state:
    Read artifacts/tweaks/<session-id>/state.yaml
    Read artifacts/tweaks/<session-id>/pending.yaml
    If pending.yaml is missing or empty — report "no pending tweaks" and stop.
  2. Read HTML + schema:
    • Read the target HTML (path from state.yaml or $0)
    • Extract the __tweak_schema block (JSON inside <script id="__tweak_schema">)
  3. Validate with code (all or nothing): if the tweaks came from pasted chat text, first Write them to pending.yaml. Then run:
    Bash(node scripts/validate-pending.mjs tweaks artifacts/tweaks/<session-id>/pending.yaml --html <html-path>)
    • Non-zero exit: stop. Show the script's output (one line per invalid key) to the user. Do not apply a partial set and do not repair values yourself.
    • Exit 0: the JSON on stdout ({key, type, value} per entry) is the only thing you may apply. The script checks key names ([A-Za-z0-9_-]+), that each key exists in __tweak_schema, and the typed value rules (color = #rrggbb; number within [min..max]; boolean; enum one of options; string plain text ≤ maxLength, default 200, no <, > or newline).
  4. Apply: before each Edit, read the previous value of that key from the HTML you already read (the --tweak-<key> value, the schema "default", the attribute, or the element text, whichever the key type uses) and remember it as previous. Then for each validated key → value, by type:
    • color / number / boolean — CSS var on :root: find --tweak-<key>: <old>; and Edit to new value, and update "default" for that key in the __tweak_schema block. The panel re-applies every schema default on load as an inline style on <html>, so a stale default would silently override the CSS var you just edited (boolean: the class toggle also starts from the default)
    • enum — Edit the schema "default" and, if the root element carries data-tweak-<key>="…", that attribute
    • string — Edit the text content of every element matching target (default [data-tweak="<key>"]) and the schema "default"
    • Marker block fallback: <!-- tweak:<key> -->...<!-- /tweak:<key> --> → Edit the content inside
    • If no pattern matches for a key → fail loudly (HTML didn't use /make-tweakable pattern)
  5. Atomic write via Edit: each Edit is already atomic in Claude Code, so no tmp-rename dance needed.
  6. Append to log:
    Bash(date -u +%Y%m%dT%H%M%SZ)   → use the printed value as <ts> (no shell substitution)
    Write artifacts/tweaks/<session-id>/applied/<ts>.yaml:
      applied_at: <ts>
      changes:
        - key: primaryColor
          value: "#0a5c36"
          previous: "#D97757"
        - key: dark
          value: true
          previous: false
    One entry per changed key, values as JSON scalars. previous is always the value read from the HTML before the edit, never a guess.
  7. Clear pending: Write artifacts/tweaks/<session-id>/pending.yaml with empty content (or {})
  8. Update state:
    Edit artifacts/tweaks/<session-id>/state.yaml:
      phase: idle → idle (no-op but bump timestamp)
      last_applied_at: <ts>
  9. Verify: /done <html-path> — confirms file still renders, new values visible in preview.
  10. Report: "Applied N tweaks. Logged to artifacts/tweaks/<session-id>/applied/<ts>.yaml. Pending cleared."

Revert path

If user says "revert last tweaks":

  1. Bash(ls artifacts/tweaks/<session-id>/applied/) — the filenames are YYYYMMDDTHHMMSSZ.yaml, so the last one in name order is the most recent
  2. Read that file — get the delta ({key, value, previous} per change)
  3. Build a pending set with every key's value set to its logged previous, Write it to pending.yaml (format: key: <JSON value> per line), and run Bash(node scripts/validate-pending.mjs tweaks artifacts/tweaks/<session-id>/pending.yaml --html <html-path>); stop on a non-zero exit. Then apply the validated set exactly as in Pipeline step 4. If a log entry has no previous (older log), stop and tell the user — do not guess a value.
  4. Append a new applied entry with type: revert and reference to reverted file
  5. /done

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.