| name | browser-debug |
| description | Browser debugging workflows for Chrome DevTools, Firefox DevTools, and AI agent debugging. Use when debugging UI issues, inspecting elements, analyzing performance, or troubleshooting rendering problems in the browser. Triggers: "debug", "devtools", "inspect", "console", "network", "performance", "memory", "render", "layout", "css issue", "js error".
|
| category | web-ui |
Skill: browser-debug
What This Covers
Browser debugging using Chrome DevTools, Firefox DevTools, and programmatic debugging
with Puppeteer/Playwright. Covers DOM inspection, CSS debugging, JavaScript debugging,
performance analysis, network monitoring, memory profiling, and accessibility auditing.
Core Tools
Chrome DevTools
| Panel | Purpose | Shortcut |
|---|
| Elements | DOM/CSS inspection | Ctrl+Shift+C |
| Console | JS execution/logs | Ctrl+Shift+J |
| Sources | JS debugging/breakpoints | Ctrl+Shift+F |
| Network | Request monitoring | Ctrl+Shift+E |
| Performance | Runtime profiling | Ctrl+Shift+Q |
| Memory | Heap snapshots | Ctrl+Shift+M |
| Lighthouse | Audits | Ctrl+Shift+P → "Lighthouse" |
| Accessibility | A11y tree | Ctrl+Shift+P → "Accessibility" |
Firefox DevTools
| Panel | Purpose | Shortcut |
|---|
| Inspector | DOM/CSS inspection | Ctrl+Shift+C |
| Console | JS execution/logs | Ctrl+Shift+K |
| Debugger | JS debugging | Ctrl+Shift+Z |
| Network | Request monitoring | Ctrl+Shift+E |
| Performance | Runtime profiling | Ctrl+Shift+I → Performance |
| Accessibility | A11y inspector | Ctrl+Shift+I → Accessibility |
Debugging Workflows
CSS Layout Issues
- Open Elements panel → select element
- Check Computed tab for actual values
- Use Box Model overlay to verify padding/margin
- Toggle CSS properties to test changes
- Check for conflicting selectors in Specificity view
npx impeccable detect src/ examples/
JavaScript Errors
- Open Console panel
- Filter by "Errors" level
- Click error to jump to Sources panel
- Set breakpoint at error location
- Inspect stack trace and variables
grep -rE "console\.(error|warn)" src/ examples/ --include='*.js'
Performance Issues
- Open Performance panel → Record
- Interact with page (click, scroll, type)
- Stop recording → analyze flame chart
- Look for long tasks (>50ms)
- Check for layout thrashing (forced reflows)
find src/ examples/ -name '*.js' -o -name '*.css' | xargs wc -c
Network Issues
- Open Network panel → check "Disable cache"
- Reload page → analyze waterfall
- Filter by type (JS, CSS, Image, XHR)
- Check for slow requests (>1s)
- Verify CSP headers in Response tab
Memory Leaks
- Open Memory panel → take Heap Snapshot
- Perform actions that might leak
- Take another Heap Snapshot
- Compare snapshots → look for growing objects
- Check for detached DOM nodes
Accessibility Issues
- Open Accessibility panel (Chrome) or Accessibility Inspector (Firefox)
- Check for missing names on interactive elements
- Verify contrast ratios
- Check ARIA attributes
- Run axe-core audit
npx axe-core src/ examples/
AI Agent Debugging Patterns
Console Logging
console.error('[Module]', { action: 'fetch', error: err.message });
console.time('render');
renderComponent();
console.timeEnd('render');
Error Boundaries
window.addEventListener('error', (e) => {
console.error('[App]', e.error || e.message);
});
window.addEventListener('unhandledrejection', (e) => {
console.error('[App] Unhandled', e.reason);
});
DOM Inspection
document.querySelectorAll('[aria-label]');
getComputedStyle(element).getPropertyValue('color');
element.getBoundingClientRect();
Common Issues and Fixes
| Issue | Symptom | Fix |
|---|
| Layout thrash | Janky scrolling | Batch DOM reads/writes |
| CLS shift | Content jumping | Set explicit dimensions |
| Memory leak | Growing heap | Remove event listeners |
| CSP blocked | Resources not loading | Update CSP headers |
| Contrast fail | A11y audit errors | Use design tokens |
| Overflow clip | Dropdowns hidden | Use position: fixed |
Commands
npx impeccable detect src/ examples/
grep -rE "console\.(error|warn)" src/ examples/ --include='*.js'
grep -rE "aria-label|role=" src/ examples/ --include='*.html' --include='*.js' | wc -l
grep -rE "Content-Security-Policy" src/ examples/ --include='*.html'
find src/ examples/ -name '*.js' -o -name '*.css' | xargs wc -c
bash scripts/quality-gate.sh
Rules
- Always check Console for errors before debugging
- Use Device Mode to test responsive layouts
- Record Performance traces for runtime issues
- Take Heap Snapshots before and after actions for memory leaks
- Verify ARIA attributes in Accessibility panel
- Check Network tab for blocked requests and CSP violations
- Use Lighthouse for comprehensive audits
- Prefer transform/opacity for animations (GPU-accelerated)
- Test with
prefers-reduced-motion enabled