Перейти к содержанию
Skillpedia
Тестирование15k · #10999

tdd

Что он делает

Скилл ведёт исправление ошибки, которое начинается с точечного теста на регрессию. Он нужен разработчикам, которым нужно доказательство, что ошибка исправлена и не вернётся.

Когда использовать

  • ✓Когда вы просите разработку через тесты (TDD) или тест на регрессию.
  • ✓Когда у ошибки есть простой и дешёвый тест, который показывает неверное поведение.
  • ✓Когда вам нужно исправление, которое тест докажет и которое не вернётся.

Ссылка на скилл

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/tdd/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/tdd/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Исправь ошибку входа, но сначала напиши падающий тест, чтобы мы знали, что она действительно исправлена.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Агент описывает ошибку, пишет небольшой тест, который должен падать, запускает его, чтобы подтвердить падение, и затем вносит минимальное изменение кода, которое заставляет тест пройти. Если дешёвый тест непрактичен, он использует другую проверку.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

TDD Bug Fix

When fixing a bug with a clear, cheap test path, make the broken behavior executable before changing production code. The goal is a focused regression test that fails before the fix and passes after it.

Do not force a test when it would be impractical. If the available test would require broad harness setup, brittle mocks, slow end-to-end infrastructure, production-only state, vague reproduction steps, or large unrelated fixture churn, skip adding a new test and use the closest useful verification instead.

Workflow

  1. Understand the bug. Identify the intended behavior, current behavior, affected path, and smallest observable reproduction.
  2. Choose the narrowest executable check. Prefer the closest unit, component, integration, or regression test already used for that codepath. If no practical test path is obvious, do not create one from scratch just to satisfy the workflow.
  3. Write the failing test first. Add the smallest focused test that would have caught the bug. The test should encode intended behavior, not mirror the current implementation.
  4. Run the new test before fixing. Confirm it fails for the intended reason. If it passes or fails for an unrelated reason, correct the test or reproduction before editing the implementation.
  5. Fix the bug. Make the smallest production change that satisfies the intended behavior while preserving nearby contracts.
  6. Rerun the regression test. Confirm the test now passes.

If a Failing Test Is Impractical

Use the closest executable regression check instead: a targeted script, manual reproduction command, browser automation, snapshot comparison, log assertion, or focused integration check.

Prefer no new test over a bad test. A bad test is one that mostly tests mocks, encodes current implementation details, depends on timing or unrelated global state, needs expensive infrastructure for a small fix, or would be deleted immediately after proving the fix.

Guardrails

  • Do not change tests merely to match a wrong implementation.
  • Do not weaken existing assertions unless the expected behavior has genuinely changed and the reason is clear.
  • Keep the regression test focused on the bug. Avoid broad fixture churn or unrelated coverage expansion.
  • If the bug is flaky, make the test deterministic where possible and document the signal being locked down.
  • If the bug exposes a broader class of failures, first land the focused regression path, then consider additional sibling coverage.

Final Response

Report the evidence, not just the outcome:

  • Name the failing-before test or executable check and the failure it produced.
  • Name the passing-after test run and any nearby validation performed.
  • If failing-before evidence could not be demonstrated, state why and describe the closest regression check used instead.
Частые вопросы

Что если тест непрактичен?

Скилл не навязывает тест. Он использует ближайшую полезную проверку.

Тест обязательно должен сначала упасть?

Да. Новый тест запускается до исправления, чтобы подтвердить, что он падает по правильной причине.

Зачем писать тест до исправления?

Так сначала видно, что ошибка существует, а потом видно, когда её исправили.

Подробности

Оригинальное описание автора

Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the test path is unclear, expensive, integration-heavy, or not requested.

repo: cursor/plugins

Популярность

Звёзды на GitHub
15k
Место в рейтинге
#10999
Лицензия
—
Обновлён
31.10.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы