Agent Skills: Fullstory Stable Selectors

Platform-agnostic guide for implementing stable, semantic identifiers in web and mobile applications. Solves the dynamic identifier problem across all platforms. Core concepts apply universally; see SKILL-WEB.md for web implementation and SKILL-MOBILE.md for iOS, Android, Flutter, and React Native patterns.

UncategorizedID: fullstorydev/fs-skills/fullstory-stable-selectors

Install this agent skill to your local

pnpm dlx add-skill https://github.com/fullstorydev/fs-skills/tree/HEAD/framework/fullstory-stable-selectors

Skill Files

Browse the full folder contents for fullstory-stable-selectors.

Download Skill

Loading file tree…

framework/fullstory-stable-selectors/SKILL.md

Skill Metadata

Name
fullstory-stable-selectors
Description
Platform-agnostic guide for implementing stable, semantic identifiers in web and mobile applications. Solves the dynamic identifier problem across all platforms. Core concepts apply universally; see SKILL-WEB.md for web implementation and SKILL-MOBILE.md for iOS, Android, Flutter, and React Native patterns.

Fullstory Stable Selectors

πŸ“± Platform-Specific Implementation: This document covers core concepts. For implementation details, see:

  • Web (JavaScript/TypeScript): SKILL-WEB.md β€” React, Vue, Angular, Svelte, Next.js, and more
  • Mobile: SKILL-MOBILE.md β€” iOS, Android, Flutter, React Native

Overview

Modern applicationsβ€”both web and mobileβ€”often have dynamic, unpredictable element identifiers that change across builds, deployments, or even at runtime. This creates challenges for:

  1. Fullstory: Reliable search, defined elements, heatmaps
  2. Automated Testing: Stable E2E test selectors
  3. Computer User Agents (CUA): AI agents navigating your interface
  4. Accessibility Tools: Programmatic element identification

The Solution: Add stable, semantic identifiers that describe what the element is, not how it's rendered.


The Universal Problem

Web: Dynamic CSS Classes

<!-- What your code looks like -->
<button className={styles.primaryButton}>Add to Cart</button>

<!-- What renders in the browser -->
<button class="Button_primaryButton__x7Ks2">Add to Cart</button>
                                    ↑
                        This hash changes every build!

Mobile: Dynamic View IDs

iOS View Hierarchy:
UIButton (0x7f8b4c0123a0)    ← Memory address changes every launch
  └── "Add to Cart"

Android View Tree:
Button (id: view-12345)       ← Auto-generated, unstable
  └── "Add to Cart"

React Native Bridge:
ReactButton (nativeID: rn_7)  ← Bridge-generated, changes on re-render

Impact Across Platforms

| Tool | Web Problem | Mobile Problem | |------|-------------|----------------| | Fullstory | CSS selectors break | View tree queries unreliable | | E2E Testing | Cypress/Playwright tests brittle | Detox/Espresso tests break | | AI Agents (CUA) | Cannot find elements | Cannot navigate reliably | | Automation | Scripts fail on deploy | Scripts fail on app update |


Why This Matters for AI Agents (CUA)

Computer User Agentsβ€”AI systems that interact with digital interfacesβ€”rely on stable, semantic identifiers to understand and navigate your application.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  HOW CUAs "SEE" YOUR INTERFACE                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                         β”‚
β”‚  ❌ BRITTLE (AI struggles):                                             β”‚
β”‚                                                                         β”‚
β”‚     Web: <button class="sc-3d8f2a btn_primary__xK7n2">                 β”‚
β”‚     iOS: UIButton at memory 0x7f8b4c0123a0                             β”‚
β”‚     Android: view-12345                                                 β”‚
β”‚                                                                         β”‚
β”‚  βœ… SEMANTIC (AI understands):                                          β”‚
β”‚                                                                         β”‚
β”‚     Web: data-component="ProductCard" data-element="purchase-button"   β”‚
β”‚     iOS: accessibilityIdentifier = "ProductCard.purchase-button"       β”‚
β”‚     Android: testTag = "ProductCard.purchase-button"                   β”‚
β”‚                                                                         β”‚
β”‚  The AI can now reliably:                                               β”‚
β”‚  β€’ Find "the purchase button in ProductCard"                           β”‚
β”‚  β€’ Understand the action it will trigger                               β”‚
β”‚  β€’ Maintain stable automation across deployments                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Stable selectors provide CUAs with:

  • βœ… Consistent element identification across builds
  • βœ… Semantic understanding of element purpose
  • βœ… Hierarchical context (component β†’ element relationship)
  • βœ… Action hints for interaction planning

The Universal Solution

Add stable identifiers that survive build changes and runtime variations:

| Platform | Stable Identifier Mechanism | |----------|----------------------------| | Web | data-component, data-element, data-action attributes | | iOS | accessibilityIdentifier property | | Android (Kotlin) | contentDescription or resource ID | | Android (Compose) | testTag modifier, semantics | | React Native | testID prop | | Flutter | Key, Semantics widget |

The naming conventions are the same across all platforms β€” only the implementation mechanism differs.


Core Concepts

The Identifier Taxonomy

Primary Identifiers (Required)

| Concept | Purpose | Naming Convention | Example | |---------|---------|-------------------|---------| | Component | Component/screen boundary | PascalCase | ProductCard, CheckoutForm | | Element | Element role within component | kebab-case | add-to-cart, price-display |

Extended Identifiers (Recommended for CUA/AI)

| Concept | Purpose | When to Use | |---------|---------|-------------| | Action | Describes what happens on interaction | Buttons, links, toggles | | State | Current state of the element | Expandable, toggleable elements | | Variant | Visual or functional variant | A/B tests, feature flags |

Identifier Hierarchy

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  SEMANTIC HIERARCHY (applies to all platforms)                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                         β”‚
β”‚  Component: "CheckoutForm"                      ← Component boundary    β”‚
β”‚  β”‚                                                                      β”‚
β”‚  β”œβ”€β”€ Element: "shipping-section"                ← Structural element   β”‚
β”‚  β”‚   β”œβ”€β”€ Element: "address-input"               ← Interactive element  β”‚
β”‚  β”‚   └── Element: "city-input"                                         β”‚
β”‚  β”‚                                                                      β”‚
β”‚  β”œβ”€β”€ Element: "payment-section"                                        β”‚
β”‚  β”‚   └── Element: "card-input"                                         β”‚
β”‚  β”‚       Action: "capture-payment"              ← Action hint for AI   β”‚
β”‚  β”‚                                                                      β”‚
β”‚  └── Element: "submit-button"                                          β”‚
β”‚      Action: "complete-purchase"                ← Action hint for AI   β”‚
β”‚      State: "enabled|disabled|loading"          ← Current state        β”‚
β”‚                                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Platform Implementation Quick Reference

| Concept | Web | iOS | Android | React Native | Flutter | |---------|-----|-----|---------|--------------|---------| | Component | data-component="X" | accessibilityIdentifier = "X" | testTag("X") | testID="X" | Key("X") | | Element | data-element="x" | .x suffix | .x suffix | .x suffix | .x suffix | | Combined | data-component="ProductCard" + data-element="add-to-cart" | "ProductCard.add-to-cart" | "ProductCard.add-to-cart" | "ProductCard.add-to-cart" | Key("ProductCard.add-to-cart") |


Naming Conventions (Universal)

These naming conventions apply to all platforms.

Formal Naming Grammar

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  NAMING GRAMMAR                                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                         β”‚
β”‚  Component: [Namespace.]<Domain><Type>                                  β”‚
β”‚                                                                         β”‚
β”‚    Examples:                                                            β”‚
β”‚    β€’ ProductCard         (simple)                                       β”‚
β”‚    β€’ CheckoutPaymentForm (domain + type)                               β”‚
β”‚    β€’ Checkout.PaymentForm (namespaced for micro-frontends/modules)     β”‚
β”‚                                                                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                         β”‚
β”‚  Element: <subject>-<descriptor>[-<qualifier>]                          β”‚
β”‚                                                                         β”‚
β”‚    Examples:                                                            β”‚
β”‚    β€’ add-to-cart         (action verb)                                  β”‚
β”‚    β€’ product-image       (subject + type)                              β”‚
β”‚    β€’ shipping-address-input (subject + descriptor + type)              β”‚
β”‚    β€’ nav-item-products   (type + qualifier)                            β”‚
β”‚                                                                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                         β”‚
β”‚  Action: <verb>[-<object>]                                              β”‚
β”‚                                                                         β”‚
β”‚    Examples:                                                            β”‚
β”‚    β€’ add-item                                                           β”‚
β”‚    β€’ submit-form                                                        β”‚
β”‚    β€’ toggle-menu                                                        β”‚
β”‚    β€’ expand-details                                                     β”‚
β”‚    β€’ navigate-next                                                      β”‚
β”‚                                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Component Names

Use PascalCase matching your component/class/screen names:

βœ… GOOD: Matches component names
β€’ ProductCard
β€’ CheckoutForm
β€’ NavigationHeader
β€’ UserProfileDropdown

βœ… GOOD: Namespaced for modules
β€’ Checkout.PaymentForm
β€’ Catalog.ProductCard

❌ BAD: Generic names
β€’ Container
β€’ Wrapper
β€’ Component
β€’ View
β€’ Screen

Element Names

Use kebab-case describing the element's purpose:

βœ… GOOD: Describes purpose
β€’ add-to-cart
β€’ email-input
β€’ product-image
β€’ price-display
β€’ main-navigation

βœ… GOOD: Qualified names for disambiguation
β€’ billing-address-line1
β€’ shipping-address-line1

❌ BAD: Describes appearance or position
β€’ blue-button
β€’ big-button
β€’ button-1
β€’ first-button
β€’ left-sidebar

Action Names

Use verb-first kebab-case describing the outcome:

βœ… GOOD: Clear action verbs
β€’ add-item
β€’ submit-order
β€’ toggle-filter
β€’ navigate-category
β€’ expand-details

❌ BAD: Nouns or unclear
β€’ cart
β€’ click-handler
β€’ button-action

What to Annotate

Always Annotate

  • βœ… Buttons and tappable elements β€” Primary interaction points
  • βœ… Form inputs β€” Text fields, selects, checkboxes, toggles
  • βœ… Links and navigation items β€” Navigation paths
  • βœ… Cards and list items β€” Items in repeating content
  • βœ… Modals and dialog triggers β€” State-changing interactions
  • βœ… Tab and accordion controls β€” Content switchers

Skip Annotation For

  • ❌ Pure layout containers β€” Unless interactive
  • ❌ Styling wrappers β€” Divs/Views for styling only
  • ❌ Text-only elements β€” Unless key analytics content

Best Practices

1. Annotate at Development Time

Add identifiers as you write components, not as an afterthought. This ensures complete coverage.

2. Document Your Conventions

Create a team style guide covering:

  • Component naming patterns
  • Element naming patterns
  • Required annotations
  • Platform-specific implementation

3. Combine with Privacy Controls

Stable identifiers and privacy controls work together:

  • Annotate sensitive elements for searchability
  • Apply privacy masking/exclusion for data protection
  • Both serve complementary purposes

4. Use Consistent Depth

Don't over-nest annotations:

βœ… GOOD: Flat, specific identifiers
ProductCard
  └── add-to-cart

❌ BAD: Unnecessarily deep
App
  └── MainContent
        └── ProductSection
              └── ProductCard
                    └── add-to-cart

5. Use Business Identifiers, Not Positions

For lists and repeating content:

βœ… GOOD: Business identifier
product-item with productId="SKU-123"

❌ BAD: Position-based
item-0, item-1, item-2

Integration with Accessibility

Stable selectors complement accessibility attributes:

| Attribute Type | Purpose | Audience | |----------------|---------|----------| | Stable identifiers | Programmatic targeting | Fullstory, Tests, AI Agents | | Accessibility labels | Human-readable description | Screen readers, AI understanding | | Semantic roles | Element type/behavior | Accessibility, AI categorization |

Best Practice: Use BOTH stable identifiers AND accessibility attributes. They serve complementary purposes.


Troubleshooting

Identifiers Not Working

Common issues across all platforms:

  1. Identifier not set on the element (verify in inspector/debugger)
  2. Typos in identifier names
  3. Build tools stripping identifiers in production
  4. Conditional rendering removing elements

Too Many Search Results

Problem: Searching for "button" returns hundreds of results

Solution: Be more specific with hierarchical identifiers:

  • Use ProductCard.add-to-cart not just add-to-cart
  • Combine component + element for unique targeting

Identifiers Stripped in Production

Check platform-specific build configurations:

  • Web: Verify data-* attributes aren't removed by minifiers
  • Mobile: Ensure debug-only code isn't stripping identifiers

KEY TAKEAWAYS FOR AGENT

When helping developers implement stable selectors:

Platform Routing

  1. Detect platform first β€” Web vs iOS vs Android vs React Native vs Flutter
  2. Route to implementation file β€” SKILL-WEB.md or SKILL-MOBILE.md
  3. Use consistent naming β€” Same taxonomy applies to all platforms

Core Principles (All Platforms)

  1. Name by purpose, not appearance: "add-to-cart" not "blue-button"
  2. Use hierarchical identifiers: Component.element pattern
  3. Annotate interactive elements: Buttons, inputs, links, cards in lists
  4. Combine with accessibility: Stable IDs + ARIA/accessibility labels
  5. Business IDs, not positions: productId="SKU-123" not item-0

Questions to Ask Developers

  1. "What platform(s) are you building for?" (Web, iOS, Android, React Native, Flutter)
  2. "Are your element identifiers stable across builds?"
  3. "What elements do you need to reliably find in Fullstory?"
  4. "Do you have a naming convention for components/screens?"
  5. "Are you using E2E testing tools?"
  6. "Is AI/automation tooling on your roadmap?"

Implementation Checklist (All Platforms)

Phase 1: Core Implementation
β–‘ Identify interactive elements that need tracking
β–‘ Establish naming convention (Component.element pattern)
β–‘ Add component identifiers to screens/component roots
β–‘ Add element identifiers to buttons, inputs, links, cards
β–‘ Use specific, purpose-based names
β–‘ Verify identifiers survive production build
β–‘ Test in Fullstory search

Phase 2: AI/CUA Readiness
β–‘ Add action hints to interactive elements
β–‘ Add state indicators for stateful elements
β–‘ Ensure accessibility attributes complement stable IDs
β–‘ Document naming conventions for team consistency

Phase 3: Enterprise Scale
β–‘ Implement type-safe identifier helpers
β–‘ Add namespace prefixes for modules/teams
β–‘ Add variant tracking for A/B tests
β–‘ Configure E2E tools to use stable identifiers

REFERENCE LINKS

Fullstory Documentation

  • Element Properties: ../core/fullstory-element-properties/SKILL.md
  • Privacy Controls: ../core/fullstory-privacy-controls/SKILL.md
  • Test Automation: ./fullstory-test-automation/SKILL.md

Platform-Specific Implementation

Accessibility Standards

  • WAI-ARIA Authoring Practices: https://www.w3.org/WAI/ARIA/apg/
  • iOS Accessibility: https://developer.apple.com/accessibility/
  • Android Accessibility: https://developer.android.com/guide/topics/ui/accessibility

This skill provides the universal foundation for stable selectors across all platforms. See SKILL-WEB.md for web implementation and SKILL-MOBILE.md for mobile implementation.