Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Testing

ASecurity

测试与覆盖率:单元/集成/功能测试、TDD、回归测试、性质测试(Hypothesis/QuickCheck)、 mock 外部依赖、行覆盖率与 Codecov。Use when the user asks to write tests, raise coverage, or choose a testing approach. 触发于「写测试/提覆盖率/选测试策略」。

17 stars
0 votes
0 copies
0 views
Added 10/5/2026
developmentpythonrusttestingapi

Works with

api

Security Analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned 10/5/2026

$npx -y skills add AntheaLaffy/mvsep-rs --skill testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Testing?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/anthealaffy-testing/badge)](https://www.skillsdirectory.com/skills/anthealaffy-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: testing
description: >
  测试与覆盖率:单元/集成/功能测试、TDD、回归测试、性质测试(Hypothesis/QuickCheck)、
  mock 外部依赖、行覆盖率与 Codecov。Use when the user asks to write tests, raise coverage,
  or choose a testing approach. 触发于「写测试/提覆盖率/选测试策略」。
---

# 测试

主线:测试是提高正确性信心的标准技术——写代码去调用你的代码,行为不符预期就报错。TDD 的红-绿-重构纪律另见 dsh 的 `tdd` skill;本 skill 只做 MIT 讲义的科学面(测试类型与工具)。

## 测试类型

- 按粒度:单元测试(单个函数)、集成测试(模块/服务之间的交互)、功能测试(端到端场景)。
- TDD 先写测试再写实现;发现 bug 时写**回归测试**——未来再坏立刻能抓住。
- 性质测试(property-based):QuickCheck(Haskell)开创,Hypothesis(Python)等实现——声明性质,框架随机生成输入验证并给出具体反例。它不是数学证明:要人工限定输入范围(如字符串长度 0–20、整数 0–50)。
- 用哪种看项目,通常是若干种的组合。测试放哪随语言约定:Rust 单测常与函数同文件、集成测试分离;Python 有 doctest。
- 依赖数据库/Web API 等外部服务时,测试里 mock 它们:实现相同 API 的假实现注入测试——可控制返回错误、可离线跑。不想写 mock 的替代是 VCR 类工具(pytest-vcr):录一次真实 API 通信,之后重放。

## 覆盖率

- 行覆盖率:测试跑过哪些行,按行显示、指导补测试(HTML 报告给人看,XML 更密、更适合喂 LLM);Codecov 类服务提供 Web 界面跟踪项目历史;也是粗筛开源项目质量的指标。
- 覆盖率是质量指标之一,不是目标本身——100% 覆盖的测试可能毫无意义(有人见过前端仓库满覆盖但测试全废);高质量的测试更重要。
- 让 AI 提覆盖率时,要给它「带覆盖率跑测试 + 逐行报告」的环境,它才知道聚焦在哪;它生成的测试越放任越水,要用「测试这个功能的行为」这类指令引导并审查(见 `agentic-coding`)。

## 练习

学习材料在 `exercises.md`。

> 改编自 MIT The Missing Semester 课程 Lecture 9: Code Quality(讲义 + 口播稿,CC BY-NC-SA 4.0):https://creativecommons.org/licenses/by-nc-sa/4.0/ · 课程站点:https://missing.csail.mit.edu/ · 讲座视频:https://www.youtube.com/watch?v=XBiLUNx84CQ

Attribution

AntheaLaffyAntheaLaffy
View sourceSee grades on GitHubMore from AntheaLaffy →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

286712 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Writing Plans

Use when you have a spec or requirements for a multi-step task, before touching code

2927051 votes
View all in development →