test

A command for running a project's automated tests, which are checks that software behaves as expected. It detects common project types and chooses a matching test command.

In plain words
What is it for?
Use it to run all tests or selected tests, show more detail, rerun failed tests, filter tests by name, and request coverage reports where supported.
Why use it?
It removes the need to remember different test commands for Python, Node.js, Java, .NET, Go, and Rust projects.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/xiaobei930/cc-best/test
Clone the repo
git clone --depth 1 https://github.com/xiaobei930/cc-best
Per session 5 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 646 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00005 $0.00646
Opus 5 $0.00003 $0.00323
Sonnet 5 $0.00001 $0.00129
Haiku 4.5 $0.00001 $0.00065

Measured 2d ago against content hash 95fb74c52e1b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/test.md · 88 lines

What it actually says

/test - 运行测试

运行项目测试套件。

自动检测

根据项目类型自动选择测试命令:

项目类型 检测文件 测试命令
Python pytest.ini, pyproject.toml pytest
Node.js package.json npm test
Java Maven pom.xml mvn test
Java Gradle build.gradle gradle test
.NET *.csproj, *.sln dotnet test
Go go.mod go test ./...
Rust Cargo.toml cargo test

常用选项

Python (pytest)

pytest                      # 运行所有测试
pytest tests/unit/          # 运行指定目录
pytest -v                   # 详细输出
pytest --lf                 # 只运行上次失败的
pytest -k "test_user"       # 按名称过滤
pytest --cov=src            # 覆盖率报告

Node.js

npm test                    # 运行所有测试
npm test -- --watch         # 监听模式
npm test -- --coverage      # 覆盖率
npm test -- --grep "user"   # 按名称过滤

Java

mvn test                              # Maven
mvn test -Dtest=UserServiceTest       # 指定类
gradle test                           # Gradle
gradle test --tests "UserServiceTest" # 指定类

.NET

dotnet test                                    # 运行所有测试
dotnet test --filter "FullyQualifiedName~User" # 过滤
dotnet test --collect:"XPlat Code Coverage"    # 覆盖率

执行流程

1. 检测项目类型
   └─ 查找配置文件

2. 运行测试
   └─ 执行对应的测试命令

3. 报告结果
   └─ 显示通过/失败数量
   └─ 显示失败详情

失败处理

如果测试失败:

  1. 分析失败原因
  2. 如果是代码问题,调用 /cc-best:dev 修复
  3. 如果是测试问题,更新测试用例
  4. 需要系统化测试改进时,调用 tdd-guide agent 指导 TDD 流程
  5. 重新运行测试验证

记住: 测试是信心的来源——没有测试的代码只是"可能工作",有测试的代码才是"确认工作"。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 88 lines · 5 tokens per session scan A 95fb74c52e1b

Subscribe to this mod's changes

test is a command published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 2mo ago), licensed MIT. It adds 5 tokens to every session and 646 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.