refactor

A cleanup assistant for Playwright tests that reorganizes test code into shared page objects, fixtures, and consistent test sections. Page objects keep page actions and locators in reusable files.

In plain words
What is it for?
Use it on an existing test file or code snippet to extract page objects and fixtures, add Arrange/Act/Assert sections, group cases, and replace raw browser commands.
Why use it?
It removes brittle selectors, repeated code, unclear test structure, and technical test names that make browser tests harder to maintain.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/kint4/autoframe/refactor
Any agent
npx skills add kint4/autoframe --skill refactor
Clone the repo
git clone --depth 1 https://github.com/kint4/autoframe

Made for: Claude Code, Codex.

Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 466 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00037 $0.00466
Opus 5 $0.00018 $0.00233
Sonnet 5 $0.00007 $0.00093
Haiku 4.5 $0.00004 $0.00047

Measured yesterday against content hash 0ea8ef2b63a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/refactor/SKILL.md · 46 lines

What it actually says

/refactor — Refactor to Autoframe Conventions

Type: Maintenance Description: Takes existing, messy Playwright tests and restructures them to follow Autoframe conventions — extracting Page Objects, applying AAA, grouping tests, and replacing brittle selectors.


Input Format

  • A path to an existing spec or test file (or a pasted snippet)
  • Optionally, a target feature name

Output Format

The refactored file(s) following Autoframe conventions, plus a short changelog of what was changed and why. May produce a new Page Object and/or fixture as part of the refactor.

Step-by-Step Instructions

  1. Read the target file and any related Page Objects/fixtures.
  2. Read the POM, spec, and fixture conventions in CLAUDE.md.
  3. Diagnose convention violations:
    • Raw locators / page.$() / CSS selectors in tests → extract into a Page Object using semantic locators.
    • Inline locators in Page Object methods → move to the constructor.
    • Missing AAA structure → add Arrange / Act / Assert.
    • Ungrouped tests → wrap in Happy Path / Negative / Edge describe blocks.
    • Technical test names → rewrite in plain language.
    • Raw page where a fixture exists → switch to the custom fixture.
  4. Apply the refactor incrementally, preserving the original test intent and assertions.
  5. Extract a Page Object and fixture if the logic belongs there.
  6. Save files to their correct locations per the folder structure.
  7. Output a changelog: what moved, what was renamed, what was replaced.

Rules

  • Preserve test behavior — never silently drop assertions.
  • Preserving scope may leave Negative/Edge describe groups empty — do not invent coverage the original didn't have. Instead, note the gap in the changelog and hand off to /new-spec to fill it.
  • Never introduce waitForTimeout or CSS selectors during a refactor.
  • Place all new files in their conventional locations.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 46 lines · 37 tokens per session scan A 0ea8ef2b63a9

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository kint4/autoframe (6 stars, last pushed 2mo ago), licensed MIT. It adds 37 tokens to every session and 466 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

tokenless

Use when a task can be delegated through the globally installed Tokenless CLI without directly writing to the workspace; route it to a visible AI provider website to save agent tokens.

jazelly/tokenless · 37 tokens

tokenless-install

Install, upgrade, repair, and verify Tokenless, its agent skills, and local Playwright runtime. Use only when the user explicitly asks for installation, upgrade, repair, browser sign-in handoff, a failed doctor check, or an installation integrity check.

jazelly/tokenless · 56 tokens

agent-qa-authoring

Use when creating, editing, validating, or running agent-qa tests, suites, or hooks. Prefer agent-qa MCP tools, enforce canonical agent-qa IDs, and use the bundled schema reference to avoid hallucinated config keys or YAML fields.

vostride/agent-qa · 56 tokens

agent-qa-debug-fix

Use after an agent-qa run has failed and you need to debug, patch, and verify the issue using MCP evidence, logs, artifacts, and local code changes instead of generated fix suggestions.

vostride/agent-qa · 46 tokens

linggan-talking-cards

将中文或英文口播文案与可选截图拆成 3–10 张 PPT 式演示卡片,输出文字准确的 PNG 卡片、结构化 manifest 和带逐卡口播台词的响应式 HTML 预览页。支持 3:4、16:9、9:16、4:3 四种比例,以及苹果白色毛玻璃、糖果、Obsidian、新丑风等 10 种视觉系统;适用于“口播文案拆解PPT生多图”“把逐字稿做成卡片”“给口播配 slides”“截图放进讲解卡片”“生成多图和预览页”“换一种 PPT 风格”以及修改指定卡片的请求。.

yihui-dev/linggan-talking-cards · 168 tokens

k6-load-testing

Comprehensive k6 load testing skill for API, browser, and scalability testing. Write realistic load scenarios, analyze results, and integrate with CI/CD.

LiHongwei-cn/lihongwei-cn · 35 tokens