principle-test-behavior-not-implementation
Apply when you write, change, or keep a test. Call the code the way its users do and assert the result they observe against a literal expected value. If the…
от jeremybrasher★ 41 звезда на GitHub
Установить principle-test-behavior-not-implementation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Test Behavior, Not Implementation
When to use
Apply when you write, change, or keep a test. Call the code the way its users do and assert the result they observe against a literal expected value. If the test would still pass when every imported function returns undefined, rewrite the assertion or delete the test.
Do not use when:
- The trigger in the description is not met
- A narrower operational skill already covers the same decision
- You would only be citing the name without changing a choice
Intake — before you proceed
You need all of the following. If any is missing, stop.
- A concrete situation (change, bug, design fork, or review object) that might invoke this principle
- Enough context to tell whether the trigger actually fires
- The decision or action this principle would change
If any is missing, stop. Say what is missing and what you need. Do not invent inputs to keep moving.
HOLD — stop and return this, not a polished guess
When you cannot proceed, return the gap.
| Condition | What is missing | What it needs | Return instead |
|---|---|---|---|
| Trigger unclear | Evidence the trigger fires | A fact from the work that matches the description | Name the gap. Do not cite the principle as decoration. |
| No situation object | A change, bug, fork, or review target | One sentence naming the object | I need the object of work before applying this principle. |
| Would only rename the same plan | A choice the principle actually changes | A different next action, or silence | Holding. Citing without changing a choice is noise. |
| Conflicts with a hard user constraint | Alignment with stated constraints | User confirmation or a different principle | State the conflict. Do not override the user constraint. |
A HOLD is a return value, not a delay before you guess.
Defaults: cut first
This operation defaults to less, not more.
- Do not expand scope to fully apply the principle
- Prefer the smallest structural change the principle demands
- If the principle says delete, delete before adding
- Do not write an essay about the principle; show the changed choice
- Expansion needs evidence from the request or the observed system — not from a habit of completeness.
Will not produce
- A decorative citation with no changed decision
- A rewrite of the whole system when a local application suffices
- Invented project facts to make the principle fit
Before you return
Run this check. If any item fails, fix or HOLD — do not hand over a guess.
- Trigger was evidenced or you HOLDed
- The principle changed a named choice, or you HOLDed
- No decorative citation
- Domain purpose of the surrounding task is unchanged
What this process changes
The recipe is not a neutral mirror. It changes the work:
- Naming a principle early anchors the agent on that frame and can hide better-fitting principles
- Stop-rules can freeze useful exploration when the census or premise is incomplete
- Delete-first readings can discard still-needed scaffolding if the dead-weight call is wrong
What still needs a human: Whether the trigger truly fired, whether the structural fix is worth the blast radius, and whether to override for a product reason.
Method card — same family every run
A later agent runs this from this file alone.
- Intake: situation + trigger evidence + decision to change. Gap -> HOLD.
- State the trigger match in one sentence.
- Apply the pattern in the Domain recipe below.
- Return the changed choice (or HOLD), not a principle lecture.
Domain recipe
The following is the domain behavior to keep. Alignment sections above constrain intake, pauses, cuts, and refusals; they do not replace this recipe.
A test calls the code the way its users do and asserts the result they observe against a literal expected value. A test that asserts which calls the code made, or restates a constant the code contains, does neither.
The check: before you keep a test, ask whether it would still pass if every function it imports returned undefined. If yes, it observes no behavior and cannot fail for a defect. Rewrite the assertion or delete the test.
Why: A test that cannot fail for a defect costs CI time and review attention and catches nothing. A constant pin also fails when someone edits the constant or the prompt it restates, so it prevents that edit.
Five shapes that still pass when every imported function returns undefined:
- Weak or no assertion. No
expect, or onlytoBeDefined,toBeTruthy,not.toThrow,toBeInstanceOf,toBeGreaterThan(0). - Mock or absence only. Only
toHaveBeenCalled,not.toHaveBeenCalled,toBeUndefined,toEqual([]),toHaveLength(0),not.toBe(wrongValue). - Self-referential. The expected value comes from the code under test:
expect(f(a)).toBe(f(a)),expect(parsed.url).toBe(buildUrl(...)). - Constant pin. The assertion restates a hand-maintained constant, config default, table row, or prompt string: `expect(LI
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- SCORE.json
- SOURCE.md
FAQ
Что делает скилл principle-test-behavior-not-implementation?
Apply when you write, change, or keep a test. Call the code the way its users do and assert the result they observe against a literal expected value. If the test would still pass when every imported function returns undefined, rewrite the assertion or delete the test.
Как установить скилл principle-test-behavior-not-implementation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл principle-test-behavior-not-implementation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…