Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

slop-test-detector斜率测试探测器

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

190

周安装

8

GitHub Stars

5

下载量

67
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:slop-test-detector(斜率测试探测器)
来源仓库:https://github.com/apankov1/quality-engineering
仓库路径:skills/slop-test-detector
安装命令:
npx skills add https://github.com/apankov1/quality-engineering --skill slop-test-detector
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/apankov1/quality-engineering --skill slop-test-detector

简介

用于辅助测试设计、自动化测试和回归验证,支持编写单元测试或端到端测试。

  • 适合需要根据失败日志定位问题或生成测试计划的场景。
  • 使用时需确认项目测试框架和运行命令,避免为了通过测试而改坏逻辑。
  • 涉及浏览器或外部服务时应区分本地模拟与生产环境,确保安全性。
  • 建议结合现有测试用例和夹具数据验证输出结果的合理性。

SKILL.md

Slop Test Detector

Agents generate tests that compile, pass, and increase coverage — but catch zero bugs. This skill detects those patterns programmatically.

When to use: Auditing existing test files for quality. Validating generated tests before writing them to disk. Enforcing the // Defect: comment convention.

When not to use: Evaluating test *strategy* (what to test). Measuring code coverage. Reviewing production code quality.

Rationalizations (Do Not Skip)

RationalizationWhy It's WrongRequired Action
"It compiles and passes"Slop tests always pass — that's the problemRun analyzeTestFile() and check must-fail findings
"It has a Defect comment"Comment can be trivial or copied from the test nameCheck trivial_defect_comment findings
"It has assert.ok(result)"Truthiness checks pass for any non-null valueVerify assert.equal/deepEqual on specific values
"It increases coverage"Coverage counts lines executed, not bugs caughtCheck that assertions verify behavior, not just reachability

What To Protect (Start Here)

Before auditing or generating tests, identify which slop patterns apply:

DecisionQuestion to AnswerIf Yes → Check Rule
Test body is meaningfulDoes the test have at least one assertion that can fail?empty_test_body, commented_out_assertions
Assertions verify behaviorDo assertions compare computed values to expected values?tautological_assertion, self_referential_assertion
Defect comment explains impactDoes the comment explain what breaks in production?missing_defect_comment, trivial_defect_comment
Assertions check values, not typesIs the test checking actual output, not just typeof?assert_on_type_not_value, truthiness_only
Error paths are testedDoes the describe block include negative test cases?no_negative_test
Tests vary their inputsDo sibling tests exercise different code paths?no_input_variation, duplicate_assertion_set
Assertions test computed valuesAre assertions checking results, not echoing construction literals?literal_roundtrip, schema_success_only
Assertions always executeCan the test pass without any assertion running?conditional_assertion
Property tests are meaningfulDo fc.property callbacks assert on all paths with varied inputs?vacuous_property
Tests exercise production codeDoes the test call an imported function, not just builtins?no_production_call
Assertions can actually failIs the assertion mathematically capable of failing?impossible_assertion

Assertion API Support

The detector recognizes node:assert, vitest/Jest expect(), and chai expect() patterns:

node:assertvitest/JestchaiMapped rule check
assert.equal(x, y)expect(x).toBe(y)expect(x).to.equal(y)tautological, self-referential, type-not-value
assert.deepEqual(x, y)expect(x).toEqual(y)expect(x).to.deep.equal(y)self-referential, duplicate
assert.ok(x)expect(x).toBeTruthy()expect(x).to.be.oktruthiness-only, return-type-only
assert.throws(fn)expect(fn).toThrow()expect(fn).to.throw()no-negative-test
assert.rejects(p)expect(p).rejects.toThrow()no-negative-test

Chain modifiers .not, .resolves, .rejects and chai language chains (.to, .be, .have, .been, etc.) are handled. Multiline chains (matcher on next line) are supported. Commented-out expect() calls are detected. Chai property assertions (expect(x).to.be.true) are supported.


Included Utilities

import {
  analyzeTestFile,
  validateTestBlock,
  formatReport,
  formatReportJSON,
  getPreset,
  parseImports,
  parseTestFile,
} from './slop-detector.ts';

Configuration

Presets

Three built-in presets control which rules are active:

PresetRulesDefault thresholdUse case
balanced16 rules (no defect-comment rules)80Default. Conservative, low noise
strictAll 18 rules90Teams that enforce // Defect: comments
advisoryAll 18 rules0Report everything, fail nothing
import { getPreset } from './slop-detector.ts';

const config = getPreset('balanced'); // default
const strict = getPreset('strict');   // all rules enforced

Custom Configuration

import { type SlopConfig, getPreset } from './slop-detector.ts';

const config: SlopConfig = {
  ...getPreset('balanced'),
  assertionEquivalents: ['assertLogEntry', 'assertNoLogsAbove'],
  scoreThreshold: 90,
};
  • enabledRules: Set<SlopRule> — which rules produce findings
  • assertionEquivalents: string[] — function names treated as assertions (prevents false empty_test_body)
  • scoreThreshold: number — minimum passing score (for CI gating)

Suppression Comments

Suppress specific findings with a required reason:

// slop-ignore: tautological_assertion — intentional canary test for CI pipeline health
it("canary", () => {
  assert.ok(true);
});
  • The — reason is required — suppressions without a reason are ignored
  • Multiple rules: // slop-ignore: empty_test_body, truthiness_only — stub pending #1234
  • Place on the line before it() or anywhere inside the test body

Core Workflow

Step 1: Audit Existing Files

import { readFileSync } from 'node:fs';

const source = readFileSync('my-module.spec.ts', 'utf-8');
const report = analyzeTestFile(source, 'my-module.spec.ts');
console.log(formatReport(report));

Step 2: Report Findings with Impact

When presenting findings, always include:

  • Rule name — the specific slop pattern (e.g., tautological_assertion)
  • Test name and line number — so the user can navigate to it
  • Severitymust-fail (test is structurally broken) vs should-fail (quality concern)
  • Why it matters — what production bug could slip through because of this pattern
  • What clean tests should NOT be flagged — avoid false positives on well-written tests

If a test file has assertion-equivalent helpers (functions named assert*() or test*() that internally call assert.*), configure assertionEquivalents to prevent false empty_test_body findings.

Step 3: Validate During Generation

Before writing a generated test to disk, check for slop:

const findings = validateTestBlock(`
  // Defect: if the parser miscounts blocks then all downstream rules produce wrong results
  it("parses correctly", () => {
    assert.equal(result, expected);
  });
`);

if (findings.some(f => f.severity === 'must-fail')) {
  // Fix before writing
}

Step 4: Machine-Readable Output (CI)

const report = analyzeTestFile(source, filePath, getPreset('balanced'));
const json = formatReportJSON(report);
// Outputs structured JSON with filePath, score, summary, findings[]

Step 5: Interpret the Score

The score formula weights must-fail findings (1.0) higher than should-fail (0.3):

score = max(0, round(100 × (1 - weightedFindings / testCount)))
  • 100: No slop detected
  • 90-99: Minor should-fail findings (missing comments, no negative tests)
  • Below 80: Significant quality issues — review must-fail findings first

Violation Rules

RuleDescriptionSeverityDefault
empty_test_bodyit() with zero assertions or assertion-equivalent callsmust-failon
commented_out_assertionsAll assert.* calls commented out, zero activemust-failon
tautological_assertionassert.equal(LITERAL, LITERAL) or assert.ok(true)must-failon
self_referential_assertionassert.equal(x, x) where both args textually identicalmust-failon
missing_defect_commentit() with no // Defect: in preceding 3 linesshould-failopt-in
trivial_defect_comment// Defect: exists but fewer than 10 wordsshould-failopt-in
assert_on_type_not_valueAll assertions check typeof, no value checksshould-failon
truthiness_onlyAll assertions are assert.ok(identifier)should-failon
no_negative_testdescribe with 3+ tests, zero assert.throws/.rejectsshould-failon
duplicate_assertion_setTwo it() blocks with identical normalized assertion sequencesshould-failon
assert_return_type_onlySole assertion is assert.ok(r) on a return valueshould-failon
no_input_variationSibling it() blocks pass identical args to same functionshould-failon
literal_roundtripAssertion compares obj.field to the same literal used to construct objshould-failon
schema_success_onlysafeParse() result checked for .success but never .data or .error.issuesshould-failon
conditional_assertionAll assertions are inside if/switch blocks — test may silently passmust-failon
vacuous_propertyfc.property callback has return true path with zero assertions, or all generators are fc.constantshould-failon
no_production_callTest body calls no imported production function — only builtins or language guaranteesshould-failon
impossible_assertionAssertion is mathematically impossible to fail (e.g., .length >= 0)should-failon

opt-in rules are only active in the strict preset. Use getPreset('strict') or add them to a custom enabledRules set.


Definition of Done

  • analyzeTestFile() returns zero must-fail findings
  • All should-fail findings are reviewed and either fixed or justified
  • Score is 90 or above
  • slop-detector.spec.ts itself passes all its own rules

Companion Skills

  • observability-testing — Structured log assertions that the slop detector validates for completeness
  • fault-injection-testing — Circuit breaker and retry tests where empty_test_body and no_negative_test rules are most likely to fire
  • breaking-change-detector — Contract classification tests where duplicate_assertion_set detects copy-paste patterns
  • model-based-testing — State machine transition matrix tests where no_input_variation catches redundant transition checks
  • pairwise-test-coverage — Combinatorial test generation where truthiness_only and assert_return_type_only are common slop patterns

See patterns.md for all 12 patterns with before/after code examples.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.73%
按下载量换算25

Claude

31.25%
按下载量换算21

Cursor

17.12%
按下载量换算11

Gemini CLI

9.19%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills