install-anti-slop
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInstall anti-slop
安装anti-slop插件
Install the bundled Oxlint plugin into the current repository and integrate it with the repository's existing lint setup. Preserve unrelated work and adapt to the project's package manager and configuration style.
将预打包的Oxlint插件安装到当前仓库,并与仓库现有的lint配置集成。保留无关工作内容,适配项目的包管理器和配置风格。
Procedure
操作步骤
-
Inspect the repository before changing it:
- Read its agent instructions.
- Check and preserve unrelated changes.
git status - Identify the package manager from and lockfiles.
packageManager - Find Oxlint configuration (,
oxlint.config.*, or a Vite+ config)..oxlintrc* - Check whether anti-slop files or rules already exist. Do not overwrite them without reviewing the diff.
-
Copy the bundled plugin from this skill. Run from the target repository:bash
node <skill-directory>/scripts/install.mjsThis creates. Pass another relative destination as the first argument when the repository has an established tooling layout. The script refuses to replace an existing destination; only usetools/oxlint/anti-slop/after backing up and reviewing existing files.--force -
Install current compatible dependencies rather than trusting versions remembered by the agent:
- Query and
npm view oxlint version.npm view @oxlint/plugins version - Install the same current version of both packages with the repository's package manager.
- is a development dependency. The copied source imports
oxlint, so install it as a development dependency for a local-only plugin.@oxlint/plugins - Do not replace the package manager or rewrite unrelated dependency ranges.
- Query
-
Register the plugin and enable all rules. Foror
oxlint.config.ts, add:.oxlintrc.jsontsjsPlugins: [ { name: "anti-slop", specifier: "./tools/oxlint/anti-slop/index.ts" }, ],For Vite+, add that same entry to. Merge it with existing entries instead of replacing them.lint.jsPluginsEnable these rules at:"error"json{ "anti-slop/no-chained-type-assertions": "error", "anti-slop/no-conditional-empty-object-spread": "error", "anti-slop/no-known-value-widening": "error", "anti-slop/no-object-parameters": "error", "anti-slop/no-runtime-typeof": "error", "anti-slop/no-shape-in-symbol-names": "error", "anti-slop/no-unknown-parameters": "error", "anti-slop/no-unknown-type-aliases": "error", "anti-slop/no-unsafe-dictionary-type": "error", "anti-slop/no-widen-then-assert": "error" } -
Run the repository's lint command and typecheck. If findings appear, report them and fix them only when the user asked for migration/cleanup. Do not suppress rules, weaken rule severity, add unsafe casts, or mechanically launder types to make lint pass.
-
Review the final diff and clearly report:
- copied path,
- dependency versions installed,
- configuration changed,
- checks run and any remaining findings.
-
在修改仓库前先进行检查:
- 读取agent说明文档。
- 执行命令,保留无关变更。
git status - 通过字段和锁文件识别包管理器。
packageManager - 查找Oxlint配置文件(、
oxlint.config.*或Vite+配置)。.oxlintrc* - 检查是否已存在anti-slop相关文件或规则。未查看差异前请勿覆盖现有内容。
-
从此skill中复制预打包的插件。在目标仓库中运行以下命令:bash
node <skill-directory>/scripts/install.mjs此命令会创建目录。若仓库已有既定的工具布局,可将另一个相对路径作为第一个参数传入。脚本会拒绝替换已存在的目标目录;仅在备份并查看现有文件后,方可使用tools/oxlint/anti-slop/参数。--force -
安装当前兼容的依赖,而非依赖agent记忆的版本:
- 查询和
npm view oxlint version获取最新版本。npm view @oxlint/plugins version - 使用仓库的包管理器安装这两个包的当前相同版本。
- 是开发依赖。复制的源码会导入
oxlint,因此需将其作为开发依赖安装,以支持本地插件。@oxlint/plugins - 请勿替换包管理器或重写无关的依赖版本范围。
- 查询
-
注册插件并启用所有规则。对于或
oxlint.config.ts文件,添加以下内容:.oxlintrc.jsontsjsPlugins: [ { name: "anti-slop", specifier: "./tools/oxlint/anti-slop/index.ts" }, ],对于Vite+,将上述条目添加至中。需与现有条目合并,而非替换。lint.jsPlugins将以下规则设置为级别:"error"json{ "anti-slop/no-chained-type-assertions": "error", "anti-slop/no-conditional-empty-object-spread": "error", "anti-slop/no-known-value-widening": "error", "anti-slop/no-object-parameters": "error", "anti-slop/no-runtime-typeof": "error", "anti-slop/no-shape-in-symbol-names": "error", "anti-slop/no-unknown-parameters": "error", "anti-slop/no-unknown-type-aliases": "error", "anti-slop/no-unsafe-dictionary-type": "error", "anti-slop/no-widen-then-assert": "error" } -
运行仓库的lint命令和类型检查。若发现问题,需进行报告;仅当用户要求迁移/清理时,才修复这些问题。请勿禁用规则、降低规则严重程度、添加不安全类型断言,或通过机械方式修改类型以通过lint检查。
-
查看最终差异并清晰报告以下内容:
- 复制的路径
- 安装的依赖版本
- 修改的配置
- 执行的检查及剩余的问题
Migration guidance
迁移指南
When replacing an older local copy, compare its rules and diagnostics before overwriting. Keep project-specific rules in their own plugin; anti-slop is intentionally generic. Prefer inference, , , named owner contracts, and boundary parsing when resolving findings.
as constsatisfies替换旧版本地副本时,需在覆盖前对比其规则和诊断信息。将项目特定规则保留在独立插件中;anti-slop规则设计为通用型。解决问题时,优先使用类型推断、、、命名所有者契约和边界解析。
as constsatisfies