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.
How do I install this agent skill?
npx skills add https://github.com/christofferbergj/agent-skills --skill principle-test-behavior-not-implementationIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill is purely instructional and provides guidance on software testing principles. It contains no executable code, scripts, or network operations and presents no security risks.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
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.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/christofferbergj/agent-skills/principle-test-behavior-not-implementation">View principle-test-behavior-not-implementation on skillZs</a>