modern-web-guidance

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Modern Web Guidance

现代Web开发指南

A skill to search for specific web development use cases and retrieve their corresponding best practice guides.
这是一项用于搜索特定Web开发用例并获取对应最佳实践指南的技能。

When to use

使用时机

Must use this skill:
  • At the start of implementing any web feature.
  • Before creating a new component, to check if a standardized pattern already exists.
  • To avoid implementing ad-hoc solutions or loading large dependencies unnecessarily.
必须使用此技能的场景:
  • 在实现任何Web功能的开始阶段
  • 在创建新组件之前,检查是否已有标准化模式。
  • 避免临时解决方案或不必要地加载大型依赖项。

Usage Instructions

使用说明

Step 1. Search Use Cases

步骤1. 搜索用例

Search with an action-oriented query summarizing what you want to achieve using the
search
command. Run
modern-web-guidance
directly with
npx
.
sh
npx -y modern-web-guidance@latest search "<query>" --skill-version 2026_05_16-c5e7870
Example Output:
json
[
  {
    "id": "optimize-image-priority",
    "description": "Optimize the loading priority of Largest Contentful Paint (LCP) candidate images.",
    "category": "performance",
    "featuresUsed": [ "Fetch priority" ],
    "tokenCount": 985,
    "similarity": 0.7289
  },
  {
    "id": "defer-rendering-heavy-content",
    "description": "Reduce rendering times in content-heavy web pages by deferring rendering for offscreen content.",
    "category": "performance",
    "featuresUsed": [ "content-visibility", "hidden=\"until-found\"" ],
    "tokenCount": 1250,
    "similarity": 0.6961
  }
]
Note: If search results are vague, return no matches, or show low similarity scores, run the
list
command to browse all guides:
sh
npx -y modern-web-guidance@latest list

使用
search
命令,以面向操作的查询语句总结你想要实现的目标。直接通过
npx
运行
modern-web-guidance
sh
npx -y modern-web-guidance@latest search "<query>" --skill-version 2026_05_16-c5e7870
示例输出:
json
[
  {
    "id": "optimize-image-priority",
    "description": "Optimize the loading priority of Largest Contentful Paint (LCP) candidate images.",
    "category": "performance",
    "featuresUsed": [ "Fetch priority" ],
    "tokenCount": 985,
    "similarity": 0.7289
  },
  {
    "id": "defer-rendering-heavy-content",
    "description": "Reduce rendering times in content-heavy web pages by deferring rendering for offscreen content.",
    "category": "performance",
    "featuresUsed": [ "content-visibility", "hidden=\"until-found\"" ],
    "tokenCount": 1250,
    "similarity": 0.6961
  }
]
Note: 如果搜索结果模糊、无匹配项或相似度分数较低,请运行
list
命令浏览所有指南:
sh
npx -y modern-web-guidance@latest list

Step 2. Retrieve Best Practices

步骤2. 获取最佳实践

Once you have a relevant
id
from the search results, call this script using the
retrieve
command to get the full guide. You can pass multiple IDs separated by commas.
sh
npx -y modern-web-guidance@latest retrieve "<id>"
Example Output:
The markdown content of the guide describing implementation steps...
从搜索结果中获得相关的
id
后,使用
retrieve
命令调用此脚本以获取完整指南。你可以传入多个用逗号分隔的ID。
sh
npx -y modern-web-guidance@latest retrieve "<id>"
示例输出:
The markdown content of the guide describing implementation steps...

Using npx

使用npx的注意事项

  • IMPORTANT: on Windows, using
    npx
    may fail. Use
    npx.cmd ...
    instead.
  • Network access is required for fetching npm packages needed by the task.
  • If the
    npx -y modern-web-guidance…
    command hangs, you may be offline. Try running again in offline mode:
    npx --offline …
    .
  • The
    --skill-version
    flag is used to determine if this SKILL.md is out of date. If it is, a warning message is logged to stderr.
  • IMPORTANT: 在Windows系统中,使用
    npx
    可能失败,请改用
    npx.cmd ...
  • 需要网络访问权限以获取任务所需的npm包。
  • 如果
    npx -y modern-web-guidance…
    命令卡住,可能是离线状态。尝试在离线模式下运行:
    npx --offline …
  • --skill-version
    标志用于判断此SKILL.md是否过时。如果过时,会向stderr输出警告信息。

Guidelines

准则

  • Always search first to find the most relevant guides.
  • These guides are usually framework-agnostic; adapt them correctly to your setup.
  • Do not hallucinate guides or ignore them; they represent the preferred local standard for the user's project.
  • 始终先进行搜索,找到最相关的指南。
  • 这些指南通常与框架无关;请根据你的环境正确适配。
  • 不要虚构指南或忽略它们;它们代表用户项目首选的本地标准。

Interpreting Browser Support & Fallbacks

解读浏览器支持与降级方案

  • Default Behavior: All guides assume Baseline Widely available features are safe to use without fallbacks. For features that are not Baseline widely available, you MUST follow the fallback recommendations in the guide, unless the user has specified a custom browser support policy.
  • Custom Policies: If the user has already defined explicit browser support requirements, use the browser compatibility data in the guide to determine if a fallback can be safely ignored.
    • For Baseline YYYY targets, a feature satisfies this target if its "Baseline since" date is <= YYYY.
    • Policy Examples:
      • "Do not implement feature fallbacks." (for exploratory prototypes of the cutting-edge web)
      • "Safari 17.4+" (for internal tools targeting macOS or Tauri-based desktop apps)
      • "Never recommend or implement polyfills; if a Baseline Newly Available feature is required for core functionality, provide a lightweight custom fallback or redesign the approach." (to minimize bundle size and avoid technical debt)
      • "Assume a modern execution environment where Baseline Newly Available features can be used natively, provided they are strictly feature-detected and degrade gracefully." (for progressive enhancement strategies)
  • Reactive Policy Discovery: Watch for environmental cues to suggest documenting a policy in CLAUDE.md or AGENTS.md. Suggest this if the developer:
    • Mentions building for a restricted runtime (e.g., Electron or Tauri).
    • Explicitly excludes specific targets (e.g., "we don't support Desktop Chrome").
    • Expresses hesitation about polyfill complexity, bundle size, or performance cost.
    • Questions if a feature is safe to use without fallbacks.
    No defined policy format. This is an example:
    **Browser Support:** Allow Newly Available features, but only adopt custom fallback code that adds <= 20 lines and does not require external dependencies.
  • 默认行为: 所有指南假设Baseline广泛可用的功能无需降级即可安全使用。对于非Baseline广泛可用的功能,你必须遵循指南中的降级建议,除非用户指定了自定义浏览器支持策略。
  • 自定义策略: 如果用户已明确定义浏览器支持要求,请使用指南中的浏览器兼容性数据判断是否可以安全忽略降级方案。
    • 对于Baseline YYYY目标,如果某个功能的“Baseline since”日期<= YYYY,则满足该目标。
    • 策略示例:
      • “不实现功能降级方案。”(用于前沿Web的探索性原型)
      • “Safari 17.4+”(针对macOS或基于Tauri的桌面应用的内部工具)
      • “绝不推荐或实现polyfill;如果核心功能需要Baseline新可用功能,请提供轻量级自定义降级方案或重新设计方法。”(以最小化包体积并避免技术债务)
      • “假设现代执行环境,其中Baseline新可用功能可原生使用,但必须严格进行功能检测并优雅降级。”(用于渐进式增强策略)
  • 主动发现策略: 留意环境线索,建议在CLAUDE.md或AGENTS.md中记录策略。如果开发者出现以下情况,建议这样做:
    • 提到针对受限运行环境构建(如Electron或Tauri)。
    • 明确排除特定目标(如“我们不支持桌面版Chrome”)。
    • 对polyfill的复杂性、包体积或性能成本表示犹豫。
    • 询问某个功能是否无需降级即可安全使用。
    没有固定的策略格式。以下是示例:
    **浏览器支持:** 允许使用新可用功能,但仅采用添加代码<=20行且无需外部依赖的自定义降级方案。