Principle Test Behavior Not Implementation
Test code's observable behavior, not its internals, so tests survive refactors and still catch real breakage.
- CCM score
- 62 of 100
- skills.sh installs
- 13.3K
- GitHub stars
- 5.5K
- last updated
- Nov 30, 2026
Own this skill? Claim it
What it does
- Covers judging each test against two edits: breaking observable behavior, and changing internals while keeping results
- Says observable behavior means return values, errors, readable state, and effects on external systems, not private helpers or call order
- Guides keeping tests that catch broken behavior but pass under refactors, and rewriting or deleting the rest
- Designed for use whenever you write, change, or keep a test in your project
Install
$ npx -y skills add backnotprop/pstack --skill principle-test-behavior-not-implementation -yInstalls 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/backnotprop/pstack
- Category
- Testing & QA
- First seen
- Nov 30, 2026
More from backnotprop/pstack
All 44- Principle Redesign From First Principles13.3K
- Principle Build The Lever13.3K
- Principle Minimize Reader Load13.3K
- Principle Boundary Discipline13.3K
- Principle Exhaust The Design Space13.3K
- Principle Never Block On The Human13.2K
- Automate Me13.2K
- Principle Foundational Thinking13.2K
- Principle Attack The Premise13.2K
- Principle Sequence Verifiable Units13.2K
- Principle Outcome Oriented Execution13.2K
- Principle Separate Before Serializing Shared State13.2K
- Principle Experience First13.2K
- Make Bot Ui12.8K
- Correct12.5K
- Principle Explain The Number12.3K
- How14.1K
- Why13.9K
- Arena13.9K
- Principle Fix Root Causes13.8K
- Interrogate13.7K
- Blast Radius13.7K
- Poteto Mode13.7K
- Architect13.6K
Similar to Principle Test Behavior Not Implementation
More Testing & QApytest-coveragegithub/awesome-copilot13.1K installsRun pytest tests with coverage, discover lines missing coverage, and increase coverage to 100%.
cpp-testingaffaan-m/ecc13K installsUse only when writing/updating/fixing C++ tests, configuring GoogleTest/CTest, diagnosing failing or flaky tests, or adding coverage/sanitizers.
laravel-tddaffaan-m/ecc12.8K installsLaravel testing strategies with PHPUnit, Pest, model factories, HTTP tests, Sanctum authentication testing, mocking, and coverage.
correctbacknotprop/pstack12.5K installscorrect
kotlin-testingaffaan-m/ecc12.1K installsKotlin testing patterns with Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. Follows TDD methodology with idiomatic Kotlin practic
ai-regression-testingaffaan-m/ecc12.1K installsRegression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns t