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

coverage-analysis

Skill này làm gì

Skill này giải thích báo cáo độ phủ test .NET, cho biết dòng và nhánh nào đã được test và chưa được test. Skill dành cho lập trình viên có số liệu độ phủ và cần hiểu chúng nghĩa là gì, cũng như nên test gì tiếp theo.

Khi nào nên dùng

  • ✓Khi bạn có báo cáo độ phủ .NET và cần biết số liệu thực sự cho thấy điều gì.
  • ✓Khi độ phủ đã ngừng tăng và bạn muốn biết code nào đang chặn tiến độ.
  • ✓Khi bạn cần tính xem cần thêm bao nhiêu độ phủ để đạt mục tiêu.

Liên kết skill

https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/coverage-analysis/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/coverage-analysis/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

“Độ phủ của chúng tôi dừng ở mức 72 phần trăm. Dựa trên báo cáo này, code nào đang chặn chúng tôi đạt 80?”

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

Cách hoạt động

Agent đọc trực tiếp dữ liệu độ phủ bạn cung cấp, xác định các dòng và nhánh chưa được phủ, rồi tính xem mỗi khoảng trống có ý nghĩa gì với mục tiêu.

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.

Coverage Analysis

Purpose

Explain what .NET coverage evidence proves, reconcile target arithmetic, and identify the code blocking progress. Add complexity/CRAP ranking only when the user explicitly asks for risk hotspots, CRAP, priorities by risk, or refactoring safety.

When to Use

Use this skill for interpreting supplied .NET line/branch/condition evidence, coverage gaps and plateaus, target arithmetic, or explicit project-wide coverage-backed risk analysis.

When Not to Use

  • Named method, class, or file CRAP/refactoring-safety analysis — use the crap-score skill instead
  • Static source-to-test pairing or listing files with no tests — use find-untested-sources
  • Behavioral or pseudo-mutation gaps in existing tests — use test-gap-analysis
  • Test trait/category distributions or coverage shape by test type — use test-tagging
  • Writing or generating tests — this skill identifies where tests are needed, not write them
  • General test execution unrelated to coverage or CRAP analysis
  • Only collecting .NET coverage or printing a raw percentage with no diagnosis — use run-tests; use native tooling for non-.NET coverage collection or analysis. Interpreting .NET line/branch gaps remains in scope here

Inputs

Input Required Default Description
Project/solution path No Current directory Path to the .NET solution or project
Line coverage threshold No 80% Minimum acceptable line coverage
Branch coverage threshold No 70% Minimum acceptable branch coverage
Existing Cobertura path No Discover only if not supplied Preferred input; never rerun tests when usable
CRAP threshold No 30 Used only for explicit risk/CRAP requests
Hotspot count No 3 Explicit risk requests only; cap at 10 unless the user asks for more

Discover optional inputs from the workspace. Do not ask for a project path when the current directory or a supplied report is sufficient.

Choose the smallest matching path

User intent Required work Do not do
Explain a supplied excerpt, condition, or summary Answer directly from the supplied evidence Tools, CRAP, discovery, report files
Interpret a supplied Cobertura path or diagnose a plateau Read that report, reconcile totals, name all material gaps, answer directly Rerun tests, install tools, compute CRAP, or generate files unless explicitly requested
Rank risk hotspots, compute project-wide CRAP, or assess refactoring safety Use the supplied/existing report, read references/guidelines.md, and compute CRAP before ranking Coverage-only ranking or a full report template unless requested
Analyze coverage when no report exists Invoke run-tests to collect coverage with the repository-compatible runner, then analyze the generated report Choose or execute a test command independently; CRAP unless risk was requested
Produce a full markdown/HTML/CSV report First deliver the direct answer; then read references/output-format.md or references/report-generation.md Report generation before the answer

Words such as analyze coverage, what is blocking coverage, or why is coverage stuck do not by themselves request CRAP. Explicit signals include risk hotspot, CRAP, complexity-weighted priority, safe to refactor, or an equivalent request to combine complexity with coverage.

Existing-data fast path

When the user supplies a coverage excerpt, summary, or valid Cobertura path:

  • Treat it as authoritative input and start there.
  • Do not discover the solution or test projects unless source mapping is necessary.
  • Do not run dotnet test, install ReportGenerator, add a coverage package, or read references/setup-discovery.md or references/report-generation.md.
  • Do not write coverage-analysis.md or create a report directory unless the user requested a saved/full report.
  • For interpretation and plateau questions, parse only the evidence needed to answer. For explicit project-wide risk requests, use the bundled scripts as described in references/guidelines.md.

A failed read/view operation is not proof that a named path does not exist. Classify the failure, then make one targeted existence probe and use a normalized path or alternate reader only for confirmed tool availability, transport, or path-normalization failures and only af

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

Skill có chạy test để lấy độ phủ không?

Mặc định là không. Skill phân tích bằng chứng độ phủ bạn cung cấp, trừ khi bạn yêu cầu rõ ràng thu thập độ phủ.

Skill có xếp hạng code theo rủi ro không?

Chỉ khi bạn yêu cầu các điểm nóng rủi ro hoặc phân tích CRAP.

Skill có viết test không?

Không. Skill chỉ ra nơi cần test, còn việc viết test thuộc skill khác.

Chi tiết

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

Activation requires either supplied .NET coverage reports/percentages/line, branch, or condition metrics, or an explicit request to collect .NET coverage for analysis. USE FOR: interpreting that evidence, including Cobertura data, partial conditions, plateaus, target arithmetic, project-wide coverage-backed CRAP, and coverage-backed refactoring safety. Analyze supplied reports directly without rerunning tests or installing tools. DO NOT USE FOR: requests with neither coverage evidence nor explicit coverage-collection intent, including hypothetical change-survival questions (use test-gap-analys

repo: dotnet/skills

Độ phổ biến

Sao GitHub
5.8k
Vị trí xếp hạng
#14625
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ự