Skip to content
cccskills
FreePublished on GitHub

coverage-reporting

测试覆盖率收集和报告时使用。适用于覆盖率目标设定、CI 集成、PR 评论、趋势跟踪。

The English summary is being prepared. Showing the original description.

See how to install

Files included (2)

  • SKILL.md2.4 KB
  • templates/coverage-config-template.md639 B

SKILL.md (original)

Review the instructions the agent will receive before you install.

覆盖率报告(Coverage Reporting)

适用场景

  • 覆盖率目标设定
  • CI 覆盖率收集
  • PR 覆盖率评论
  • 覆盖率趋势跟踪
  • 覆盖率门禁

核心原则

1. 覆盖率是基线不是目标
   80% 覆盖率 ≠ 80% 质量

2. 关注增量覆盖率
   新代码 ≥ 80%,比总覆盖率更有意义

3. 不追求 100%
   getter / setter / 配置不需要测

4. 分层看
   业务逻辑 ≥ 90%
   Controller ≥ 60%
   工具函数 ≥ 80%

5. 趋势比绝对值重要
   覆盖率不能下降

工具

工具语言用途
Codecov多语言SaaS 报告 + PR 评论
Coveralls多语言SaaS 报告
SonarQube多语言自建 + 质量门禁
Istanbul / c8JS/TS收集器
JaCoCoJava收集器
coverage.pyPython收集器
go test -coverGo内置

覆盖率目标

层目标说明
Domain / Service≥ 90%核心业务
Controller≥ 60%集成测试覆盖
Utils≥ 80%工具函数
总体≥ 70%基线
增量(新代码)≥ 80%PR 门禁

CI 集成

# Vitest 覆盖率
- run: pnpm test:coverage
- uses: codecov/codecov-action@v4
  with:
    files: coverage/lcov.info
    fail_ci_if_error: true

# 门禁:覆盖率不能下降
- name: Coverage check
  run: |
    COVERAGE=$(cat coverage/coverage-summary.json | jq '.total.lines.pct')
    if (( $(echo "$COVERAGE < 70" | bc -l) )); then
      echo "Coverage below threshold: $COVERAGE%"
      exit 1
    fi

配套模板

  • templates/coverage-config-template.md — 覆盖率配置 + 目标 + CI

质量自检

□ 覆盖率目标设定
□ CI 自动收集
□ PR 评论(增量)
□ 门禁(不能下降)
□ 趋势跟踪
□ 分层目标
□ 不追求 100%

常见坑

  1. 追求 100%——测 getter 浪费时间
  2. 只看总覆盖率——新代码 0% 也能过
  3. 不设门禁——覆盖率持续下降
  4. 覆盖率 = 质量——覆盖了不等于测对了
  5. 不看趋势——单点数据无意义

与其他 skill 的协作

上游:
  unit/integration/e2e → 测试代码产生覆盖率

下游:
  ci-test-integration → CI 收集
  qa-engineer quality-gate → 门禁条件

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

A/B 测试设计与分析时使用。适用于产品实验、功能验证、转化率优化。融合假设驱动 + 样本量计算 + 置信度判断。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

上线前业务方/产品方验收时使用。适用于功能交付确认、UAT、发布会签。融合 BDD Given-When-Then、Specification by Example、ATDD。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

设计无障碍可访问的界面时使用。适用于满足 WCAG 标准、键盘导航、屏幕阅读器支持。优先使用 WCAG 2.2 AA 级标准 + 键盘 + 焦点 + 对比度 + ARIA。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

实现可访问性(无障碍)时使用。覆盖 WCAG 2.2 AA / ARIA / 键盘导航 / 屏幕阅读器 / 颜色对比 / 焦点管理。融合 React Aria / Radix UI / Headless UI 实践 + axe-core 自动化测试。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

AI 模型部署时使用。适用于推理服务 / GPU / TensorRT / 监控 / 扩缩容。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

数据分析报告输出时使用。适用于业务分析报告、周报、专项分析、决策支持。融合洞察 + 建议 + 行动项。

The English summary is being prepared. Showing the original description.

zhaoxuya520/AI-Fullstack-Delivery-Workflow53Updated May 19, 2026

See all skills by zhaoxuya520

Report a problem with this skill