Chuyển đến nội dung
Skillpedia
Kiểm thử5.8k · #14624

code-testing

Skill này làm gì

Skill này viết test mới, sửa test lỗi hoặc không ổn định, và thêm test hồi quy cho code có sẵn. Skill dành cho lập trình viên cần độ phủ test tốt hơn mà không phải tự thiết lập.

Khi nào nên dùng

  • ✓Khi bạn cần test mới cho code chưa có test, hoặc một test để ngăn lỗi đã sửa quay lại.
  • ✓Khi test có sẵn bị lỗi, không ổn định hoặc cần khẳng định mạnh hơn.
  • ✓Khi bạn muốn lấp các khoảng trống độ phủ trong một project dùng framework test được hỗ trợ.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/code-testing/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Thêm test cho dịch vụ thanh toán của tôi, bao gồm một test hồi quy cho lỗi hoàn tiền đã sửa tuần trước.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent đọc code và test hiện có, chọn kiểu viết phù hợp với framework, viết các test case, rồi chạy chúng. Các công việc lớn được lên kế hoạch theo từng giai đoạn trước.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

Câu hỏi thường gặp

Skill chỉ chạy test thôi à?

Không. Skill viết và sửa test. Chạy test riêng lẻ là một skill khác.

Skill có lên kế hoạch cho công việc lớn không?

Có. Công việc rộng hoặc nhiều giai đoạn được lên kế hoạch và ghi lại trước khi viết test.

Skill hỗ trợ framework nào?

Skill làm việc với xUnit, MSTest, NUnit, pytest, Jest, Vitest, Go và các framework khác.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
5.8k
Vị trí xếp hạng
#14624
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự