UI Debug Agent logo

UI Debug Agent

Community
anhtester
UI Debug Agent

Skill inspect web/mobile applications bằng browser tools, phân tích DOM elements, xác định locators ổn định, debug UI automation failures, và hỗ trợ sinh Page Object classes.

Overview

Publisheranhtester
Repositoryantigravity-testing-kit
Skill nameUI Debug Agent
Stars
149
Forks
57
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by anhtester on GitHub. Read the source before you install it.

Installation

Install the UI Debug Agent AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/anhtester/antigravity-testing-kit/tree/main/.agent/skills/ui_debug_agent
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/anhtester/antigravity-testing-kit.git /tmp/antigravity-testing-kit
mkdir -p .claude/skills
cp -r /tmp/antigravity-testing-kit/.agent/skills/ui_debug_agent .claude/skills/anhtester-ui-debug-agent
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable UI Debug Agent in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads UI Debug Agent on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so UI Debug Agent is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

UI Debug Agent

Description

Skill chuyên biệt giúp agent inspect ứng dụng web/mobile trực tiếp trên browser thật, phân tích DOM, thu thập locators ổn định, và debug các vấn đề UI automation.

Agent có thể:

  • Mở browser thật, navigate đến bất kỳ URL nào
  • Inspect DOM elements — xác định attributes, hierarchy, state
  • Thu thập locators ổn định cho Playwright, Selenium, Appium
  • Debug automation failures (element not found, click intercepted, timeout)
  • Capture UI state (snapshot, screenshot) để phân tích
  • Phân tích dynamic content, iframe, shadow DOM, SPA navigation

When to Use

Sử dụng skill này khi:

  • Cần khám phá UI của một trang web/module mới
  • Cần tìm locator cho element cụ thể
  • Cần debug test automation fail do UI thay đổi
  • Cần verify locator có hoạt động trên DOM thực tế không
  • Cần phân tích DOM để hiểu cấu trúc UI (forms, tables, modals)
  • Cần capture evidence (screenshot) cho test report

Trigger keywords: "inspect UI", "tìm locator", "debug element", "mở browser xem", "kiểm tra DOM"


MCP Command Sequence (BẮT BUỘC)

Khi sử dụng Playwright MCP để debug UI, LUÔN tuân theo thứ tự:

1. browser_navigate(url)           → Mở trang
2. browser_resize(1920, 1080)      → Desktop viewport
3. browser_wait_for(text/time)     → Chờ page load
4. browser_snapshot()              → Thu thập DOM (dùng để phân tích + tìm locator)
5. browser_click/type/hover(ref)   → Tương tác (nếu cần)
6. browser_take_screenshot()       → Chụp ảnh (evidence khi fail hoặc milestone)

Quy tắc quan trọng:

Quy tắcChi tiết
KHÔNG navigate lại nếu đã ở đúng trangTránh reload ngoài ý muốn
LUÔN resize ngay sau navigatebrowser_resize(1920, 1080) — đảm bảo desktop viewport
LUÔN wait trước khi snapshotChờ page load hoàn tất
Dùng snapshot để phân tíchSnapshot trả về accessibility tree — nhanh, chính xác, có ref để tương tác
Dùng screenshot để báo cáoScreenshot là hình ảnh — dùng khi cần evidence visual

Snapshot vs Screenshot

browser_snapshotbrowser_take_screenshot
Trả vềAccessibility tree (text + ref IDs)Hình ảnh (PNG/JPEG)
Mục đíchPhân tích DOM, tìm locator, xác định elementVisual evidence, báo cáo, debug layout
Khi nào dùng⭐ Luôn dùng trước khi tương tácChỉ khi fail hoặc milestone quan trọng
Có ref để interact✅ Có — dùng ref để click/type/hover❌ Không — chỉ là hình ảnh
Tốc độNhanhChậm hơn

Quy tắc: Ưu tiên snapshot cho phân tích, dùng screenshot cho evidence.


Quy trình Inspect UI

1. Mở & Chuẩn bị trang

browser_navigate → URL target
browser_resize → 1920 × 1080
browser_wait_for → chờ indicator page đã load (text hoặc thời gian)

Nếu trang yêu cầu đăng nhập:

  • Hỏi user credentials HOẶC dùng fixture sẵn có trong project
  • KHÔNG đọc file .env trực tiếp (quy tắc bảo mật)

2. Thu thập DOM Structure

browser_snapshot → accessibility tree

Từ snapshot, xác định:

  • Các element chính: buttons, inputs, links, headings, tables
  • Attributes quan trọng: role, name, label, placeholder, testid
  • Hierarchy: parent → child relationships
  • State: visible, enabled, disabled, checked, expanded

3. Xác định Locators

Với mỗi element cần locator, áp dụng priority order theo framework:

Playwright:

PriorityLocatorVí dụKhi nào dùng
1 ⭐getByRole()getByRole('button', {name: 'Submit'})Element có role + accessible name rõ ràng
2getByLabel()getByLabel('Email')Form input có label
3getByPlaceholder()getByPlaceholder('Enter email')Input có placeholder, không có label
4getByText()getByText('Welcome back')Text content unique
5getByTestId()getByTestId('submit-btn')Element có data-testid attribute
6CSSpage.locator('.submit-button')Không có semantic option nào phù hợp
7XPathpage.locator('//div[@class="x"]')Last resort — tránh dùng

Selenium:

PriorityLocatorVí dụ
1 ⭐By.id()By.id("email")
2By.cssSelector("[data-testid]")By.cssSelector("[data-testid='submit']")
3By.name()By.name("username")
4By.cssSelector()By.cssSelector(".login-form button")
5By.xpath()By.xpath("//button[text()='Login']")

Appium (Mobile):

PriorityLocatorVí dụ
1 ⭐Accessibility IDMobileBy.accessibilityId("loginButton")
2ID (resource-id)MobileBy.id("com.app:id/login_btn")
3NameMobileBy.name("Login")
4XPath (relative)MobileBy.xpath("//android.widget.Button[@text='Login']")

4. Verify Locator

Sau khi xác định locator, bắt buộc verify trên DOM thực tế:

browser_snapshot → tìm element bằng ref
browser_click/type(ref) → thử tương tác
browser_snapshot → xác nhận kết quả

Locator được chấp nhận khi:

  • Unique trên page (chỉ match 1 element)
  • Ổn định qua nhiều lần reload
  • Không chứa dynamic class (css-xxx, sc-xxx, MuiXxx-root)
  • Không chứa positional xpath (//div[3]/button[2])
  • Không phụ thuộc auto-generated attribute

Xử lý tình huống đặc biệt

Trang yêu cầu đăng nhập

  • Dùng fixture login sẵn có trong project hoặc hỏi user credentials
  • KHÔNG đọc .env trực tiếp
  • Sau khi login, navigate đến trang cần inspect

Modal / Dialog / Popup

  • Modal thường là overlay trên page chính
  • browser_snapshot sẽ thấy modal content trong accessibility tree
  • Tương tác với modal elements bằng ref từ snapshot
  • Chờ modal animation hoàn thành trước khi interact

Iframe

  • browser_snapshot có thể không thấy content trong iframe
  • Dùng browser_evaluate để switch vào iframe:
    javascript
    () => document.querySelector('iframe').contentDocument.body.innerHTML
  • Hoặc dùng Playwright frame locator: page.frameLocator('#iframe-id')

Shadow DOM

  • Playwright locator() tự động pierce shadow DOM
  • Selenium cần shadowRoot.findElement()
  • browser_snapshot có thể thấy shadow DOM content tùy MCP version

Dynamic Content (SPA / AJAX)

  • Chờ content load bằng browser_wait_for(text) trước khi snapshot
  • Nếu content load lazy → scroll xuống trước, rồi snapshot
  • Nếu content thay đổi theo thời gian → chụp snapshot nhiều lần

Tables / Lists (nhiều elements lặp)

  • Xác định pattern locator cho row/cell
  • Dùng nth() hoặc filter() để target element cụ thể
  • Ví dụ Playwright: page.getByRole('row').filter({hasText: 'John'}).getByRole('button', {name: 'Edit'})

Element bị che (Overlay / Toast)

  • Kiểm tra z-index, opacity, visibility trong DOM
  • Chờ overlay biến mất: browser_wait_for(textGone: 'Loading...')
  • Nếu toast notification che button → chờ toast timeout

Anti-Patterns (FORBIDDEN)

❌ Sai✅ ĐúngLý do
Đoán locator từ tên tính năngInspect DOM thực tế rồi mới lấy locatorLocator chính xác 100%
Dùng screenshot để chọn locatorDùng snapshot (accessibility tree)Snapshot có ref, screenshot thì không
Copy locator từ code cũ không verifyLuôn verify locator trên browser hiện tạiDOM có thể đã thay đổi
Dùng dynamic class .css-1abcDùng role/label/testidDynamic class thay đổi mỗi build
Dùng positional xpath //div[3]Dùng relative xpath hoặc CSSPositional xpath dễ vỡ
Chụp screenshot liên tụcChỉ screenshot khi fail hoặc milestoneTốn resource, chậm
Navigate lại khi đã ở đúng trangChỉ navigate khi cần đổi URLTránh reload không cần thiết

Output

Skill này có thể trả về:

  • Locator recommendations — bảng primary + fallback cho mỗi element
  • DOM analysis — cấu trúc element, attributes, state, hierarchy
  • Page Object suggestions — class structure phù hợp cho trang đã inspect
  • Screenshots — evidence visual tại các milestone
  • Debug findings — nguyên nhân element not found / click fail + cách fix

Rules References

Agent PHẢI tuân thủ các rules chi tiết:

  • .agent/rules/locator_strategy.md — Master locator priority map
  • .agent/rules/playwright_rules.md — Playwright browser setup and locator rules
  • .agent/rules/selenium_rules.md — Selenium locator and wait rules
  • .agent/rules/appium_rules.md — Appium mobile locator rules
  • .agent/rules/automation_rules.md — General automation best practices

Frequently asked questions

What does the UI Debug Agent AI skill do?

Skill inspect web/mobile applications bằng browser tools, phân tích DOM elements, xác định locators ổn định, debug UI automation failures, và hỗ trợ sinh Page Object classes.

Why use UI Debug Agent on TypingMind?

Because you install it once and use it with any model. UI Debug Agent is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install UI Debug Agent in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/anhtester/antigravity-testing-kit/tree/main/.agent/skills/ui_debug_agent. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use UI Debug Agent?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with UI Debug Agent?

As many as you like. As long as a model supports skills, you can use UI Debug Agent with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the UI Debug Agent AI skill free?

Yes. It is published on GitHub by anhtester under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇