Skip to content
Back to skills

Refactor Values

ASecurity

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`).

  • 312 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 22, 2026
testinggobashdebugging

Works with

  • cli

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned November 9, 2026

npx -y skills add idavidov13/agentic-playwright --skill refactor-values --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactor Values?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Refactor Values
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/idavidov13-refactor-values/badge)](https://www.skillsdirectory.com/skills/idavidov13-refactor-values)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: refactor-values
description: 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`).
---

# 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.

    ```ts
    role: z.literal('administrator'), // correct: the literal follows the value
    ```

    ```ts
    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):

    ```bash
    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.

Files in this skill

  • SKILL.md9.2 KB
  • references/examples.md3.5 KB
  • references/troubleshooting.md1.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in testing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.