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

test-legacy测试遗产

Agent Skill

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

总安装

233

周安装

10

GitHub Stars

公开资料未说明

下载量

82
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/andresnator/agents-orchestrator --skill test-legacy

简介

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

  • 适合编写单元测试、端到端测试或根据日志定位问题。
  • 需确认项目测试框架、运行命令和夹具数据后使用。test-legacy 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 涉及浏览器或外部服务时应区分模拟环境与生产环境。
  • 安装方式:通过 npx 从指定 GitHub 仓库添加。

SKILL.md

Legacy Code Testing Skill (Multi-Language)

Battle-tested techniques for introducing tests into legacy code in any language, based on Michael Feathers' "Working Effectively with Legacy Code."

Step 0: Detect Language and Test Framework

Before generating any code, detect the project's language and testing ecosystem:

LanguageTest FrameworksMocking ToolsSeam Style
JavaJUnit 4/5Mockito, PowerMockObject Seams (polymorphism), Link Seams (classpath)
Pythonpytest, unittestunittest.mock, pytest-mock, monkeypatchObject Seams (duck typing), Monkey-patching, Module Seams (imports)
TypeScript/JSJest, Vitest, Mochajest.mock, jest.spyOn, sinon, vi.mockModule Seams (import mocking), Object Seams (prototype/class)
C#xUnit, NUnit, MSTestMoq, NSubstitute, FakeItEasyObject Seams (interfaces/virtual), Link Seams (assembly)
Gotesting (stdlib)testify/mock, gomock, interfacesInterface Seams (implicit interfaces), Function Seams (func fields)
KotlinJUnit 5, KotestMockK, Mockito-KotlinObject Seams, Extension Seams
RubyRSpec, Minitestrspec-mocks, mochaObject Seams (open classes), Module Seams (monkey-patch)
PHPPHPUnit, PestMockery, PHPUnit mocks, ProphecyObject Seams (interfaces), Link Seams (autoloader)
Rust#[test], cargo testmockall, mockito (trait-based)Trait Seams, Feature-flag Seams (cfg), Module Seams
SwiftXCTest, Quick/NimbleProtocol-based mockingProtocol Seams (protocols = interfaces)

Detection heuristic: Check project files — pom.xml/build.gradle → Java, package.json → TS/JS, pyproject.toml/requirements.txt → Python, *.csproj → C#, go.mod → Go, Cargo.toml → Rust, Gemfile → Ruby, composer.json → PHP, Package.swift → Swift.

If the language is Java and the user needs version-specific JUnit 4/5/Mockito matrices, delegate to the test-legacy-java skill.

Core Philosophy

Legacy code = code without tests. The methodology is Cover and Modify — the opposite of "Edit and Pray."

  • Edit and Pray: Change the code carefully, test manually, hope nothing breaks. Slow, risky, fear-driven.
  • Cover and Modify: Build a safety net of tests first ("the Vise"), then change with confidence.

The golden rule: Cover → Modify → Refactor.

The Legacy Code Change Algorithm

Before any modification, follow these 5 steps:

  1. Identify change points — Where do I need to touch the code?
  2. Find test points — Where can I detect the behavior? (use Effect Sketches to trace impact)
  3. Break dependencies — Two reasons: Sensing (to observe effects) and Separation (to run code in isolation)
  4. Write characterization tests — Document what the code does NOW, not what it should do
  5. Make changes and refactor — Now it's safe

How to Use This Skill

  1. Detect the language and test framework (Step 0 table above)
  2. Apply the Legacy Code Change Algorithm (5 steps above)
  3. If stuck testing something → read references/quick-decision-flow.md for the "I can't test X" decision tree
  4. For seam identification → read references/seam-model.md to find where to inject test behavior
  5. For language-specific patterns → read references/language-adaptations.md for Feathers-to-language mappings
  6. For strategy selection → read references/four-strategies.md to choose the right dependency-breaking approach

Reference Files

FileContentChapters
references/seam-model.mdSeam types across language paradigms (7 types), enabling points, static vs dynamic insightCh 4
references/quick-decision-flow.md"I can't test X" decision tree: instantiate, run, observe, add functionality, understand, many classes, 3rd-partyCh 9, 25
references/language-adaptations.mdFeathers-to-language mapping tables for Python, TypeScript/JS, C#, Go, RustAll
references/four-strategies.mdAccept & Adapt / Subclass & Override / Inject & Delegate / Brute Force with language considerationsCh 25

Rules for Generating Code

  1. Always detect the project's language and test framework before generating examples
  2. Generate idiomatic code for the detected language — don't write Java patterns in Python
  3. Use the language's standard mocking tools (see Step 0 table)
  4. Include comments explaining which Feathers technique is being applied and the chapter reference
  5. Each example must be complete and runnable (imports/requires included)
  6. Name tests descriptively using the language's convention (Java: testBehavior_whenCondition, Python: test_behavior_when_condition, TS/JS: it('should behavior when condition'), Go: TestBehavior_WhenCondition, Rust: fn test_behavior_when_condition())
  7. When discovering bugs during characterization: document the bug as-is, do NOT fix it yet
  8. Prefer Object/Interface Seams over monkey-patching or module-mocking — cleanest across all languages
  9. Always mention whether you're applying Sensing or Separation when breaking a dependency
  10. If the language is Java, reference the test-legacy-java skill for version-specific examples

Key Principles

  1. Cover before you Modify — tests first, always. The code IS the specification.
  2. Prefer Object/Interface Seams — cleanest across all languages, most maintainable.
  3. Name the reason — always state whether you're applying Sensing or Separation when breaking a dependency.
  4. Idiomatic per language — don't write Java patterns in Python or Go patterns in Rust.
  5. Characterization tests document what IS, not what should be — if you find a bug, document it, don't fix it yet.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

38.61%
按下载量换算32

Claude

30.32%
按下载量换算25

Cursor

18.27%
按下载量换算15

Gemini CLI

10.14%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

来源信息

继续浏览同类 Skills