lwc-debugging-devtools

Use when you need to diagnose live Lightning Web Component behavior in the browser — setting breakpoints, stepping through @wire emits, inspecting component state with the Lightning Component Inspector, reading wire-adapter network traffic, and interpreting symptoms like silent render failures or 'works in dev but not in prod'. Triggers: 'how to set breakpoint in lwc', 'source maps missing', 'enable debug mode', 'lightning inspector chrome extension', 'lwc wire not emitting'. NOT for Jest test failures — use `lwc-testing` — and NOT for Apex debug logs, which are an Apex debugging concern. Specific runtime error messages (wire undefined, querySelector returns null, NavigationMixin errors) belong in `common-lwc-runtime-errors`; this skill covers the debug TOOLING itself.

Best use case

lwc-debugging-devtools is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when you need to diagnose live Lightning Web Component behavior in the browser — setting breakpoints, stepping through @wire emits, inspecting component state with the Lightning Component Inspector, reading wire-adapter network traffic, and interpreting symptoms like silent render failures or 'works in dev but not in prod'. Triggers: 'how to set breakpoint in lwc', 'source maps missing', 'enable debug mode', 'lightning inspector chrome extension', 'lwc wire not emitting'. NOT for Jest test failures — use `lwc-testing` — and NOT for Apex debug logs, which are an Apex debugging concern. Specific runtime error messages (wire undefined, querySelector returns null, NavigationMixin errors) belong in `common-lwc-runtime-errors`; this skill covers the debug TOOLING itself.

Teams using lwc-debugging-devtools should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/lwc-debugging-devtools/SKILL.md --create-dirs "https://raw.githubusercontent.com/PranavNagrecha/AwesomeSalesforceSkills/main/skills/lwc/lwc-debugging-devtools/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/lwc-debugging-devtools/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How lwc-debugging-devtools Compares

Feature / Agentlwc-debugging-devtoolsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when you need to diagnose live Lightning Web Component behavior in the browser — setting breakpoints, stepping through @wire emits, inspecting component state with the Lightning Component Inspector, reading wire-adapter network traffic, and interpreting symptoms like silent render failures or 'works in dev but not in prod'. Triggers: 'how to set breakpoint in lwc', 'source maps missing', 'enable debug mode', 'lightning inspector chrome extension', 'lwc wire not emitting'. NOT for Jest test failures — use `lwc-testing` — and NOT for Apex debug logs, which are an Apex debugging concern. Specific runtime error messages (wire undefined, querySelector returns null, NavigationMixin errors) belong in `common-lwc-runtime-errors`; this skill covers the debug TOOLING itself.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# LWC Debugging DevTools

Use this skill when an LWC compiles and deploys cleanly but misbehaves at runtime, and the next step is live browser debugging — breakpoints, the component tree inspector, wire network traces, and render profiles — rather than static code review. This skill is about the tooling; specific error-message diagnosis lives in `common-lwc-runtime-errors`.

---

## Before Starting

Gather this context before touching devtools:

- **Is Debug Mode enabled for the acting user?** Debug Mode is toggled per user under Setup → Debug Mode. Without it, the org serves minified LWC JavaScript, source maps are absent, and breakpoints land on unreadable framework code.
- **Which surface is failing?** Lightning Experience, Experience Cloud, and the Salesforce Mobile app each have different security policies, CSP rules, and debug affordances. A bug that reproduces in LEX may not reproduce in an Experience Cloud site because the CSP is stricter there.
- **Is Lightning Web Security (LWS) active?** LWS sandboxes module globals and wraps `this.template` and many records with Proxies. Under LWS, `console.log(this.record)` often prints a Proxy handle that looks empty — not because the object is empty, but because the logger cannot traverse the wrapper.
- **What is the reproducing path?** Record ID, page, user profile, and the exact action. Debug Mode slows the app noticeably; you do not want to hunt blind.

---

## Core Concepts

### Debug Mode Is Per User, Not Per Org

Salesforce serves minified LWC bundles by default for performance. Enabling Debug Mode for a specific user replaces the minified bundle with un-minified JavaScript and serves source maps. That means: you can enable Debug Mode for yourself to investigate a ticket without affecting any other user. End users continue to see the fast, minified version. Debug Mode lives in Setup and is also exposed to each user via their own Debug Mode page. It does not live under "Production Settings" — a common hallucination.

### Source Maps, Breakpoints, and the Sources Panel

With Debug Mode on and a hard refresh, Chrome DevTools' Sources panel shows the original component files under a virtual path that includes the component namespace and bundle name. You can set breakpoints by clicking the gutter, or by dropping a `debugger;` statement in the component (remove before commit). The Sources panel is also where you toggle "Pause on caught exceptions" — essential for catching errors that LWS or the framework swallows before they reach your listener. The top of the call stack will usually be your component code; frames lower in the stack belong to the LWC engine and `@salesforce/*` modules.

### The Lightning Component Inspector

The Lightning Component Inspector is a Salesforce-published Chromium extension that adds a panel to DevTools. It shows the component tree for the current page, the `@api` property values on any selected component, and the current state of each `@wire` on that component (loading, data, error). It is the fastest way to answer "is the wire emitting at all, and what is it returning?" without writing logging code. It is Chromium-only; there is no Firefox equivalent.

### Logging Under Lightning Web Security

LWS wraps many platform objects in membrane Proxies so that component code cannot reach into privileged internals. `console.log(obj)` with a Proxy-wrapped object often shows the handle, not the traversed contents. The workaround is to force a plain JSON copy: `console.log(JSON.parse(JSON.stringify(obj)))` or, when the structure is known to be clonable, `console.log(structuredClone(obj))`. Non-JSON-clonable values (functions, `Map`, `Set`) still need ad-hoc unwrapping.

### Wire Traffic on the Network Panel

UI API wire adapters (`getRecord`, `getRelatedListRecords`, the GraphQL adapter) hit `/services/data/vXX.X/ui-api/*`. Filter the Network panel by `/ui-api/` to see exactly which wires fire, their payload shape, and any 4xx/5xx. If a wire "never emits," there are two common causes: a reactive `$variable` is still `undefined`, so the adapter was never activated; or the adapter ran and the response was cached with `undefined` data (no fields requested).

### Render Profiling and Mobile

The Performance panel captures long tasks, render frames, and script execution for the LWC runtime. For mobile debugging, the Salesforce Mobile app exposes a debug bridge that lets desktop Chrome DevTools attach to the in-app webview; pair this with Debug Mode for the mobile user.

---

## Common Patterns

### Pattern 1: Prove the Wire Is Firing

**When to use:** `@wire` appears not to emit, component shows no data.

**How it works:** Enable Debug Mode, hard-refresh, open Network and filter by `/ui-api/`. Place a breakpoint on the first line of the wire handler function. Reproduce. If the breakpoint never hits and no network call fires, the reactive parameter is `undefined`; inspect the class property feeding `$recordId` in the Inspector panel. If the breakpoint hits with `data: undefined, error: undefined`, that is the normal first emission — step and watch for the second emission.

**Why not the alternative:** `console.log` alone tells you nothing about whether the adapter was activated at all.

### Pattern 2: Capture a Silent Render Failure

**When to use:** Component renders blank in production, works in dev sandbox.

**How it works:** Confirm Debug Mode is enabled for the prod user (this is the frequent miss), hard-refresh, open Sources, enable "Pause on exceptions" and "Pause on caught exceptions." Reproduce. If a throw is caught by LWS or the framework error boundary, the debugger pauses at the origin so you can read the real message instead of a swallowed one. Use the Inspector to confirm which child component is actually failing.

**Why not the alternative:** Relying on the browser console alone misses errors that LWS silently wraps or that a parent `errorCallback` swallows.

### Pattern 3: Readable Logging Under LWS

**When to use:** You need to dump component state and plain `console.log` shows a Proxy handle.

**How it works:** `console.log('state', JSON.parse(JSON.stringify(this.account)));` — this materializes the wrapped object into a plain JSON tree the console can expand. For shapes that include `Map`/`Set` or circular refs, log individual fields instead of the whole object.

**Why not the alternative:** `console.log(this.account)` in LWS shows `Proxy {}` or similar, making the log useless for diagnosing data shape.

---

## Decision Guidance

| Symptom | Start Here | Why |
|---|---|---|
| Component renders blank | Confirm Debug Mode is on, open Sources with pause-on-exceptions, scan for thrown errors | Many render failures are swallowed by framework error boundaries or LWS |
| `@wire` never emits | Network panel filtered by `/ui-api/`, breakpoint at top of wire handler | Distinguishes "adapter never activated" from "adapter returned empty" |
| Works in dev, fails in prod | Check Debug Mode status in the prod user; check CSP/Experience Cloud context | Minified code without source maps is the single biggest "I can't see anything" cause |
| Console logs show Proxy handles | Wrap with `JSON.parse(JSON.stringify(obj))` or log individual fields | LWS proxies block the default console traversal |
| Render feels slow | Performance panel, record a 10s profile around the interaction | Gives per-frame render cost and long-task attribution |
| Bug only reproduces on mobile | Enable Debug Mode for the mobile user, attach desktop Chrome via mobile debug bridge | No parity tool exists inside the mobile app itself |

---

## Recommended Workflow

1. **Enable Debug Mode for your user** — Setup → Debug Mode (or the per-user Debug Mode page). Confirm the badge appears in the app nav.
2. **Hard-refresh and confirm un-minified JS** — DevTools → Sources → search for your bundle filename. You should see readable code, not a single-line minified blob.
3. **Install the Lightning Component Inspector** — Chromium extension; reload the page; confirm the "Lightning" panel appears in DevTools.
4. **Reproduce with Pause on Exceptions on** — toggle both caught and uncaught pausing; reproduce the user action; let the debugger catch any thrown error.
5. **Inspect component state and wire responses** — use the Inspector to read `@api` values and wire state; use the Network panel filter `/ui-api/` to see raw wire payloads.
6. **Capture a Performance profile if perf-related** — record during the slow interaction; inspect long tasks and render frames.
7. **Disable Debug Mode when finished** — Debug Mode noticeably degrades perceived performance; leaving it on in production pollutes analytics and user experience.

---

## Review Checklist

- [ ] Debug Mode is enabled for the acting user (not assumed org-wide).
- [ ] Un-minified source is visible in the Sources panel after a hard refresh.
- [ ] The Lightning Component Inspector is installed and the Lightning panel appears.
- [ ] Any object logging under LWS uses `JSON.parse(JSON.stringify(...))` or per-field logs — not raw `console.log(this.x)`.
- [ ] `debugger;` statements are removed from the code before commit.
- [ ] Network filter `/ui-api/` was used (not just console) to confirm wire behavior.
- [ ] Debug Mode was turned off after the session so end users do not see degraded performance.
- [ ] CSP differences were considered when the bug is Experience Cloud or mobile-specific.

---

## Salesforce-Specific Gotchas

1. **Debug Mode is per user, not per org** — enabling it for yourself does not help an end user who is also seeing the bug; either enable it for their user, or reproduce under your own user.
2. **`console.log(this.record)` under LWS prints a Proxy handle** — looks like the object is empty; it is not. Unwrap with `JSON.parse(JSON.stringify(...))`.
3. **Breakpoints are meaningless without source maps** — without Debug Mode, the Sources panel shows minified code and your breakpoints land on the wrong line or a wrapper.
4. **The Lightning Component Inspector is Chromium-only** — Firefox users have no equivalent; switch to Chrome/Edge/Brave.
5. **`renderedCallback` breakpoints fire many times** — they run after every render. Use conditional breakpoints on a specific prop value or log-points to avoid storming the debugger.
6. **Experience Cloud CSP is stricter than LEX** — "works in LEX, fails in Experience Cloud" is often a Content Security Policy issue surfacing on a different surface.
7. **Leaving Debug Mode on globally is an anti-pattern** — real users see degraded perf, and analytics get skewed; always turn it off when the investigation ends.

---

## Output Artifacts

| Artifact | Description |
|---|---|
| Diagnosis path | Ordered devtools steps from symptom to root cause |
| Wire network trace | Filtered `/ui-api/` requests with payload and timing |
| Inspector capture | Component tree state, `@api` values, `@wire` state for the failing component |
| Performance profile summary | Long tasks, render frames, attributable scripts |
| Checker report | Output from `scripts/check_lwc_debugging_devtools.py` |

---

## Related Skills

- `lwc/common-lwc-runtime-errors` — use when the browser console shows a specific error message (wire undefined, querySelector null, NavigationMixin error); that skill is about error meanings, this one is about the debugging tools themselves.
- `lwc/lwc-performance` — use when the finding from a Performance profile points to payload or render cost that needs architectural fixes.
- `lwc/lwc-security` — use when the debugging session surfaces LWS or CSP behavior that needs to be understood structurally.
- `lwc/lwc-testing` — use when the right fix is a Jest test rather than a live browser debug session.

Related Skills

omnistudio-debugging

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when diagnosing failures, unexpected output, or silent errors in OmniScript, DataRaptor, or Integration Procedure assets. Triggers: 'omniscript not working', 'dataraptor returns empty', 'integration procedure failing', 'debug mode', 'action debugger', 'preview not running'. NOT for Apex debugging, LWC console errors unrelated to OmniStudio, or Flow fault path debugging.

flow-interview-debugging

8
from PranavNagrecha/AwesomeSalesforceSkills

Diagnose Flow failures using the Debug Log, Flow Error emails, and the Debug panel; instrument flows so production issues are triageable. NOT for Apex debugging.

flow-debugging

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when diagnosing a Flow that does not run, runs but produces wrong results, fails silently, or shows an unexpected fault email. Triggers: 'flow debug mode', 'flow not running', 'flow interview log', 'fault email', 'record-triggered flow not firing', 'debug run as user', 'flow test suite'. NOT for Apex debugging (use debug-and-logging), NOT for designing fault connectors (use fault-handling), NOT for fixing governor-limit failures caused by bulk volume (use flow-bulkification).

xss-and-injection-prevention

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when writing or reviewing Visualforce pages, Apex controllers, or LWC components that output user-supplied data, build dynamic queries, or construct HTTP responses. Triggers: 'XSS in Visualforce', 'SOQL injection vulnerability', 'how to encode output in Apex', 'JSENCODE Visualforce', 'open redirect prevention'. NOT for Apex CRUD/FLS enforcement (use soql-security or apex-crud-and-fls), NOT for Shield encryption (use shield-encryption-key-management), NOT for AppExchange security review process (use secure-coding-review-checklist).

visualforce-security-and-modernization

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when hardening or modernizing legacy Visualforce pages — covers the platform CSRF token model and when disabling it is a security regression, view state encryption guarantees and the 170 KB ceiling, FLS/CRUD enforcement gaps on `<apex:outputField>` and on getters that return sObjects, `<apex:includeScript>` interaction with the org Content Security Policy, hosting LWC inside a VF page via `lightning:container` / `lightning-out`, and the retire-vs-harden-vs-leave-alone decision for an inventory of legacy pages. Triggers: 'should I rewrite this Visualforce page in LWC', 'CSRF protection disabled on Visualforce page is that safe', 'community user sees a field they should not on a Visualforce page', 'view state encryption is that enough for sensitive data', 'how do I host an LWC inside a Visualforce page', 'apex:dynamicComponent and apex:actionFunction safe to keep'. NOT for greenfield Visualforce architecture (use apex/visualforce-fundamentals — controller types, view state pattern selection, PDF rendering); NOT for Visualforce email template authoring (use apex/visualforce-email-templates if/when that skill is authored); NOT for general Apex security review across triggers and async (use apex/soql-security and security/secure-coding-review-checklist).

transaction-security-policies

8
from PranavNagrecha/AwesomeSalesforceSkills

Transaction Security policy creation and configuration: condition builder, enhanced policies, enforcement actions (block, MFA, notification, end session), real-time monitoring mode, and policy troubleshooting. NOT for Event Monitoring log analysis or Shield Event Monitoring setup (use event-monitoring). NOT for Apex testing or debug-log analysis.

sso-saml-troubleshooting

8
from PranavNagrecha/AwesomeSalesforceSkills

Diagnosing broken SAML SSO into Salesforce — IdP-initiated vs SP-initiated flows, signing-certificate validity / expiry, NameID format mismatches, RelayState handling, audience / entityId / issuer mismatches, clock skew, the SAML Assertion Validator in Setup, the Login History debug log, and the My Domain prerequisite for SSO. Covers the standard diagnostic loop: read the SAML response, identify which check failed, fix at the IdP or SP. NOT for OAuth / OpenID Connect SSO (see security/oauth-openid-troubleshooting), NOT for setting up SSO from scratch (see security/sso-saml-setup).

shield-kms-byok-setup

8
from PranavNagrecha/AwesomeSalesforceSkills

Configure Shield Platform Encryption with customer-supplied (BYOK) or customer-held (Cache-Only Key Service) tenant secrets, rotate them, and recover. NOT for Classic Encryption or field masking.

shield-event-log-retention-strategy

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when designing Salesforce Shield Event Monitoring retention, SIEM routing, and storage-tier strategy — which event types to keep, for how long, where, and how to answer audit queries across hot/warm/cold tiers. Triggers: 'shield event log retention', 'route event monitoring to splunk', 'how long to keep login history', 'siem salesforce integration', 'event monitoring storage tier'. NOT for enabling Shield (see salesforce-shield-deployment).

session-management-and-timeout

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when configuring session timeout values, concurrent session limits, session IP locking, or logout behavior in Salesforce. Covers org-wide session settings, profile-level overrides, Connected App session policies, and Metadata API SecuritySettings deployment. NOT for OAuth token refresh flows, login IP ranges, or MFA/identity-provider configuration.

session-high-assurance-policies

8
from PranavNagrecha/AwesomeSalesforceSkills

Enforce step-up authentication for sensitive pages/objects using High Assurance session level and login flow policies. NOT for initial MFA enrollment UX.

service-account-credential-rotation

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when designing credential rotation for integration users, connected apps, named credentials, and OAuth client secrets in Salesforce. Covers rotation cadence, zero-downtime handover, secret storage, and detection of stale credentials. Triggers: 'rotate integration user password', 'connected app secret rotation', 'named credential rotation', 'stale service account', 'zero downtime secret rotation'. NOT for end-user password policies.