Agent skill

Refactor Values

by idavidov13 in idavidov13/agentic-playwright

Safe refactoring workflow for enum values, enum keys, and static test data in test-data/static/.ts — mandatory impact analysis, cascading updates, and verification.

MITAuto-check passedTesting & QA

Install Refactor Values

skills CLI
$ npx skills add idavidov13/agentic-playwright --skill refactor-values -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install idavidov13/agentic-playwright refactor-values --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/idavidov13/agentic-playwright.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/refactor-values .claude/skills/refactor-values && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
refactor-values
GitHub stars
223
Token cost
~2.3k tokens
SKILL.md length
806 words
Files
3 (incl. references)
Skills in repo
13
Repo updated
First seen
Licence
MIT

At a glance

Safe refactoring workflow for enum values, enum keys, and static test data in test-data/static/.ts — mandatory impact analysis, cascading updates, and verification.

  • Works in 4 steps: Find all consumers before touching… → Categorize impact using the right table → Make all changes atomically → …
  • Tasks that involve Refactoring
  • SKILL.md covers Critical, Instructions, Anti-Patterns and See Also
  • Calls npx and rg

What it does

Refactor Values is an agent skill from idavidov13/agentic-playwright. Safe refactoring workflow for enum values, enum keys, and static test data in test-data/static/.ts — mandatory impact analysis, cascading updates, and verification. Use BEFORE changing any enum member's string value (ApiEndpoints., Messages., Roles, StorageStatePaths), renaming any enum key, or editing any existing file under test-data/static/. Running this workflow prevents silent test failures, TypeScript errors from stale imports, and assertion drift from hardcoded strings that bypass the enum. For defining…

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/examples.md` and `references/troubleshooting.md`).

It sits in Testing & QA, covering Refactoring, Test data and fixtures and Failing and flaky tests. It works with TypeScript and Playwright. The repository describes itself as: Production-grade Playwright + TypeScript Scaffold for Agentic Testing. Harness for all major AI coding agents baked in. The licence is MIT.

When your agent uses it

  • Tasks that involve Refactoring
  • Tasks that involve Test data and fixtures
  • Tasks that involve Failing and flaky tests

Example prompts

  • “/refactor-values”

Requirements

  • Node.js

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Find all consumers before touching anything
  2. Categorize impact using the right table
  3. Make all changes atomically
  4. Verify no breakage

What it can do on your machine

Read from SKILL.md and the folder at commit f6cbf35. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx
    • rg

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npx, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Refactor Values loads about 2.3k tokens when it runs, and up to ~3.6k if it reads all its reference files. Until then it costs about 160 tokens; SKILL.md has 806 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~160
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from idavidov13/agentic-playwright at commit f6cbf35, republished under its MIT licence (© idavidov13). 806 words, ~2,332 tokens.

Download SKILL.mdSave it as .claude/skills/refactor-values/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
refactor-values
description
Safe refactoring workflow for enum values, enum keys, and static test data in test-data/static/*.ts — mandatory impact analysis, cascading updates, and verification. Use BEFORE changing any enum member's string value (ApiEndpoints.*, Messages.*, Roles, StorageStatePaths), renaming any enum key, or editing any existing file under test-data/static/. Running this workflow prevents silent test failures, TypeScript errors from stale imports, and assertion drift from hardcoded strings that bypass the enum. For defining NEW enums see the enums skill; for adding NEW static data see the data-strategy skill (three-tier rule).
author
Ivan Davidov

Refactoring Enum Values and Static Test Data

Critical

  • ALWAYS run Phase 1 (find all consumers) before making any edit. Enum values and static data feed into tests, page objects, schemas, and assertions — the blast radius must be known up front.
  • ALWAYS search for both the enum key (Messages.LOGIN_ERROR) and the raw string value ('Invalid email or password'). Some consumers may have bypassed the enum and hardcoded the string — they won't update when you change the enum.
  • NEVER update an enum value, rename a key, or edit a static-data file without updating every consumer in the same commit (atomicity — no intermediate broken state).
  • NEVER loosen a Zod schema (z.literal / z.enum) to make an updated value pass. Update the schema to match the new value; the schema is the contract.
  • ALWAYS run npx tsc --noEmit + npx eslint . + the affected tests before concluding the refactor. TypeScript catches key renames; eslint catches stale patterns; tests catch assertion drift.
  • NEVER use a single global find-and-replace — it misses case variants, hardcoded copies, and references inside comments, documentation, and sibling skill files. Inspect each match.

Instructions

Phase 1: Find all consumers before touching anything

Search the entire codebase for every occurrence of both:

  1. The enum key (the import reference consumers use).
  2. The current string value (the raw string — catches hardcoded usages that bypass the enum).

Use rg (ripgrep) when available — faster and more ergonomic — or grep -r as a universal fallback:

bash
# Find all usages of the enum key
rg "Messages.LOGIN_ERROR" .
grep -r "Messages.LOGIN_ERROR" .

# Find all usages of the raw string value
rg "Invalid email or password" .
grep -r "Invalid email or password" .

# For endpoint changes, search both
rg "ApiEndpoints.LOGIN" .
rg "'/api/users/login'" .

Do this before making any edits. Understand the full blast radius first. Expect matches in .ts, .tsx, .md (skill files, README, CHANGELOG), and .json (Playwright reports — ignore).

Phase 2: Categorize impact using the right table

Pick the table that matches the change you are making.

For enum string-value changes (changing what the member resolves to):

Consumer TypeWhat to CheckAction Required
Tests with toHaveText() / toBeVisible() using the old raw valueWill fail if hardcodedUpdate to use enum or new value
Page object locators using getByText(Messages.X)Auto-updated via enumNo change needed — enum reference already correct
Zod schemas with z.literal('old-value') or z.enum([..., 'old-value'])Will reject new valueUpdate literal/enum to new value
API endpoint paths in apiRequest callsWill call wrong URLUpdate enum reference or hardcoded path
Static data in test-data/static/*.ts using the old string as expected valueTest data mismatchUpdate the as const entry
Other enum members that derive from this valueIndirect breakageAudit and update

For enum key renames (e.g., LOGIN_ERROR → AUTH_FAILURE):

Consumer TypeWhat to CheckAction Required
Every file importing and using the old keyTypeScript compile errorRename key reference in every file
Re-exports or barrel filesMay silently pass at runtimeCheck index.ts files
Documentation / skill files referring to the old nameReader confusionUpdate .md files too

For static data value changes (editing a file in test-data/static/*.ts):

Consumer TypeWhat to CheckAction Required
Tests importing the named as const export and looping over itMay use the changed value in an assertionVerify test assertions still match new data
Tests asserting against a specific value from the file directlyWill failUpdate hardcoded expected value in the test
Enum members mirroring the static-data stringOut of syncUpdate the matching enum member
Show full SKILL.md (276 more words)Show less
Phase 3: Make all changes atomically

Update the source (enum or static-data file) and all consumers in one pass. Never leave an intermediate broken state where the value is changed but consumers still reference the old value.

Recommended order:

  1. Change the enum value / rename the key / update the as const entry in the static-data file.
  2. Update every consumer identified in Phase 1.
  3. Run TypeScript compile check.
  4. Lint.
  5. Run affected tests.
Phase 4: Verify no breakage
bash
# 1. TypeScript -- catches key renames and type mismatches
npx tsc --noEmit

# 2. Lint
npx eslint .

# 3. Run tests that use the changed value (adjust grep pattern)
npx playwright test --grep "@api"

Notes on npx playwright test --grep:

  • Matches against tag names (@smoke, @api, etc.) and against test titles. Use the most specific filter.
  • If the change touches a single spec file, run that file directly instead of --grep.

If any test fails, trace the failure back to a missed consumer from Phase 1 and update it.

Anti-Patterns

typescript
// ANTI-PATTERN 1 -- string value changed but test still hardcodes old value
export enum Messages {
    LOGIN_ERROR = 'Incorrect credentials. Please try again.', // updated
}

// This test now fails silently -- old string no longer matches the UI:
await expect(page.getByText('Invalid email or password')).toBeVisible(); // STALE
typescript
// ANTI-PATTERN 2 -- enum key renamed but not all usages updated
// File A: updated ✅
Messages.AUTH_FAILURE;

// File B: still using old key -- TypeScript error (caught by tsc --noEmit)
Messages.LOGIN_ERROR; // ❌ Property 'LOGIN_ERROR' does not exist
typescript
// ANTI-PATTERN 3 -- static data changed but assertion not updated
// test-data/static/app/invalidCredentials.ts was updated with a new password
// but the test still asserts the old password is present in the response
expect(response.password).toBe('WrongPassword123!'); // ❌ stale assertion
typescript
// ANTI-PATTERN 4 -- Zod schema loosened to "fix" a drift
// BEFORE
role: z.literal('admin'),

// WRONG -- hides future drift instead of tracking the contract
role: z.string(),

// CORRECT -- update the literal to the new value (or switch to z.enum([...])
// if multiple values are valid)
role: z.literal('administrator'),

See Also

  • enums skill — enum conventions, organization, and how to define NEW enums (this skill covers CHANGING existing ones).
  • data-strategy skill — static data file structure (.ts with as const exports, three-tier rule) and how to ADD new static data.
  • test-standards skill — how data-driven tests import and use static TS modules.
  • type-safety skill — Zod schema patterns; z.literal() and z.enum() that may reference enum values.
  • api-testing skill — consumers of ApiEndpoints.* and how schema drift is handled via test.skip + // FIXME:.
  • debugging skill — Phase 4 verification failures during a refactor (text mismatch, ZodError, strict-mode violation) — classify the failure and use the right tool before assuming the refactor itself is wrong.
  • references/examples.md — four worked refactors (endpoint URL change, UI message wording change, enum key rename, static-data value change).
  • references/troubleshooting.md — common refactor pitfalls (hardcoded-old-string failure, missed consumer, --grep confusion, Zod literal drift, find-and-replace gaps in docs/mirrors).

© idavidov13, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in .claude/skills/refactor-values of idavidov13/agentic-playwright.

  • SKILL.md
  • references/examples.md
  • references/troubleshooting.md

Open the folder on GitHubat commit f6cbf35

Compare with similar skills

Refactor Values next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Refactor Values compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Refactor Values this skillidavidov13/agentic-playwright223—~2.3kAutomated safety check: PassMIT
Testing Patternssoftspark/ai-toolkit179—~1.6kAutomated safety check: PassApache-2.0
Playwright Page Objectsbartstc/vite-ts-react-template122—~1kAutomated safety check: NotesMIT
ClickUp CLI Testingkrodak/clickup-cli121—~1.4kAutomated safety check: NotesMIT
Fixing Flaky Testsrileyhilliard/claude-essentials130—~1.1kAutomated safety check: PassMIT
Playwright Regression Testingfugazi/test-automation-skills-agents247—~1.4kAutomated safety check: PassMIT

Similar skills

  • Testing Patterns

    softspark/ai-toolkit

    Testing strategy: pyramid, AAA, mocks/fakes/stubs, flaky tests, coverage.

    179 GitHub stars~1.6k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Playwright Page Objects

    bartstc/vite-ts-react-template

    A skill your agent uses when creating page objects or refactoring Playwright E2E tests for better maintainability with Page Object Model patterns.

    122 GitHub stars~1k tokensUpdated yesterday
    Testing & QAAuto-check: notes
  • ClickUp CLI Testing

    krodak/clickup-cli

    Explains how to run and extend the clickup-cli tests: unit tests with a mocked client, e2e tests against a real ClickUp workspace, and the fixture data they rely on.

    121 GitHub stars~1.4k tokensUpdated yesterday
    Testing & QAAuto-check: notes
  • Fixing Flaky Tests

    rileyhilliard/claude-essentials

    Diagnose and fix tests that pass in isolation but fail when run concurrently.

    130 GitHub stars~1.1k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Playwright Regression Testing

    fugazi/test-automation-skills-agents

    Govern Playwright TypeScript regression suites across many tests.

    247 GitHub stars~1.4k tokensUpdated 4 days ago
    Testing & QAAuto-check passed
  • Selector Drift Recovery

    petrkindlmann/qa-skills

    Bulk-regenerate broken test selectors after a UI refactor or redesign.

    165 GitHub stars~5.1k tokensUpdated 3 mo ago
    Testing & QAAuto-check passed

More from idavidov13/agentic-playwright

All 13 skills in this repo
  • AI Native Workflow

    idavidov13/agentic-playwright

    Sole entry-point router for AI-assisted work on this Playwright scaffold — owns the 8-phase main workflow (classify → route → explore → plan+confidence → human gate → apply → verify → report), the…

    223 GitHub stars~3.5k tokensUpdated 6 days ago
    Auto-check passed
  • Common Tasks

    idavidov13/agentic-playwright

    Copy-paste AI prompt templates for common Playwright scaffold development tasks — adding page objects, functional/E2E/API tests, Zod schemas, factories, fixtures, and components.

    223 GitHub stars~2.5k tokensUpdated 6 days ago
    Auto-check passed
  • Data Strategy

    idavidov13/agentic-playwright

    Test data strategy for the Playwright scaffold — Faker + Zod factories for dynamic happy-path data, static TS files (.ts with as const exports — never .json) for domain-specific curated invalid…

    223 GitHub stars~3.4k tokensUpdated 6 days ago
    Auto-check passed
  • Page Objects

    idavidov13/agentic-playwright

    Page Object Model pattern for the Playwright scaffold — class structure, get-accessor locator pattern, action-method conventions, component composition, registration via the page-object fixture, and…

    223 GitHub stars~3.6k tokensUpdated 6 days ago
    Auto-check passed
  • Selectors

    idavidov13/agentic-playwright

    Selector strategy, exploration-first workflow, locator priority order (getByRole then getByLabel then getByPlaceholder then getByText then getByTestId), and feedback/validation-message selector…

    223 GitHub stars~2.7k tokensUpdated 6 days ago
    Auto-check passed
  • Test Standards

    idavidov13/agentic-playwright

    Spec file conventions for the Playwright scaffold — imports from test-options.ts, test file structure (describe / beforeEach / test / test.step), single-tag rule, functional vs E2E vs API vs setup…

    223 GitHub stars~3.9k tokensUpdated 6 days ago
    Auto-check passed

Questions about Refactor Values

What does Refactor Values do?

Safe refactoring workflow for enum values, enum keys, and static test data in test-data/static/.ts — mandatory impact analysis, cascading updates, and verification. Refactor Values is an agent skill from idavidov13/agentic-playwright.ts — mandatory impact analysis, cascading updates, and verification.

When should I use Refactor Values?

Refactor Values fits situations like: tasks that involve Refactoring; tasks that involve Test data and fixtures; tasks that involve Failing and flaky tests.

How do I install Refactor Values in Claude Code?

Run `npx skills add idavidov13/agentic-playwright --skill refactor-values -a claude-code`. Or copy the skill folder (.claude/skills/refactor-values in idavidov13/agentic-playwright) into .claude/skills/refactor-values in your project. Claude Code loads it when a task matches its description.

How do I install Refactor Values in Codex?

Run `npx skills add idavidov13/agentic-playwright --skill refactor-values -a codex`. Or copy the skill folder (.claude/skills/refactor-values in idavidov13/agentic-playwright) into .agents/skills/refactor-values in your project. Codex loads it when a task matches its description.

Can I use Refactor Values in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add idavidov13/agentic-playwright --skill refactor-values -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refactor-values, .gemini/skills/refactor-values, .github/skills/refactor-values and .opencode/skills/refactor-values in your project.

What does Refactor Values need to run?

Going by SKILL.md and its folder, Refactor Values needs the command-line tools its instructions call (npx and rg). Our summary lists: Node.js.

Does Refactor Values access the network?

SKILL.md contains no URLs. Its commands use npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Refactor Values safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Refactor Values use?

Refactor Values is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Refactor Values use?

About 2.3k tokens (SKILL.md is roughly 9.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.3k tokens, read only when the agent opens those files.

What are the alternatives to Refactor Values?

Skills that share tags, products or a category with Refactor Values: Testing Patterns (softspark/ai-toolkit, 179 stars), Playwright Page Objects (bartstc/vite-ts-react-template, 122 stars), ClickUp CLI Testing (krodak/clickup-cli, 121 stars) and Fixing Flaky Tests (rileyhilliard/claude-essentials, 130 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Refactor Values?

idavidov13 (a GitHub user) maintains it in idavidov13/agentic-playwright, which has 223 GitHub stars. The repository holds 13 skills in this directory. The repository was last updated on October 1, 2026.

Source: idavidov13/agentic-playwright on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.