
Principle test behavior not implementation
Guides agents to write tests that check observable behavior, not internal details
Principle test behavior not implementation is an open-source agent skill for developer tools. It is available on Claude Code.
- Scripts
- None
- Platforms
- Claude Code
- GitHub stars
- 5.1K
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Principle test behavior not implementation
This skill teaches an agent to judge tests by what callers of the code can observe: return values, raised errors, readable state and effects on external systems. Private helpers, call order and intermediate data are treated as implementation that tests should not pin.
It gives the agent a two-part check to apply to any test it writes, changes or keeps. The first asks whether the test would fail if the behavior broke, flagging loose assertions, expected values computed by the code under test, and assertions on data the test created itself. The second asks whether the test would survive a refactor that keeps every observable result. Tests that fail the second check are to be rewritten or removed.
The guidance covers practical habits such as driving code through its public interface with concrete inputs, deriving expected values from the requirement, asserting error types rather than messages, and pairing a "this never happens" test with a case where it does. It is written as instructions only, with no scripts, and works with whatever test framework the project already uses.
When your agent uses it
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.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 2 files (2 KB) on GitHub on 1 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the pstack plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add michael-denyer/pstack-claude
/plugin install pstack@pstack-claudeOr copy only this skill to ~/.claude/skills/principle-test-behavior-not-implementation:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/principle-test-behavior-not-implementation &&
cp -R "$tmp/plugins/pstack/skills/principle-test-behavior-not-implementation" ~/.claude/skills/principle-test-behavior-not-implementation &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/principle-test-behavior-not-implementation inside it instead.
Copy the skill folder to ~/.agents/skills/principle-test-behavior-not-implementation to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/principle-test-behavior-not-implementation &&
cp -R "$tmp/plugins/pstack/skills/principle-test-behavior-not-implementation" ~/.agents/skills/principle-test-behavior-not-implementation &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/principle-test-behavior-not-implementation inside it instead.
Copy the skill folder to ~/.cursor/skills/principle-test-behavior-not-implementation to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/principle-test-behavior-not-implementation &&
cp -R "$tmp/plugins/pstack/skills/principle-test-behavior-not-implementation" ~/.cursor/skills/principle-test-behavior-not-implementation &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/principle-test-behavior-not-implementation inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/michael-denyer/pstack-claude.git --path plugins/pstack/skills/principle-test-behavior-not-implementationOr copy the folder to ~/.gemini/skills/principle-test-behavior-not-implementation yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/principle-test-behavior-not-implementation:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/principle-test-behavior-not-implementation &&
cp -R "$tmp/plugins/pstack/skills/principle-test-behavior-not-implementation" ~/.copilot/skills/principle-test-behavior-not-implementation &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/principle-test-behavior-not-implementation inside it instead.
Get the folder:
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.gitThen copy pstack-claude/plugins/pstack/skills/principle-test-behavior-not-implementation into your agent's skills folder as principle-test-behavior-not-implementation. Agents that support SKILL.md read one folder per skill.
What it does
- Observable behavior focus
- Defines what counts as the public interface: return values, errors, readable state and outside effects.
- Break-and-refactor check
- Two imagined edits test whether a test catches real bugs without breaking on internal changes.
- Concrete expected values
- Expected results come from the requirement rather than from the code under test.
- Error type assertions
- Asserts the error type callers branch on instead of brittle message text.
- Paired negative cases
- Pairs a claim that something never happens with a case where it does happen.
- Constant pin guidance
- Treats documented defaults and promised values as behavior worth asserting, with the promise named.
Good for
- Review a new test suite so it fails when user-visible behavior breaks
- Rewrite brittle tests that break whenever internal helpers are renamed
- Check that a test asserts a real outcome rather than a value it computed itself
- Assert that an external service receives the right request without testing internal call order
- Replace message-text assertions with checks on the error type callers handle
Principle test behavior not implementation FAQ
When does Principle test behavior not implementation trigger?
It applies when the agent writes, changes or keeps a test, according to its description.
Does Principle test behavior not implementation need any scripts or tools?
No. It has no scripts and no allowed tools are set; it is a set of written instructions.
Which clients can use Principle test behavior not implementation?
It is a Claude Code plugin skill from the pstack-claude marketplace, so it is listed for Claude Code.
How do I install Principle test behavior not implementation in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/principle-test-behavior-not-implementation to use it in all your projects, or to .claude/skills/principle-test-behavior-not-implementation in one project. Or install the pstack plugin, which includes it: /plugin marketplace add michael-denyer/pstack-claude, then /plugin install pstack@pstack-claude.
Does Principle test behavior not implementation run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Principle test behavior not implementation?
Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.
What are the best alternatives to Principle test behavior not implementation?
The closest alternatives to Principle test behavior not implementation are Property based testing, Characterization tests, TDD, Refactor and Testing strategy.
Where this comes from
- Description: from the skill's own SKILL.md.
More from michael-denyer/pstack-claude

Makes the agent read pstack's poteto-mode skill first and follow its routing
- Open source
- 5.1K GitHub stars
- Developer tools

Has the agent restate your goals and the problem you're solving in its own words
- Open source
- 5.1K GitHub stars
- Productivity

Prototype 2-3 competing designs and compare them before committing to one
- Open source
- 5.1K GitHub stars
- Developer tools

Sketches types, signatures and module layout before the agent writes code
- Open source
- 5.1K GitHub stars
- Developer tools

Runs parallel candidate attempts at a task, then merges the best parts into one artifact
- Open source
- 5.1K GitHub stars
- Developer tools

Drafts a personal working-style skill from your past agent conversations
- Open source
- 5.1K GitHub stars
- Developer tools





