cursor avatar

Principle Test Behavior Not Implementation

Test assertions that check observable behavior, not the internals that produce it.

CCM score
58 of 100
skills.sh installs
3.5K
GitHub stars
19.4K
last updated
Nov 25, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers judging each test against two edits: breaking observable behavior and changing internals while keeping results
  • Keeps tests that fail on a broken result and pass on internal refactors; rewrites or deletes the rest
  • Drives code through its public interface with concrete inputs and derives expected values from the requirement, not the code
  • Treats what an external service receives as behavior, but a call to an internal helper as implementation
  • Designed for writing, changing, or reviewing tests where assertions should survive refactoring

Install

$ npx -y skills add cursor/plugins --skill principle-test-behavior-not-implementation -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Test Behavior, Not Implementation

A test is a claim about what users of the code can observe through its interface: return values, errors, state they can read back, and effects on outside systems. Private helpers, internal call order, and intermediate data are implementation.

Judge each test against two imagined edits:

  • Break the behavior (a wrong value, a skipped or doubled effect). If the test still passes, it proves nothing. The usual causes are a loose assertion, an expected value computed by the code under test, and an assertion on data the test built itself.
  • 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 the rest. Drive the code through its public interface with a concrete input, and derive the expected value from the requirement. What an external service receives is behavior. A call to an internal helper is not. Pair "this never happens" with a case where it does happen. Assert the error type that callers branch on, not the message.

Details

Repository
github.com/cursor/plugins
Category
Testing & QA
First seen
Nov 25, 2026

More from cursor/plugins

All 93

Similar to Principle Test Behavior Not Implementation

More Testing & QA