Test Discipline

用户要求建立或补齐项目测试规范,或明确点名 test-discipline 自检时使用。常规写测试由 hook 提醒。

107 stars 21 forksTesting & QA

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add Dimon94/skills --skill test-discipline
Manual install
git clone --depth 1 https://github.com/Dimon94/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/skills/test-discipline ~/.claude/skills/test-discipline

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Test Discipline

用户明确要求建立或补齐项目测试规范时,执行「建档」。用户明确点名 test-discipline 自检时,先读目标项目测试规范,再按「写前自检」核对实际测试。常规编辑由 hook 提醒;提醒已到达时直接处理,不重复加载全文。

## 写前自检

实现优先。把绝大部分时间和精力用于完成当前功能,沿现有实现与明确需求走最短路径。外部输入在边界校验一次,内部直接复用已校验数据和既有合同;不为假想风险添加防御性分支、兜底或预防性操作。

验证够用即停。复用已读的项目规范和仍有效的检查结果;只有相关代码、输入或环境变化,出现新失败,或尚有具体疑点时才追加验证。当前验收通过就继续交付,不重复核对完整性,也不扩展检查范围。

测试只补当前需求的关键缺口。先复用现有测试;确需新增时,只判断哪个具体错误实现会让哪条断言失败,无需逐条书面作答。断言通过公开入口观察业务结果,替身放在外部边界。具体测试质量有争议时,再读下方深层说明。

## 项目测试规范定位

hook 优先读取仓根 AGENTS.md 首条行首为 `测试规范:` 的索引行,按 `、` 分隔并逐项校验 `repo://` 路径。有合法项时只列合法项;失效项只列原值与首个原因,不作为规范路径。没有合法项才检查常见落点,两步皆空时提示“无项目测试规范”。校验与落点顺序归 repo://skills/test-discipline/hooks/core.cjs 的 `indexFailure`、`projectContext`。

无论规范是否存在,都列出从被编辑文件所在目录到仓根之间最近的 AGENTS.md;子 agent 从 `cwd` 起查找。仓根通过向上寻找 `.git` 目录或文件确定,找不到时使用事件 `cwd`。hook 只提供规范路径,不复制规范正文。

## 建档

仅在用户明确要求为项目建立或补齐测试规范时执行;执行其他任务不建档。建档由 agent 手动完成,不生成执行脚本。

### 五步流程

先按下列步骤确定写入清单,再写文件;第 5 步是全部写入的前置检查。

1. 按「项目测试规范定位」查找。找到合法规范且已有测试规范索引时,报告“已有测试规范”并结束。
2. 没有索引但找到常见落点时,只在根 AGENTS.md 末尾追加一行 `测试规范:repo://<路径一>、repo://<路径二>`,按查找顺序列全找到的规范,不生成第二份规范。
3. 什么都没找到时,按下方规则识别语言,读取 [通用正文模板](references/baseline-testing-standards.md) 和命中的语言节模板,填写并生成 `docs/agents/testing-standards.md`;在根 AGENTS.md 末尾追加 `测试规范:repo://docs/agents/testing-standards.md`。生成结果归目标项目所有,由该项目维护。
4. 根目录没有 AGENTS.md 时,新建一个,只含本次索引行。仅在此分支且 CLAUDE.md 不存在时新建 CLAUDE.md,内容为 `@AGENTS.md`;已有 CLAUDE.md 保持不变,并在完成报告中提示用户。
5. 新建目标文件已存在时不覆盖,报告冲突后停止,保留原文件。已有 AGENTS.md 只允许步骤 2、3 的末尾追加;已有首条索引却无合法项时,报告失效原因并停止,不追加一条 hook 读不到的第二索引。
Read the full skill on GitHub

Details

Skill name
test-discipline
Repository
Dimon94/skills
Path
skills/test-discipline/SKILL.md
Repo updated
18 November 2026

FAQ

What does the Test Discipline skill do?

用户要求建立或补齐项目测试规范,或明确点名 test-discipline 自检时使用。常规写测试由 hook 提醒。

How do I install the Test Discipline skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add Dimon94/skills --skill test-discipline. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Test Discipline popular?

It lives in Dimon94/skills, which has 107 GitHub stars and 21 forks.

Related skills

Maintain Verification Skill

107

Dimon94/skills

Periodic pass that keeps a project's verification skill and feature map honest: parallel source readers per feature, one live session driving every feature, at most one PR of proven corrections. Use for /maintain-verification-skill or "audit the verify skill".

Git & Code ReviewIn 2 lists21

Create Verification Skill

107

Dimon94/skills

Generate a project-local verification skill that drives your app the way a user does — any language, framework, or platform. Use for /create-verification-skill, "make a control skill for this repo", or when a project has no scripted way to prove UI/CLI/service behavior.

Software DevelopmentIn 2 lists21

How

107

Dimon94/skills

Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions ("where should this live", "which package owns this", "is this the right layer"). Explains subsystem architecture, runtime flow, onboarding mental models. Use why for motivation.

Software DevelopmentIn 2 lists21

Test Review

107

Dimon94/skills

专项审查分支、PR/MR 或 WIP 中测试的正确性与必要性。按二八原则聚焦高价值覆盖,结合目标项目规范、BDD 业务结果、独立预期与消融测试识别假绿、脆弱测试及有效覆盖,分别审查 Standards 与 Spec,核实 fixture、mock 和 CI 接线。

Testing & QA21

TDD

107

Dimon94/skills

按需先红后绿:按改动类型决定要不要先写失败检查、放在哪层,期望值来自独立预期,并用真跑的探针证明检查能拒绝错误实现。用于实现功能或修复缺陷时测试先行,或用户提到 TDD、红绿、先写测试。

Testing & QA21

D School

66

aparente/claude-skills

Stanford d.school design thinking facilitator. Use when the user wants to: brainstorm, ideate, generate ideas, run a design thinking session, create How Might We statements, use SCAMPER, do Crazy 8s, mind map, storyboard, define a problem statement, create empathy maps, build prototypes, test assumptions, run design sprints, reframe problems, do "worst possible idea", use "yes and" building, explore analogous inspiration, conduct user interviews, synthesize insights, create POV statements, plan user tests, iterate on concepts, or facilitate any creative problem-solving session. Covers all 5 ph

Testing & QA

Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.