Skip to content
Back to skills

Principle Test Behavior Not Implementation

ASecurity

Test behaviour, not implementation. Apply when writing, changing or keeping a test.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
ai-agentsgit

Works with

  • cursor

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add erickb336/sage-stack --skill principle-test-behavior-not-implementation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Principle Test Behavior Not Implementation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Principle Test Behavior Not Implementation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/erickb336-principle-test-behavior-not-implementation/badge)](https://www.skillsdirectory.com/skills/erickb336-principle-test-behavior-not-implementation)

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

Download with Pro
SKILL.md
---
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.

Attribution

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

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.