ClaudeCode_Playwright_Demo: Command for Claude Code

.claude/commands/generate_automation_from_ui_flow.md

generate_automation_from_ui_flow is a command for Claude Code from anhtester/ClaudeCode_Playwright_Demo. It costs 36 tokens per session (2,827 once invoked), scanned A, a copy of generate_automation_from_ui_flow, MIT.

A workflow that uses a real browser to follow described interface steps, inspect the page's actual structure, and create automation scripts.

In plain words
What is it for?
It is for building Playwright, Selenium, or Appium automation from a UI flow, while checking failed tests and revising the result.
Why use it?
It avoids guessing selectors by collecting them from the live page before generating the script.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is anhtester/ClaudeCode_Playwright_Demo's own configuration. It tells Claude Code how to work on ClaudeCode_Playwright_Demo itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ClaudeCode_Playwright_Demo configures →

Reuse

Borrowing it

Nothing to install: this file belongs to anhtester/ClaudeCode_Playwright_Demo. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/anhtester/ClaudeCode_Playwright_Demo/main/.claude/commands/generate_automation_from_ui_flow.md
Clone the repo
git clone --depth 1 https://github.com/anhtester/ClaudeCode_Playwright_Demo

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for generate_automation_from_ui_flow

README.md
[![agentmods](https://agentmods.dev/badge/commands/anhtester/claudecode_playwright_demo/generate_automation_from_ui_flow/github.svg)](https://agentmods.dev/commands/anhtester/claudecode_playwright_demo/generate_automation_from_ui_flow)
Your own site
<a href="https://agentmods.dev/commands/anhtester/claudecode_playwright_demo/generate_automation_from_ui_flow"><img src="https://agentmods.dev/badge/commands/anhtester/claudecode_playwright_demo/generate_automation_from_ui_flow/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for generate_automation_from_ui_flow

Your own site · 80×15
<a href="https://agentmods.dev/commands/anhtester/claudecode_playwright_demo/generate_automation_from_ui_flow"><img src="https://agentmods.dev/badge/commands/anhtester/claudecode_playwright_demo/generate_automation_from_ui_flow.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,827 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 89% copy Near-identical to another mod 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.1 $0.00036 $0.02827
Opus 5 $0.00018 $0.01413
Sonnet 5 $0.00007 $0.00565
Haiku 4.5 $0.00004 $0.00283

Measured 8d ago against content hash f6fc3dea68b5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

generate_automation_from_ui_flow 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 8d ago.

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.

Origin

This is a copy

89% identical to generate_automation_from_ui_flow — 20 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/commands/generate_automation_from_ui_flow.md · 278 lines

How it starts

The opening of the file, as written. The whole thing — 278 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Workflow: Sinh Automation từ UI Flow

BẮT BUỘC (MANDATORY SKILL): Bạn PHẢI nạp và đọc kỹ nội dung của skill ui_debug_agent (tại .agent/skills/ui_debug_agent/SKILL.md) trước khi bắt đầu. Ngoài ra tham khảo thêm skill smart_locator_agent để sinh locator ổn định và qa_automation_engineer cho quy tắc automation chung.

Workflow này giúp agent thực thi trực tiếp một chuỗi thao tác UI trên browser thật, thu thập locators từ DOM thực tế, và sinh automation scripts hoàn chỉnh — tất cả trong một luồng tự động, không cần manual test case có sẵn.

⚠️ Nguyên tắc thực thi

  • Tất cả output bằng Tiếng Việt
  • TUYỆT ĐỐI KHÔNG ĐOÁN locator — phải lấy từ DOM thực tế bằng MCP browser tools
  • Phải chạy từng bước UI trên browser thật trước khi sinh code
  • Desktop viewport 1920×1080 cho tất cả UI debugging
  • ⚠️ Rule E3: Khi test FAIL → tự đọc log → phân tích → sửa → chạy lại. KHÔNG hỏi user

Workflow này khác gì generate_automation_from_testcases?

from_testcases from_ui_flow (workflow này)
Input File manual test cases có sẵn Mô tả UI steps bằng lời hoặc URL + hành động
Approach Đọc TC → inspect UI → sinh code Chạy thật trên browser → thu thập locator → sinh code
Khi nào dùng Đã có test case document Chưa có TC, chỉ biết "vào trang này, click cái kia"

Input cần thu thập

Agent cần ít nhất 1 trong các input sau từ user:

Input Ví dụ Độ ưu tiên
URL + UI steps mô tả "Vào https://example.com, login, tạo user mới" ⭐ Phổ biến nhất
URL + recording/video User cung cấp video thao tác Tùy chọn
URL + screenshots User cung cấp ảnh chụp từng bước Tùy chọn
Chỉ URL "Automate login flow của trang này" Agent tự khám phá

Nếu user chưa cung cấp đủ → hỏi:

  • URL ứng dụng?
  • Mô tả flow cần automate (từng bước)?
  • Credentials nếu cần đăng nhập?
  • Framework mong muốn? (mặc định: Playwright + TypeScript)

Các bước thực hiện

Read the full file on GitHub · 278 lines

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. 8d ago First seen · 278 lines · 36 tokens per session scan A f6fc3dea68b5

Subscribe to this mod's changes

generate_automation_from_ui_flow is a command published in the GitHub repository anhtester/ClaudeCode_Playwright_Demo (2 stars, last pushed 3mo ago), licensed MIT. It adds 36 tokens to every session and 2,827 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 89% identical to generate_automation_from_ui_flow, differing in 20 lines, and is treated as a copy.