Principle Test Behavior Not Implementation

Apply when you write, change, or keep a test. Assert what the code's users can observe, so that the test fails when that behavior breaks and keeps passing when only the internals change.

107 stars 21 forksTesting & QA

Install

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

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 Behavior, Not Implementation

A test is a claim about what the code does for its users: a caller, an end user, or another service. Behavior is what those users can observe through the interface they use. That includes return values, errors, state they can read back, and effects on systems outside the code, such as a request sent, a row written, or a message emitted. Implementation is what they cannot observe: private helpers, internal call order, intermediate data, and which internal collaborator did the work.

Judge each test against two imagined edits:

- **Break the behavior.** Make the code return a wrong value, skip an effect, or do the effect twice. If the test still passes, it proves nothing. The usual causes are an assertion looser than the contract, an expected value computed by the code under test, a restated constant or prompt string that never runs the code that reads it, and an assertion on data that the test built itself.
- **Change the internals.** Keep every observable result the same and restructure the code underneath. If the test now fails, it is pinned to the implementation. It will need a rewrite on every refactor and still catches no bug.
Read the full skill on GitHub

Details

Skill name
principle-test-behavior-not-implementation
Repository
Dimon94/skills
Path
skills/principle-test-behavior-not-implementation/SKILL.md
Repo updated
18 November 2026

FAQ

What does the Principle Test Behavior Not Implementation skill do?

Apply when you write, change, or keep a test. Assert what the code's users can observe, so that the test fails when that behavior breaks and keeps passing when only the internals change.

How do I install the Principle Test Behavior Not Implementation skill?

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

Is Principle Test Behavior Not Implementation 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

TDD

107

Dimon94/skills

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

Testing & QA21

Implement

107

Dimon94/skills

按 spec、计划或 tickets 实现:逐条拆验收与失败方式,按需 TDD,跑相关 E2E 与形式验证,对账后双轴审查(最多三轮),P2 登记 issue,再提交。

Testing & QA21

Test Discipline

107

Dimon94/skills

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

Testing & QA21

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