Agent skill

Playwright Page Objects

by bartstc in 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.

MITAuto-check: notesTesting & QA

Install Playwright Page Objects

skills CLI
$ npx skills add bartstc/vite-ts-react-template --skill playwright-page-objects -a claude-code

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

GitHub CLI
$ gh skill install bartstc/vite-ts-react-template playwright-page-objects --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/bartstc/vite-ts-react-template.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/playwright-page-objects .claude/skills/playwright-page-objects && 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
playwright-page-objects
GitHub stars
122
Token cost
~1k tokens
SKILL.md length
297 words
Files
5 (incl. references)
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 10 steps: Fixtures over PageManager — On-demand… → Composition over inheritance — Compose… → Role-based selectors first — getByRole()… → …
  • Creating page objects
  • SKILL.md covers When to Apply, Core Principles, Quick Reference and Locator Priority, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Playwright Page Objects is an agent skill from bartstc/vite-ts-react-template. Use when creating page objects or refactoring Playwright E2E tests for better maintainability with Page Object Model patterns.

Its SKILL.md is about 1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `references/anti-patterns.md`, `references/core-patterns.md` and `references/fixtures-pattern.md`).

It sits in Testing & QA, covering Browser testing, End-to-end testing and Refactoring. It works with Playwright, React and TypeScript. The repository describes itself as: This project provides a basic dev setup intended for Single Page Application (SPA) development. It contains key tools, settings for seamless DX, and an demo app presenting good… The licence is MIT.

When your agent uses it

  • Creating page objects
  • Refactoring Playwright E2E tests for better maintainability with Page Object Model patterns

Example prompts

  • “/playwright-page-objects”

Requirements

  • Pre-approved tools (allowed-tools): Bash, Read, Write, Edit

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Fixtures over PageManager — On-demand instantiation, automatic setup/teardown, native TypeScript inference
  2. Composition over inheritance — Compose from focused components, avoid deep class hierarchies
  3. Role-based selectors first — getByRole() > getByLabel() > getByText() > getByTestId()
  4. Tests own assertions — Page objects expose state via getters, tests make assertions
  5. Separate pages by workflow — ProductListPage ≠ ProductDetailsPage (different user interactions)
  6. Readonly locators — All page object locator properties should be readonly
  7. Fluent interfaces — Methods return this for chaining; navigation methods return target page object
  8. Private internals — Mark implementation details (spinners, retry logic, helpers) as private
  9. Wait for stability — Use waitForPageLoad(), waitForResponse() before assertions
  10. High-level actions — Create AppActions class for complex multi-page user flows

What it can do on your machine

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

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash
    • Read
    • Write
    • Edit

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

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

  • Network

    No URLs in SKILL.md.

    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

Playwright Page Objects loads about 1k tokens when it runs, and up to ~8.2k if it reads all its reference files. Until then it costs about 38 tokens; SKILL.md has 297 words of instructions outside code blocks.

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

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: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Bash, Read, Write, Edit

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 bartstc/vite-ts-react-template at commit 6aa5c9c, republished under its MIT licence (© bartstc). 297 words, ~1,036 tokens.

Download SKILL.mdSave it as .claude/skills/playwright-page-objects/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
playwright-page-objects
description
Use when creating page objects or refactoring Playwright E2E tests for better maintainability with Page Object Model patterns.
allowed-tools
Bash, Read, Write, Edit

Playwright Page Objects

Modern POM architecture using Playwright's fixtures pattern, composition over inheritance, and role-based locators.

When to Apply

  • Setting up E2E test architecture from scratch
  • Creating new page objects or component helpers
  • Implementing test fixtures for dependency injection
  • Refactoring existing page objects for maintainability
  • Writing reusable component-level test abstractions

Core Principles

  1. Fixtures over PageManager — On-demand instantiation, automatic setup/teardown, native TypeScript inference
  2. Composition over inheritance — Compose from focused components, avoid deep class hierarchies
  3. Role-based selectors first — getByRole() > getByLabel() > getByText() > getByTestId()
  4. Tests own assertions — Page objects expose state via getters, tests make assertions
  5. Separate pages by workflow — ProductListPage ≠ ProductDetailsPage (different user interactions)
  6. Readonly locators — All page object locator properties should be readonly
  7. Fluent interfaces — Methods return this for chaining; navigation methods return target page object
  8. Private internals — Mark implementation details (spinners, retry logic, helpers) as private
  9. Wait for stability — Use waitForPageLoad(), waitForResponse() before assertions
  10. High-level actions — Create AppActions class for complex multi-page user flows

Quick Reference

PatternWhen to UseReference
FixturesAlways for page object instantiationfixtures-pattern.md
Basic POMAll page objectscore-patterns.md
CompositionShared UI elements (header, cards, modals)core-patterns.md
Waiting strategiesLoading states, API responsescore-patterns.md
High-level actionsMulti-page flows (checkout, onboarding)core-patterns.md
Form handlingMulti-step forms, validationform-handling.md

Locator Priority

1. page.getByRole('button', { name: 'Add to Cart' })  // Preferred
2. page.getByLabel('Email')                           // Form inputs
3. page.getByText('Welcome back')                     // Non-interactive
4. page.getByPlaceholder('Search...')                 // When no label
5. page.getByTestId('cart-item-count')                // Escape hatch

Anti-Patterns Summary

Anti-PatternProblemSolution
Assertions in POMsHidden test logicExpose state, assert in tests
Fat page objects50+ locators unmaintainableSplit into components
Deep inheritanceRigid, hard to modifyUse composition
CSS selectorsBreak on styling changesUse role-based selectors
Wrapping PlaywrightUnnecessary abstractionUse Playwright directly
All members publicExposes internalsMark internal members private

References

© bartstc, 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 4 other files (references) in .agents/skills/playwright-page-objects of bartstc/vite-ts-react-template.

  • SKILL.md
  • references/anti-patterns.md
  • references/core-patterns.md
  • references/fixtures-pattern.md
  • references/form-handling.md

Open the folder on GitHubat commit 6aa5c9c

Compare with similar skills

Playwright Page Objects 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.

Playwright Page Objects compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Playwright Page Objects this skillbartstc/vite-ts-react-template122—~1kAutomated safety check: NotesMIT
Frontend Typescript Testingshinpr/ai-coding-project-boilerplate232—~1.5kAutomated safety check: PassMIT
Frontend Typescript Testingshinpr/ai-coding-project-boilerplate232—~843Automated safety check: PassMIT
Frontend Typescript Testingshinpr/ai-coding-project-boilerplate232—~692Automated safety check: PassMIT
RStudio Selenium to Playwright Migrationrstudio/rstudio5.1k—~3.6kAutomated safety check: PassCustom licence
Playwright Coretestdino-hq/playwright-skill3851 repos~1.4kAutomated safety check: PassMIT

Similar skills

  • Frontend Typescript Testing

    shinpr/ai-coding-project-boilerplate

    Designs frontend tests using the repository's configured React test and browser harnesses, including RTL, MSW, Vitest, and Playwright when present.

    232 GitHub stars~1.5k tokensUpdated 3 days ago
    Testing & QAAuto-check passed
  • Frontend Typescript Testing

    shinpr/ai-coding-project-boilerplate

    リポジトリで設定済みのReactテスト・ブラウザハーネスを使用してフロントエンドテストを設計。RTL、MSW、Vitest、Playwrightが存在する場合に適用。コンポーネント、loading/error state、統合、フロントエンドE2Eテストの追加・レビュー時に使用。

    232 GitHub stars~843 tokensUpdated 3 days ago
    Testing & QAAuto-check passed
  • Frontend Typescript Testing

    shinpr/ai-coding-project-boilerplate

    使用仓库已配置的 React 测试与浏览器测试工具(包括 RTL、MSW、Vitest,以及存在时的 Playwright)设计前端测试。适用于新增或评审组件测试、加载/错误状态测试、集成测试或前端 E2E 测试时。

    232 GitHub stars~692 tokensUpdated 3 days ago
    Testing & QAAuto-check passed
  • Converts RStudio Python Selenium electron tests into TypeScript Playwright tests, checking each against a live RStudio before counting it as migrated.

    5.1k GitHub stars~3.6k tokensUpdated today
    Testing & QAAuto-check passed
  • Playwright Core

    testdino-hq/playwright-skill

    Battle-tested Playwright patterns for writing and debugging reliable E2E, API, component, visual, accessibility, and security tests.

    385 GitHub starsUsed in 1 repo~1.4k tokens
    Testing & QAAuto-check passed
  • Svelte Testing

    spences10/sveltest

    Fix and create Svelte 5 tests with vitest-browser-svelte and Playwright.

    113 GitHub stars~579 tokensUpdated yesterday
    Testing & QAAuto-check passed

More from bartstc/vite-ts-react-template

  • GitHub Actions Templates

    bartstc/vite-ts-react-template

    Create production-ready GitHub Actions workflows for automated testing, building, and deploying applications.

    122 GitHub starsUsed in 13 repos~1.9k tokens
    Auto-check passed
  • Commit Work

    bartstc/vite-ts-react-template

    Create high-quality git commits: review/stage intended changes, split into logical commits, and write clear commit messages (including Conventional Commits).

    122 GitHub starsUsed in 3 repos~623 tokens
    Auto-check passed
  • Writing Spec

    bartstc/vite-ts-react-template

    Collaboratively write a feature spec with the developer. An agent skill from bartstc/vite-ts-react-template.

    122 GitHub stars~3.4k tokensUpdated yesterday
    Auto-check passed
  • Explaining Code

    bartstc/vite-ts-react-template

    Explains code with visual diagrams and analogies. An agent skill from bartstc/vite-ts-react-template.

    122 GitHub starsUsed in 2 repos~154 tokens
    Auto-check passed
  • Building Blocks

    bartstc/vite-ts-react-template

    Frontend building block catalog — typed patterns for components, hooks, queries, mutations, stores, and models.

    122 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check passed
  • Test Building Blocks

    bartstc/vite-ts-react-template

    Test building block catalog — typed patterns for Storybook play-function tests, Vitest hook tests, Vitest unit tests, MSW handlers, and test data fixtures.

    122 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Playwright Page Objects

What does Playwright Page Objects do?

A skill your agent uses when creating page objects or refactoring Playwright E2E tests for better maintainability with Page Object Model patterns. Playwright Page Objects is an agent skill from bartstc/vite-ts-react-template. Use when creating page objects or refactoring Playwright E2E tests for better maintainability with Page Object Model patterns.

When should I use Playwright Page Objects?

Playwright Page Objects fits situations like: creating page objects; refactoring Playwright E2E tests for better maintainability with Page Object Model patterns.

How do I install Playwright Page Objects in Claude Code?

Run `npx skills add bartstc/vite-ts-react-template --skill playwright-page-objects -a claude-code`. Or copy the skill folder (.agents/skills/playwright-page-objects in bartstc/vite-ts-react-template) into .claude/skills/playwright-page-objects in your project. Claude Code loads it when a task matches its description.

How do I install Playwright Page Objects in Codex?

Run `npx skills add bartstc/vite-ts-react-template --skill playwright-page-objects -a codex`. Or copy the skill folder (.agents/skills/playwright-page-objects in bartstc/vite-ts-react-template) into .agents/skills/playwright-page-objects in your project. Codex loads it when a task matches its description.

Can I use Playwright Page Objects 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 bartstc/vite-ts-react-template --skill playwright-page-objects -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/playwright-page-objects, .gemini/skills/playwright-page-objects, .github/skills/playwright-page-objects and .opencode/skills/playwright-page-objects in your project.

What does Playwright Page Objects need to run?

SKILL.md names no scripts, command-line tools or credentials: Playwright Page Objects is instructions for the agent only. Its frontmatter pre-approves these tools: Bash, Read, Write, Edit.

Does Playwright Page Objects access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Playwright Page Objects safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Playwright Page Objects use?

Playwright Page Objects 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 Playwright Page Objects use?

About 1k tokens (SKILL.md is roughly 4.1k 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 7.2k tokens, read only when the agent opens those files.

What are the alternatives to Playwright Page Objects?

Skills that share tags, products or a category with Playwright Page Objects: Frontend Typescript Testing (shinpr/ai-coding-project-boilerplate, 232 stars), Frontend Typescript Testing (shinpr/ai-coding-project-boilerplate, 232 stars), Frontend Typescript Testing (shinpr/ai-coding-project-boilerplate, 232 stars) and RStudio Selenium to Playwright Migration (rstudio/rstudio, 5.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Playwright Page Objects?

bartstc (a GitHub user) maintains it in bartstc/vite-ts-react-template, which has 122 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 6, 2026.

Source: bartstc/vite-ts-react-template on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.