Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Principle Test Behavior Not Implementation?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/erickb336-principle-test-behavior-not-implementation)
---
name: principle-test-behavior-not-implementation
description: "Test behaviour, not implementation. Apply when writing, changing or keeping a test."
license: MIT
metadata:
source: "pstack principle-test-behavior-not-implementation, MIT, Copyright (c) 2026 Lauren Tan, github.com/cursor/plugins, adapted; checked against pstack 0.15.36 at commit 0bb6f37"
---
<!-- Generated by scripts/build.mjs from the sources; edit the source, then run npm run build. -->
# Test behaviour, not implementation
A test checks what the code's users observe: return values, errors, readable state, and outside effects such as a sent request or a written row. Internal helpers and call order are not behaviour.
**Two imagined edits:**
- **Break the behaviour:** return a wrong value, skip an effect or do it twice. If the test still passes, it proves nothing.
- **Change the internals** and keep every observable result. If the test fails, it is pinned to the implementation.
Keep a test that catches the first edit and survives the second; rewrite or delete others.
**Usual causes:** an assertion looser than the contract, an expected value from the code under test, a restated constant or prompt string, a fixture asserting itself, an exact message, not the error type that callers branch on.
**The fix.** Drive the code through its users' interface with a concrete input. Derive the expected value from the requirement; assert exactly what the contract promises. Pair an absence (no call, an empty list) with a case that shows the presence. A payload sent to an external service is behaviour; an internal helper call is not.
**Keep** invariant tests: a key in two tables, or a compile-time type check.