← 返回
未分类 中文

can i use

Query browser compatibility for CSS/JS features using caniuse-cli. Use when user asks about browser support, compatibility, "can I use X", "does X work in IE...
使用 caniuse-cli 查询 CSS/JS 功能的浏览器兼容性。适用于用户询问浏览器支持、兼容性、X能否使用、X在IE中是否支持等场景。
zhouqicf zhouqicf 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 285
下载
💾 0
安装
1
版本
#latest

概述

Browser Compatibility Query

Query browser compatibility data for web features using the caniuse CLI tool.

Prerequisites Check

Before querying, verify caniuse-cli is installed:

which caniuse || echo "NOT_INSTALLED"

If not installed, tell the user:

> caniuse-cli is not installed. Install it with:

> ```bash

> npm install -g @bramus/caniuse-cli

> ```

Querying Compatibility

Run the caniuse command with the feature name:

caniuse <feature-name>

Feature name formats:

  • Hyphenated: caniuse viewport-units
  • Quoted phrases: caniuse "viewport units"
  • With special chars: caniuse @property

Common feature name mappings (user term → caniuse query):

  • :has() selector → css-has
  • :where() selector → css-where
  • :is() selector → css-matches-pseudo
  • container queries → css-container-queries (size) or css-container-queries-style (style)
  • CSS nesting → css-nesting
  • subgrid → subgrid
  • aspect-ratio → css-aspect-ratio
  • gap in flexbox → flexbox-gap
  • CSS grid → css-grid
  • flexbox → flexbox

JS/API features:

  • ES modules → es6-module
  • async/await → async-functions
  • optional chaining → mdn-javascript_operators_optional_chaining
  • fetch API → fetch
  • service workers → serviceworkers
  • WebGPU → webgpu

Presenting Results

After running the command:

  1. Show the compatibility table as returned by caniuse
  1. Highlight key findings:
    • Which major browsers fully support it
    • Any browsers with partial support (note the limitations)
    • Browsers that don't support it at all
  1. Call out important notes if the output includes numbered notes (these often contain critical info about prefixes, flags, or partial implementations)
  1. Give practical advice based on the results:
    • If widely supported: "Safe to use in production"
    • If partial support: "Works but check the notes for limitations"
    • If poor support: "Consider a polyfill or fallback"

Handling Unknown Features

If caniuse returns "Nothing was found":

  1. Check the mapping table above — many features have specific caniuse names (e.g., :has()css-has)
  1. Try common prefixes:
    • CSS properties: try css- prefix (e.g., css-grid, css-variables)
    • MDN data: try mdn- prefix for JS features
  1. Try variations:
    • Remove special characters: :has()has or css-has
    • Use hyphens: "container queries" → container-queries
  1. If still not found, tell the user:

> This feature might not be in the caniuse database, or uses a different name.

> Check https://caniuse.com to find the correct feature name.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 23:12 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 685 📥 330,757
dev-programming

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 142 📥 42,062
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 198 📥 68,164