SkillAtlasSkill 详情

install-anti-slop

Opinionated Oxlint rules that reject low-evidence and low-signal TypeScript and JavaScript patte...

审核状态:已审核Quality 80Security 80

复制安装命令

用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。

复制前请先查看来源、License 和安全提示。

项目 README

来源文件:README.md

抓取于 2026年8月18日

anti-slop

skills.sh

Opinionated Oxlint rules that reject low-evidence and low-signal TypeScript and JavaScript patterns.

This project is meant to be vendored, not treated as a fixed npm dependency. Copy the rules into your repository, read them, and change them to match your team's standards. The bundled agent skill handles the initial copy and configuration; after that, the vendored files are yours to maintain and make your own.

Install with an agent skill

npx skills add dmmulroy/anti-slop --skill install-anti-slop

Then ask your coding agent to install or configure anti-slop in the current repository. The skill copies the plugin, installs current Oxlint dependencies, merges the plugin into the existing lint configuration, enables every generic rule, and validates the result. In repositories that depend on Effect, it also enables the opt-in Effect rule group.

To inspect available skills first:

npx skills add dmmulroy/anti-slop --list

Manual local installation

Copy src/ into the target repository, for example at tools/oxlint/anti-slop/, and install matching current versions of oxlint and @oxlint/plugins.

Register the copied entry point in oxlint.config.ts:

import { defineConfig } from "oxlint";

export default defineConfig({
  ignorePatterns: [
    ".agent/**",
    ".agents/**",
    ".claude/**",
    ".codex/**",
    ".continue/**",
    ".cursor/**",
    ".gemini/**",
    ".opencode/**",
    ".pi/**",
    ".roo/**",
    ".windsurf/**",
    "tools/oxlint/anti-slop/**",
  ],
  jsPlugins: [
    { name: "anti-slop", specifier: "./tools/oxlint/anti-slop/index.ts" },
  ],
  rules: {
    "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-module-mocking": "error",
    "anti-slop/no-object-parameters": "error",
    "anti-slop/no-reflect-apply": "error",
    "anti-slop/no-reflect-get": "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-returns": "error",
    "anti-slop/no-unknown-type-aliases": "error",
    "anti-slop/no-unsafe-dictionary-type": "error",
    "anti-slop/no-widen-then-assert": "error",
    "anti-slop/require-safety-comment-for-type-assertion": "error"
  }
});

The same ignorePatterns, jsPlugins, and rules work under lint in a Vite+ config. Merge the ignore patterns into Vite+'s fmt.ignorePatterns as well so vp check does not reformat installed agent assets or the vendored plugin. Preserve existing ignores and add any other project-local agent tooling directories detected in the repository; do not broadly ignore every dot-directory.

Optional Effect rules

Effect-specific rules live in a separate plugin so projects that do not use Effect do not inherit Effect architecture policy. Register the Effect entry point only in repositories that use Effect:

export default defineConfig({
  jsPlugins: [
    { name: "anti-slop", specifier: "./tools/oxlint/anti-slop/index.ts" },
    {
      name: "anti-slop-effect",
      specifier: "./tools/oxlint/anti-slop/effect/index.ts"
    }
  ],
  rules: {
    "anti-slop-effect/no-service-constructor-imports": "error"
  }
});

Rules

Generic rules

  • no-chained-type-assertions — rejects nested type assertions that fabricate evidence.
  • no-conditional-empty-object-spread — rejects conditional spreads that use {} to omit fields.
  • no-known-value-widening — rejects explicit broad target types that discard known value evidence.
  • no-module-mocking — rejects Vitest and Jest module mocks in favor of real dependency seams.
  • no-object-parameters — rejects the broad object type on function inputs.
  • no-reflect-apply — rejects Reflect.apply in favor of typed function calls.
  • no-reflect-get — rejects Reflect.get in favor of typed property access or boundary parsing.
  • no-runtime-typeof — requires boundary parsing instead of ad hoc typeof narrowing.
  • no-shape-in-symbol-names — rejects shape in symbol names.
  • no-unknown-parameters — rejects unknown inputs except the explicit cause convention.
  • no-unknown-returns — rejects function contracts that return unknown or Promise<unknown>.
  • no-unknown-type-aliases — rejects aliases that merely conceal unknown.
  • no-unsafe-dictionary-type — rejects dictionary value contracts based on unknown, any, object, {}, and semantic equivalents.
  • no-widen-then-assert — rejects local flows that widen known values and later assert them back.
  • require-safety-comment-for-type-assertion — requires each non-const assertion to document its checked invariant.

Effect rules

  • no-service-constructor-imports — rejects relative project imports of exported make<CapabilityName> constructors outside *.test.* and *.spec.* files. Runtime callers should import the owning Layer and yield the contextual service instead. Package imports and static constructors such as WorkspaceName.make are outside the rule.

Violation examples

Each snippet below is rejected by the named rule.

no-chained-type-assertions

const user = input as object as User;

no-conditional-empty-object-spread

const options = {
  ...(timeout !== undefined ? { timeout } : {}),
};

no-known-value-widening

const handlers: Record<string, Handler> = {
  start: startHandler,
};

This discards the known start key. Preserve inference or use satisfies Record<string, Handler> instead.

no-module-mocking

vi.mock("./user-store");

no-object-parameters

function save(value: object) {}

no-reflect-apply

const value = Reflect.apply(operation, owner, args);

no-reflect-get

const value = Reflect.get(owner, key);

no-runtime-typeof

if (typeof input === "string") {
  useName(input);
}

Schema-free projects can permit typeof checks directly inside type predicate and assertion functions while continuing to reject ad hoc checks elsewhere:

{
  "anti-slop/no-runtime-typeof": [
    "error",
    { "allowInTypeGuards": true }
  ]
}

The option defaults to false.

no-shape-in-symbol-names

interface UserShape {
  id: string;
}

Effect: no-service-constructor-imports

import { makeIssueService } from "./issue-service.ts";

Import the owning Layer and yield IssueService instead. Focused *.test.* and *.spec.* files may import the constructor directly.

no-unknown-parameters

function handle(input: unknown) {}

no-unknown-returns

function loadUser(): unknown {
  return input;
}

no-unknown-type-aliases

type ExternalValue = unknown;

no-unsafe-dictionary-type

type Metadata = Record<string, unknown>;
type OtherMetadata = { [key: string]: object };

no-widen-then-assert

const loaded: User = loadUser();
const stored: unknown = loaded;
const user = stored as User;

require-safety-comment-for-type-assertion

const userId = value as UserId;

Add a specific justification immediately before a necessary assertion:

// SAFETY: parseUserId validated the identifier before branding it.
const userId = value as UserId;

Development

pnpm install
pnpm check

src/ is canonical. After changing production source, run pnpm sync:skill-assets; CI checks that the skill's bundled copy remains identical.

License

MIT

其他

中风险

  • 来源需自行核对维护者身份。
  • 包含脚本或命令调用,安装前请复核。
  • 未检测到明显外部权限要求。
  • 未检测到高风险命令。
  • 扫描发现:1 条。

Codex — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/dmmulroy/anti-slop.git
  3. 将 "skills/install-anti-slop" 文件夹复制到 Codex 的 skills 目录中。
  4. 重启 Codex 让新的 skill 生效。

Codex — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Codex 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Codex 让新的 skill 生效。

Claude Code — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/dmmulroy/anti-slop.git
  3. 将 "skills/install-anti-slop" 文件夹复制到 Claude Code 的 skills 目录中。
  4. 重启 Claude Code 让新的 skill 生效。

Claude Code — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Claude Code 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Claude Code 让新的 skill 生效。

Cursor — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/dmmulroy/anti-slop.git
  3. 将 "skills/install-anti-slop" 文件夹复制到 Cursor 的 skills 目录中。
  4. 重启 Cursor 让新的 skill 生效。

Cursor — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Cursor 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Cursor 让新的 skill 生效。

GitHub Copilot — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/dmmulroy/anti-slop.git
  3. 将 "skills/install-anti-slop" 文件夹复制到 GitHub Copilot 的 skills 目录中。
  4. 重启 GitHub Copilot 让新的 skill 生效。

GitHub Copilot — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 GitHub Copilot 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 GitHub Copilot 让新的 skill 生效。

Windsurf — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/dmmulroy/anti-slop.git
  3. 将 "skills/install-anti-slop" 文件夹复制到 Windsurf 的 skills 目录中。
  4. 重启 Windsurf 让新的 skill 生效。

Windsurf — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Windsurf 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Windsurf 让新的 skill 生效。
查看 SKILL.md 原文
name: install-anti-slop
description: Install and configure the generic and optional Effect anti-slop Oxlint plugins in a local TypeScript or JavaScript repository. Use whenever a user asks to add anti-slop lint rules, copy the anti-slop plugin, configure opinionated Oxlint rules, or migrate an existing local anti-slop setup.

Install 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.

Procedure

  1. Inspect the repository before changing it:

    • Read its agent instructions.
    • Check git status and preserve unrelated changes.
    • Identify the package manager from packageManager and lockfiles.
    • Find Oxlint configuration (oxlint.config.*, .oxlintrc*, or a Vite+ config).
    • Check whether anti-slop files or rules already exist. Do not overwrite them without reviewing the diff.
  2. Copy the bundled plugin from this skill. Run from the target repository:

    node <skill-directory>/scripts/install.mjs
    

    This creates tools/oxlint/anti-slop/. 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 use --force after backing up and reviewing existing files.

  3. Install current compatible dependencies rather than trusting versions remembered by the agent:

    • Query npm view oxlint version and npm view @oxlint/plugins version.
    • Install the same current version of both packages with the repository's package manager.
    • oxlint is a development dependency. The copied source imports @oxlint/plugins, so install it as a development dependency for a local-only plugin.
    • Do not replace the package manager or rewrite unrelated dependency ranges.
  4. Register the generic plugin, configure ignores, and enable all generic rules. For oxlint.config.ts or .oxlintrc.json, merge these fields with the existing configuration:

    ignorePatterns: [
      ".agent/**",
      ".agents/**",
      ".claude/**",
      ".codex/**",
      ".continue/**",
      ".cursor/**",
      ".gemini/**",
      ".opencode/**",
      ".pi/**",
      ".roo/**",
      ".windsurf/**",
      "tools/oxlint/anti-slop/**",
    ],
    jsPlugins: [
      { name: "anti-slop", specifier: "./tools/oxlint/anti-slop/index.ts" },
    ],
    

    Keep every existing ignore. Adjust the final pattern when the plugin was copied elsewhere. Inspect the repository for other project-local agent tooling directories and add them rather than linting installed skills, hooks, or generated agent configuration as application source. Do not broadly ignore all dot-directories, because some repositories keep owned source or checks in them.

    For Vite+, add these fields to lint.ignorePatterns and lint.jsPlugins. Also merge the same patterns into fmt.ignorePatterns so vp check does not reformat installed agent assets or the vendored plugin. Merge existing entries instead of replacing them.

    Enable these rules at "error":

    {
      "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-module-mocking": "error",
      "anti-slop/no-object-parameters": "error",
      "anti-slop/no-reflect-apply": "error",
      "anti-slop/no-reflect-get": "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-returns": "error",
      "anti-slop/no-unknown-type-aliases": "error",
      "anti-slop/no-unsafe-dictionary-type": "error",
      "anti-slop/no-widen-then-assert": "error",
      "anti-slop/require-safety-comment-for-type-assertion": "error"
    }
    

    If the repository declares effect in a package manifest, or the user explicitly requests Effect rules, also register the opt-in Effect plugin:

    jsPlugins: [
      {
        name: "anti-slop-effect",
        specifier: "./tools/oxlint/anti-slop/effect/index.ts",
      },
    ],
    rules: {
      "anti-slop-effect/no-service-constructor-imports": "error",
    },
    

    Merge these entries with the generic plugin configuration rather than replacing it. Do not enable the Effect plugin merely because Effect appears transitively in a lockfile; require a direct package-manifest dependency or an explicit user request. The rule covers relative project imports. Report package-alias imports as a current limitation rather than pretending they are enforced.

  5. Run the repository's lint command and typecheck. For Vite+, run the repository's full vp check command after adding both lint and format ignores. If findings appear in owned project source, 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.

  6. Review the final diff and clearly report:

    • copied path,
    • dependency versions installed,
    • configuration changed,
    • checks run and any remaining findings.

Migration guidance

When replacing an older local copy, compare its rules and diagnostics before overwriting. Keep project-specific rules in their own plugin. The default anti-slop plugin is intentionally generic; framework-specific policy belongs in an explicit opt-in group such as anti-slop-effect. Prefer inference, as const, satisfies, named owner contracts, and boundary parsing when resolving findings.

发现问题?提交给管理员复核

评分:

评论 (0)

暂无评论,成为第一个评论者吧!