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

running-mutation-tests运行突变测试

Agent Skill

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

总安装

606

周安装

25

GitHub Stars

2,064

下载量

198
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:running-mutation-tests(运行突变测试)
来源仓库:https://github.com/jeremylongshore/claude-code-plugins-plus-skills
仓库路径:skills/running-mutation-tests
安装命令:
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill running-mutation-tests
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill running-mutation-tests

简介

用于辅助测试设计、自动化测试、用例整理和回归验证。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中编写单元测试、端到端测试或根据失败日志定位问题。
  • 使用时需确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑。
  • 涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。
  • 安装方式:github,安装命令:npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill running-mutation-tests

SKILL.md

Mutation Test Runner

Overview

Execute mutation testing to evaluate the effectiveness of a test suite by systematically introducing small code changes (mutants) and checking whether existing tests detect them. A killed mutant means the tests caught the change; a surviving mutant reveals a testing gap.

Prerequisites

  • Mutation testing framework installed (Stryker, mutmut, PITest, or go-mutesting)
  • Existing test suite with reasonable pass rate (all tests must pass before mutation testing)
  • Source code with functions and logic suitable for mutation (conditionals, arithmetic, return values)
  • Sufficient CI resources (mutation testing runs the test suite once per mutant -- CPU-intensive)
  • Configuration file for the mutation tool specifying target files and test commands

Instructions

  1. Verify the existing test suite passes completely:

- Run the full test suite and confirm 100% pass rate. - Fix any failing or skipped tests before proceeding. - Mutation testing is meaningless if the baseline tests are broken.

  1. Configure the mutation testing tool:

- Stryker: Create stryker.config.mjs with mutate patterns, test runner, and thresholds. - mutmut: Configure setup.cfg or pyproject.toml with [mutmut] section. - PITest: Add Maven/Gradle plugin with target classes and test configurations.

  1. Select target files for mutation:

- Focus on business logic modules (not configuration, constants, or type definitions). - Exclude auto-generated code, third-party wrappers, and test utilities. - Start with a small scope (one module) to validate setup before expanding.

  1. Run the mutation testing suite:

- Execute npx stryker run, mutmut run, or mvn pitest:mutationCoverage. - Monitor progress -- expect long execution times (10-100x normal test runtime). - Use incremental mode if available to skip already-tested mutants.

  1. Analyze the mutation report:

- Killed mutants: Tests detected the change -- indicates strong test coverage. - Survived mutants: Tests did not catch the change -- indicates a testing gap. - Timed out mutants: Mutation caused an infinite loop -- generally acceptable. - No coverage mutants: The mutated code is not exercised by any test.

  1. For each surviving mutant, determine the appropriate action:

- Write a new test that specifically catches the mutation. - Or determine the mutation is equivalent (functionally identical to original) and mark as ignored.

  1. Set mutation score thresholds (recommended: 80% kill rate) and integrate into CI as a quality gate.

Output

  • Mutation testing report (HTML or JSON) with killed/survived/timed-out counts
  • Mutation score percentage (killed / total non-equivalent mutants)
  • Surviving mutant inventory with file, line, mutation type, and suggested test
  • New test cases written to kill surviving mutants
  • CI configuration with mutation score threshold enforcement

Error Handling

ErrorCauseSolution
Mutation run takes hoursToo many files in scope or slow test suiteNarrow mutate scope to critical modules; use --incremental mode; parallelize with --concurrency
All mutants surviveTests only check for truthiness, not specific valuesStrengthen assertions -- use toBe(42) instead of toBeTruthy(); add boundary checks
Equivalent mutant false positiveMutation produces functionally identical code (e.g., x >= 0 vs x > -1)Mark as equivalent in config; ignore in score calculation; document rationale
Out of memory during runToo many concurrent mutation workersReduce --concurrency setting; increase Node.js --max-old-space-size; reduce shard size
Stryker "initial test run failed"Test suite does not pass cleanly before mutations beginFix all failing tests first; ensure npm test exits 0; check test runner configuration

Examples

Stryker configuration for TypeScript project:

// stryker.config.mjs
export default {
  mutate: ['src/**/*.ts', '!src/**/*.d.ts', '!src/**/index.ts'],
  testRunner: 'jest',
  jest: { configFile: 'jest.config.ts' },
  reporters: ['html', 'clear-text', 'progress'],
  thresholds: { high: 80, low: 60, break: 50 },
  concurrency: 4,
  timeoutMS: 10000,  # 10000: 10 seconds in ms
};

Example surviving mutant and fix:

Mutant: src/utils/discount.ts:15 -- ConditionalExpression
  Original:  if (total > 100)
  Mutant:    if (total >= 100)
  Status:    SURVIVED

Fix -- add boundary test:
it('does not apply discount at exactly 100', () => {
  expect(calculateDiscount(100)).toBe(0);
});
it('applies discount above 100', () => {
  expect(calculateDiscount(101)).toBe(10.1);
});

mutmut for Python:

# Run mutation testing
mutmut run --paths-to-mutate=src/ --tests-dir=tests/

# View surviving mutants
mutmut results

# Inspect a specific mutant
mutmut show 42

Resources

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

37.51%
按下载量换算74

Claude

28.55%
按下载量换算57

Cursor

20.66%
按下载量换算41

Gemini CLI

9.84%
按下载量换算19

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills