with one click
debug-weird-ui-behavior-with-cdp-logging
// Use when weird app/UI behavior needs live reproduction and tracing, including flicker, stale state, remounts, focus/scroll jumps, action glitches, or ordering flashes
// Use when weird app/UI behavior needs live reproduction and tracing, including flicker, stale state, remounts, focus/scroll jumps, action glitches, or ordering flashes
TypeScript/JavaScript codebase hardening: maintainability, code quality, architecture cleanup, repo scoring, agent-friendly structure, godfiles, godfunctions, feature folders, DRY, type safety, traversability, feedback loops, worktrees, subagents, swarm refactors.
Runs this repo's GitHub issue and PR workflow with gh. Use when the user mentions issue numbers, PR links, or the project board, asks to pick a manageable issue, wants an issue rewritten into a proper issue, wants backlog triage or relabeling, or wants a PR opened, updated, or reviewed. Do not use for local-only git work with no GitHub issue or project flow.
Build or modify Howcode native extensions that work in both desktop composer/runtime-host and Pi TUI takeover. Use when adding another Howcode-only agent tool, dual-surface extension, native extension setting, per-session extension snapshot, or composer-adjacent tool UI. Do not use for ordinary installable Pi extensions or UI-only composer cards.
Use when Igor asks to build this branch/current repo and run a disposable build version
How to add short-lived static fixtures for hard-to-reproduce UI states while tuning layout
Use when Igor says a worktree seems complete and wants a branch/worktree summary saved for later review and merging
| name | Debug weird UI behavior with CDP logging |
| description | Use when weird app/UI behavior needs live reproduction and tracing, including flicker, stale state, remounts, focus/scroll jumps, action glitches, or ordering flashes |
Use this when the app does something weird and the behavior must be observed live: refreshes, remounts, flickers, rows briefly unfolding, wrong ordering for a moment, state changing then reverting, actions firing twice, stale UI, unexpected navigation, focus loss, scroll jumps, or anything where code inspection alone is likely to lie.
CDP_PORT=39217) when possible.cdp-debug-* or tmp-*.List targets:
CDP_PORT=39217 /home/igorw/.pi/agent/skills/chrome-cdp/scripts/cdp.mjs list
Use the target id prefix from list in later commands.
Adapt selectors to the surface being debugged. For sidebar branch/worktree flicker, this logger captures row labels, expanded state, and scroll position:
CDP_PORT=39217 /home/igorw/.pi/agent/skills/chrome-cdp/scripts/cdp.mjs eval <target> '(() => {
window.__uiDebug?.observer?.disconnect?.()
const root = document.querySelector(".sidebar-project-work-section")
window.__uiDebug = { events: [], startedAt: Date.now() }
const labels = () => Array.from(document.querySelectorAll(".sidebar-project-work-branch-toggle"))
.map((el) => ({
text: el.textContent.trim(),
expanded: el.getAttribute("aria-expanded"),
disabled: el.hasAttribute("disabled"),
}))
const snap = (reason) => window.__uiDebug.events.push({
t: Date.now(),
dt: Date.now() - window.__uiDebug.startedAt,
reason,
labels: labels(),
scrollTop: document.querySelector(".sidebar-project-work-scroll-shell")?.scrollTop ?? null,
})
snap("install")
const observer = new MutationObserver((mutations) => {
if (!mutations.some((m) => m.type === "childList" || m.type === "attributes")) return
snap("mutation:" + mutations.map((m) =>
m.type + (m.attributeName ? ":" + m.attributeName : "") + ":+" + m.addedNodes.length + ":-" + m.removedNodes.length
).slice(0, 8).join(","))
})
if (root) observer.observe(root, {
subtree: true,
childList: true,
attributes: true,
attributeFilter: ["aria-expanded", "data-current", "data-divider-after", "data-divider-before"],
})
window.__uiDebug.observer = observer
return labels().slice(0, 20)
})()'
Example pattern:
cdp-debug-*).CDP_PORT=39217 /home/igorw/.pi/agent/skills/chrome-cdp/scripts/cdp.mjs eval <target> '(() => {
window.__uiDebug.events.push({ reason: "before-action", t: Date.now(), dt: Date.now() - window.__uiDebug.startedAt })
return true
})()'
CDP_PORT=39217 /home/igorw/.pi/agent/skills/chrome-cdp/scripts/cdp.mjs eval <target> '(() => window.__uiDebug?.events?.slice(-80))()'
window.__uiDebug is gone, or Vite logs full reload.