Index of every page on this site: llms.txt
All skills
steelan9199 avatar

/js-error-fixer

@9e01957
Run it yourself

自动检查和修复 JavaScript 文件的语法错误、类型错误等问题。支持单个文件或整个文件夹批量处理。何时使用:当用户需要检查 JS 文件错误、修复 JS 语法问题、或批量处理 JS 文件时。

Use this Skill: https://skilld.dev/gh/steelan9199/wechat-publisher/js-error-fixer

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈65 tokens for metadata: the name and description. ≈1.7k when used: this file.

Description uses 1.4% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈114 characters, or 1.4%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

JavaScript 错误检查与修复器

触发映射

用户输入触发词 AI 执行动作
"检查 JS 错误" / "修复 JS 问题" / "JS 语法错误" 按【检查修复模式】执行
"检查文件夹" / "批量处理 JS" / "修复所有 JS" 按【批量处理模式】执行
"检查这个文件" / "修复这个 JS" 按【单文件模式】执行

执行模式

检查修复模式

触发:用户提到检查或修复 JS 错误

步骤 执行动作 具体命令/操作
1 检查 ESLint 配置 检查项目是否已安装 ESLint 和配置文件
2 安装 ESLint(如需要) 运行 npm install --save-dev eslint globals 安装依赖
3 配置 ESLint(如需要) 创建 eslint.config.js 配置文件
4 运行 ESLint 检查 执行 npx eslint <路径> 检查 JS 文件
5 分析错误 分类统计错误:语法错误、类型错误、其他
6 创建待办 运行 TodoWrite 创建修复任务列表
7 逐个修复 按优先级逐个修复文件,使用 Read 和 SearchReplace
8 验证修复 再次运行 ESLint 确认错误已修复
9 输出报告 列出修复的文件和错误类型

批量处理模式

触发:用户提到文件夹或批量处理

步骤 执行动作 具体命令/操作
1 获取目录路径 询问用户或从上下文获取目标文件夹路径
2 查找 JS 文件 运行 Glob 搜索 **/*.js 文件
3 检查 ESLint 运行 ESLint 检查所有 JS 文件错误
4 创建待办 运行 TodoWrite 列出所有待修复文件
5 批量修复 循环处理每个有错误的文件
6 验证结果 再次运行 ESLint,输出修复报告

单文件模式

触发:用户指定某个 JS 文件

步骤 执行动作 具体命令/操作
1 获取文件路径 从用户输入或上下文获取文件路径
2 读取文件 运行 Read 读取该文件内容
3 检查 ESLint 运行 ESLint 检查该文件的错误
4 分析问题 定位具体错误位置和类型
5 执行修复 使用 SearchReplace 或重写文件修复
6 验证修复 再次运行 ESLint,确认修复完成

ESLint 配置指南

安装 ESLint

步骤 操作 命令
1 进入项目目录 cd <项目路径>
2 安装 ESLint npm install --save-dev eslint
3 安装 globals 包 npm install --save-dev globals

创建 ESLint 配置文件

创建 eslint.config.js 配置文件(flat config 格式):

import globals from "globals";

export default [
  {
    languageOptions: {
      ecmaVersion: "latest",
      sourceType: "module",
      globals: {
        ...globals.node,
        ...globals.es2022
      }
    },
    rules: {
      "no-undef": "error",
      "no-unused-vars": "warn",
      "semi": [
        "error",
        "always"
      ],
      "quotes": [
        "error",
        "double"
      ]
    }
  }
];

运行 ESLint 检查

检查范围 命令
检查单个文件 npx eslint <文件路径>
检查整个目录 npx eslint <目录路径>
检查当前目录所有 JS npx eslint .

常见错误修复策略

错误类型 错误表现 修复方式
HTML 实体编码 特殊字符被编码 将编码字符替换为实际字符
缺少右括号 ) 诊断提示"应为')'" 找到对应左括号位置,在正确位置添加 )
缺少分号 ; 诊断提示"应为';'" 在语句末尾添加 ;
引号不匹配 字符串引号未闭合 检查字符串,补全闭合引号
花括号不匹配 { 和 } 数量不匹配 找到缺失的 { 或 }
变量未定义 使用了未声明的变量 检查变量作用域,添加声明或修正拼写

错误处理

错误场景 错误表现 处理方式
无 JS 文件 Glob 搜索结果为空 提示用户未找到 JS 文件,询问是否调整路径
无 ESLint 错误 ESLint 返回空 输出"未发现错误",结束任务
文件无法读取 Read 返回错误 跳过该文件,记录到报告,继续处理其他文件
修复后仍有错误 修复后 ESLint 仍有问题 标记为"需要人工检查",继续处理其他文件
未安装 ESLint npx eslint 失败 先安装 ESLint 和 globals 包

核心法则检查表

法则 检查标准 通过?
⭐⭐⭐ 人类中心 用户只需说自然语言,AI 自动执行检查和修复 ✅
⭐⭐⭐ AI 优先 使用祈使句指令,表格展示决策逻辑 ✅
⭐⭐⭐ 即调即用 有触发映射表,用户输入 → AI 动作一一对应 ✅
渐进披露 核心内容简短 ✅
错误处理 包含常见错误场景和处理方式表格 ✅

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts7mo3 checks · Risk SAFE
  • Gen Agent Trust Hub7mo

    This skill automates the identification and correction of JavaScript errors using ESLint. It involves installing standard npm packages and executing shell commands for linting. The primary security consideration is its susceptibility to indirect prompt injection if processing untrusted files.

  • Socket7mo

    No alerts

  • Snyk7mo

    Risk: LOW · No issues

Signed by skilld at 9e01957. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 8 months ago
metadata
{
  "author": "AI Assistant",
  "updated": "2026-03-01",
  "version": "2.0.0"
}

README badge

README badge for steelan9199/wechat-publisher/js-error-fixer