write-tests
БесплатноБез исполняемых скриптовНе проверенWrites or changes tests in this repository to its quality bar, with the right helpers and layer. Use when adding, fixing or reviewing tests, when a change…
от todoist★ 340 звёзд на GitHubОб этом скилле
Write tests
Where tests live
- Next to the code:
src/lib/refs.ts→src/lib/refs.test.ts. A command group has one test file for the group or one per subcommand (src/commands/label/label.test.ts,src/commands/project/reorder.test.ts). Vitest, globals on,restoreMocks: true, so spies restore themselves: no manual.mockRestore(). - Command tests mock the SDK client:
vi.mock('../../lib/api/core.js', () => ({ getApi: vi.fn() }))at the top,mockApi = setupApiMock()inbeforeEach, a program fromcreateTestProgram(registerXxxCommand), thenprogram.parseAsync(['node', 'td', ...]). Capture output withcaptureConsole()orcaptureStream(). Readsrc/commands/label/label.test.tsfor the shape. src/index.integration.test.tsbuilds the CLI and runsdist/index.js, for argv handling, global flags and JSON errors end to end.vi.mock('chalk')uses the manual mock insrc/__mocks__/chalk.ts, which makes styling a passthrough so tests read plain text.- Agent tooling tests live in
.agents/scripts/and run copies of the tools in throwaway repos (.agents/scripts/lib/test-repo.ts).
Helpers
From src/test-support/: createMockApi, setupApiMock, fixtures, makeFilter, createProjectProgram. From @todoist/cli-core/testing: createTestProgram, captureConsole, captureStream, describeEmptyMachineOutput. Build entities from fixtures instead of by hand; extend it when a test needs a new shape.
The quality bar
Read references/test-rules.md before writing or reviewing a test. In short: a test counts only if it can fail. It asserts outcomes, takes expected values from outside the code under test, mocks only real boundaries, and you saw it fail once.
Done when each new test has failed once for the right reason, and then passes.
When an existing test may change
- The behaviour changed on purpose (a feature or a fix): change the assertions that describe it, and say which in the report.
- A refactor: only how the test reaches the code (imports, names, call sites). Never its inputs or assertions, including expected output strings.
- Never to make a failing check pass without a behaviour change: no
.skip, no deleted test, no looser matcher (toEqual→toMatchObject, exact arguments →toHaveBeenCalled()).
Установить write-tests в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл write-tests?
Writes or changes tests in this repository to its quality bar, with the right helpers and layer. Use when adding, fixing or reviewing tests, when a change "needs a test", or when deciding whether a test may change.
Как установить скилл write-tests?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл write-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