360 Secure SkillHub
360 安全技能中心

Axiom Css Specificity

通过纯标准库 Python 脚本按 W3C Selectors Level 4 计算 CSS 选择器的 (a,b,c) 特异度,支持 :is()、:not()、:where()、属性选择器、伪类和组合符,可比较两个选择器并以 JSON 输出明细,用于调试 CSS 冲突与审计选择器;不含 CSS 渲染或 SCSS/Less 支持。

kofna3369
kofna3369
热度 24.22
最近更新 2026-06-15 12:50:09
分类:开发依赖:代码执行应用场景:调试排错 / 代码审查

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add axiom-css-specificity
Metadata
name
axiom-css-specificity
description
CSS specificity calculator — compute (a, b, c) specificity for any CSS selector. Handles :is(), :not(), :where(), combinators, attribute selectors. Use when you need to debug CSS conflicts. Pure stdlib, no LLM.
version
0.1.2
license
Apache-2.0

axiom-css-specificity

Version: 0.1.2 Axioma Tools

Computes CSS specificity per W3C Selectors Level 4.

What this skill does

  • Computes (a, b, c) tuple per W3C spec
  • Handles :is(), :not(), :where() (where() = 0)
  • Handles attribute selectors, pseudo-classes
  • Supports combinators (>, +, ~, descendant)
  • JSON output with breakdown

When to use this skill

  • ✅ Debug CSS specificity conflicts
  • ✅ Audit CSS for overly-broad selectors
  • ✅ Compare specificity of two rules
  • ❌ Render CSS (use a browser)
  • ❌ Support CSS preprocessor syntax (SCSS/Less)

Usage

python3 axiom_css_specificity.py "body div#main .item:first-child"
python3 axiom_css_specificity.py --compare "a" "div.menu a"
from axiom_css_specificity import compute_specificity
compute_specificity('div#main a:hover')  # (0, 2, 2)

Validation

Check Status
Unit tests 18 cases
Performance <100ms
Security Pure stdlib, no injection
Determinism Byte-to-byte stable
License Apache-2.0

Last updated: 2026-06-14