agentleFS
idavidov13idavidov13/agentic-playwright/.agents/skills/refactor-values/SKILL.md

refactor-values

Skill268 starsChanged 9 days agoMITView on GitHub

Use before changing an existing enum member's value or key under enums/** or editing an existing value under test-data/static/**. Not for adding a new enum or member (see `enums`) or a new static set (see `data-strategy`).

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    Before any edit, find all consumers: Search the enum key (Messages.LOGIN_ERROR) and the raw string value ('Invalid email or password') …

    line 10
  2. Very specific:

    Search both forms and list every hit (rg or grep -rn.

    line 27
  3. Very specific:

    Run npx tsc --noEmit, npx eslint ., then the affected spec files by path (--grep matches tags and titles, not file names).

    line 35

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Refactor Values

Critical

  • Before any edit, find all consumers. Search the enum key (Messages.LOGIN_ERROR) and the raw string value ('Invalid email or password') across the whole repository; a consumer that bypassed the enum does not follow it.
  • Every consumer changes in the same commit as the enum member or static entry; no state where the value moved and a consumer still holds the old one.
  • Never loosen z.literal or z.enum to a wider type to make a changed value pass; move the literal, or list the valid values.

    role: z.literal('administrator'), // correct: the literal follows the value
    role: z.string(), // wrong: hides the next drift
  • npx tsc --noEmit, npx eslint . and the affected tests pass before the refactor is done.
  • No blind find-and-replace. Inspect every match; hits include .md docs and skills, comments and case variants.

Procedure

  1. Search both forms and list every hit (rg or grep -rn; skip .json reports):

    rg -n "Messages.LOGIN_ERROR|Invalid email or password" --glob '!*.json' .
  2. Categorise each hit with references/impact-tables.md; the files that change are the proposal's scope.
  3. Change the source (enum member or as const entry) and every listed consumer in one pass; a UI message is captured from the live app with playwright-cli first (enums).
  4. Run npx tsc --noEmit, npx eslint ., then the affected spec files by path (--grep matches tags and titles, not file names); red → debugging.

References

  • references/impact-tables.md: step 2, the consumer table per change type and the stale-consumer patterns.

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.