/ogxo-debug:css-alignment-debugfrom ogxo-debug
Injects temporary CSS outlines to diagnose visual layout bugs — misaligned elements, scoped styles not applying, phantom DOM nodes, and hidden ancestor effects. Use after reading source code fails to reveal the cause.
Ships in ogxo-debug. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill when the user reports a visual layout bug AND you have spent more than one round trip guessing at the cause from CSS source alone. It exists because layout bugs frequently come from invisible boxes — pseudo-elements, ancestor flex containers, scoped-CSS misses, inherited font-size from unexpected parents. Reading CSS files doesn't show you what's actually in the DOM.
The single fundamental move: inject a temporary high-contrast outline + dashed border on the suspect container and every descendant, ship to the browser, ask the user for a screenshot, then read the picture to see which boxes are real, where they sit, and what's actually inheriting your CSS.
Use this skill when:
::before, ::after), a flex/grid child, or an unexpected ancestor seems to be the culpritDo NOT use this skill for:
live-debug)live-debug)Three categories of layout bug are impossible to confirm without seeing the rendered DOM:
font-size: 2em, transform: scale(...), display: contents, etc., and your child's em-based sizing or alignment is inheriting that<title> in body, a leaked <h1>, a sibling rendered by another component)<style scoped> adds [data-v-xxxxxx] attribute selectors; if <router-link> or any wrapper doesn't propagate that attribute to the actual rendered <a>, your scoped rule silently doesn't applyA 2px outline + dashed descendant outline answers all three in one screenshot:
┌──────────────────────────────┐
│ 1. STATE THE HYPOTHESIS │
│ "X is too big because Y" │
└──────────────┬───────────────┘
▼
┌──────────────────────────────┐
│ 2. INJECT DEBUG OVERLAY │
│ outline + dashed children │
└──────────────┬───────────────┘
▼
┌──────────────────────────────┐
│ 3. ASK FOR SCREENSHOT │
│ "hard-refresh and send" │
└──────────────┬───────────────┘
▼
┌──────────────────────────────┐
│ 4. READ THE PICTURE │
│ confirm or refute │
└──────────────┬───────────────┘
▼
┌──────────────────────────────┐
│ 5. FIX │
│ targeted at real cause │
└──────────────┬───────────────┘
▼
┌──────────────────────────────┐
│ 6. REMOVE DEBUG OVERLAY │
│ + verify │
└──────────────┬───────────────┘
│ not fixed?
└────► back to 1
Before injecting anything, write down (in one sentence) what you believe is happening and where. Examples:
mygit text is the last <li> in #breadcrumbs inheriting font-size from an ancestor with font-size: 2em."#main isn't getting padding-left: 16em when sticky is on."align-items: stretch (default) instead of center."Your overlay should test that specific hypothesis. If your overlay doesn't produce evidence for or against the hypothesis, you haven't stated it precisely enough.
Add the overlay rules to a global CSS file (not a scoped Vue/component CSS) so they win specificity easily and you don't have to chase scoping. In most projects this is styles.css, app.css, main.css, global.css, or index.css.
The default overlay (covers 90% of cases):
/* CSS-ALIGNMENT-DEBUG: remove before committing */
#suspect-container {
outline: 2px solid red !important;
}
#suspect-container * {
outline: 1px dashed orange !important;
}
Add a second pair if you also need to see a sibling container for comparison:
.other-container {
outline: 2px solid cyan !important;
}
.other-container * {
outline: 1px dashed lime !important;
}
Key choices:
outline, not border — outlines don't affect layout, so what you see is the layout as-is. Borders shift things by their own width and lie to you.!important on the outlines — to win any pre-existing border/outline rules.CSS-ALIGNMENT-DEBUG: so the cleanup step (Step 6) is trivially greppable. Never ship this rule.When the symptom is specifically a sizing/inheritance issue (not "where is this element"), include the size/inheritance probe in the same overlay:
/* CSS-ALIGNMENT-DEBUG: also lock font-size to see what overrides inheritance */
#suspect-container,
#suspect-container * {
outline: 1px dashed orange !important;
font-size: 13px !important;
line-height: 1.4 !important;
}
#suspect-container .material-symbols,
#suspect-container .icon-class {
font-size: 18px !important; /* exception for icon fonts so glyphs don't break */
}
When the symptom is "things in the wrong z-stack" (modal hidden behind sidebar, etc.), use background tints instead of outlines:
/* CSS-ALIGNMENT-DEBUG: tint to see z-stack */
#suspect { background: rgba(255, 0, 0, 0.18) !important; }
#other-suspect { background: rgba(0, 200, 255, 0.18) !important; }
Wait for the dev server/HMR to rebuild (1–3 seconds), then ask the user to hard-refresh and paste a screenshot. A useful prompt:
"Rebuilt with a debug overlay. Hard-refresh (⌘⇧R) and screenshot the affected area. Red solid = the container; orange dashed = every descendant. Pixels with no outline are not inside the container."
If a browser tool is available in this session, take the screenshot yourself instead, and read computed styles directly where the tool supports it. With a tool that can run page JavaScript, you can inject the overlay at runtime instead of editing source.
Look for these signals:
| What you see | What it tells you |
|---|---|
| Suspect text has no outline | Element is not where you think — it's outside the container you targeted. Pivot your hypothesis. |
| Outline is present but child boxes are misaligned vertically | Flex/grid axis alignment problem — fix align-items. |
| Outline is present, child sizes vary unexpectedly | Inheritance issue — find which ancestor is multiplying em units. |
| Outline is present and looks correct but visual still wrong | Specificity loss — your "real" rule isn't winning. Climb the Specificity Ladder one level at a time. |
| Outline appears in unexpected location (wrong viewport region) | Positioning bug — element is position: fixed/absolute and offset wrong. |
| Multiple outlines stacking in same location | The DOM has duplicate elements (component rendered twice). |
Write down what the picture told you. Then go fix the actual cause, not the symptom.
Now write the real fix targeted at the cause you confirmed. Keep the debug overlay in place during the fix — it lets you verify the fix without a second overlay round-trip.
Once you've confirmed the fix works:
# find every debug marker you left
grep -rn "CSS-ALIGNMENT-DEBUG" . --include="*.css" --include="*.scss" --include="*.sass" --include="*.less" --include="*.tsx" --include="*.jsx" --include="*.vue" --include="*.svelte" --include="*.astro" --include="*.html"
Remove every rule prefixed with the marker. Ask for one final screenshot to confirm:
Never commit code with CSS-ALIGNMENT-DEBUG left in. A pre-commit hook or grep in CI can enforce this.
If your hypothesis is right but your rule isn't winning, escalate one level at a time. Don't jump straight to !important — that hides scoping bugs that will resurface.
.classname { ... }.parent .classname { ... }#id .classname { ... }#id .classname { ... !important }#id, #id * { ... !important } (nuke from orbit)If you needed level 4 or 5, leave a comment explaining why — future you (or another developer) will want to know whether to clean up the !important once the underlying bug is fixed.
Vue <style scoped> adds [data-v-xxxxxx] to elements. When a slot or <router-link> wraps an element, the attribute may or may not propagate. If a scoped rule isn't applying:
:deep(selector) in Vue 3 scoped CSSReact + CSS-in-JS / CSS Modules generates hashed class names. Inspect the rendered element to see the hash, then match it in your debug overlay.
Svelte scoped styles add an .svelte-xxxxxx class. Same principles.
"I see no outlines at all."
The overlay rule is in a CSS file that isn't loaded for this route, or you put it in a scoped component CSS. Move to a global stylesheet that's always loaded (e.g. the entry-point CSS imported by main.js).
"Everything has an outline, including unrelated parts of the page."
Your selector is too broad. * { outline: ... } covers literally everything. Scope it: #myContainer *.
"The element I'm trying to outline is position: fixed and the outline shows in a weird place."
The outline is correct; the element really is positioned there. Check top/left/right/bottom in the computed styles, or look for ancestor transform that creates a new containing block.
"Outline shows but the box is empty / collapsed."
The element exists but has display: none, visibility: hidden, zero width/height, or all its children are absolute-positioned out of flow. Read the computed styles to see which.
"Hot-reload doesn't pick up the overlay change." Some build systems cache CSS aggressively. Force a full reload: kill the dev server and restart, or temporarily edit a Vue/component file alongside the CSS to trigger a full rebuild.
Copy-paste these as starting points and adapt the selector.
Default overlay (container + all descendants):
/* CSS-ALIGNMENT-DEBUG: remove before committing */
#TARGET { outline: 2px solid red !important; }
#TARGET * { outline: 1px dashed orange !important; }
Compare two containers side by side:
/* CSS-ALIGNMENT-DEBUG */
#A { outline: 2px solid red !important; }
#A * { outline: 1px dashed orange !important; }
#B { outline: 2px solid cyan !important; }
#B * { outline: 1px dashed lime !important; }
Lock sizing while you debug inheritance:
/* CSS-ALIGNMENT-DEBUG */
#TARGET, #TARGET * {
outline: 1px dashed orange !important;
font-size: 13px !important;
line-height: 1.4 !important;
}
#TARGET .material-symbols { font-size: 18px !important; }
Z-stack visualisation (instead of outlines):
/* CSS-ALIGNMENT-DEBUG */
#header { background: rgba(255, 0, 0, .18) !important; }
#sidebar { background: rgba(0, 200, 255, .18) !important; }
#shelf { background: rgba(132, 204, 22, .18) !important; }
#main { background: rgba(245, 158, 11, .18) !important; }
Find phantom duplicate elements (very specific selector + count):
/* CSS-ALIGNMENT-DEBUG */
.suspect-class {
outline: 2px solid magenta !important;
outline-offset: 2px !important;
}
.suspect-class::before {
content: "DUP";
position: absolute;
background: magenta;
color: white;
font-size: 10px;
padding: 1px 3px;
z-index: 99999;
}
If you see more than one magenta tag on screen, the component is being mounted multiple times.
Drop this in a local pre-commit hook or a CI grep step:
# Fail if any debug-overlay rules are left in the source tree
if grep -rqn "CSS-ALIGNMENT-DEBUG" --include="*.css" --include="*.scss" --include="*.vue" --include="*.svelte" --include="*.jsx" --include="*.tsx" src/; then
echo "ERROR: CSS-ALIGNMENT-DEBUG markers found. Remove before committing."
grep -rn "CSS-ALIGNMENT-DEBUG" --include="*.css" --include="*.scss" --include="*.vue" --include="*.svelte" --include="*.jsx" --include="*.tsx" src/
exit 1
fi
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ogxo-io/plugins --plugin ogxo-debug3 skills in this plugin
/browser-testingBrowser and web app testing with Playwright. Auto-detects dev servers; writes and runs E2E, accessibility, responsive-layout, form/login, and link-check scripts. Use when the user wants to test a website or web app or script a browser task; for diagnosing a live runtime bug use ogxo-debug:live-debug./live-debugDebug running web apps by driving browser, reading console and network errors, iteratively fixing code. Use when the user reports a runtime symptom in a web app (broken layout, clicks that do nothing, JS or hydration errors, failing API calls) or wants to confirm a fix in the browser. For writing E2E test suites use ogxo-debug:browser-testing.