global-error-handling

adigunners 的头像作者 adigunners

在客户端JavaScript代码中实现健壮的错误处理,以优雅地管理静态网站操作中的失败。当处理API调用、DOM操作、数据解析和用户交互中的错误场景时使用此技能。

📖 中文导读:在客户端JavaScript代码中实现健壮的错误处理,以优雅地管理静态网站操作中的失败。当处理API调用、DOM操作、数据解析和用户交互中的错误场景时使用此技能。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: Global Error Handling description: Implement robust error handling in client-side JavaScript code to gracefully manage failures in static site operations. Use this skill when working with error scenarios in API calls, DOM manipulation, data parsing, and user interactions.

Global Error Handling

This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle global error handling in the adigunners.github.io static website project.

When to use this skill

  • Handling errors when fetching JSON data files from the data/ directory in JavaScript modules
  • Implementing try-catch blocks around DOM manipulation code to prevent silent failures when HTML elements are missing
  • Adding error handlers to event listeners for user interactions (clicks, form submissions) in the static site
  • Managing errors that occur during JSON parsing when loading data into the page
  • Creating user-friendly error messages when resources fail to load or data is unavailable
  • Logging errors to browser console in development while providing graceful fallbacks to users
  • Implementing fallback rendering when CSS fails to load or JavaScript modules encounter runtime errors

Instructions

For details, refer to the information provided in this file: global error handling