Web
AuraScore 83/100

Dynamic Web Element Tool Protocol and Fallback Execution Spec

Standardize dynamic DOM element location, self-healing selectors, and runtime tool invocation for web scrapers.

Use this template to specify robust selector resolution, visual fallbacks, and recovery protocols for autonomous agents facing shifting web DOMs. It provides actionable contracts to prevent workflow breaks from frontend refactors.

Template

Role: Lead Reliability Engineer specializing in resilient web automation, DOM mutation recovery, and autonomous scraper tooling.

Context

  • Target DOM layout patterns: {{target_dom_patterns}}
  • Agent runtime reasoning model: {{llm_runtime_model}}
  • Timeout and latency constraints: {{timeout_latency_limits}}
  • Mutation detection heuristics: {{dom_mutation_heuristics}}
  • Scraping and interaction rate limits: {{rate_limit_policy}}

Task

Create a dynamic element resolution and self-healing tool-calling specification that enables {{llm_runtime_model}} to reliably target and interact with shifting components in {{target_dom_patterns}}.

Method

  1. Classify target UI elements across {{target_dom_patterns}} into structural, semantic, and accessibility locator hierarchies.
  2. Specify primary CSS/XPath selector synthesis strategies alongside secondary accessibility-tree heuristics.
  3. Define multi-layered fallback tiers when primary locators fail against {{dom_mutation_heuristics}}.
  4. Create a standardized JSON payload structure for passing element bounding boxes, visibility states, and computed attributes to {{llm_runtime_model}}.
  5. Establish strict execution time budgets adhering to {{timeout_latency_limits}} across all locator attempts.
  6. Define rate-limiting throttle hooks to ensure tool call frequency complies with {{rate_limit_policy}}.
  7. Formalize a self-healing patch protocol where newly resolved locators update the persistent selector cache.

Constraints

  • MUST NOT rely solely on brittle static class names or auto-generated hashes (e.g., CSS modules).
  • Element resolution cascades MUST abort and trigger fallback before exceeding {{timeout_latency_limits}}.
  • Tool payloads MUST sanitize raw DOM fragments to minimize context window token consumption.
  • The protocol MUST strictly throttle concurrent element lookups in compliance with {{rate_limit_policy}}.

Output format

    1. Locator Cascade Architecture (ordered hierarchy from CSS to Accessibility to Vision)
    1. Tool Interface Specification (JSON Schema for resolve_element, interact_element, and report_dom_mutation)
    1. DOM Sanitization & Token Optimization Guidelines (filtering algorithms and size limits)
    1. Self-Healing Selector Update Protocol (state transition logic for caching verified selectors)

Self-review

  1. Does the locator cascade enforce strict timeout cutoffs matching {{timeout_latency_limits}}?
  2. Are DOM payload structures optimized to prevent LLM context bloating?
  3. Does the self-healing protocol clearly define when a selector cache entry must be invalidated?
AuraScore breakdown
83/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-web
autonomous-agents-workflows
web-scraping
dom-automation
self-healing