Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Help debug code by analyzing error messages, identifying root causes, and providing fix suggestions.
.claude/skills/jackyst0-debug-helper/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 21% | 0% |
| case-21 | ✓→✗ | ▼ Worse | 49% | 0% |
| case-07 | ✓→✓ | = Same ✓ | 12% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 28% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 12% | 0% |
> 帮助调试代码,分析错误信息,定位问题根源,提供修复建议。 > > Help debug code by analyzing error messages, identifying root causes, and providing fix suggestions.
当用户请求以下操作时使用此 skill:
| 错误类型 | 可能原因 | |----------|----------| | TypeError | 类型不匹配、空值操作 | | ReferenceError | 未定义变量、作用域问题 | | SyntaxError | 语法错误、缺少括号/引号 | | RuntimeError | 运行时逻辑错误 | | NetworkError | 网络请求失败、超时 |
对于每个错误,需要分析:
使用 templates/debug-report.md 模板格式化输出。
Use the templates/debug-report.md template to format output.
markdown## 调试分析报告 / Debug Analysis Report ### 错误概述 / Error Summary [错误类型和简要描述] ### 根本原因 / Root Cause [详细分析] ### 修复方案 / Fix [具体代码修改] ### 预防建议 / Prevention [如何避免类似问题]
错误信息:
TypeError: Cannot read properties of undefined (reading 'map')
at UserList (UserList.jsx:15:23)
at renderWithHooks (react-dom.development.js:14985:18)相关代码:
jsxfunction UserList({ users }) { return ( <ul> {users.map(user => ( <li key={user.id}>{user.name}</li> ))} </ul> ); }
TypeError: Cannot read properties of undefined (reading 'map')
在 UserList 组件第 15 行调用 .map() 时,users 变量为 undefined。
undefined 上调用 .map() 方法users prop方案 1: 添加默认值(推荐)
jsxfunction UserList({ users = [] }) { return ( <ul> {users.map(user => ( <li key={user.id}>{user.name}</li> ))} </ul> ); }
方案 2: 条件渲染
jsxfunction UserList({ users }) { if (!users || users.length === 0) { return <p>No users found</p>; } return ( <ul> {users.map(user => ( <li key={user.id}>{user.name}</li> ))} </ul> ); }
方案 3: 可选链操作符
jsxfunction UserList({ users }) { return ( <ul> {users?.map(user => ( <li key={user.id}>{user.name}</li> ))} </ul> ); }
typescript interface Props { users: User[]; }
jsx UserList.propTypes = { users: PropTypes.array.isRequired };
Other measured skills in the registry, with their headline benchmark lift.