Warn LLM against hashed/generated CSS class names in schema prompts
Replace vague "handle dynamic class names appropriately" with explicit rule: never use auto-generated class names (.styles_card__xK9r2, etc.) as they break on every site rebuild. Prefer data-* attributes, semantic tags, ARIA attributes, and stable meaningful class names instead.
This commit is contained in:
@@ -348,8 +348,9 @@ When repeating items are siblings (e.g. table rows, flat divs):
|
||||
- Include prices, dates, titles, and other common data types
|
||||
|
||||
3. Always:
|
||||
- Use reliable CSS selectors
|
||||
- Handle dynamic class names appropriately
|
||||
- Use reliable CSS selectors that will survive page rebuilds
|
||||
- NEVER use auto-generated or hashed class names (e.g. `.styles_card__xK9r2`, `.css-1a2b3c`, `.sc-bdnxRM`). These are generated by CSS-in-JS tools and change on every build — your schema will break on the next crawl.
|
||||
- PREFER: `data-*` attributes (`[data-testid="review"]`), semantic tags (`article`, `section`, `nav`), ARIA attributes (`[role="listitem"]`), and stable class names that reflect meaning (`.product-card`, `.review`).
|
||||
- Create descriptive field names
|
||||
- Follow consistent naming conventions
|
||||
</behavior_rules>
|
||||
@@ -811,8 +812,9 @@ When repeating items are siblings (e.g. table rows, flat divs):
|
||||
- Include prices, dates, titles, and other common data types
|
||||
|
||||
3. Always:
|
||||
- Use reliable XPath selectors
|
||||
- Handle dynamic element IDs appropriately
|
||||
- Use reliable XPath selectors that will survive page rebuilds
|
||||
- NEVER use auto-generated or hashed class names (e.g. `styles_card__xK9r2`, `css-1a2b3c`, `sc-bdnxRM`). These are generated by CSS-in-JS tools and change on every build — your schema will break on the next crawl.
|
||||
- PREFER: `data-*` attributes (`@data-testid='review'`), semantic tags (`article`, `section`, `nav`), ARIA attributes (`@role='listitem'`), and stable class names that reflect meaning (`product-card`, `review`).
|
||||
- Create descriptive field names
|
||||
- Follow consistent naming conventions
|
||||
</behavior_rules>
|
||||
|
||||
Reference in New Issue
Block a user