Zum Inhalt springen
Skillpedia
Tests15k · #10999

tdd

Was er macht

Der Skill führt durch eine Fehlerbehebung, die mit einem gezielten Regressionstest beginnt. Er ist für Entwickler gedacht, die einen Beleg wollen, dass ein Fehler behoben ist und nicht zurückkommt.

Wann du ihn nutzt

  • ✓Wenn du testgetriebene Entwicklung oder einen Regressionstest verlangst.
  • ✓Wenn ein Fehler einen einfachen, günstigen Test hat, der das kaputte Verhalten zeigt.
  • ✓Wenn du eine Korrektur willst, die ein Test als dauerhaft behoben belegt.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/tdd/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Behebe den Login-Fehler, aber schreib zuerst einen fehlschlagenden Test, damit wir wissen, dass er wirklich behoben ist.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent beschreibt den Fehler, schreibt einen kleinen Test, der fehlschlagen sollte, lässt ihn laufen, um das Scheitern zu bestätigen, und nimmt dann die kleinste Codeänderung vor, die ihn bestehen lässt. Ist ein günstiger Test nicht praktikabel, nutzt er eine andere Prüfung.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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.
Häufige Fragen

Was ist, wenn kein Test praktikabel ist?

Der Skill erzwingt keinen. Er nutzt stattdessen die nächstliegende sinnvolle Prüfung.

Muss der Test zuerst fehlschlagen?

Ja. Der neue Test läuft vor der Korrektur, um zu bestätigen, dass er aus dem richtigen Grund scheitert.

Warum den Test vor der Korrektur schreiben?

So zeigt sich zuerst, dass der Fehler existiert, und später, wann er behoben ist.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
15k
Platz im Ranking
#10999
Lizenz
—
Aktualisiert
31.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills