dotnet-coverlet
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCoverlet for .NET
适用于.NET的Coverlet
Trigger On
适用场景
- the repo uses or wants
coverlet - CI needs line or branch coverage for .NET tests
- the team needs to choose between ,
coverlet.collector, orcoverlet.msbuildcoverlet.console
- 代码仓库正在使用或想要使用
coverlet - CI需要为.NET测试生成行覆盖率或分支覆盖率数据
- 团队需要在、
coverlet.collector和coverlet.msbuild之间做选型coverlet.console
Value
价值
- produce a concrete project delta: code, docs, config, tests, CI, or review artifact
- reduce ambiguity through explicit planning, verification, and final validation skills
- leave reusable project context so future tasks are faster and safer
- 生成具体的项目变更:代码、文档、配置、测试、CI或评审产物
- 通过明确的规划、验证和最终校验能力减少歧义
- 留下可复用的项目上下文,让后续任务执行更快速安全
Do Not Use For
不适用场景
- coverage report rendering by itself
- repos that intentionally use a different coverage engine
- 仅用于覆盖率报告渲染的场景
- 明确使用其他覆盖率引擎的代码仓库
Inputs
输入依赖
- the nearest
AGENTS.md - active runner model: VSTest or Microsoft.Testing.Platform
- target test projects
- 最近的文件
AGENTS.md - 活跃的运行器模型:VSTest 或 Microsoft.Testing.Platform
- 目标测试项目
Quick Start
快速开始
- Read the nearest and confirm scope and constraints.
AGENTS.md - Run this skill's through the
Workflowuntil outcomes are acceptable.Ralph Loop - Return the with concrete artifacts and verification evidence.
Required Result Format
- 阅读最近的文件,确认范围和约束条件。
AGENTS.md - 通过运行本技能的工作流,直到输出结果符合预期。
Ralph Loop - 按照「要求结果格式」返回具体产物和验证证据。
Workflow
工作流
- Choose the driver deliberately:
- for VSTest
coverlet.collectordotnet test --collect - for MSBuild property-driven runs
coverlet.msbuild - for standalone scenarios
coverlet.console
- Add coverage packages only to test projects.
- Do not mix and
coverlet.collectorin the same test project.coverlet.msbuild - Pair raw coverage collection with only when humans need rendered reports.
ReportGenerator
- 谨慎选择驱动类型:
- 若使用VSTest的命令,选择
dotnet test --collectcoverlet.collector - 若使用MSBuild属性驱动的运行方式,选择
coverlet.msbuild - 独立部署场景选择
coverlet.console
- 若使用VSTest的
- 仅在测试项目中添加覆盖率相关包。
- 不要在同一个测试项目中混用和
coverlet.collector。coverlet.msbuild - 仅当需要人工查看渲染后的报告时,才将原始覆盖率收集结果和搭配使用。
ReportGenerator
Bootstrap When Missing
缺失配置时的初始化流程
If coverage is not configured yet:
- Detect current state:
rg -n "coverlet\\.(collector|msbuild)|CollectCoverage|XPlat Code Coverage" -g '*.csproj' -g '*.props' -g '*.targets' .dotnet tool list --localdotnet tool list --globalcommand -v coverlet
- Install exactly one driver path:
- VSTest collector:
dotnet add TEST_PROJECT.csproj package coverlet.collector - MSBuild driver:
dotnet add TEST_PROJECT.csproj package coverlet.msbuild - Console tool: (if missing) and
dotnet new tool-manifestdotnet tool install coverlet.console
- VSTest collector:
- Record one concrete local and CI command in :
AGENTS.md- collector:
dotnet test TEST_PROJECT.csproj --collect:"XPlat Code Coverage" - msbuild:
dotnet test TEST_PROJECT.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura - console:
dotnet tool run coverlet TEST_ASSEMBLY.dll --target "dotnet" --targetargs "test TEST_PROJECT.csproj --no-build"
- collector:
- Run the chosen command once and return or
status: configured.status: improved - If another coverage engine already owns coverage for this repo, return .
status: not_applicable
如果尚未配置覆盖率统计:
- 检测当前状态:
rg -n "coverlet\\.(collector|msbuild)|CollectCoverage|XPlat Code Coverage" -g '*.csproj' -g '*.props' -g '*.targets' .dotnet tool list --localdotnet tool list --globalcommand -v coverlet
- 仅安装一种驱动:
- VSTest collector:
dotnet add TEST_PROJECT.csproj package coverlet.collector - MSBuild驱动:
dotnet add TEST_PROJECT.csproj package coverlet.msbuild - 控制台工具:如果缺少工具清单则先执行,再执行
dotnet new tool-manifestdotnet tool install coverlet.console
- VSTest collector:
- 在中记录一条可用于本地和CI环境的具体命令:
AGENTS.md- collector:
dotnet test TEST_PROJECT.csproj --collect:"XPlat Code Coverage" - msbuild:
dotnet test TEST_PROJECT.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura - console:
dotnet tool run coverlet TEST_ASSEMBLY.dll --target "dotnet" --targetargs "test TEST_PROJECT.csproj --no-build"
- collector:
- 运行一次选择的命令,返回或
status: configured。status: improved - 如果本仓库已经使用其他覆盖率引擎,返回。
status: not_applicable
Deliver
交付产物
- explicit coverage driver selection
- reproducible coverage commands for local and CI runs
- 明确的覆盖率驱动选型结果
- 可复现的本地和CI环境覆盖率运行命令
Validate
校验标准
- coverage driver matches the runner model
- coverage files are stable and consumable by downstream reporting
- 覆盖率驱动与运行器模型匹配
- 覆盖率文件稳定,可被下游报告工具消费
Ralph Loop
Ralph Loop
Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.
- Plan first (mandatory):
- analyze current state
- define target outcome, constraints, and risks
- write a detailed execution plan
- list final validation skills to run at the end, with order and reason
- Execute one planned step and produce a concrete delta.
- Review the result and capture findings with actionable next fixes.
- Apply fixes in small batches and rerun the relevant checks or review steps.
- Update the plan after each iteration.
- Repeat until outcomes are acceptable or only explicit exceptions remain.
- If a dependency is missing, bootstrap it or return with explicit reason and fallback path.
status: not_applicable
所有任务都需使用Ralph Loop,包括文档、架构、测试和工具类工作。
- 首先做规划(强制要求):
- 分析当前状态
- 定义目标产出、约束和风险
- 编写详细的执行计划
- 列出最终要运行的校验能力,说明顺序和原因
- 执行一个规划好的步骤,生成具体的变更。
- 评审结果,记录发现的问题和可执行的后续修复方案。
- 小批量应用修复,重新运行相关检查或评审步骤。
- 每次迭代后更新规划。
- 重复以上步骤直到产出符合预期,或仅剩下明确的例外项。
- 如果缺少依赖,先初始化依赖,或返回,同时说明明确原因和备选方案。
status: not_applicable
Required Result Format
要求结果格式
- :
status|complete|clean|improved|configured|not_applicableblocked - : concise plan and current iteration step
plan - : concrete changes made
actions_taken - : final skills run, or skipped with reasons
validation_skills - : commands, checks, or review evidence summary
verification - : top unresolved items or
remainingnone
For setup-only requests with no execution, return and exact next commands.
status: configured- :可选值
status|complete|clean|improved|configured|not_applicableblocked - :简洁的计划和当前迭代步骤
plan - :已执行的具体变更
actions_taken - :最终运行的校验能力,若跳过需说明原因
validation_skills - :命令、检查或评审证据的汇总
verification - :最主要的未解决事项,若无则填
remainingnone
对于仅要求配置无需执行的请求,返回和准确的后续执行命令。
status: configuredLoad References
参考文档
references/commands.mdreferences/patterns.mdreferences/coverlet.md
references/commands.mdreferences/patterns.mdreferences/coverlet.md
Example Requests
请求示例
- "Add Coverlet to this .NET solution."
- "Choose the right Coverlet driver for CI."
- "给这个.NET解决方案添加Coverlet支持。"
- "为CI环境选择合适的Coverlet驱动。"