css-debug

css-debug is a skill for Claude Code, Codex from majiayu000/spellbook. It costs 35 tokens per session (1,606 once invoked), scanned A, original, MIT.

A troubleshooting guide for CSS and frontend layout problems in web applications, including React and Tailwind CSS.

In plain words
What is it for?
Checking positioning, overflow, Flexbox and Grid layouts, z-index stacking, computed styles, Tailwind classes, and React rendering or visibility issues.
Why use it?
It helps explain why elements are misplaced, clipped, hidden, covered by other elements, or unaffected by expected styles.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Checking positioning, overflow, Flexbox and Grid layouts, z-index stacking, computed styles, Tailwind classes, and React rendering or visibility issues.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/majiayu000/spellbook/css-debug
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add majiayu000/spellbook --skill css-debug
Clone the repo
git clone --depth 1 https://github.com/majiayu000/spellbook

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for css-debug

README.md
[![agentmods](https://agentmods.dev/badge/skills/majiayu000/spellbook/css-debug/github.svg)](https://agentmods.dev/skills/majiayu000/spellbook/css-debug)
Your own site
<a href="https://agentmods.dev/skills/majiayu000/spellbook/css-debug"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/css-debug/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for css-debug

Your own site · 80×15
<a href="https://agentmods.dev/skills/majiayu000/spellbook/css-debug"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/css-debug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,606 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.01606
Opus 5.5 $0.00014 $0.00642
Sonnet 5.5 $0.00007 $0.00321
Haiku 4.5 $0.00003 $0.00161

Measured 1mo ago against content hash 38bfe7d7ab0b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

css-debug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/css-debug/SKILL.md · 216 lines

How it starts

The opening of the file, as written. The whole thing — 216 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CSS Debug Skill

css-debug true

使用场景

当用户遇到以下问题时使用此 skill:

  • CSS 定位问题(元素位置不正确、被裁剪、溢出等)
  • React 组件渲染问题
  • Tailwind CSS 类不生效
  • 绝对定位/相对定位问题
  • Flexbox/Grid 布局问题
  • z-index 层叠问题

调试步骤

1. 收集信息

首先向用户询问或获取:

  • 浏览器开发者工具中的 HTML 结构
  • 相关元素的 computed styles
  • 父容器的 CSS 属性(特别是 position、overflow、display)
  • 截图(如果有的话)

2. 常见问题检查清单

绝对定位内容被裁剪
问题:position: absolute 的元素被父容器裁剪
检查:
- [ ] 父容器是否有 overflow: hidden 或 overflow: auto
- [ ] 祖先容器是否有 overflow: hidden
- [ ] 父容器是否设置了 position: relative
- [ ] 元素的 top/left/right/bottom 值是否超出父容器

解决方案:
1. 将 overflow: hidden 改为 overflow: visible
2. 或将绝对定位元素移到更外层的容器
3. 或使用 fixed 定位(相对于视口)
元素位置偏移
问题:元素位置与预期不符
检查:
- [ ] positionX/positionY 或 left/top 值是否正确
- [ ] 最近的 position: relative 祖先是哪个
- [ ] 是否有 margin/padding 影响
- [ ] transform 是否影响定位上下文

解决方案:
1. 确认定位参考点是正确的祖先元素
2. 检查 CSS 单位(px vs % vs rem)
3. 使用浏览器检查器的"元素选择"功能定位问题
内容不显示
问题:React 组件渲染但内容不可见
检查:
- [ ] 元素是否有 width/height(可能为 0)
- [ ] opacity 是否为 0
- [ ] visibility 是否为 hidden
- [ ] display 是否为 none
- [ ] z-index 是否被其他元素遮挡
- [ ] color 是否与背景色相同

解决方案:
1. 在开发者工具中检查 Computed 面板
2. 临时添加边框或背景色调试:border: 1px solid red
3. 检查条件渲染逻辑
Tailwind 类不生效
问题:Tailwind CSS 类没有应用
检查:
- [ ] 类名拼写是否正确
- [ ] 是否被更高优先级的样式覆盖
- [ ] 动态类名是否正确生成(字符串拼接问题)
- [ ] tailwind.config.js 中 content 配置是否包含该文件

解决方案:
1. 使用 !important 临时测试:!overflow-visible
2. 检查 className 是否正确传递
3. 使用内联 style 作为备选方案

3. 浏览器调试命令

在浏览器控制台运行:

// 高亮所有绝对定位元素
document.querySelectorAll('[style*="position: absolute"]').forEach(el => {
  el.style.outline = '2px solid red';
  console.log(el, getComputedStyle(el));
});

// 查找 overflow: hidden 的容器
document.querySelectorAll('*').forEach(el => {
  const style = getComputedStyle(el);
  if (style.overflow === 'hidden' || style.overflowX === 'hidden' || style.overflowY === 'hidden') {
    el.style.outline = '2px dashed blue';
    console.log('overflow-hidden:', el);
  }
});

// 检查元素的完整 computed 样式
const el = document.querySelector('.your-selector');
console.table({
  position: getComputedStyle(el).position,
  overflow: getComputedStyle(el).overflow,
  display: getComputedStyle(el).display,
  width: getComputedStyle(el).width,
  height: getComputedStyle(el).height,
  top: getComputedStyle(el).top,
  left: getComputedStyle(el).left,
});

// 查找定位祖先
function findPositionedAncestor(el) {
  let current = el.parentElement;
  while (current) {
    const position = getComputedStyle(current).position;
    if (position !== 'static') {
      console.log('Positioned ancestor:', current, 'position:', position);
      return current;
    }
    current = current.parentElement;
  }
  console.log('No positioned ancestor found, using viewport');
  return null;
}
findPositionedAncestor(document.querySelector('.your-selector'));

Read the full file on GitHub · 216 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 216 lines · 35 tokens per session scan A 38bfe7d7ab0b

Subscribe to this mod's changes

css-debug is a skill published in the GitHub repository majiayu000/spellbook (288 stars, last pushed yesterday), licensed MIT. It adds 35 tokens to every session and 1,606 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

workflow

A workflow skill for embedded-device projects that plans and runs building, flashing, debugging, observing, and diagnosis tasks.

zhinkgit/embeddedskills · 88 tokens

RootCauseAnalysis

Structured incident investigation using Five Whys, Fishbone, blameless Postmortem, Fault Tree, Kepner-Tregoe, and FMEA — traces failures to systemic root causes rather than blaming humans. USE WHEN root cause, RCA, 5 whys, fishbone, postmortem, incident analysis, fault tree, why does this keep failing, blameless…

danielmiessler/LifeOS · 93 tokens

deck-retro

Run a fully local agent-deck retrospective over the user's own transcripts, Recall index and logs. Use when a user wants to find recurring failures or take their own finding from investigation through synthetic reproduction, a user-filed issue, a test-first fix and contributor PR handoff. Also use for weekly usage…

asheshgoplani/agent-deck · 86 tokens

recipe-diagnose

Investigate problem, verify findings, and derive solutions.

shinpr/claude-code-workflows · 15 tokens

Vitals

Read-only macOS performance inspection: a deterministic CLI gathers the numbers, Interpretation.md turns them into a diagnosis instead of a data dump.

danielmiessler/LifeOS · 179 tokens

cao-session-management

Find available CAO (CLI Agent Orchestrator) agent profiles, and talk to the conductor and worker terminals of a running CAO session, including unblocking a stuck worker. Use when choosing a profile to launch, messaging or unblocking workers, or diagnosing a stuck session. For preflight, launching, session commands…

awslabs/cli-agent-orchestrator · 83 tokens