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.svg" alt="Measured on agentmods" 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 | $0.00057 | $0.03020 |
| Sonnet 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 6d 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.
- 6d 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 8mo ago), licensed Apache-2.0. It adds 115 tokens to every session and 6,040 once invoked, about $0.0006 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-30.
Other cursor rules, from other repositories
puppeteer
This guide provides opinionated, actionable best practices for writing robust, performant, and maintainable Puppeteer scripts for web scraping, automation, and testing. It emphasizes modern patterns like page.locator() and efficient resource management.
vasu-playwright-utils
../../templates/cursor-rules/vasu-playwright-utils.mdc.
qa-script-executor
QA Script Executor - Executes natural language test scripts using Chrome DevTools MCP and enhances them with technical hints.
playwright
A set of guidelines for Playwright, a tool that controls a web browser to test websites and web applications.
playwright
Playwright: e2e testing, page objects, fixtures, assertions.
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.