Claude Skill

ux-inspector

Symfony UX Inspector: dev-only in-page panel to inspect Stimulus controllers, LiveComponents and Turbo frames, and trace their activity. Use for installing or configuring ux_inspector, the /_ux/inspector.js firewall issue, or debugging UX components in the browser.

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download smnandre-symfony-ux-skills-skills_ux-inspector-78c25ed.zip · 2 KB

Install

skills CLI npx skills add https://github.com/smnandre/symfony-ux-skills/tree/main/skills/ux-inspector
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install smnandre-symfony-ux-skills@llmmart
Git git clone https://github.com/smnandre/symfony-ux-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole smnandre/symfony-ux-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

UX Inspector

A development panel injected into your pages. It lists the Stimulus controllers, LiveComponents and Turbo frames on the page, shows their state (values, targets, props, models, frame sources...), and traces their activity (actions, renders, fetches, stream actions).

Since Symfony UX 3.6+. The package is experimental: its API may still change. Install it in the dev environment.

Installation

composer require --dev symfony/ux-inspector

Until a Flex recipe exists, register the bundle and its route yourself:

// config/bundles.php
return [
    // ...
    Symfony\UX\Inspector\UXInspectorBundle::class => ['dev' => true],
];
# config/routes/ux_inspector.yaml
when@dev:
    ux_inspector:
        resource: '@UXInspectorBundle/config/routes.php'

The script is served at /_ux/inspector.js and injected automatically.

Firewall

When an access_control rule matches /_ux/inspector.js, the script does not load: logged-in users get "Session was used while the request was declared stateless", anonymous users are denied. Add it to the dev firewall:

# config/packages/security.yaml
security:
    firewalls:
        dev:
            pattern: ^/(_profiler|_wdt|assets|build)/|^/_ux/inspector\.js$
            security: false

Connect Stimulus (Optional)

By default, Stimulus inspection reads HTML attributes only. Expose the application to also detect inactive controllers, show default values, and check missing targets, classes, outlets and action methods. After startStimulusApp() in your Stimulus bootstrap file:

// assets/stimulus_bootstrap.js
import { startStimulusApp } from '@symfony/stimulus-bundle';

const app = startStimulusApp();
if (app.debug) {
    window.Stimulus = app;
}

With Encore, keep your existing startStimulusApp(...) call and add the same lines. LiveComponent activity shows up either way.

Using the Panel

  • Open it with the pull tab on the right edge, or type u then x outside an editable field.
  • Components lists what was detected; search by name, tag or ID; filter by Stimulus, LiveComponent or Turbo; Show all components highlights them.
  • Inspect page components, then click an element (hold Shift to keep inspecting). Follow element and component links; breadcrumbs or Escape go back.
  • Show activity opens the page event log; Activity in a component detail filters to that component; Copy activity copies event details.
Framework What it shows
Stimulus Values and classes, targets and actions, outlets and parent/child controllers, controller-prefixed custom events
LiveComponent LiveProps and parent props, model bindings and modifiers, actions and listeners, loading directives, polling, request and render activity, errors
Turbo Frames (id, src, loading, target, state, nesting), permanent elements, disabled scopes, stream sources, fetches with status and duration, frame renders, missing frames, morphs, stream actions

Stimulus connect() / disconnect() are not DOM events, so they do not appear in the activity log.

Configuration

# config/packages/ux_inspector.yaml (defaults)
when@dev:
    ux_inspector:
        enabled: true          # only effective when kernel.debug is true
        pull_tab: true         # false hides the tab; the "ux" shortcut still works
        exclude_paths: ['/_profiler', '/_wdt', '/_error', '/_fragment']
        ignore_selectors: []   # e.g. ['[data-no-inspect]']

exclude_paths matches path segments (/admin matches /admin/users, not /administrator) and replaces the default list, so keep the defaults when adding your own.

Gotchas

  • Panel missing: injection needs an HTML response with explicit <body> and </body> tags. Check kernel.debug, exclude_paths, and the firewall rule above.
  • Stimulus details look incomplete: connect Stimulus with window.Stimulus = app.
  • Web Debug Toolbar: .sf-toolbar is excluded automatically from detection and inspection.

References

See Also

  • stimulus, live-component, turbo: the Inspector reads exactly what those skills configure. Use it to check a data-model, find a missing target or see which frame failed to load.
Files (symfony-ux-skills)
  • SKILL.md 5 KB
    ---
    name: ux-inspector
    description: 'Symfony UX Inspector: dev-only in-page panel to inspect Stimulus controllers, LiveComponents and Turbo frames, and trace their activity. Use for installing or configuring ux_inspector, the /_ux/inspector.js firewall issue, or debugging UX components in the browser.'
    license: MIT
    metadata:
      author: Simon André
      url: https://smnandre.dev
    ---
    
    # UX Inspector
    
    A development panel injected into your pages. It lists the Stimulus controllers, LiveComponents and Turbo frames on the page, shows their state (values, targets, props, models, frame sources...), and traces their activity (actions, renders, fetches, stream actions).
    
    Since Symfony UX 3.6+. The package is **experimental**: its API may still change. Install it in the `dev` environment.
    
    ## Installation
    
    ```bash
    composer require --dev symfony/ux-inspector
    ```
    
    Until a Flex recipe exists, register the bundle and its route yourself:
    
    ```php
    // config/bundles.php
    return [
        // ...
        Symfony\UX\Inspector\UXInspectorBundle::class => ['dev' => true],
    ];
    ```
    
    ```yaml
    # config/routes/ux_inspector.yaml
    when@dev:
        ux_inspector:
            resource: '@UXInspectorBundle/config/routes.php'
    ```
    
    The script is served at `/_ux/inspector.js` and injected automatically.
    
    ### Firewall
    
    When an `access_control` rule matches `/_ux/inspector.js`, the script does not load: logged-in users get "Session was used while the request was declared stateless", anonymous users are denied. Add it to the `dev` firewall:
    
    ```yaml
    # config/packages/security.yaml
    security:
        firewalls:
            dev:
                pattern: ^/(_profiler|_wdt|assets|build)/|^/_ux/inspector\.js$
                security: false
    ```
    
    ### Connect Stimulus (Optional)
    
    By default, Stimulus inspection reads HTML attributes only. Expose the application to also detect inactive controllers, show default values, and check missing targets, classes, outlets and action methods. After `startStimulusApp()` in your Stimulus bootstrap file:
    
    ```javascript
    // assets/stimulus_bootstrap.js
    import { startStimulusApp } from '@symfony/stimulus-bundle';
    
    const app = startStimulusApp();
    if (app.debug) {
        window.Stimulus = app;
    }
    ```
    
    With Encore, keep your existing `startStimulusApp(...)` call and add the same lines. LiveComponent activity shows up either way.
    
    ## Using the Panel
    
    - Open it with the pull tab on the right edge, or type `u` then `x` outside an editable field.
    - **Components** lists what was detected; search by name, tag or ID; filter by Stimulus, LiveComponent or Turbo; **Show all components** highlights them.
    - **Inspect page components**, then click an element (hold `Shift` to keep inspecting). Follow element and component links; breadcrumbs or `Escape` go back.
    - **Show activity** opens the page event log; **Activity** in a component detail filters to that component; **Copy activity** copies event details.
    
    | Framework | What it shows |
    |-----------|---------------|
    | Stimulus | Values and classes, targets and actions, outlets and parent/child controllers, controller-prefixed custom events |
    | LiveComponent | LiveProps and parent props, model bindings and modifiers, actions and listeners, loading directives, polling, request and render activity, errors |
    | Turbo | Frames (id, src, loading, target, state, nesting), permanent elements, disabled scopes, stream sources, fetches with status and duration, frame renders, missing frames, morphs, stream actions |
    
    Stimulus `connect()` / `disconnect()` are not DOM events, so they do not appear in the activity log.
    
    ## Configuration
    
    ```yaml
    # config/packages/ux_inspector.yaml (defaults)
    when@dev:
        ux_inspector:
            enabled: true          # only effective when kernel.debug is true
            pull_tab: true         # false hides the tab; the "ux" shortcut still works
            exclude_paths: ['/_profiler', '/_wdt', '/_error', '/_fragment']
            ignore_selectors: []   # e.g. ['[data-no-inspect]']
    ```
    
    `exclude_paths` matches path segments (`/admin` matches `/admin/users`, not `/administrator`) and replaces the default list, so keep the defaults when adding your own.
    
    ## Gotchas
    
    - **Panel missing**: injection needs an HTML response with explicit `<body>` and `</body>` tags. Check `kernel.debug`, `exclude_paths`, and the firewall rule above.
    - **Stimulus details look incomplete**: connect Stimulus with `window.Stimulus = app`.
    - **Web Debug Toolbar**: `.sf-toolbar` is excluded automatically from detection and inspection.
    
    ## References
    
    - [Symfony UX package page](https://ux.symfony.com/inspector) ([Markdown summary](https://ux.symfony.com/inspector.md)) · [`symfony/ux-inspector` on Packagist](https://packagist.org/packages/symfony/ux-inspector).
    - Try the [interactive Inspector demo](https://ux.symfony.com/inspector#demo).
    - For development setup, component inspection and activity tracing, see the [Symfony UX Inspector documentation](https://symfony.com/bundles/ux-inspector).
    
    ## See Also
    
    - **stimulus**, **live-component**, **turbo**: the Inspector reads exactly what those skills configure. Use it to check a `data-model`, find a missing target or see which frame failed to load.
    

Comments

Sign in to join the conversation.

No comments yet. Start the conversation.

Reviews (0)

No reviews yet.