Token导航 LogoToken导航

Agent Skill · 开发

test(测试)

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

test 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描有提醒项,按安装量在开发类的 21,746 个 Skill 里排第 14,634。

总安装 679周安装 28GitHub Stars 318下载 222核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/boshu2/agentops --skill test

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

test 生成测试用例并运行 TDD 循环,输出覆盖率报告。适合在 Codex、Claude、Cursor、Gemini CLI 中保障功能正确性。支持生成、覆盖分析与策略推荐三种模式,适配不同需求。所有测试必须真实通过,严禁为通过而破坏业务逻辑。test 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/test

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/boshu2/agentops --skill test;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

test 怎么安装?

在终端执行 npx skills add https://github.com/boshu2/agentops --skill test。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

test 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

test 需要什么权限?

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

test 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

test 用的人多吗?

公开数据是累计安装 679 次,近一周安装 28 次,下载 222 次,GitHub 318 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

test 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
test

测试 · 本页

679318只读未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Test Skill

Quick Ref: Generate tests, analyze coverage, fill gaps, run TDD loops. Output: passing tests + coverage report in .agents/test/.

YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.

Generate real tests, run them, verify they pass, and produce coverage artifacts. Do not output a plan and stop.

Modes

ModeTriggerWhat It Does
generate"generate tests", "write tests", "add tests"Create tests for existing code
coverage"test coverage", "coverage gaps", "missing tests"Analyze coverage and fill gaps
strategy"test strategy", "test architecture"Recommend test structure and patterns
tdd"tdd", "red green refactor"Red-green-refactor loop for new features

Default mode is generate when unspecified. Detect from user intent.

Step 0: Detect Language and Load Standards

Scan the project root for language markers. Stop at the first match:

Marker FileLanguageTest FrameworkCoverage Command
go.modGogo testgo test -coverprofile=coverage.out./...
pyproject.toml or setup.pyPythonpytestpytest --cov --cov-report=term-missing
package.jsonJS/TSjest or vitestnpx jest --coverage or npx vitest run --coverage
Cargo.tomlRustcargo testcargo tarpaulin --out Lcov

Load /standards for the detected language. Apply all testing conventions from the standards skill (naming, assertion style, structural rules).

Go-specific rules (from project CLAUDE.md):

  • Test file naming: <source>_test.go. NEVER cov*_test.go or *_extra_test.go.
  • Test function naming: Test<Uppercase> (e.g., TestParseConfig_EmptyInput).
  • Prefer table-driven tests for multi-case functions.
  • Use captureStdout for output functions and assert content.

Python-specific rules:

  • Use pytest with conftest.py for shared fixtures.
  • Use @pytest.mark.parametrize for multi-case functions.
  • Type hints on test helpers.

JS/TS-specific rules:

  • Use describe/it blocks with clear names.
  • Group by function or module under test.
  • Mock external services, not internal code.

Step 1: Analyze Existing Test Coverage

Run the coverage command for the detected language:

# Go
go test -coverprofile=coverage.out ./... 2>&1 | tee .agents/test/coverage-raw.txt
go tool cover -func=coverage.out > .agents/test/coverage-func.txt

# Python
pytest --cov --cov-report=term-missing --cov-report=json:.agents/test/coverage.json 2>&1 | tee .agents/test/coverage-raw.txt

# JS/TS
npx jest --coverage --coverageReporters=text 2>&1 | tee .agents/test/coverage-raw.txt

# Rust
cargo tarpaulin --out Lcov 2>&1 | tee .agents/test/coverage-raw.txt

Parse the output. Build a ranked list of files by coverage percentage (lowest first).

If /complexity is available, cross-reference: high-complexity + low-coverage = highest priority targets.

Step 2: Identify Gaps

From the coverage data, identify:

  1. Untested files -- source files with no corresponding test file.
  2. Uncovered functions -- exported/public functions with 0% coverage.
  3. Uncovered branches -- functions with partial coverage (conditionals, error paths).
  4. Missing edge cases -- functions that only test the happy path.

Produce a gap list sorted by risk (high complexity + low coverage first):

File                        | Coverage | Functions Missing Tests | Risk
----------------------------|----------|------------------------|------
internal/parser/parse.go    | 23%      | ParseConfig, Validate  | HIGH
internal/goals/measure.go   | 45%      | MeasureFitness         | MEDIUM
lib/utils.go                | 89%      | (edge cases only)      | LOW

Write gap list to .agents/test/gaps.md.

Step 3: Generate Tests

For each gap (highest risk first), generate tests following language-specific patterns.

Go: Table-Driven Tests

func TestParseConfig_Variants(t *testing.T) {
    tests := []struct {
        name    string
        input   string
        want    *Config
        wantErr bool
    }{
        {name: "valid minimal", input: `name: foo`, want: &Config{Name: "foo"}},
        {name: "empty input", input: "", want: nil, wantErr: true},
        {name: "invalid yaml", input: `: bad`, want: nil, wantErr: true},
    }
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            got, err := ParseConfig(tt.input)
            if (err != nil) != tt.wantErr {
                t.Errorf("ParseConfig() error = %v, wantErr %v", err, tt.wantErr)
                return
            }
            if !reflect.DeepEqual(got, tt.want) {
                t.Errorf("ParseConfig() = %v, want %v", got, tt.want)
            }
        })
    }
}

Python: Parametrized Tests

@pytest.mark.parametrize("input_val,expected", [
    ("valid", Config(name="valid")),
    ("", None),
    (None, None),
])
def test_parse_config(input_val: str, expected: Config | None) -> None:
    result = parse_config(input_val)
    assert result == expected

JS/TS: Describe Blocks

describe("parseConfig", () => {
  it("parses valid input", () => {
    expect(parseConfig("valid")).toEqual({ name: "valid" });
  });

  it("returns null for empty input", () => {
    expect(parseConfig("")).toBeNull();
  });

  it("throws on malformed input", () => {
    expect(() => parseConfig(": bad")).toThrow();
  });
});

Generation Rules

  1. Read the source function first. Understand inputs, outputs, error conditions, and branches.
  2. Cover every branch. Each if, switch, error return, and edge case gets at least one test case.
  3. Assert exact expected values. Use == expected, not != nil or != "".
  4. Name tests descriptively. The test name should describe the scenario: "empty input returns error", not "test1".
  5. Test error paths explicitly. Verify error messages or error types, not just that an error occurred.
  6. One assertion focus per test case. Each table row or parametrized case tests one specific behavior.

Step 4: Run Generated Tests

After writing each test file, immediately run it:

# Go
go test -v -run TestParseConfig ./internal/parser/

# Python
pytest -xvs tests/test_parser.py

# JS/TS
npx jest --verbose tests/parser.test.ts

# Rust
cargo test test_parse_config -- --nocapture

If tests fail:

  1. Read the failure output.
  2. Determine if the test is wrong or the code has a bug.
  3. If the test is wrong: fix the test assertion or setup.
  4. If the code has a bug: report it but fix the test to match current behavior, noting the bug in the output.
  5. Re-run until green.

Never commit failing tests (unless in TDD mode, Step red).

Step 5: Output Coverage Report

Re-run coverage after adding tests:

# Same commands as Step 1

Compare before/after. Write summary to .agents/test/summary.md:

# Test Generation Summary

**Language:** Go
**Date:** 2026-03-27
**Mode:** generate

## Coverage Delta

| Metric | Before | After | Delta |
|--------|--------|-------|-------|
| Overall | 52.3%  | 71.8% | +19.5% |
| internal/parser | 23.0% | 85.2% | +62.2% |
| internal/goals  | 45.0% | 67.3% | +22.3% |

## Tests Added

- `internal/parser/parse_test.go` -- 12 test cases (3 existing + 9 new)
- `internal/goals/measure_test.go` -- 8 test cases (new file)

## Remaining Gaps

- `internal/render/` -- 34% coverage, complex template logic
- `cmd/root.go` -- integration test needed

## Bugs Found

- `ParseConfig` does not validate empty name field (passes silently)

Create .agents/test/ directory if it does not exist. All artifacts go there.

TDD Mode

When mode is tdd, follow the red-green-refactor cycle:

Red: Write a Failing Test

  1. Understand the feature requirement from the user.
  2. Write a test that describes the desired behavior.
  3. Run the test -- it MUST fail. If it passes, the test is not testing new behavior.
# Verify the test fails
go test -v -run TestNewFeature ./...
# Expected: FAIL

Green: Minimal Implementation

  1. Write the minimum code to make the test pass. No extra logic, no optimization.
  2. Run the test -- it MUST pass now.
go test -v -run TestNewFeature ./...
# Expected: PASS

Refactor

  1. Clean up the implementation. Remove duplication, improve naming, simplify logic.
  2. Run ALL tests -- everything must still pass.
go test ./...
# Expected: all PASS

Repeat

  1. Pick the next behavior. Write the next failing test. Continue the cycle.

Log each cycle to .agents/test/tdd-log.md:

## Cycle 1: Parse empty config returns error
- RED: TestParseConfig_EmptyInput -- FAIL (function not implemented)
- GREEN: Added nil check in ParseConfig -- PASS
- REFACTOR: Extracted validation to validateConfig() -- PASS

## Cycle 2: Parse config validates name field
- RED: TestParseConfig_MissingName -- FAIL (no name validation)
- GREEN: Added name check -- PASS
- REFACTOR: None needed -- PASS

Strategy Mode

When mode is strategy, analyze and recommend (no code generation):

  1. Inventory existing tests. Count test files, test functions, assertion density.
  2. Classify test types. Unit, integration, end-to-end, benchmark.
  3. Identify structural gaps. Missing test directories, no CI integration, no fixtures.
  4. Recommend architecture:

- Test directory structure matching source layout. - Shared fixtures and helpers. - Integration test separation (build tags in Go, markers in pytest). - CI pipeline integration.

  1. Output to .agents/test/strategy.md.

What Makes Good Tests vs Bad Tests

Good Tests

  • Assert behavioral correctness. Test what the function does, not that it exists.
  • Use exact expected values. assert result == Config(name="foo", count=3) -- verifies the full output.
  • Cover error paths. Error conditions are where bugs hide. Test them explicitly.
  • Descriptive names. TestParseConfig_InvalidYAML_ReturnsError tells you what broke when it fails.
  • Independent. Each test runs in isolation. No shared mutable state between tests.
  • Fast. Unit tests should run in milliseconds. Slow tests get skipped.

Bad Tests (Banned)

  • Coverage-padding. Tests that assert != nil or != "" solely to inflate coverage metrics. Every test must assert a specific expected value.
  • Zero-assertion smoke tests. func TestFoo(t *testing.T) {Foo()} -- proves nothing except "doesn't panic."
  • Tautological assertions. assert foo(x) == foo(x) -- tests the test framework, not the code.
  • Implementation-coupled tests. Tests that break when you refactor internals without changing behavior. Test the interface, not the implementation.
  • Flaky tests. Tests that depend on timing, network, or ordering. Mock external dependencies. Use deterministic inputs.

If you find existing tests that match the "bad" patterns, flag them in the summary but do not delete them without user confirmation.

Integration with Other Skills

SkillIntegration
/standardsLoaded in Step 0 for language-specific test conventions
/complexityCross-referenced in Step 2 to prioritize high-risk untested code
/vibeAfter test generation, run /vibe to validate overall code quality
/implementDuring implementation, invoke /test --mode=tdd for test-first workflow
/bug-huntTests generated here help /bug-hunt verify fixes

Flags

FlagDefaultDescription
--modegenerateExecution mode: generate, coverage, strategy, tdd
--scope.Directory or file to target (e.g., ./internal/parser/)
--min-coveragenoneTarget coverage percentage; keep generating until met
--dry-runoffShow what tests would be generated without writing files

Output Artifacts

All artifacts are written to .agents/test/:

FileContents
coverage-raw.txtRaw coverage tool output
coverage-func.txtPer-function coverage breakdown (Go)
coverage.jsonMachine-readable coverage (Python)
gaps.mdRanked list of coverage gaps
summary.mdBefore/after coverage delta and test inventory
tdd-log.mdTDD cycle log (tdd mode only)
strategy.mdTest architecture recommendations (strategy mode only)

平台分布

Codex

35.28%
按下载量换算78

Claude

34.33%
按下载量换算76

Cursor

18.48%
按下载量换算41

Gemini CLI

9.65%
按下载量换算21

安全审计

Gen Agent Trust Hub

可疑

Socket

可疑

Snyk

通过

权限和风险

只读

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills