跳到正文
Skillpedia
测试5.8k · #14624

code-testing

它能做什么

这项技能编写新测试、修复失败或不稳定的测试,并为现有代码添加回归测试。适合需要更好的测试覆盖率、又不想手动设置的开发者。

适用场景

  • ✓当代码没有测试,或你需要一个用来防止缺陷复发的测试时。
  • ✓当现有测试失败、不稳定或需要更强的检查时。
  • ✓当你希望在使用受支持测试框架的项目中补充覆盖率缺口的时候。

技能链接

https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/code-testing/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/code-testing/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请为我的支付服务添加测试,包括针对我们上周修复的退款缺陷的回归测试。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会阅读代码和现有测试,为该框架选择合适的写法,编写测试用例并运行。规模较大的工作会先分阶段规划。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Code Testing Skill

The reliable implicit entry point for generating, repairing, and strengthening tests. It handles focused work directly and invokes the public test-engineer agent for broad or multi-stage requests.

Non-negotiable execution contract

Check pipeline ownership first. If the active agent is test-engineer (including a plugin-qualified name such as dotnet-test:test-engineer), or the caller assigned you a phase of that pipeline, do not delegate to another generator. Continue the assigned work inline. This guard takes precedence over every broad-scope delegation instruction below, even if this skill was loaded automatically.

Classify scope before editing:

  • Broad (a project/package-wide suite, or multiple production files/modules): create research.md and plan.md in a resolved non-stageable <TESTAGENT_DIR> before implementation, then status.md there after the final test-quality review. When test-engineer is available, invoke that named custom agent before implementing; do not replace it with a generic subagent carrying the same label or implement the broad request inline. If the state files are absent, the broad workflow is incomplete.
  • Focused (the user explicitly limits work to one function/class/file or one missing method): do not create intermediate state files or fan out to multiple agents. A sparse project-wide request remains broad even when only one source module is present.

For either scope, run the narrowest relevant test command to a clean exit. Always apply Report-safe test names and result validation, including when the caller supplies conventions. Pass this contract to delegated implementers/testers; preserve edge-case data and validate configured reports, not just console output. Keep the handoff proportional: for one to three focused requirements, use a compact bullet list under a Requirement coverage label that names the tests and successful command; for broader or multi-requirement work, use a Requirement | Evidence table. Each requested behavior must cite an exact test name.

Before sending a broad-scope final response, check that the response itself contains | Requirement | Evidence | and exact test names for every behavioral row. A table in a child report or internal plan is not enough. Do not summarize away those names into module-level bullets or an Area | Tests table.

Intermediate state files are internal working data, never deliverables. Keep <TESTAGENT_DIR> non-stageable, never place it or its files in version-controlled workspace content, and never modify .gitignore to hide them.

Treat completeness as a requirement matrix, not a test-count target. Give every independently requested state, boundary, error path, or interaction its own concrete assertion. Combine cases only when one execution genuinely proves the whole requested combination; do not let a parameterized happy-path case stand in for an empty state, invalid discriminator, or before/at/after boundary. For broad requests that name several production modules or layers, give each named module direct tests for its non-trivial public behavior. Cross-module tests prove composition, but do not substitute for the requested module-level coverage. Judge breadth by the behavior matrix, never by matching or exceeding a raw test count.

At the public entry point, delegate broad work to test-engineer once. Research, plan, implementation, and review remain required, but they need not be separate sub-agent calls.

Use only capabilities available in the current runtime. Do not retry a missing skill under aliases or use another agent to retry a policy-denied operation. Read language guidance directly from the caller-provided or runtime-listed code-testing-extensions catalog and its matching language file. It is reference-only, not an invocable skill. If the bundle is absent, use manifests and representative tests and report the missing reference rather than searching installation dirs. If scratch storage is denied, keep the research and plan in context, continue permitted test edits, and report the missing state artifacts. If execution is denied, continue permitted static review and report tests as unrun, never passed. Neither blocker authorizes modifying production code or weakening requirements.

For a broad or comprehensive request, the explicit matrix is the floor, not the

常见问题

它只运行测试吗?

不。它编写和修复测试。单独运行测试是另一项技能。

它会先规划大型任务吗?

会。范围广或多阶段的工作会在编写测试之前先被规划和记录。

它支持哪些框架?

它适用于 xUnit、MSTest、NUnit、pytest、Jest、Vitest、Go 以及其他框架。

详情

作者的原始描述

ALWAYS USE for test work that requires changes: write, add, generate, repair, or strengthen tests for existing code in xUnit, MSTest, NUnit, pytest, Vitest/Jest, Go, or another framework. Includes regression cases, failing or flaky tests, coverage-driven additions, and audit-then-fix requests. Focused work stays direct; broad or multi-stage work invokes test-engineer. DO NOT USE for only running tests, analysis-only audits, framework/platform migrations, a test blocked on a missing production seam (testability-obstacle), or MSTest API/configuration corrections that do not design new cases (wri

repo: dotnet/skills

热度

GitHub 星标
5.8k
排名
#14624
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能