writing-tests
БесплатноБез исполняемых скриптовНе проверенUse when writing, changing, or deciding whether to keep a test in this repo, especially in the @mcp-use/cli package. Tests assert what callers can observe…
от mcp-use★ 11 038 звёзд на GitHubОб этом скилле
Writing tests
A test is a claim about what the code does for the people and programs that use it. Write it so it fails when that behaviour breaks and keeps passing when only the internals change. If you can't write a test like that, write no test: no new test beats a bad test.
Rules
- Test what callers can observe. For the CLI that means the exit code,
stdout and stderr, the error
codethat callers branch on, state they can read back (files, config), and effects outside the process, such as the requests Cloud receives. It does not mean private helpers, internal call order, or which module did the work. - Expected values are literals from the requirement. Write
"12345678\tserver_1\tfailed", notformatRow(item). Never compute the expected value with the code under test. - Don't mock what you can run. Spawn the real CLI, write real files, run real git. Fake only the real outside boundaries (Manufact Cloud, GitHub, the browser). What a fake receives is behaviour, so assert on it.
- Pair every "nothing happened" assertion with a case where it happens. A test that checks "no request was sent" also needs a case proving the test can see a request.
- Avoid snapshots of human prose, exact error messages (assert the
code), sleeps and timing races, and assertions on data the test built itself.
Workflow
- Name the observable behaviour the test covers.
- Drive the built CLI through the real-process runner and fake Cloud.
- Assert on output, exit status, files, and requests received by the fake.
- Rebuild after source edits, then run the relevant tests and typecheck.
References
- references/principles.md: each rule in more depth, with good and bad examples from this repo.
- references/cli-and-cloud.md: how to test
@mcp-use/clicommands with the fake-Cloud harness inlibraries/typescript/packages/cli/tests/helpers/.
Adapted in our own words from the testing guidance in Cursor's pstack (MIT, © 2026 Lauren Tan).
Установить writing-tests в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл writing-tests?
Use when writing, changing, or deciding whether to keep a test in this repo, especially in the @mcp-use/cli package. Tests assert what callers can observe (exit code, output, error codes, state, requests sent), use literal expected values, and run real code instead of mocks. Includes the fake-Cloud harness for CLI cloud commands.
Как установить скилл writing-tests?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл writing-tests запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop 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…
от Anthropicinternal-comms
A 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…
от Anthropicskill-development
This 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…
от Anthropic