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.
git clone --depth 1 https://github.com/verdexhq/verdex-mcpWrote 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.
[](https://agentmods.dev/rules/verdexhq/verdex-mcp/selector-writing-guide)<a href="https://agentmods.dev/rules/verdexhq/verdex-mcp/selector-writing-guide"><img src="https://agentmods.dev/badge/rules/verdexhq/verdex-mcp/selector-writing-guide/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.
<a href="https://agentmods.dev/rules/verdexhq/verdex-mcp/selector-writing-guide"><img src="https://agentmods.dev/badge/rules/verdexhq/verdex-mcp/selector-writing-guide.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00115 | $0.06040 |
| Opus 5.5 | $0.00046 | $0.02416 |
| Sonnet 5.5 | $0.00023 | $0.01208 |
| Haiku 4.5 | $0.00012 | $0.00604 |
Grade A, and why
selector-writing-guide 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 3mo 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.
How it starts
The opening of the file, as written. The whole thing — 852 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Verdex Selector Writing Guide: From Exploration to Production-Ready Selectors
A comprehensive guide for writing stable, role-first Playwright selectors using Verdex MCP's progressive disclosure tools.
Table of Contents
- Core Principles
- The Verdex Workflow
- The Winning Pattern
- Tool Usage Guide
- Real-World Example Walkthrough
- Common Pitfalls & Solutions
- Selector Pattern Library
- Token Efficiency Guidelines
- Quick Reference
Core Principles
✅ Always Follow This Priority Order:
- Check uniqueness FIRST - If an element is unique on the page, don't over-scope
- Use Playwright built-in locators -
getByRole(),getByTestId(),getByLabel(), etc. - Container → Content → Role pattern - Scope to stable containers, filter by content, target by role
- Minimal chain depth - Keep selector chains ≤ 2-3 levels deep
- Role-first targeting - Always end with semantic roles when possible
❌ Never Do These:
- ❌ Positional selectors:
.nth(0),.first(),.last() - ❌ Old locator syntax:
locator("text=..."),locator("role=...")(usegetByText(),getByRole()) - ❌ Parent traversal:
.locator('..') - ❌ Excessive nesting: 4+ level chains like
div > div > div > button - ❌ Class-only selectors:
.locator('div.class1.class2.class3') - ❌ Filter in wrong place: Filtering buttons by text that's in sibling elements
The Verdex Workflow
Step-by-Step Process
graph TD
A[1. browser_navigate] --> B[2. browser_snapshot]
B --> C{Element Unique?}
C -->|Yes| D[Use simple selector]
C -->|No| E[3. resolve_container]
E --> F{Found stable anchor?}
F -->|Test ID/Landmark| G[Use as container]
F -->|Generic divs| H[4. inspect_pattern]
H --> I[5. extract_anchors if needed]
I --> G
G --> J[Generate selector]
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.
- 3mo ago First seen · 852 lines · 115 tokens per session scan A 9817b339b011
selector-writing-guide is a cursor rule published in the GitHub repository verdexhq/verdex-mcp (17 stars, last pushed 11mo ago), licensed Apache-2.0. It adds 115 tokens to every session and 6,040 once invoked, about $0.0005 per session on Opus 5.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-30.
selector-writing-guide compared with cursor rules from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| selector-writing-guideverdexhq/verdex-mcp | Cursor rule | 17 | 11mo ago | Apache-2.0 | A | 115 | Cursor |
| puppeteersanjeed5/awesome-cursor-rules-mdc | Cursor rule | 3.6k | 9d ago | CC0-1.0 | A | 1,826 | Cursor |
| playwright-rulesbeel-collab/presets.dev | Cursor rule | 3 | 9d ago | MIT | A | 0 | Cursor |
| vasu-playwright-utilsvasu31dev/playwright-ts-lib | Cursor rule | 25 | 8mo ago | MIT | A | 14 | Cursor |
| qa-script-executorazam-sdet/10xquality | Cursor rule | 2 | 8mo ago | MIT | A | 0 | Cursor |
| playwrightTideTree/awesome-cursor-rules-mdc-zh | Cursor rule | 14 | 8mo ago | none | A | 0 | Cursor |
| playwrightnedcodes-ok/cursor-doctor | Cursor rule | 10 | 8mo ago | MIT | A | 643 | Cursor |